From 82c90734eed44a0ff4c634a7d6cbfce6e2ceea4a Mon Sep 17 00:00:00 2001 From: "Carsten Csiky (csicar)" Date: Thu, 27 Jun 2019 17:05:37 +0200 Subject: [PATCH 1/3] add button to MainPlayer to go to Detail view --- .../newpipe/player/MainVideoPlayer.java | 10 +++ .../main/res/layout/activity_main_player.xml | 88 +++++++++++-------- 2 files changed, 60 insertions(+), 38 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java b/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java index f48ad7019d2..43cba2e7ab5 100644 --- a/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java +++ b/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java @@ -388,6 +388,7 @@ private class VideoPlayerImpl extends VideoPlayer { private TextView titleTextView; private TextView channelTextView; + private ImageButton showDetailButton; private RelativeLayout volumeRelativeLayout; private ProgressBar volumeProgressBar; private ImageView volumeImageView; @@ -430,6 +431,7 @@ public void initViews(View rootView) { super.initViews(rootView); this.titleTextView = rootView.findViewById(R.id.titleTextView); this.channelTextView = rootView.findViewById(R.id.channelTextView); + this.showDetailButton = rootView.findViewById(R.id.showDetailButton); this.volumeRelativeLayout = rootView.findViewById(R.id.volumeRelativeLayout); this.volumeProgressBar = rootView.findViewById(R.id.volumeProgressBar); this.volumeImageView = rootView.findViewById(R.id.volumeImageView); @@ -492,6 +494,7 @@ public void initListeners() { playPreviousButton.setOnClickListener(this); playNextButton.setOnClickListener(this); closeButton.setOnClickListener(this); + showDetailButton.setOnClickListener(this); moreOptionsButton.setOnClickListener(this); shareButton.setOnClickListener(this); @@ -564,6 +567,10 @@ public void onPlaybackShutdown() { finish(); } + public void onShowDetailClicked() { + NavigationHelper.openVideoDetail(context, playQueue.getItem().getServiceId(), playQueue.getItem().getUrl()); + } + /*////////////////////////////////////////////////////////////////////////// // Player Overrides //////////////////////////////////////////////////////////////////////////*/ @@ -641,6 +648,9 @@ public void onClick(View v) { } else if (v.getId() == repeatButton.getId()) { onRepeatClicked(); return; + } else if (v.getId() == showDetailButton.getId()){ + onShowDetailClicked(); + return; } else if (v.getId() == shuffleButton.getId()) { onShuffleClicked(); return; diff --git a/app/src/main/res/layout/activity_main_player.xml b/app/src/main/res/layout/activity_main_player.xml index a55a5df0531..aa2ecfec954 100644 --- a/app/src/main/res/layout/activity_main_player.xml +++ b/app/src/main/res/layout/activity_main_player.xml @@ -151,49 +151,61 @@ tools:ignore="RtlHardcoded"> - - + + - - + + + android:gravity="top" + android:orientation="vertical" + android:paddingLeft="8dp" + android:paddingRight="8dp" + tools:ignore="RtlHardcoded"> + + + + + Date: Thu, 27 Jun 2019 17:24:30 +0200 Subject: [PATCH 2/3] refine ImageButton properties: tint for color accent and more --- app/src/main/res/layout/activity_main_player.xml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/res/layout/activity_main_player.xml b/app/src/main/res/layout/activity_main_player.xml index aa2ecfec954..946f385e56e 100644 --- a/app/src/main/res/layout/activity_main_player.xml +++ b/app/src/main/res/layout/activity_main_player.xml @@ -162,7 +162,13 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="5dp" - android:background="@drawable/ic_expand_more_white_24dp" /> + android:background="@drawable/ic_arrow_back_white_24dp" + android:padding="10dp" + android:clickable="true" + android:focusable="true" + android:scaleType="fitXY" + android:tint="?attr/colorAccent" + /> Date: Fri, 28 Jun 2019 21:52:08 +0200 Subject: [PATCH 3/3] fixed formatting in MainVideoPlayer and its layout --- .../main/java/org/schabi/newpipe/player/MainVideoPlayer.java | 2 +- app/src/main/res/layout/activity_main_player.xml | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java b/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java index 43cba2e7ab5..e82bea9ce5d 100644 --- a/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java +++ b/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java @@ -648,7 +648,7 @@ public void onClick(View v) { } else if (v.getId() == repeatButton.getId()) { onRepeatClicked(); return; - } else if (v.getId() == showDetailButton.getId()){ + } else if (v.getId() == showDetailButton.getId()) { onShowDetailClicked(); return; } else if (v.getId() == shuffleButton.getId()) { diff --git a/app/src/main/res/layout/activity_main_player.xml b/app/src/main/res/layout/activity_main_player.xml index 946f385e56e..87ab7bc6ad9 100644 --- a/app/src/main/res/layout/activity_main_player.xml +++ b/app/src/main/res/layout/activity_main_player.xml @@ -167,8 +167,7 @@ android:clickable="true" android:focusable="true" android:scaleType="fitXY" - android:tint="?attr/colorAccent" - /> + android:tint="?attr/colorAccent"/>