From fc755e517634b3d7cfbc4a125817203493338011 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Wed, 1 Oct 2014 11:50:19 -0700 Subject: Call setView after dialog is created to work around issue with top/bottom borders http://stackoverflow.com/a/10556843/992439 --- .../daneren2005/dsub/fragments/SelectDirectoryFragment.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java index 824d4f33..5f988bbc 100644 --- a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java +++ b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java @@ -1187,12 +1187,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(); } }); -- cgit v1.2.3 From b42afdfa88451f1a60c86ce9ef942062c659e3d5 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Thu, 2 Oct 2014 13:16:46 -0700 Subject: Remove select all --- res/menu/select_song.xml | 4 ---- 1 file changed, 4 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 @@ -13,10 +13,6 @@ android:title="@string/menu.shuffle" compat:showAsAction="ifRoom|withText"/> - - -- cgit v1.2.3 From 20b7bab0361c30f66ebb5d33dbf2c4ecdf2cdf05 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Thu, 2 Oct 2014 13:16:54 -0700 Subject: Remove select all --- res/menu/select_song_offline.xml | 4 ---- 1 file changed, 4 deletions(-) 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 @@ -13,10 +13,6 @@ android:title="@string/menu.shuffle" compat:showAsAction="ifRoom|withText"/> - - -- cgit v1.2.3 From d29d9b4dcb9029a88eb956ac283e4807ba9b6367 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Thu, 2 Oct 2014 13:17:08 -0700 Subject: Remove select all --- .../dsub/fragments/SelectDirectoryFragment.java | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java index 5f988bbc..6cbb7e9b 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); @@ -778,18 +775,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; -- cgit v1.2.3 From 1704177fbd4327c956d2fdfd5b70c5529c5ae019 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Thu, 2 Oct 2014 13:31:00 -0700 Subject: Add method to retrieve SongView's downloadFile --- src/github/daneren2005/dsub/view/SongView.java | 4 ++++ 1 file changed, 4 insertions(+) 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) { -- cgit v1.2.3 From 146491ac63dc7beba308997f2c744bdaaed1bc7f Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Thu, 2 Oct 2014 13:41:50 -0700 Subject: Conditionally remove cache/delete menu items depending on status --- .../dsub/fragments/SubsonicFragment.java | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/github/daneren2005/dsub/fragments/SubsonicFragment.java b/src/github/daneren2005/dsub/fragments/SubsonicFragment.java index cf6f78b0..2dbf3535 100644 --- a/src/github/daneren2005/dsub/fragments/SubsonicFragment.java +++ b/src/github/daneren2005/dsub/fragments/SubsonicFragment.java @@ -74,6 +74,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; @@ -205,6 +206,31 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR if(entry.getBookmark() == null) { menu.removeItem(R.id.bookmark_menu_delete); } + + // If we are looking at a standard song view, get downloadFile to cache what options to show + if(view instanceof SongView) { + SongView songView = (SongView) view; + 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.menu_delete); + } + } + } catch(Exception e) { + Log.w(TAG, "Failed to lookup downloadFile info", e); + } + } } menu.findItem(entry.isDirectory() ? R.id.album_menu_star : R.id.song_menu_star).setTitle(entry.isStarred() ? R.string.common_unstar : R.string.common_star); } else { -- cgit v1.2.3 From 6daacadaffd59f14606f0f9110802ae18e0aa086 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Thu, 2 Oct 2014 18:58:06 -0700 Subject: Fix menu items not being updated --- src/github/daneren2005/dsub/fragments/SubsonicFragment.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/github/daneren2005/dsub/fragments/SubsonicFragment.java b/src/github/daneren2005/dsub/fragments/SubsonicFragment.java index 2dbf3535..d2e20b18 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; @@ -169,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()) { @@ -208,8 +209,9 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR } // If we are looking at a standard song view, get downloadFile to cache what options to show - if(view instanceof SongView) { - SongView songView = (SongView) view; + AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo; + if(info.targetView instanceof SongView) { + SongView songView = (SongView) info.targetView; DownloadFile downloadFile = songView.getDownloadFile(); try { @@ -224,7 +226,7 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR menu.removeItem(R.id.song_menu_download); } else { // Remove delete option if nothing to delete - menu.removeItem(R.id.menu_delete); + menu.removeItem(R.id.song_menu_delete); } } } catch(Exception e) { -- cgit v1.2.3 From d85b982e32737211cdc1f2aab42d718a6cbad1bc Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Thu, 2 Oct 2014 19:14:40 -0700 Subject: Apply conditional cache/delete logic to more fragments --- .../dsub/fragments/NowPlayingFragment.java | 2 +- .../dsub/fragments/SelectBookmarkFragment.java | 6 +++ .../dsub/fragments/SubsonicFragment.java | 55 +++++++++++----------- 3 files changed, 34 insertions(+), 29 deletions(-) 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 Date: Thu, 2 Oct 2014 19:16:23 -0700 Subject: Remove select all strings --- res/values-de/strings.xml | 1 - res/values-es/strings.xml | 1 - res/values-fr/strings.xml | 1 - res/values-hu/strings.xml | 1 - res/values-ru/strings.xml | 1 - res/values/strings.xml | 1 - 6 files changed, 6 deletions(-) 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 @@ Suche Zufall Aktualisieren - Wähle Alle Abspielen Ans Ende der Wiedergabeliste Beenden 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 @@ Buscar Aleatorio Actualizar - Seleccionar todo Reproducir Reproducir al final Salir 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 @@ Recherche Hasard Recharger - Tout sélectionner Jouer Quitter Jouer dernier diff --git a/res/values-hu/strings.xml b/res/values-hu/strings.xml index c7fa1728..5ac4f652 100644 --- a/res/values-hu/strings.xml +++ b/res/values-hu/strings.xml @@ -78,7 +78,6 @@ Keresés Lejátszás kevert sorrendben Frissítés - Összes jelölése be/ki Lejátszás Sorbaállítás utolsónak Kilépés 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 @@ Поиск Перемешать Обновить - Выбрать все Воспроизвести Воспроизвести последним Выход 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 @@ Search Shuffle Refresh - Select All Play Play Last Exit -- cgit v1.2.3