aboutsummaryrefslogtreecommitdiff
path: root/subsonic-android
diff options
context:
space:
mode:
Diffstat (limited to 'subsonic-android')
-rw-r--r--subsonic-android/res/layout/action_bar.xml97
-rw-r--r--subsonic-android/res/layout/search.xml2
-rw-r--r--subsonic-android/res/menu/search.xml24
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/activity/SearchActivity.java62
4 files changed, 55 insertions, 130 deletions
diff --git a/subsonic-android/res/layout/action_bar.xml b/subsonic-android/res/layout/action_bar.xml
deleted file mode 100644
index 2aaa4116..00000000
--- a/subsonic-android/res/layout/action_bar.xml
+++ /dev/null
@@ -1,97 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="45dp"
- android:background="@drawable/menubar_button_disabled">
-
- <ImageView
- android:id="@+id/actionbar_home_icon"
- android:src="@drawable/main_header_icon2"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
- android:layout_alignParentTop="true"
- android:layout_alignParentLeft="true"
- android:layout_alignParentBottom="true"
- android:paddingLeft="4dip"
- android:paddingRight="4dip"
- android:paddingTop="2dip"
- android:paddingBottom="2dip"
- android:scaleType="centerInside"
- />
-
- <ImageButton
- android:id="@+id/action_button_4"
- android:src="@drawable/action_settings"
- android:layout_width="44dip"
- android:layout_height="wrap_content"
- android:layout_alignParentRight="true"
- android:layout_alignParentTop="true"
- android:layout_alignParentBottom="true"
- android:scaleType="fitCenter"
- android:padding="5dp"
- android:background="@drawable/actionbar_button"
- />
-
- <ImageButton
- android:id="@+id/action_button_3"
- android:src="@drawable/action_help"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentTop="true"
- android:layout_alignParentBottom="true"
- android:layout_toLeftOf="@id/action_button_4"
- android:scaleType="center"
- android:padding="5dp"
- android:background="@drawable/actionbar_button"
- />
-
- <ImageButton
- android:id="@+id/action_button_2"
- android:src="@drawable/action_search"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentTop="true"
- android:layout_alignParentBottom="true"
- android:layout_toLeftOf="@id/action_button_3"
- android:scaleType="center"
- android:padding="5dp"
- android:background="@drawable/actionbar_button"
- />
-
- <ImageButton
- android:id="@+id/action_button_1"
- android:src="@drawable/action_shuffle"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentTop="true"
- android:layout_alignParentBottom="true"
- android:layout_toLeftOf="@id/action_button_2"
- android:scaleType="center"
- android:padding="5dp"
- android:background="@drawable/actionbar_button"
- />
-
- <TextView
- android:id="@+id/actionbar_title_text"
- android:text="Subsonic"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentTop="true"
- android:layout_alignParentBottom="true"
- android:layout_toLeftOf="@id/action_button_1"
- android:layout_toRightOf="@id/actionbar_home_icon"
- android:gravity="center_vertical"
- android:textColor="#FFFFFF"
- android:textSize="18sp"
- android:textStyle="bold"
- android:shadowColor="#000000"
- android:shadowDx="1"
- android:shadowDy="1"
- android:shadowRadius="1"
- android:lineSpacingMultiplier="0.85"
- android:ellipsize="middle"
- android:inputType="none"
- />
-
-</RelativeLayout>
diff --git a/subsonic-android/res/layout/search.xml b/subsonic-android/res/layout/search.xml
index f65bcb36..5f5c26e0 100644
--- a/subsonic-android/res/layout/search.xml
+++ b/subsonic-android/res/layout/search.xml
@@ -4,8 +4,6 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent">
- <include layout="@layout/action_bar"/>
-
<View
android:layout_width="fill_parent"
android:layout_height="1px"
diff --git a/subsonic-android/res/menu/search.xml b/subsonic-android/res/menu/search.xml
new file mode 100644
index 00000000..b9cdecac
--- /dev/null
+++ b/subsonic-android/res/menu/search.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+ <item
+ android:id="@+id/menu_search"
+ android:icon="@drawable/action_search"
+ android:title="@string/menu.search"
+ android:showAsAction="ifRoom|withText"/>
+
+ <item
+ android:id="@+id/menu_help"
+ android:icon="@drawable/ic_menu_help"
+ android:title="@string/menu.help"/>
+
+ <item
+ android:id="@+id/menu_settings"
+ android:icon="@drawable/ic_menu_settings"
+ android:title="@string/menu.settings"/>
+
+ <item
+ android:id="@+id/menu_exit"
+ android:icon="@drawable/ic_menu_exit"
+ android:title="@string/menu.exit"/>
+
+</menu>
diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/SearchActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/SearchActivity.java
index 3ea0cabf..4b9d844f 100644
--- a/subsonic-android/src/github/daneren2005/dsub/activity/SearchActivity.java
+++ b/subsonic-android/src/github/daneren2005/dsub/activity/SearchActivity.java
@@ -36,6 +36,7 @@ import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.net.Uri;
+import com.actionbarsherlock.view.Menu;
import github.daneren2005.dsub.R;
import github.daneren2005.dsub.domain.Artist;
import github.daneren2005.dsub.domain.MusicDirectory;
@@ -134,39 +135,38 @@ public class SearchActivity extends SubsonicTabActivity {
}
});
registerForContextMenu(list);
+ onNewIntent(getIntent());
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ com.actionbarsherlock.view.MenuInflater inflater = getSupportMenuInflater();
+ inflater.inflate(R.menu.search, menu);
+ return true;
+ }
- // Button 1: gone
- findViewById(R.id.action_button_1).setVisibility(View.GONE);
-
- // Button 2: search
- final ImageButton actionSearchButton = (ImageButton)findViewById(R.id.action_button_2);
- actionSearchButton.setImageResource(R.drawable.action_search);
- actionSearchButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- onSearchRequested();
- }
- });
-
- // Button 3: Help
- ImageButton actionHelpButton = (ImageButton)findViewById(R.id.action_button_3);
- actionHelpButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- startActivity(new Intent(SearchActivity.this, HelpActivity.class));
- }
- });
-
- // Button 4: Settings
- ImageButton actionSettingsButton = (ImageButton)findViewById(R.id.action_button_4);
- actionSettingsButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- startActivity(new Intent(SearchActivity.this, SettingsActivity.class));
- }
- });
+ @Override
+ public boolean onOptionsItemSelected(com.actionbarsherlock.view.MenuItem item) {
+ Intent intent;
+ switch (item.getItemId()) {
+ case R.id.menu_search:
+ onSearchRequested();
+ return true;
+ case R.id.menu_exit:
+ intent = new Intent(this, MainActivity.class);
+ intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ intent.putExtra(Constants.INTENT_EXTRA_NAME_EXIT, true);
+ Util.startActivityWithoutTransition(this, intent);
+ return true;
+ case R.id.menu_settings:
+ startActivity(new Intent(this, SettingsActivity.class));
+ return true;
+ case R.id.menu_help:
+ startActivity(new Intent(this, HelpActivity.class));
+ return true;
+ }
- onNewIntent(getIntent());
+ return false;
}
@Override