aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2012-09-13 21:20:45 -0700
committerScott Jackson <daneren2005@gmail.com>2012-09-13 21:20:45 -0700
commitd0e7ff24e162532daf90176f21059c06ae0f9e84 (patch)
treebd448785d4ecff9014a0aef4ed1b36ce4c3932d3
parent75a688847ca797905106d95bf6f41660c6ed650b (diff)
downloaddsub-d0e7ff24e162532daf90176f21059c06ae0f9e84.tar.gz
dsub-d0e7ff24e162532daf90176f21059c06ae0f9e84.tar.bz2
dsub-d0e7ff24e162532daf90176f21059c06ae0f9e84.zip
Finished removing AlbumActivities bottom buttons and integrate them into the Action Bar
-rw-r--r--subsonic-android/res/layout/select_album.xml48
-rw-r--r--subsonic-android/res/menu/select_album.xml18
-rw-r--r--subsonic-android/res/values/strings.xml4
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java94
4 files changed, 41 insertions, 123 deletions
diff --git a/subsonic-android/res/layout/select_album.xml b/subsonic-android/res/layout/select_album.xml
index 59860e28..a5802246 100644
--- a/subsonic-android/res/layout/select_album.xml
+++ b/subsonic-android/res/layout/select_album.xml
@@ -26,54 +26,6 @@
android:layout_weight="1.0"
android:fastScrollEnabled="true"
/>
-
- <LinearLayout android:orientation="horizontal"
- android:layout_marginTop="6dp"
- android:layout_marginBottom="3dp"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content">
-
- <Button android:id="@+id/select_album_pin"
- android:text="@string/common.pin"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:layout_marginLeft="6dp"
- android:layout_marginRight="3dp"
- android:layout_weight="1"
- android:layout_width="0dp"
- android:layout_height="fill_parent"
- android:visibility="gone"/>
-
- <Button android:id="@+id/select_album_unpin"
- android:text="@string/common.unpin"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:layout_marginLeft="3dp"
- android:layout_marginRight="3dp"
- android:layout_weight="1"
- android:layout_width="0dp"
- android:layout_height="fill_parent"
- android:visibility="gone"/>
-
- <Button android:id="@+id/select_album_delete"
- android:text="@string/common.delete"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:layout_marginLeft="3dp"
- android:layout_marginRight="6dp"
- android:layout_weight="1"
- android:layout_width="0dp"
- android:layout_height="fill_parent"
- android:visibility="gone"/>
-
- <Button android:id="@+id/select_album_play_last"
- android:text="@string/common.play_last"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:visibility="gone"
- android:layout_marginLeft="3dp"
- android:layout_marginRight="6dp"
- android:layout_weight="1"
- android:layout_width="0dp"
- android:layout_height="fill_parent"/>
-
- </LinearLayout>
<include layout="@layout/button_bar"/>
diff --git a/subsonic-android/res/menu/select_album.xml b/subsonic-android/res/menu/select_album.xml
index b725469a..fe6e8eba 100644
--- a/subsonic-android/res/menu/select_album.xml
+++ b/subsonic-android/res/menu/select_album.xml
@@ -23,6 +23,24 @@
android:icon="@drawable/action_select"
android:title="@string/menu.select"
android:showAsAction="ifRoom|withText"/>
+
+ <item
+ android:id="@+id/menu_cache"
+ android:icon="@drawable/action_save"
+ android:title="@string/common.pin"
+ android:showAsAction="ifRoom|withText"/>
+
+ <item
+ android:id="@+id/menu_delete"
+ android:icon="@drawable/action_remove_all"
+ android:title="@string/common.delete"
+ android:showAsAction="ifRoom|withText"/>
+
+ <item
+ android:id="@+id/menu_play_last"
+ android:icon="@drawable/action_play_all"
+ android:title="@string/menu.play_last"
+ android:showAsAction="ifRoom|withText"/>
<item
android:id="@+id/menu_help"
diff --git a/subsonic-android/res/values/strings.xml b/subsonic-android/res/values/strings.xml
index a2a9df56..b183c95c 100644
--- a/subsonic-android/res/values/strings.xml
+++ b/subsonic-android/res/values/strings.xml
@@ -9,8 +9,7 @@
<string name="common.play_shuffled">Play shuffled</string>
<string name="common.play_next">Play next</string>
<string name="common.play_last">Play last</string>
- <string name="common.pin">Pin</string>
- <string name="common.unpin">Unpin</string>
+ <string name="common.pin">Cache</string>
<string name="common.delete">Delete</string>
<string name="button_bar.home">DSub home</string>
@@ -38,6 +37,7 @@
<string name="menu.refresh">Refresh</string>
<string name="menu.select">Select All</string>
<string name="menu.play">Play</string>
+ <string name="menu.play_last">Play Last</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/SelectAlbumActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java
index abbfe67b..9d1936ab 100644
--- a/subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java
+++ b/subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java
@@ -57,10 +57,9 @@ public class SelectAlbumActivity extends SubsonicTabActivity {
private View footer;
private View emptyView;
private com.actionbarsherlock.view.MenuItem selectAll;
- private Button playLastButton;
- private Button pinButton;
- private Button unpinButton;
- private Button deleteButton;
+ private com.actionbarsherlock.view.MenuItem cache;
+ private com.actionbarsherlock.view.MenuItem delete;
+ private com.actionbarsherlock.view.MenuItem playLast;
private Button moreButton;
private boolean licenseValid;
@@ -88,53 +87,16 @@ public class SelectAlbumActivity extends SubsonicTabActivity {
Util.startActivityWithoutTransition(SelectAlbumActivity.this, intent);
} else if (entry.isVideo()) {
playVideo(entry);
- } else {
- enableButtons();
}
}
}
});
- playLastButton = (Button) findViewById(R.id.select_album_play_last);
- pinButton = (Button) findViewById(R.id.select_album_pin);
- unpinButton = (Button) findViewById(R.id.select_album_unpin);
- deleteButton = (Button) findViewById(R.id.select_album_delete);
moreButton = (Button) footer.findViewById(R.id.select_album_more);
emptyView = findViewById(R.id.select_album_empty);
- playLastButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- download(true, false, false, false, false);
- selectAll(false, false);
- }
- });
- pinButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- download(true, true, false, false, false);
- selectAll(false, false);
- }
- });
- unpinButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- unpin();
- selectAll(false, false);
- }
- });
- deleteButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- delete();
- selectAll(false, false);
- }
- });
-
registerForContextMenu(entryList);
- enableButtons();
-
String id = getIntent().getStringExtra(Constants.INTENT_EXTRA_NAME_ID);
String name = getIntent().getStringExtra(Constants.INTENT_EXTRA_NAME_NAME);
String playlistId = getIntent().getStringExtra(Constants.INTENT_EXTRA_NAME_PLAYLIST_ID);
@@ -157,6 +119,9 @@ public class SelectAlbumActivity extends SubsonicTabActivity {
com.actionbarsherlock.view.MenuInflater inflater = getSupportMenuInflater();
inflater.inflate(R.menu.select_album, menu);
selectAll = menu.findItem(R.id.menu_select);
+ cache = menu.findItem(R.id.menu_cache);
+ delete = menu.findItem(R.id.menu_delete);
+ playLast = menu.findItem(R.id.menu_play_last);
return true;
}
@@ -167,6 +132,10 @@ public class SelectAlbumActivity extends SubsonicTabActivity {
case R.id.menu_play_now:
playNow(false);
return true;
+ case R.id.menu_play_last:
+ download(true, false, false, false, false);
+ selectAll(false, false);
+ return true;
case R.id.menu_shuffle:
playNow(true);
return true;
@@ -176,6 +145,14 @@ public class SelectAlbumActivity extends SubsonicTabActivity {
case R.id.menu_refresh:
refresh();
return true;
+ case R.id.menu_cache:
+ download(true, true, false, false, false);
+ selectAll(false, false);
+ return true;
+ case R.id.menu_delete:
+ delete();
+ selectAll(false, false);
+ return true;
case R.id.menu_exit:
intent = new Intent(this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
@@ -378,34 +355,6 @@ public class SelectAlbumActivity extends SubsonicTabActivity {
: R.string.select_album_n_unselected;
Util.toast(this, getString(toastResId, selectedCount));
}
-
- enableButtons();
- }
-
- private void enableButtons() {
- if (getDownloadService() == null) {
- return;
- }
-
- List<MusicDirectory.Entry> selection = getSelectedSongs();
- boolean enabled = !selection.isEmpty();
- boolean unpinEnabled = false;
- boolean deleteEnabled = false;
-
- for (MusicDirectory.Entry song : selection) {
- DownloadFile downloadFile = getDownloadService().forSong(song);
- if (downloadFile.isCompleteFileAvailable()) {
- deleteEnabled = true;
- }
- if (downloadFile.isSaved()) {
- unpinEnabled = true;
- }
- }
-
- playLastButton.setEnabled(enabled);
- pinButton.setEnabled(enabled && !Util.isOffline(this));
- unpinButton.setEnabled(unpinEnabled);
- deleteButton.setEnabled(deleteEnabled);
}
private List<MusicDirectory.Entry> getSelectedSongs() {
@@ -556,12 +505,11 @@ public class SelectAlbumActivity extends SubsonicTabActivity {
if (songCount > 0) {
getImageLoader().loadImage(getSupportActionBar(), entries.get(0));
entryList.addFooterView(footer);
- playLastButton.setVisibility(View.VISIBLE);
- pinButton.setVisibility(View.VISIBLE);
- unpinButton.setVisibility(View.VISIBLE);
- deleteButton.setVisibility(View.VISIBLE);
} else {
selectAll.setVisible(false);
+ cache.setVisible(false);
+ delete.setVisible(false);
+ playLast.setVisible(false);
}
emptyView.setVisibility(entries.isEmpty() ? View.VISIBLE : View.GONE);