From ef23f45cc92ef307ee6071ead0d0cb97cd3c6dbe Mon Sep 17 00:00:00 2001 From: Ethan Budd Date: Mon, 22 Jun 2020 22:15:02 -0500 Subject: [PATCH 1/3] Clicking on title should open video details --- .../schabi/newpipe/player/MainVideoPlayer.java | 16 ++++++++++++++++ .../newpipe/player/ServicePlayerActivity.java | 4 +++- app/src/main/res/layout/activity_main_player.xml | 8 ++++---- 3 files changed, 23 insertions(+), 5 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 56744d858bb..46b6b670075 100644 --- a/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java +++ b/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java @@ -48,6 +48,7 @@ import android.widget.Button; import android.widget.ImageButton; import android.widget.ImageView; +import android.widget.LinearLayout; import android.widget.PopupMenu; import android.widget.ProgressBar; import android.widget.RelativeLayout; @@ -86,6 +87,7 @@ import org.schabi.newpipe.util.ListHelper; import org.schabi.newpipe.util.NavigationHelper; import org.schabi.newpipe.util.PermissionHelper; +import org.schabi.newpipe.util.ServiceHelper; import org.schabi.newpipe.util.ShareUtils; import org.schabi.newpipe.util.StateSaver; import org.schabi.newpipe.util.ThemeHelper; @@ -517,6 +519,7 @@ public void onPlaybackParameterChanged(final float playbackTempo, final float pl private class VideoPlayerImpl extends VideoPlayer { private static final float MAX_GESTURE_LENGTH = 0.75f; + private LinearLayout metadata; private TextView titleTextView; private TextView channelTextView; private RelativeLayout volumeRelativeLayout; @@ -561,6 +564,7 @@ private class VideoPlayerImpl extends VideoPlayer { @Override public void initViews(final View view) { super.initViews(view); + this.metadata = view.findViewById(R.id.metadataView); this.titleTextView = view.findViewById(R.id.titleTextView); this.channelTextView = view.findViewById(R.id.channelTextView); this.volumeRelativeLayout = view.findViewById(R.id.volumeRelativeLayout); @@ -619,6 +623,7 @@ public void initListeners() { gestureDetector.setIsLongpressEnabled(false); getRootView().setOnTouchListener(listener); + metadata.setOnClickListener(this); queueButton.setOnClickListener(this); repeatButton.setOnClickListener(this); shuffleButton.setOnClickListener(this); @@ -814,6 +819,15 @@ public void onMuteUnmuteButtonClicked() { setMuteButton(muteButton, playerImpl.isMuted()); } + public void onMetadataClicked() { + NavigationHelper.openVideoDetail(context, + ServiceHelper.getSelectedServiceId(context), + playerImpl.getVideoUrl(), playerImpl.getVideoTitle()); + + ((View) getControlAnimationView().getParent()).setVisibility(View.GONE); + destroy(); + finish(); + } @Override public void onClick(final View v) { @@ -850,6 +864,8 @@ public void onClick(final View v) { return; } else if (v.getId() == kodiButton.getId()) { onKodiShare(); + } else if (v.getId() == metadata.getId()) { + onMetadataClicked(); } if (getCurrentState() != STATE_COMPLETED) { diff --git a/app/src/main/java/org/schabi/newpipe/player/ServicePlayerActivity.java b/app/src/main/java/org/schabi/newpipe/player/ServicePlayerActivity.java index 72becef8ff1..04af0d376dd 100644 --- a/app/src/main/java/org/schabi/newpipe/player/ServicePlayerActivity.java +++ b/app/src/main/java/org/schabi/newpipe/player/ServicePlayerActivity.java @@ -40,6 +40,7 @@ import org.schabi.newpipe.player.playqueue.PlayQueueItemTouchCallback; import org.schabi.newpipe.util.Localization; import org.schabi.newpipe.util.NavigationHelper; +import org.schabi.newpipe.util.ServiceHelper; import org.schabi.newpipe.util.ThemeHelper; import java.util.Collections; @@ -485,7 +486,8 @@ public void onClick(final View view) { } else if (view.getId() == shuffleButton.getId()) { player.onShuffleClicked(); } else if (view.getId() == metadata.getId()) { - scrollToSelected(); + onOpenDetail(ServiceHelper.getSelectedServiceId(getApplicationContext()), + player.getVideoUrl(), player.getVideoTitle()); } else if (view.getId() == progressLiveSync.getId()) { player.seekToDefault(); } diff --git a/app/src/main/res/layout/activity_main_player.xml b/app/src/main/res/layout/activity_main_player.xml index 4bae123ee4d..08479129a00 100644 --- a/app/src/main/res/layout/activity_main_player.xml +++ b/app/src/main/res/layout/activity_main_player.xml @@ -157,6 +157,8 @@ android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_toLeftOf="@+id/qualityTextView" + android:clickable="true" + android:focusable="true" android:gravity="top" android:orientation="vertical" android:paddingLeft="8dp" @@ -167,6 +169,7 @@ android:id="@+id/titleTextView" android:layout_width="match_parent" android:layout_height="wrap_content" + android:clickable="false" android:ellipsize="marquee" android:fadingEdge="horizontal" android:marqueeRepeatLimit="marquee_forever" @@ -175,8 +178,6 @@ android:textColor="@android:color/white" android:textSize="15sp" android:textStyle="bold" - android:clickable="true" - android:focusable="true" tools:ignore="RtlHardcoded" tools:text="The Video Title LONG very LONG"/> @@ -184,6 +185,7 @@ android:id="@+id/channelTextView" android:layout_width="match_parent" android:layout_height="wrap_content" + android:clickable="false" android:ellipsize="marquee" android:fadingEdge="horizontal" android:marqueeRepeatLimit="marquee_forever" @@ -191,8 +193,6 @@ android:singleLine="true" android:textColor="@android:color/white" android:textSize="12sp" - android:clickable="true" - android:focusable="true" tools:text="The Video Artist LONG very LONG very Long"/> From fa536687eaf376505ab28f6bcf36f62ec52ff794 Mon Sep 17 00:00:00 2001 From: Ethan Budd Date: Fri, 26 Jun 2020 22:39:59 -0500 Subject: [PATCH 2/3] fixes the children not being focusable and adds large-land --- .../res/layout-large-land/activity_main_player.xml | 12 ++++++++---- app/src/main/res/layout/activity_main_player.xml | 4 +++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/src/main/res/layout-large-land/activity_main_player.xml b/app/src/main/res/layout-large-land/activity_main_player.xml index 16dcff63966..3ca777fdb30 100644 --- a/app/src/main/res/layout-large-land/activity_main_player.xml +++ b/app/src/main/res/layout-large-land/activity_main_player.xml @@ -159,6 +159,8 @@ android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_toLeftOf="@+id/qualityTextView" + android:clickable="true" + android:focusable="true" android:gravity="top" android:orientation="vertical" android:paddingLeft="8dp" @@ -169,31 +171,33 @@ android:id="@+id/titleTextView" android:layout_width="match_parent" android:layout_height="wrap_content" + android:clickable="false" android:ellipsize="marquee" android:fadingEdge="horizontal" + android:focusable="true" android:marqueeRepeatLimit="marquee_forever" android:scrollHorizontally="true" android:singleLine="true" android:textColor="@android:color/white" android:textSize="15sp" android:textStyle="bold" - android:clickable="true" tools:ignore="RtlHardcoded" - tools:text="The Video Title LONG very LONG"/> + tools:text="The Video Title LONG very LONG" /> + tools:text="The Video Artist LONG very LONG very Long" />