From 9bd26798b669296acbcd3021cee2427e4bcf8bb8 Mon Sep 17 00:00:00 2001 From: John Zhen Mo Date: Wed, 17 Jan 2018 14:32:09 -0800 Subject: [PATCH] -Added icon for adding stream to playlist. -Renamed HistoryPlaylistFragment to StatisticsPlaylistFragment. --- .../fragments/detail/VideoDetailFragment.java | 9 ++++++++ .../local/LocalPlaylistFragment.java | 3 +-- .../fragments/local/MostPlayedFragment.java | 2 +- ...t.java => StatisticsPlaylistFragment.java} | 8 +++---- .../fragments/local/WatchHistoryFragment.java | 2 +- .../ic_playlist_add_black_24dp.png | Bin 0 -> 106 bytes .../ic_playlist_add_white_24dp.png | Bin 0 -> 107 bytes .../ic_playlist_add_black_24dp.png | Bin 0 -> 100 bytes .../ic_playlist_add_white_24dp.png | Bin 0 -> 101 bytes .../ic_playlist_add_black_24dp.png | Bin 0 -> 113 bytes .../ic_playlist_add_white_24dp.png | Bin 0 -> 109 bytes .../ic_playlist_add_black_24dp.png | Bin 0 -> 129 bytes .../ic_playlist_add_white_24dp.png | Bin 0 -> 113 bytes .../ic_playlist_add_black_24dp.png | Bin 0 -> 128 bytes .../ic_playlist_add_white_24dp.png | Bin 0 -> 111 bytes .../main/res/layout/fragment_video_detail.xml | 21 +++++++++++++++++- app/src/main/res/values/attrs.xml | 1 + app/src/main/res/values/strings.xml | 2 ++ app/src/main/res/values/styles.xml | 2 ++ 19 files changed, 40 insertions(+), 10 deletions(-) rename app/src/main/java/org/schabi/newpipe/fragments/local/{HistoryPlaylistFragment.java => StatisticsPlaylistFragment.java} (96%) create mode 100644 app/src/main/res/drawable-hdpi/ic_playlist_add_black_24dp.png create mode 100644 app/src/main/res/drawable-hdpi/ic_playlist_add_white_24dp.png create mode 100644 app/src/main/res/drawable-mdpi/ic_playlist_add_black_24dp.png create mode 100644 app/src/main/res/drawable-mdpi/ic_playlist_add_white_24dp.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_playlist_add_black_24dp.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_playlist_add_white_24dp.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_playlist_add_black_24dp.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_playlist_add_white_24dp.png create mode 100644 app/src/main/res/drawable-xxxhdpi/ic_playlist_add_black_24dp.png create mode 100644 app/src/main/res/drawable-xxxhdpi/ic_playlist_add_white_24dp.png diff --git a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java index c7b61eceb..7f8afdbe8 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java @@ -58,6 +58,7 @@ import org.schabi.newpipe.extractor.stream.StreamInfoItem; import org.schabi.newpipe.extractor.stream.VideoStream; import org.schabi.newpipe.fragments.BackPressable; import org.schabi.newpipe.fragments.BaseStateFragment; +import org.schabi.newpipe.fragments.local.PlaylistAppendDialog; import org.schabi.newpipe.history.HistoryListener; import org.schabi.newpipe.info_list.InfoItemBuilder; import org.schabi.newpipe.info_list.InfoItemDialog; @@ -145,6 +146,7 @@ public class VideoDetailFragment extends BaseStateFragment implement private TextView detailControlsBackground; private TextView detailControlsPopup; + private TextView detailControlsAddToPlaylist; private TextView appendControlsDetail; private LinearLayout videoDescriptionRootLayout; @@ -327,6 +329,11 @@ public class VideoDetailFragment extends BaseStateFragment implement case R.id.detail_controls_popup: openPopupPlayer(false); break; + case R.id.detail_controls_playlist_append: + if (getFragmentManager() != null && currentInfo != null) { + PlaylistAppendDialog.newInstance(currentInfo).show(getFragmentManager(), TAG); + } + break; case R.id.detail_uploader_root_layout: if (TextUtils.isEmpty(currentInfo.getUploaderUrl())) { Log.w(TAG, "Can't open channel because we got no channel URL"); @@ -429,6 +436,7 @@ public class VideoDetailFragment extends BaseStateFragment implement detailControlsBackground = rootView.findViewById(R.id.detail_controls_background); detailControlsPopup = rootView.findViewById(R.id.detail_controls_popup); + detailControlsAddToPlaylist = rootView.findViewById(R.id.detail_controls_playlist_append); appendControlsDetail = rootView.findViewById(R.id.touch_append_detail); videoDescriptionRootLayout = rootView.findViewById(R.id.detail_description_root_layout); @@ -479,6 +487,7 @@ public class VideoDetailFragment extends BaseStateFragment implement thumbnailBackgroundButton.setOnClickListener(this); detailControlsBackground.setOnClickListener(this); detailControlsPopup.setOnClickListener(this); + detailControlsAddToPlaylist.setOnClickListener(this); relatedStreamExpandButton.setOnClickListener(this); detailControlsBackground.setLongClickable(true); diff --git a/app/src/main/java/org/schabi/newpipe/fragments/local/LocalPlaylistFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/local/LocalPlaylistFragment.java index 6709b1bad..44ecfb924 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/local/LocalPlaylistFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/local/LocalPlaylistFragment.java @@ -144,9 +144,8 @@ public class LocalPlaylistFragment extends BaseListFragment, infoListAdapter.setOnStreamSelectedListener(new InfoItemBuilder.OnInfoItemSelectedListener() { @Override public void selected(StreamInfoItem selectedItem) { - if (getParentFragment() == null) return; // Requires the parent fragment to find holder for fragment replacement - NavigationHelper.openVideoDetailFragment(getParentFragment().getFragmentManager(), + NavigationHelper.openVideoDetailFragment(getFragmentManager(), selectedItem.getServiceId(), selectedItem.url, selectedItem.getName()); } diff --git a/app/src/main/java/org/schabi/newpipe/fragments/local/MostPlayedFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/local/MostPlayedFragment.java index 466b1d569..7862cf2f4 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/local/MostPlayedFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/local/MostPlayedFragment.java @@ -9,7 +9,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -public class MostPlayedFragment extends HistoryPlaylistFragment { +public class MostPlayedFragment extends StatisticsPlaylistFragment { @Override protected String getName() { return getString(R.string.title_most_played); diff --git a/app/src/main/java/org/schabi/newpipe/fragments/local/HistoryPlaylistFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/local/StatisticsPlaylistFragment.java similarity index 96% rename from app/src/main/java/org/schabi/newpipe/fragments/local/HistoryPlaylistFragment.java rename to app/src/main/java/org/schabi/newpipe/fragments/local/StatisticsPlaylistFragment.java index 3941df6c0..8db1f8780 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/local/HistoryPlaylistFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/local/StatisticsPlaylistFragment.java @@ -35,7 +35,7 @@ import io.reactivex.android.schedulers.AndroidSchedulers; import static org.schabi.newpipe.util.AnimationUtils.animateView; -public abstract class HistoryPlaylistFragment +public abstract class StatisticsPlaylistFragment extends BaseListFragment, Void> { private View headerRootLayout; @@ -130,9 +130,7 @@ public abstract class HistoryPlaylistFragment infoListAdapter.setOnStreamSelectedListener(new InfoItemBuilder.OnInfoItemSelectedListener() { @Override public void selected(StreamInfoItem selectedItem) { - if (getParentFragment() == null) return; - // Requires the parent fragment to find holder for fragment replacement - NavigationHelper.openVideoDetailFragment(getParentFragment().getFragmentManager(), + NavigationHelper.openVideoDetailFragment(getFragmentManager(), selectedItem.getServiceId(), selectedItem.url, selectedItem.getName()); } @@ -231,7 +229,7 @@ public abstract class HistoryPlaylistFragment @Override public void onError(Throwable exception) { - HistoryPlaylistFragment.this.onError(exception); + StatisticsPlaylistFragment.this.onError(exception); } @Override diff --git a/app/src/main/java/org/schabi/newpipe/fragments/local/WatchHistoryFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/local/WatchHistoryFragment.java index 794872954..2a4b8cfb0 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/local/WatchHistoryFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/local/WatchHistoryFragment.java @@ -11,7 +11,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -public class WatchHistoryFragment extends HistoryPlaylistFragment { +public class WatchHistoryFragment extends StatisticsPlaylistFragment { @Override protected String getName() { return getString(R.string.title_watch_history); diff --git a/app/src/main/res/drawable-hdpi/ic_playlist_add_black_24dp.png b/app/src/main/res/drawable-hdpi/ic_playlist_add_black_24dp.png new file mode 100644 index 0000000000000000000000000000000000000000..731b42590633cb2654a0c553b297f87e209cdf09 GIT binary patch literal 106 zcmeAS@N?(olHy`uVBq!ia0vp^Dj>|k0wldT1B8K;p{I*uNCjiEL{EZ9Pt*UFhZjsT zOs)xNu`hI-(x8|nu(04DJNtY`XSHi?yi#HbA`A=@6CWrnHJ!i))Xd=N>gTe~DWM4f D-jN$L literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-hdpi/ic_playlist_add_white_24dp.png b/app/src/main/res/drawable-hdpi/ic_playlist_add_white_24dp.png new file mode 100644 index 0000000000000000000000000000000000000000..4fb76e1784aa8d42add6d5dcfc91c304c6c201d8 GIT binary patch literal 107 zcmeAS@N?(olHy`uVBq!ia0vp^Dj>`VBp6OsFEs^HOeH~n!3+##lh0a!q&!_5Ln;`P z75Gp5|KI5IDCjdoD+{AZ(7*YA|FfkCDfxA%@G#8Nlb=@fz2!d06i-(_mvv4FO#njp B9#a4S literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-mdpi/ic_playlist_add_black_24dp.png b/app/src/main/res/drawable-mdpi/ic_playlist_add_black_24dp.png new file mode 100644 index 0000000000000000000000000000000000000000..d7a7514a84072ca393b32a30aa1427ab8ed37bb5 GIT binary patch literal 100 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM0wlfaz7_*1ZBG}+kP60R1*x8<|2Gs*O0lh! xcQDy0#lie4^T0b1ACG-(r~W$B^B(45U@*U(JU7SI#s;X3!PC{xWt~$(69A%_8>#>R literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-mdpi/ic_playlist_add_white_24dp.png b/app/src/main/res/drawable-mdpi/ic_playlist_add_white_24dp.png new file mode 100644 index 0000000000000000000000000000000000000000..73c981285837f550453b25eda148c90f1b1c7a47 GIT binary patch literal 101 zcmeAS@N?(olHy`uVBq!ia0vp^5+KY7Bp6QcFoXgrrjj7PUx9{KW6@ll{Pre}Cj9mdKI;Vst09JY%g#Z8m literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xhdpi/ic_playlist_add_black_24dp.png b/app/src/main/res/drawable-xhdpi/ic_playlist_add_black_24dp.png new file mode 100644 index 0000000000000000000000000000000000000000..dc4ebe9f39a7bc76959e00f975a36880980654b4 GIT binary patch literal 113 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA0wn)(8}a}t3r`ovkP61PmoIWMC3FG+?2Zo5J^ZOdkg}ZJ7n!(`d L>gTe~DWM4fRg5BO literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xhdpi/ic_playlist_add_white_24dp.png b/app/src/main/res/drawable-xhdpi/ic_playlist_add_white_24dp.png new file mode 100644 index 0000000000000000000000000000000000000000..52ccba0b2f500aab5cc7f89184de089425638fe7 GIT binary patch literal 109 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZA`BpB)|k7xlYrjj7PUsElAj0bSzCLqp zSfb;PGdFyqYu2$dFl?Bu>@h(h;YxhjeQqHY4ONc`3m)8bpKNFb6tz|X5{^wQf7uz> YgL@iQo&P4j3uq>Tr>mdKI;Vst06PUJ-T(jq literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxhdpi/ic_playlist_add_white_24dp.png b/app/src/main/res/drawable-xxhdpi/ic_playlist_add_white_24dp.png new file mode 100644 index 0000000000000000000000000000000000000000..3f652366df1d17852a763aa0634361a066ac41da GIT binary patch literal 113 zcmeAS@N?(olHy`uVBq!ia0vp^9w5vJBp7O^^}Pa8OeH~n!3+##lh0ZJd0L(>jv*C{ z$r4=+KkWr%6#89v?yWzOaFF4p&I--?AC7Dj&pFL-3cuFC$iUQ8>8mdK II;Vst04|sy&Hw-a literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxxhdpi/ic_playlist_add_black_24dp.png b/app/src/main/res/drawable-xxxhdpi/ic_playlist_add_black_24dp.png new file mode 100644 index 0000000000000000000000000000000000000000..46020a7e04f2cd8f9945abd5eb75e7917c2e22d4 GIT binary patch literal 128 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeK3?y%aJ*@^(YymzYu0R?HmZtAK52P4Ng8YIR z9G=}s19CJxT^vIy7?Tx*dz$_yI3)A^{rh?TG#Qo!w(Lo&92cfFZzy?D+$PV!;Kh90 TQvZJM5s*Qiu6{1-oD!MT$m`Z~Df*BafCZDwc@-#eM978G? zlNE$}n*Jv^B=i0K`+5E}8I}dM>`AH|7p66DD0xxbCeOg&#eCdS|9 + android:textSize="12sp"/> + + diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml index 61bc5e520..46676e200 100644 --- a/app/src/main/res/values/attrs.xml +++ b/app/src/main/res/values/attrs.xml @@ -26,6 +26,7 @@ + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index df5b15c19..361f453c4 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -38,6 +38,7 @@ Background Popup + Add To Video download path Path to store downloaded videos in @@ -375,4 +376,5 @@ Create New Playlist Delete Playlist Name + Add To Playlist diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index ee526ca41..1f79bbf3d 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -41,6 +41,7 @@ @drawable/ic_play_arrow_black_24dp @drawable/ic_whatshot_black_24dp @drawable/ic_channel_black_24dp + @drawable/ic_playlist_add_black_24dp @color/light_separator_color @color/light_contrast_background_color @@ -88,6 +89,7 @@ @drawable/ic_play_arrow_white_24dp @drawable/ic_whatshot_white_24dp @drawable/ic_channel_white_24dp + @drawable/ic_playlist_add_white_24dp @color/dark_separator_color @color/dark_contrast_background_color