From 094bd31522c8d194f364f79e470c7b21c9f28151 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Fri, 7 Sep 2012 19:54:15 -0700 Subject: Fixed widget layout --- .../res/drawable-hdpi-v4/appwidget_bg.9.png | Bin 2909 -> 3117 bytes subsonic-android/res/layout/appwidget.xml | 3 +-- 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'subsonic-android/res') diff --git a/subsonic-android/res/drawable-hdpi-v4/appwidget_bg.9.png b/subsonic-android/res/drawable-hdpi-v4/appwidget_bg.9.png index 3b29eae7..d8f892c3 100644 Binary files a/subsonic-android/res/drawable-hdpi-v4/appwidget_bg.9.png and b/subsonic-android/res/drawable-hdpi-v4/appwidget_bg.9.png differ diff --git a/subsonic-android/res/layout/appwidget.xml b/subsonic-android/res/layout/appwidget.xml index e2c797b3..6b3c892e 100644 --- a/subsonic-android/res/layout/appwidget.xml +++ b/subsonic-android/res/layout/appwidget.xml @@ -3,8 +3,7 @@ android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal" - android:background="@drawable/widget_background" - android:padding="0dp"> + android:background="@drawable/widget_background"> Date: Fri, 7 Sep 2012 21:04:53 -0700 Subject: Made title in notification bar stretch along the top for long titles + buttons aren't so freakishly large --- .../res/drawable/notification_play.png | Bin 0 -> 807 bytes subsonic-android/res/layout/notification.xml | 162 +++++++++++---------- 2 files changed, 85 insertions(+), 77 deletions(-) create mode 100644 subsonic-android/res/drawable/notification_play.png (limited to 'subsonic-android/res') diff --git a/subsonic-android/res/drawable/notification_play.png b/subsonic-android/res/drawable/notification_play.png new file mode 100644 index 00000000..8c95b6a5 Binary files /dev/null and b/subsonic-android/res/drawable/notification_play.png differ diff --git a/subsonic-android/res/layout/notification.xml b/subsonic-android/res/layout/notification.xml index 2c65d7a0..22e2cb63 100644 --- a/subsonic-android/res/layout/notification.xml +++ b/subsonic-android/res/layout/notification.xml @@ -3,93 +3,101 @@ android:id="@+id/statusbar" android:layout_width="fill_parent" android:layout_height="fill_parent" - android:orientation="vertical" > + android:orientation="horizontal" > + + + android:orientation="vertical" + android:paddingLeft="11.0dip"> + + + + - + - + - + + - + - - - - - - - - + + + - -- cgit v1.2.3 From 9398f1b61396bb8c8859a6c1367a09cafcc2cd03 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Sat, 8 Sep 2012 17:19:38 -0700 Subject: Started to work on move to ActionBarSherlock --- subsonic-android/AndroidManifest.xml | 4 +- subsonic-android/project.properties | 1 + subsonic-android/res/layout/main.xml | 6 -- subsonic-android/res/layout/select_album.xml | 2 - subsonic-android/res/layout/select_artist.xml | 2 - subsonic-android/res/layout/select_playlist.xml | 2 - subsonic-android/res/menu/main.xml | 38 +++++--- subsonic-android/res/menu/select_album.xml | 30 ++++++ subsonic-android/res/menu/select_artist.xml | 30 ++++++ subsonic-android/res/menu/select_playlist.xml | 24 +++++ subsonic-android/res/values/strings.xml | 4 + .../dsub/activity/DownloadActivity.java | 15 +-- .../daneren2005/dsub/activity/MainActivity.java | 103 ++++++++++----------- .../dsub/activity/SelectAlbumActivity.java | 70 +++++++------- .../dsub/activity/SelectArtistActivity.java | 76 +++++++-------- .../dsub/activity/SelectPlaylistActivity.java | 61 ++++++------ .../dsub/activity/SubsonicTabActivity.java | 61 ++---------- 17 files changed, 276 insertions(+), 253 deletions(-) create mode 100644 subsonic-android/res/menu/select_album.xml create mode 100644 subsonic-android/res/menu/select_artist.xml create mode 100644 subsonic-android/res/menu/select_playlist.xml (limited to 'subsonic-android/res') 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 @@ - + - + - - - - - - - - + + + - + - + - + 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 @@ + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + 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 @@ Top rated Random + Search + Shuffle + Refresh + Play Exit Settings Help 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() { @@ -136,36 +138,6 @@ public class SubsonicTabActivity extends Activity { Util.registerMediaButtonEventReceiver(this); } - @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(); @@ -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)) { -- cgit v1.2.3 From 00646f4aacd09c24d13170fe78bb144f1a98c4f6 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Sat, 8 Sep 2012 17:27:12 -0700 Subject: Revert "Started to work on move to ActionBarSherlock" This reverts commit 9398f1b61396bb8c8859a6c1367a09cafcc2cd03. --- subsonic-android/AndroidManifest.xml | 4 +- subsonic-android/project.properties | 1 - subsonic-android/res/layout/main.xml | 6 ++ subsonic-android/res/layout/select_album.xml | 2 + subsonic-android/res/layout/select_artist.xml | 2 + subsonic-android/res/layout/select_playlist.xml | 2 + subsonic-android/res/menu/main.xml | 38 +++----- subsonic-android/res/menu/select_album.xml | 30 ------ subsonic-android/res/menu/select_artist.xml | 30 ------ subsonic-android/res/menu/select_playlist.xml | 24 ----- subsonic-android/res/values/strings.xml | 4 - .../dsub/activity/DownloadActivity.java | 15 ++- .../daneren2005/dsub/activity/MainActivity.java | 103 +++++++++++---------- .../dsub/activity/SelectAlbumActivity.java | 70 +++++++------- .../dsub/activity/SelectArtistActivity.java | 76 ++++++++------- .../dsub/activity/SelectPlaylistActivity.java | 61 ++++++------ .../dsub/activity/SubsonicTabActivity.java | 61 ++++++++++-- 17 files changed, 253 insertions(+), 276 deletions(-) delete mode 100644 subsonic-android/res/menu/select_album.xml delete mode 100644 subsonic-android/res/menu/select_artist.xml delete mode 100644 subsonic-android/res/menu/select_playlist.xml (limited to 'subsonic-android/res') 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 @@ - + - + + + + + + + + + - - - - + - + - + 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 @@ - - - - - - - - - - - - - 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 @@ - - - - - - - - - - - - - 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 @@ - - - - - - - - - - - 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 @@ Top rated Random - Search - Shuffle - Refresh - Play Exit Settings Help 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() { @@ -138,6 +136,36 @@ public class SubsonicTabActivity extends SherlockActivity { Util.registerMediaButtonEventReceiver(this); } + @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(); @@ -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)) { -- cgit v1.2.3