diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-10-02 19:17:22 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-10-02 19:17:22 -0700 |
commit | 7069ab8ab78a48e60fa4a95ccc325eb7e56fa1be (patch) | |
tree | 7b2ec25823373ad6b1473559a2d9d86d253645a8 | |
parent | e34688b0366f9ac17e8c9c55877d83d4acd7fb0d (diff) | |
parent | ad8e2fbbe3a096dbcea0f252ba0fa1bad6baffda (diff) | |
download | dsub-7069ab8ab78a48e60fa4a95ccc325eb7e56fa1be.tar.gz dsub-7069ab8ab78a48e60fa4a95ccc325eb7e56fa1be.tar.bz2 dsub-7069ab8ab78a48e60fa4a95ccc325eb7e56fa1be.zip |
Merge branch 'master' into Transition
-rw-r--r-- | res/menu/select_song.xml | 4 | ||||
-rw-r--r-- | res/menu/select_song_offline.xml | 4 | ||||
-rw-r--r-- | res/values-de/strings.xml | 1 | ||||
-rw-r--r-- | res/values-es/strings.xml | 1 | ||||
-rw-r--r-- | res/values-fr/strings.xml | 1 | ||||
-rw-r--r-- | res/values-hu/strings.xml | 1 | ||||
-rw-r--r-- | res/values-ru/strings.xml | 1 | ||||
-rw-r--r-- | res/values/strings.xml | 1 | ||||
-rw-r--r-- | src/github/daneren2005/dsub/fragments/NowPlayingFragment.java | 2 | ||||
-rw-r--r-- | src/github/daneren2005/dsub/fragments/SelectBookmarkFragment.java | 6 | ||||
-rw-r--r-- | src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java | 25 | ||||
-rw-r--r-- | src/github/daneren2005/dsub/fragments/SubsonicFragment.java | 33 | ||||
-rw-r--r-- | src/github/daneren2005/dsub/view/SongView.java | 4 |
13 files changed, 47 insertions, 37 deletions
diff --git a/res/menu/select_song.xml b/res/menu/select_song.xml index ec4af96a..07fd57a7 100644 --- a/res/menu/select_song.xml +++ b/res/menu/select_song.xml @@ -14,10 +14,6 @@ compat:showAsAction="ifRoom|withText"/> <item - android:id="@+id/menu_select" - android:title="@string/menu.select"/> - - <item android:id="@+id/menu_download" android:title="@string/common.download"/> diff --git a/res/menu/select_song_offline.xml b/res/menu/select_song_offline.xml index 6915c873..c45405fb 100644 --- a/res/menu/select_song_offline.xml +++ b/res/menu/select_song_offline.xml @@ -14,10 +14,6 @@ compat:showAsAction="ifRoom|withText"/> <item - android:id="@+id/menu_select" - android:title="@string/menu.select"/> - - <item android:id="@+id/menu_delete" android:title="@string/menu.delete_cache"/> diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml index ebfe7377..e57d7fb4 100644 --- a/res/values-de/strings.xml +++ b/res/values-de/strings.xml @@ -78,7 +78,6 @@ <string name="menu.search">Suche</string>
<string name="menu.shuffle">Zufall</string>
<string name="menu.refresh">Aktualisieren</string>
- <string name="menu.select">Wähle Alle</string>
<string name="menu.play">Abspielen</string>
<string name="menu.play_last">Ans Ende der Wiedergabeliste</string>
<string name="menu.exit">Beenden</string>
diff --git a/res/values-es/strings.xml b/res/values-es/strings.xml index e2350bab..e49d6197 100644 --- a/res/values-es/strings.xml +++ b/res/values-es/strings.xml @@ -75,7 +75,6 @@ <string name="menu.search">Buscar</string> <string name="menu.shuffle">Aleatorio</string> <string name="menu.refresh">Actualizar</string> - <string name="menu.select">Seleccionar todo</string> <string name="menu.play">Reproducir</string> <string name="menu.play_last">Reproducir al final</string> <string name="menu.exit">Salir</string> diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml index 40d04b42..4adaf141 100644 --- a/res/values-fr/strings.xml +++ b/res/values-fr/strings.xml @@ -77,7 +77,6 @@ <string name="menu.search">Recherche</string>
<string name="menu.shuffle">Hasard</string>
<string name="menu.refresh">Recharger</string>
- <string name="menu.select">Tout sélectionner</string>
<string name="menu.play">Jouer</string>
<string name="menu.exit">Quitter</string>
<string name="menu.play_last">Jouer dernier</string>
diff --git a/res/values-hu/strings.xml b/res/values-hu/strings.xml index 98b64e25..e3197bee 100644 --- a/res/values-hu/strings.xml +++ b/res/values-hu/strings.xml @@ -78,7 +78,6 @@ <string name="menu.search">Keresés</string>
<string name="menu.shuffle">Lejátszás kevert sorrendben</string>
<string name="menu.refresh">Frissítés</string>
- <string name="menu.select">Összes jelölése be/ki</string>
<string name="menu.play">Lejátszás</string>
<string name="menu.play_last">Sorbaállítás utolsónak</string>
<string name="menu.exit">Kilépés</string>
diff --git a/res/values-ru/strings.xml b/res/values-ru/strings.xml index 9e9bc211..5a009228 100644 --- a/res/values-ru/strings.xml +++ b/res/values-ru/strings.xml @@ -54,7 +54,6 @@ <string name="menu.search">Поиск</string>
<string name="menu.shuffle">Перемешать</string>
<string name="menu.refresh">Обновить</string>
- <string name="menu.select">Выбрать все</string>
<string name="menu.play">Воспроизвести</string>
<string name="menu.play_last">Воспроизвести последним</string>
<string name="menu.exit">Выход</string>
diff --git a/res/values/strings.xml b/res/values/strings.xml index dc2e4980..857ebe71 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -78,7 +78,6 @@ <string name="menu.search">Search</string>
<string name="menu.shuffle">Shuffle</string>
<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>
diff --git a/src/github/daneren2005/dsub/fragments/NowPlayingFragment.java b/src/github/daneren2005/dsub/fragments/NowPlayingFragment.java index ac197161..1f5c7b88 100644 --- a/src/github/daneren2005/dsub/fragments/NowPlayingFragment.java +++ b/src/github/daneren2005/dsub/fragments/NowPlayingFragment.java @@ -627,7 +627,7 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis menu.findItem(R.id.menu_show_artist).setVisible(false);
}
- hideMenuItems(menu);
+ hideMenuItems(menu, (AdapterView.AdapterContextMenuInfo) menuInfo);
}
}
diff --git a/src/github/daneren2005/dsub/fragments/SelectBookmarkFragment.java b/src/github/daneren2005/dsub/fragments/SelectBookmarkFragment.java index f9ab0cc9..c26429ce 100644 --- a/src/github/daneren2005/dsub/fragments/SelectBookmarkFragment.java +++ b/src/github/daneren2005/dsub/fragments/SelectBookmarkFragment.java @@ -19,6 +19,7 @@ package github.daneren2005.dsub.fragments; import android.content.DialogInterface; +import android.util.Log; import android.view.ContextMenu; import android.view.MenuInflater; import android.view.MenuItem; @@ -29,6 +30,7 @@ import github.daneren2005.dsub.R; import github.daneren2005.dsub.activity.DownloadActivity; import github.daneren2005.dsub.domain.Bookmark; import github.daneren2005.dsub.domain.MusicDirectory; +import github.daneren2005.dsub.service.DownloadFile; import github.daneren2005.dsub.service.DownloadService; import github.daneren2005.dsub.service.MusicService; import github.daneren2005.dsub.service.MusicServiceFactory; @@ -39,6 +41,8 @@ import github.daneren2005.dsub.util.ProgressListener; import github.daneren2005.dsub.util.SilentBackgroundTask; import github.daneren2005.dsub.util.Util; import github.daneren2005.dsub.view.BookmarkAdapter; +import github.daneren2005.dsub.view.SongView; + import java.text.Format; import java.text.SimpleDateFormat; import java.util.Arrays; @@ -53,6 +57,8 @@ public class SelectBookmarkFragment extends SelectListFragment<MusicDirectory.En MenuInflater inflater = context.getMenuInflater(); inflater.inflate(R.menu.select_bookmark_context, menu); + + hideMenuItems(menu, (AdapterView.AdapterContextMenuInfo) menuInfo); } @Override diff --git a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java index cc38ad69..4b845753 100644 --- a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java +++ b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java @@ -258,9 +258,6 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter case R.id.menu_shuffle:
playNow(true, false);
return true;
- case R.id.menu_select:
- selectAllOrNone();
- return true;
case R.id.menu_download:
downloadBackground(false);
selectAll(false, false);
@@ -777,18 +774,6 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter }
}
- private void selectAllOrNone() {
- boolean someUnselected = false;
- int count = entryList.getCount();
- for (int i = 0; i < count; i++) {
- if (!entryList.isItemChecked(i) && entryList.getItemAtPosition(i) instanceof Entry) {
- someUnselected = true;
- break;
- }
- }
- selectAll(someUnselected, true);
- }
-
private void selectAll(boolean selected, boolean toast) {
int count = entryList.getCount();
int selectedCount = 0;
@@ -1186,12 +1171,14 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter return;
}
- AlertDialog.Builder imageDialog = new AlertDialog.Builder(context);
+ AlertDialog.Builder builder = new AlertDialog.Builder(context);
ImageView fullScreenView = new ImageView(context);
imageLoader.loadImage(fullScreenView, albumRep, true, true);
- imageDialog.setView(fullScreenView);
- imageDialog.setCancelable(true);
- imageDialog.create();
+ builder.setCancelable(true);
+
+ AlertDialog imageDialog = builder.create();
+ // Set view here with unecessary 0's to remove top/bottom border
+ imageDialog.setView(fullScreenView, 0, 0, 0, 0);
imageDialog.show();
}
});
diff --git a/src/github/daneren2005/dsub/fragments/SubsonicFragment.java b/src/github/daneren2005/dsub/fragments/SubsonicFragment.java index fe1153c0..66900b55 100644 --- a/src/github/daneren2005/dsub/fragments/SubsonicFragment.java +++ b/src/github/daneren2005/dsub/fragments/SubsonicFragment.java @@ -40,6 +40,7 @@ import android.view.MenuItem; import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
+import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
@@ -74,6 +75,7 @@ import github.daneren2005.dsub.util.LoadingTask; import github.daneren2005.dsub.util.UserUtil;
import github.daneren2005.dsub.util.Util;
import github.daneren2005.dsub.view.PlaylistSongView;
+import github.daneren2005.dsub.view.SongView;
import github.daneren2005.dsub.view.UpdateView;
import java.io.File;
@@ -168,7 +170,7 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo menuInfo, Object selected) {
MenuInflater inflater = context.getMenuInflater();
-
+
if(selected instanceof Entry) {
Entry entry = (Entry) selected;
if(entry instanceof PodcastEpisode && !entry.isVideo()) {
@@ -227,10 +229,10 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR }
}
- hideMenuItems(menu);
+ hideMenuItems(menu, (AdapterView.AdapterContextMenuInfo) menuInfo);
}
- protected void hideMenuItems(ContextMenu menu) {
+ protected void hideMenuItems(ContextMenu menu, AdapterView.AdapterContextMenuInfo info) {
if(!ServerInfo.checkServerVersion(context, "1.8")) {
menu.setGroupVisible(R.id.server_1_8, false);
menu.setGroupVisible(R.id.hide_star, false);
@@ -258,6 +260,31 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR if(!prefs.getBoolean(Constants.PREFERENCES_KEY_MENU_RATING, true)) {
menu.setGroupVisible(R.id.hide_rating, false);
}
+
+ // If we are looking at a standard song view, get downloadFile to cache what options to show
+ if(info.targetView instanceof SongView) {
+ SongView songView = (SongView) info.targetView;
+ DownloadFile downloadFile = songView.getDownloadFile();
+
+ try {
+ if(downloadFile != null) {
+ if(downloadFile.isWorkDone()) {
+ // Remove permanent cache menu if already perma cached
+ if(downloadFile.isSaved()) {
+ menu.removeItem(R.id.song_menu_pin);
+ }
+
+ // Remove cache option no matter what if already downloaded
+ menu.removeItem(R.id.song_menu_download);
+ } else {
+ // Remove delete option if nothing to delete
+ menu.removeItem(R.id.song_menu_delete);
+ }
+ }
+ } catch(Exception e) {
+ Log.w(TAG, "Failed to lookup downloadFile info", e);
+ }
+ }
}
protected void recreateContextMenu(ContextMenu menu) {
diff --git a/src/github/daneren2005/dsub/view/SongView.java b/src/github/daneren2005/dsub/view/SongView.java index f795cbce..0fe19944 100644 --- a/src/github/daneren2005/dsub/view/SongView.java +++ b/src/github/daneren2005/dsub/view/SongView.java @@ -161,6 +161,10 @@ public class SongView extends UpdateView implements Checkable { dontChangeDownloadFile = true; } + public DownloadFile getDownloadFile() { + return downloadFile; + } + @Override protected void updateBackground() { if (downloadService == null) { |