diff options
Diffstat (limited to 'subsonic-android')
17 files changed, 253 insertions, 276 deletions
diff --git a/subsonic-android/AndroidManifest.xml b/subsonic-android/AndroidManifest.xml index 8f3100c8..8cc8eb82 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="15"/>
+ <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="14"/>
<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/Theme.Sherlock.Light">
+ <application android:label="@string/common.appname" android:icon="@drawable/launch2" android:theme="@style/Wheat">
<activity android:name="github.daneren2005.dsub.activity.MainActivity"
android:label="DSub"
diff --git a/subsonic-android/project.properties b/subsonic-android/project.properties index 0b3adc12..8da376af 100644 --- a/subsonic-android/project.properties +++ b/subsonic-android/project.properties @@ -9,4 +9,3 @@ # 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 56b013fe..e151f319 100644 --- a/subsonic-android/res/layout/main.xml +++ b/subsonic-android/res/layout/main.xml @@ -4,6 +4,12 @@ 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 d5a4d0d1..2c9a00aa 100644 --- a/subsonic-android/res/layout/select_album.xml +++ b/subsonic-android/res/layout/select_album.xml @@ -4,6 +4,8 @@ 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 bebfdec4..7cf6fc77 100644 --- a/subsonic-android/res/layout/select_artist.xml +++ b/subsonic-android/res/layout/select_artist.xml @@ -4,6 +4,8 @@ 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 2555687d..c23e764b 100644 --- a/subsonic-android/res/layout/select_playlist.xml +++ b/subsonic-android/res/layout/select_playlist.xml @@ -4,6 +4,8 @@ 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 af6a5a7d..27698f81 100644 --- a/subsonic-android/res/menu/main.xml +++ b/subsonic-android/res/menu/main.xml @@ -1,30 +1,22 @@ <?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_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" + /> - <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_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" + /> </menu> diff --git a/subsonic-android/res/menu/select_album.xml b/subsonic-android/res/menu/select_album.xml deleted file mode 100644 index a5f2a3a9..00000000 --- a/subsonic-android/res/menu/select_album.xml +++ /dev/null @@ -1,30 +0,0 @@ -<?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 deleted file mode 100644 index 42916622..00000000 --- a/subsonic-android/res/menu/select_artist.xml +++ /dev/null @@ -1,30 +0,0 @@ -<?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 deleted file mode 100644 index 46d863cd..00000000 --- a/subsonic-android/res/menu/select_playlist.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?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 ea926fd9..7f9f6728 100644 --- a/subsonic-android/res/values/strings.xml +++ b/subsonic-android/res/values/strings.xml @@ -33,10 +33,6 @@ <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 4a3dd9bc..a657b7eb 100644 --- a/subsonic-android/src/github/daneren2005/dsub/activity/DownloadActivity.java +++ b/subsonic-android/src/github/daneren2005/dsub/activity/DownloadActivity.java @@ -40,6 +40,9 @@ 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; @@ -55,10 +58,6 @@ 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; @@ -488,7 +487,7 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi @Override public boolean onCreateOptionsMenu(Menu menu) { - MenuInflater inflater = getSupportMenuInflater(); + MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.nowplaying, menu); return true; } @@ -508,14 +507,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 = getSupportMenuInflater(); + MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.nowplaying_context, menu); if (downloadFile.getSong().getParent() == null) { @@ -533,7 +532,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 60532868..e5958e57 100644 --- a/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java +++ b/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java @@ -28,9 +28,6 @@ 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; @@ -38,6 +35,7 @@ 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; @@ -117,52 +115,63 @@ public class MainActivity extends SubsonicTabActivity { } } }); - - // Title: Subsonic - setTitle(R.string.common_appname); - - // 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; - } + // Title: Subsonic + setTitle(R.string.common_appname); - @Override - public boolean onOptionsItemSelected(MenuItem item) { - Intent intent; - switch (item.getItemId()) { - case R.id.menu_shuffle: - intent = new Intent(MainActivity.this, DownloadActivity.class); + // 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); intent.putExtra(Constants.INTENT_EXTRA_NAME_SHUFFLE, true); Util.startActivityWithoutTransition(MainActivity.this, intent); - return true; - case R.id.menu_search: - intent = new Intent(MainActivity.this, SearchActivity.class); + } + }); + + // 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); intent.putExtra(Constants.INTENT_EXTRA_REQUEST_SEARCH, true); Util.startActivityWithoutTransition(MainActivity.this, intent); - 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 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));*/ + } + }); - return false; + // Remember the current theme. + theme = Util.getTheme(this); + + showInfoDialog(); } private void loadSettings() { @@ -189,10 +198,10 @@ public class MainActivity extends SubsonicTabActivity { public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, view, menuInfo); - 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)); + 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)); menu.setGroupCheckable(MENU_GROUP_SERVER, true, true); menu.setHeaderTitle(R.string.main_select_server); @@ -213,7 +222,7 @@ public class MainActivity extends SubsonicTabActivity { } @Override - public boolean onContextItemSelected(android.view.MenuItem menuItem) { + public boolean onContextItemSelected(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 31c4e728..108dcf9c 100644 --- a/subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java +++ b/subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java @@ -34,7 +34,6 @@ 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; @@ -178,40 +177,45 @@ 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; - } - @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 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); + } + }); - return false; + // 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)); + } + }); } 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 bee76641..8b32ff3a 100644 --- a/subsonic-android/src/github/daneren2005/dsub/activity/SelectArtistActivity.java +++ b/subsonic-android/src/github/daneren2005/dsub/activity/SelectArtistActivity.java @@ -30,7 +30,6 @@ 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; @@ -74,46 +73,51 @@ public class SelectArtistActivity extends SubsonicTabActivity implements Adapter } registerForContextMenu(artistList); - 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; - } + setTitle(Util.isOffline(this) ? R.string.music_library_label_offline : R.string.music_library_label); - @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); + // 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); intent.putExtra(Constants.INTENT_EXTRA_NAME_SHUFFLE, true); Util.startActivityWithoutTransition(SelectArtistActivity.this, intent); - 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; - } + } + }); - return false; + // 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)); + } + }); + + musicFolders = null; + load(); } 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 f515d5be..a299b84b 100644 --- a/subsonic-android/src/github/daneren2005/dsub/activity/SelectPlaylistActivity.java +++ b/subsonic-android/src/github/daneren2005/dsub/activity/SelectPlaylistActivity.java @@ -61,38 +61,39 @@ public class SelectPlaylistActivity extends SubsonicTabActivity implements Adapt // Title: Playlists setTitle(R.string.playlist_label); - 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: + // 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) { 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 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 false; + load(); } 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 7d303a8d..6afe842b 100644 --- a/subsonic-android/src/github/daneren2005/dsub/activity/SubsonicTabActivity.java +++ b/subsonic-android/src/github/daneren2005/dsub/activity/SubsonicTabActivity.java @@ -34,12 +34,13 @@ 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; @@ -53,7 +54,7 @@ import github.daneren2005.dsub.util.Util; /** * @author Sindre Mehus */ -public class SubsonicTabActivity extends SherlockActivity { +public class SubsonicTabActivity extends Activity { private static final String TAG = SubsonicTabActivity.class.getSimpleName(); private static ImageLoader IMAGE_LOADER; @@ -67,9 +68,9 @@ public class SubsonicTabActivity extends SherlockActivity { @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); } @@ -77,9 +78,6 @@ public class SubsonicTabActivity extends SherlockActivity { @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() { @@ -139,6 +137,36 @@ public class SubsonicTabActivity extends SherlockActivity { } @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; @@ -166,6 +194,23 @@ public class SubsonicTabActivity extends SherlockActivity { 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)) { |