aboutsummaryrefslogtreecommitdiff
path: root/subsonic-android
diff options
context:
space:
mode:
Diffstat (limited to 'subsonic-android')
-rw-r--r--subsonic-android/AndroidManifest.xml4
-rw-r--r--subsonic-android/project.properties1
-rw-r--r--subsonic-android/res/layout/main.xml6
-rw-r--r--subsonic-android/res/layout/select_album.xml2
-rw-r--r--subsonic-android/res/layout/select_artist.xml2
-rw-r--r--subsonic-android/res/layout/select_playlist.xml2
-rw-r--r--subsonic-android/res/menu/main.xml38
-rw-r--r--subsonic-android/res/menu/select_album.xml30
-rw-r--r--subsonic-android/res/menu/select_artist.xml30
-rw-r--r--subsonic-android/res/menu/select_playlist.xml24
-rw-r--r--subsonic-android/res/values/strings.xml4
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/activity/DownloadActivity.java15
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java103
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java70
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/activity/SelectArtistActivity.java76
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/activity/SelectPlaylistActivity.java61
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/activity/SubsonicTabActivity.java61
17 files changed, 276 insertions, 253 deletions
diff --git a/subsonic-android/AndroidManifest.xml b/subsonic-android/AndroidManifest.xml
index 8cc8eb82..8f3100c8 100644
--- a/subsonic-android/AndroidManifest.xml
+++ b/subsonic-android/AndroidManifest.xml
@@ -14,11 +14,11 @@
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
- <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="14"/>
+ <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="15"/>
<supports-screens android:anyDensity="true" android:xlargeScreens="true" android:largeScreens="true" android:normalScreens="true" android:smallScreens="true"/>
- <application android:label="@string/common.appname" android:icon="@drawable/launch2" android:theme="@style/Wheat">
+ <application android:label="@string/common.appname" android:icon="@drawable/launch2" android:theme="@style/Theme.Sherlock.Light">
<activity android:name="github.daneren2005.dsub.activity.MainActivity"
android:label="DSub"
diff --git a/subsonic-android/project.properties b/subsonic-android/project.properties
index 8da376af..0b3adc12 100644
--- a/subsonic-android/project.properties
+++ b/subsonic-android/project.properties
@@ -9,3 +9,4 @@
# Project target.
target=android-15
+android.library.reference.1=../../ActionBarSherlock
diff --git a/subsonic-android/res/layout/main.xml b/subsonic-android/res/layout/main.xml
index e151f319..56b013fe 100644
--- a/subsonic-android/res/layout/main.xml
+++ b/subsonic-android/res/layout/main.xml
@@ -4,12 +4,6 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent">
- <include
- layout="@layout/action_bar"
- android:layout_width="fill_parent"
- android:layout_height="45dp"
- />
-
<View
android:layout_width="fill_parent"
android:layout_height="1px"
diff --git a/subsonic-android/res/layout/select_album.xml b/subsonic-android/res/layout/select_album.xml
index 2c9a00aa..d5a4d0d1 100644
--- a/subsonic-android/res/layout/select_album.xml
+++ b/subsonic-android/res/layout/select_album.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/layout/select_artist.xml b/subsonic-android/res/layout/select_artist.xml
index 7cf6fc77..bebfdec4 100644
--- a/subsonic-android/res/layout/select_artist.xml
+++ b/subsonic-android/res/layout/select_artist.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/layout/select_playlist.xml b/subsonic-android/res/layout/select_playlist.xml
index c23e764b..2555687d 100644
--- a/subsonic-android/res/layout/select_playlist.xml
+++ b/subsonic-android/res/layout/select_playlist.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/main.xml b/subsonic-android/res/menu/main.xml
index 27698f81..af6a5a7d 100644
--- a/subsonic-android/res/menu/main.xml
+++ b/subsonic-android/res/menu/main.xml
@@ -1,22 +1,30 @@
<?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_shuffle"
+ android:icon="@drawable/action_shuffle"
+ android:title="@string/menu.shuffle"
+ android:showAsAction="ifRoom|withText"/>
- <item
- android:id="@+id/menu_exit"
- android:icon="@drawable/ic_menu_exit"
- android:title="@string/menu.exit"
- />
+ <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_settings"
+ android:icon="@drawable/ic_menu_settings"
+ android:title="@string/menu.settings"/>
- <item
- android:id="@+id/menu_help"
- android:icon="@drawable/ic_menu_help"
- android:title="@string/menu.help"
- />
+ <item
+ android:id="@+id/menu_exit"
+ android:icon="@drawable/ic_menu_exit"
+ android:title="@string/menu.exit"/>
</menu>
diff --git a/subsonic-android/res/menu/select_album.xml b/subsonic-android/res/menu/select_album.xml
new file mode 100644
index 00000000..a5f2a3a9
--- /dev/null
+++ b/subsonic-android/res/menu/select_album.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+ <item
+ android:id="@+id/menu_play_all"
+ android:icon="@drawable/action_play_all"
+ android:title="@string/menu.play"
+ android:showAsAction="ifRoom|withText"/>
+
+ <item
+ android:id="@+id/menu_refresh"
+ android:icon="@drawable/action_refresh"
+ android:title="@string/menu.refresh"
+ android:showAsAction="ifRoom|withText"/>
+
+ <item
+ android:id="@+id/menu_help"
+ android:icon="@drawable/action_help"
+ android:title="@string/menu.help"/>
+
+ <item
+ android:id="@+id/menu_settings"
+ android:icon="@drawable/action_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/res/menu/select_artist.xml b/subsonic-android/res/menu/select_artist.xml
new file mode 100644
index 00000000..42916622
--- /dev/null
+++ b/subsonic-android/res/menu/select_artist.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+ <item
+ android:id="@+id/menu_refresh"
+ android:icon="@drawable/action_refresh"
+ android:title="@string/menu.refresh"
+ android:showAsAction="ifRoom|withText"/>
+
+ <item
+ android:id="@+id/menu_shuffle"
+ android:icon="@drawable/action_shuffle"
+ android:title="@string/menu.shuffle"
+ android:showAsAction="ifRoom|withText"/>
+
+ <item
+ android:id="@+id/menu_help"
+ android:icon="@drawable/action_help"
+ android:title="@string/menu.help"/>
+
+ <item
+ android:id="@+id/menu_settings"
+ android:icon="@drawable/action_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/res/menu/select_playlist.xml b/subsonic-android/res/menu/select_playlist.xml
new file mode 100644
index 00000000..46d863cd
--- /dev/null
+++ b/subsonic-android/res/menu/select_playlist.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_refresh"
+ android:icon="@drawable/action_refresh"
+ android:title="@string/menu.refresh"
+ android:showAsAction="ifRoom|withText"/>
+
+ <item
+ android:id="@+id/menu_help"
+ android:icon="@drawable/action_help"
+ android:title="@string/menu.help"/>
+
+ <item
+ android:id="@+id/menu_settings"
+ android:icon="@drawable/action_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/res/values/strings.xml b/subsonic-android/res/values/strings.xml
index 7f9f6728..ea926fd9 100644
--- a/subsonic-android/res/values/strings.xml
+++ b/subsonic-android/res/values/strings.xml
@@ -33,6 +33,10 @@
<string name="main.albums_highest">Top rated</string>
<string name="main.albums_random">Random</string>
+ <string name="menu.search">Search</string>
+ <string name="menu.shuffle">Shuffle</string>
+ <string name="menu.refresh">Refresh</string>
+ <string name="menu.play">Play</string>
<string name="menu.exit">Exit</string>
<string name="menu.settings">Settings</string>
<string name="menu.help">Help</string>
diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/DownloadActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/DownloadActivity.java
index a657b7eb..4a3dd9bc 100644
--- a/subsonic-android/src/github/daneren2005/dsub/activity/DownloadActivity.java
+++ b/subsonic-android/src/github/daneren2005/dsub/activity/DownloadActivity.java
@@ -40,9 +40,6 @@ import android.view.Display;
import android.view.GestureDetector;
import android.view.GestureDetector.OnGestureListener;
import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuInflater;
-import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
@@ -58,6 +55,10 @@ import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.ViewFlipper;
+import com.actionbarsherlock.app.SherlockActivity;
+import com.actionbarsherlock.view.Menu;
+import com.actionbarsherlock.view.MenuItem;
+import com.actionbarsherlock.view.MenuInflater;
import github.daneren2005.dsub.R;
import github.daneren2005.dsub.domain.MusicDirectory;
import github.daneren2005.dsub.domain.PlayerState;
@@ -487,7 +488,7 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi
@Override
public boolean onCreateOptionsMenu(Menu menu) {
- MenuInflater inflater = getMenuInflater();
+ MenuInflater inflater = getSupportMenuInflater();
inflater.inflate(R.menu.nowplaying, menu);
return true;
}
@@ -507,14 +508,14 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi
return super.onPrepareOptionsMenu(menu);
}
- @Override
+ /*@Override
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, view, menuInfo);
if (view == playlistView) {
AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
DownloadFile downloadFile = (DownloadFile) playlistView.getItemAtPosition(info.position);
- MenuInflater inflater = getMenuInflater();
+ MenuInflater inflater = getSupportMenuInflater();
inflater.inflate(R.menu.nowplaying_context, menu);
if (downloadFile.getSong().getParent() == null) {
@@ -532,7 +533,7 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi
AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuItem.getMenuInfo();
DownloadFile downloadFile = (DownloadFile) playlistView.getItemAtPosition(info.position);
return menuItemSelected(menuItem.getItemId(), downloadFile) || super.onContextItemSelected(menuItem);
- }
+ }*/
@Override
public boolean onOptionsItemSelected(MenuItem menuItem) {
diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java
index e5958e57..60532868 100644
--- a/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java
+++ b/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java
@@ -28,6 +28,9 @@ import github.daneren2005.dsub.util.Constants;
import github.daneren2005.dsub.util.MergeAdapter;
import github.daneren2005.dsub.util.Util;
import github.daneren2005.dsub.util.FileUtil;
+import com.actionbarsherlock.view.Menu;
+import com.actionbarsherlock.view.MenuItem;
+import com.actionbarsherlock.view.MenuInflater;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
@@ -35,7 +38,6 @@ import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.ContextMenu;
import android.view.LayoutInflater;
-import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ImageButton;
@@ -115,63 +117,52 @@ public class MainActivity extends SubsonicTabActivity {
}
}
});
-
- // Title: Subsonic
+
+ // Title: Subsonic
setTitle(R.string.common_appname);
- // Button 1: shuffle
- ImageButton actionShuffleButton = (ImageButton)findViewById(R.id.action_button_1);
- actionShuffleButton.setImageResource(R.drawable.action_shuffle);
- actionShuffleButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- Intent intent = new Intent(MainActivity.this, DownloadActivity.class);
+ // Remember the current theme.
+ theme = Util.getTheme(this);
+
+ showInfoDialog();
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ MenuInflater inflater = getSupportMenuInflater();
+ inflater.inflate(R.menu.main, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ Intent intent;
+ switch (item.getItemId()) {
+ case R.id.menu_shuffle:
+ intent = new Intent(MainActivity.this, DownloadActivity.class);
intent.putExtra(Constants.INTENT_EXTRA_NAME_SHUFFLE, true);
Util.startActivityWithoutTransition(MainActivity.this, intent);
- }
- });
-
- // Button 2: search
- 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) {
- Intent intent = new Intent(MainActivity.this, SearchActivity.class);
+ return true;
+ case R.id.menu_search:
+ intent = new Intent(MainActivity.this, SearchActivity.class);
intent.putExtra(Constants.INTENT_EXTRA_REQUEST_SEARCH, true);
Util.startActivityWithoutTransition(MainActivity.this, intent);
- }
- });
-
- // 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(MainActivity.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(MainActivity.this, SettingsActivity.class));
-
- /*LayoutInflater inflater = (LayoutInflater)MainActivity.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- PopupWindow pw = new PopupWindow(inflater.inflate(R.layout.overflow_menu, null, false), 100, 100, true);
- pw.showAsDropDown(findViewById(R.id.action_button_4));*/
-
- /*PopupWindow window = new PopupWindow(findViewById(R.layout.overflow_menu));
- window.showAsDropDown(findViewById(R.id.action_button_2));*/
- }
- });
-
- // Remember the current theme.
- theme = Util.getTheme(this);
+ 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;
+ }
- showInfoDialog();
+ return false;
}
private void loadSettings() {
@@ -198,10 +189,10 @@ public class MainActivity extends SubsonicTabActivity {
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, view, menuInfo);
- MenuItem menuItem1 = menu.add(MENU_GROUP_SERVER, MENU_ITEM_SERVER_1, MENU_ITEM_SERVER_1, Util.getServerName(this, 1));
- MenuItem menuItem2 = menu.add(MENU_GROUP_SERVER, MENU_ITEM_SERVER_2, MENU_ITEM_SERVER_2, Util.getServerName(this, 2));
- MenuItem menuItem3 = menu.add(MENU_GROUP_SERVER, MENU_ITEM_SERVER_3, MENU_ITEM_SERVER_3, Util.getServerName(this, 3));
- MenuItem menuItem4 = menu.add(MENU_GROUP_SERVER, MENU_ITEM_OFFLINE, MENU_ITEM_OFFLINE, Util.getServerName(this, 0));
+ android.view.MenuItem menuItem1 = menu.add(MENU_GROUP_SERVER, MENU_ITEM_SERVER_1, MENU_ITEM_SERVER_1, Util.getServerName(this, 1));
+ android.view.MenuItem menuItem2 = menu.add(MENU_GROUP_SERVER, MENU_ITEM_SERVER_2, MENU_ITEM_SERVER_2, Util.getServerName(this, 2));
+ android.view.MenuItem menuItem3 = menu.add(MENU_GROUP_SERVER, MENU_ITEM_SERVER_3, MENU_ITEM_SERVER_3, Util.getServerName(this, 3));
+ android.view.MenuItem menuItem4 = menu.add(MENU_GROUP_SERVER, MENU_ITEM_OFFLINE, MENU_ITEM_OFFLINE, Util.getServerName(this, 0));
menu.setGroupCheckable(MENU_GROUP_SERVER, true, true);
menu.setHeaderTitle(R.string.main_select_server);
@@ -222,7 +213,7 @@ public class MainActivity extends SubsonicTabActivity {
}
@Override
- public boolean onContextItemSelected(MenuItem menuItem) {
+ public boolean onContextItemSelected(android.view.MenuItem menuItem) {
switch (menuItem.getItemId()) {
case MENU_ITEM_OFFLINE:
setActiveServer(0);
diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java
index 108dcf9c..31c4e728 100644
--- a/subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java
+++ b/subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java
@@ -34,6 +34,7 @@ import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ListView;
+import com.actionbarsherlock.view.Menu;
import github.daneren2005.dsub.R;
import github.daneren2005.dsub.domain.MusicDirectory;
import github.daneren2005.dsub.service.DownloadFile;
@@ -177,45 +178,40 @@ public class SelectAlbumActivity extends SubsonicTabActivity {
} else {
getMusicDirectory(id, name);
}
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ com.actionbarsherlock.view.MenuInflater inflater = getSupportMenuInflater();
+ inflater.inflate(R.menu.select_album, menu);
+ return true;
+ }
- // Button 1: play all
- playAllButton = (ImageButton) findViewById(R.id.action_button_1);
- playAllButton.setImageResource(R.drawable.action_play_all);
- playAllButton.setVisibility(View.GONE);
- playAllButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- playAll(false);
- }
- });
+ @Override
+ public boolean onOptionsItemSelected(com.actionbarsherlock.view.MenuItem item) {
+ Intent intent;
+ switch (item.getItemId()) {
+ case R.id.menu_play_all:
+ playAll(false);
+ return true;
+ case R.id.menu_refresh:
+ refresh();
+ 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;
+ }
- // Button 2: refresh
- ImageButton refreshButton = (ImageButton) findViewById(R.id.action_button_2);
- refreshButton.setImageResource(R.drawable.action_refresh);
- refreshButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- refresh();
- }
- });
-
- // 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(SelectAlbumActivity.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(SelectAlbumActivity.this, SettingsActivity.class));
- }
- });
+ return false;
}
private void playAll(final boolean shuffle) {
diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/SelectArtistActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/SelectArtistActivity.java
index 8b32ff3a..bee76641 100644
--- a/subsonic-android/src/github/daneren2005/dsub/activity/SelectArtistActivity.java
+++ b/subsonic-android/src/github/daneren2005/dsub/activity/SelectArtistActivity.java
@@ -30,6 +30,7 @@ import android.widget.AdapterView;
import android.widget.ImageButton;
import android.widget.ListView;
import android.widget.TextView;
+import com.actionbarsherlock.view.Menu;
import github.daneren2005.dsub.R;
import github.daneren2005.dsub.domain.Artist;
import github.daneren2005.dsub.domain.Indexes;
@@ -73,51 +74,46 @@ public class SelectArtistActivity extends SubsonicTabActivity implements Adapter
}
registerForContextMenu(artistList);
+ setTitle(Util.isOffline(this) ? R.string.music_library_label_offline : R.string.music_library_label);
- setTitle(Util.isOffline(this) ? R.string.music_library_label_offline : R.string.music_library_label);
+ musicFolders = null;
+ load();
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ com.actionbarsherlock.view.MenuInflater inflater = getSupportMenuInflater();
+ inflater.inflate(R.menu.select_artist, menu);
+ return true;
+ }
- // Button 1: shuffle
- ImageButton shuffleButton = (ImageButton) findViewById(R.id.action_button_1);
- shuffleButton.setImageResource(R.drawable.action_shuffle);
- shuffleButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- Intent intent = new Intent(SelectArtistActivity.this, DownloadActivity.class);
+ @Override
+ public boolean onOptionsItemSelected(com.actionbarsherlock.view.MenuItem item) {
+ Intent intent;
+ switch (item.getItemId()) {
+ case R.id.menu_refresh:
+ refresh();
+ return true;
+ case R.id.menu_shuffle:
+ intent = new Intent(SelectArtistActivity.this, DownloadActivity.class);
intent.putExtra(Constants.INTENT_EXTRA_NAME_SHUFFLE, true);
Util.startActivityWithoutTransition(SelectArtistActivity.this, intent);
- }
- });
-
- // Button 2: refresh
- ImageButton refreshButton = (ImageButton) findViewById(R.id.action_button_2);
- refreshButton.setImageResource(R.drawable.action_refresh);
- refreshButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- refresh();
- }
- });
-
- // 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(SelectArtistActivity.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(SelectArtistActivity.this, SettingsActivity.class));
- }
- });
+ 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;
+ }
- musicFolders = null;
- load();
+ return false;
}
private void refresh() {
diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/SelectPlaylistActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/SelectPlaylistActivity.java
index a299b84b..f515d5be 100644
--- a/subsonic-android/src/github/daneren2005/dsub/activity/SelectPlaylistActivity.java
+++ b/subsonic-android/src/github/daneren2005/dsub/activity/SelectPlaylistActivity.java
@@ -61,39 +61,38 @@ public class SelectPlaylistActivity extends SubsonicTabActivity implements Adapt
// Title: Playlists
setTitle(R.string.playlist_label);
- // Button 1: gone
- ImageButton searchButton = (ImageButton)findViewById(R.id.action_button_1);
- searchButton.setVisibility(View.GONE);
-
- // Button 2: refresh
- ImageButton refreshButton = (ImageButton) findViewById(R.id.action_button_2);
- refreshButton.setImageResource(R.drawable.action_refresh);
- refreshButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
+ load();
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(com.actionbarsherlock.view.Menu menu) {
+ com.actionbarsherlock.view.MenuInflater inflater = getSupportMenuInflater();
+ inflater.inflate(R.menu.select_playlist, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(com.actionbarsherlock.view.MenuItem item) {
+ Intent intent;
+ switch (item.getItemId()) {
+ case R.id.menu_refresh:
refresh();
- }
- });
-
- // 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(SelectPlaylistActivity.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(SelectPlaylistActivity.this, SettingsActivity.class));
- }
- });
+ 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;
+ }
- load();
+ return false;
}
private void refresh() {
diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/SubsonicTabActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/SubsonicTabActivity.java
index 6afe842b..7d303a8d 100644
--- a/subsonic-android/src/github/daneren2005/dsub/activity/SubsonicTabActivity.java
+++ b/subsonic-android/src/github/daneren2005/dsub/activity/SubsonicTabActivity.java
@@ -34,13 +34,12 @@ import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.KeyEvent;
-import android.view.Menu;
-import android.view.MenuInflater;
-import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.widget.TextView;
import github.daneren2005.dsub.R;
+import com.actionbarsherlock.app.ActionBar;
+import com.actionbarsherlock.app.SherlockActivity;
import github.daneren2005.dsub.domain.MusicDirectory;
import github.daneren2005.dsub.service.DownloadService;
import github.daneren2005.dsub.service.DownloadServiceImpl;
@@ -54,7 +53,7 @@ import github.daneren2005.dsub.util.Util;
/**
* @author Sindre Mehus
*/
-public class SubsonicTabActivity extends Activity {
+public class SubsonicTabActivity extends SherlockActivity {
private static final String TAG = SubsonicTabActivity.class.getSimpleName();
private static ImageLoader IMAGE_LOADER;
@@ -68,9 +67,9 @@ public class SubsonicTabActivity extends Activity {
@Override
protected void onCreate(Bundle bundle) {
setUncaughtExceptionHandler();
- applyTheme();
+ // applyTheme();
super.onCreate(bundle);
- requestWindowFeature(Window.FEATURE_NO_TITLE);
+ // requestWindowFeature(Window.FEATURE_NO_TITLE);
startService(new Intent(this, DownloadServiceImpl.class));
setVolumeControlStream(AudioManager.STREAM_MUSIC);
}
@@ -78,6 +77,9 @@ public class SubsonicTabActivity extends Activity {
@Override
protected void onPostCreate(Bundle bundle) {
super.onPostCreate(bundle);
+
+ ActionBar actionBar = getSupportActionBar();
+ // actionBar.setDisplayHomeAsUpEnabled(true);
homeButton = findViewById(R.id.button_bar_home);
homeButton.setOnClickListener(new View.OnClickListener() {
@@ -137,36 +139,6 @@ public class SubsonicTabActivity extends Activity {
}
@Override
- public boolean onCreateOptionsMenu(Menu menu) {
- MenuInflater inflater = getMenuInflater();
- inflater.inflate(R.menu.main, menu);
- return true;
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
-
- case R.id.menu_exit:
- Intent 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;
- }
-
- return false;
- }
-
- @Override
protected void onDestroy() {
super.onDestroy();
destroyed = true;
@@ -194,23 +166,6 @@ public class SubsonicTabActivity extends Activity {
Util.disablePendingTransition(this);
}
- @Override
- public void setTitle(CharSequence title) {
- super.setTitle(title);
-
- // Set the font of title in the action bar.
- TextView text = (TextView) findViewById(R.id.actionbar_title_text);
- Typeface typeface = Typeface.createFromAsset(getAssets(), "fonts/Storopia.ttf");
- text.setTypeface(typeface);
-
- text.setText(title);
- }
-
- @Override
- public void setTitle(int titleId) {
- setTitle(getString(titleId));
- }
-
private void applyTheme() {
String theme = Util.getTheme(this);
if ("dark".equals(theme)) {