From 73cfa5499dfd4479e35b9d1172ff059e143d6c1c Mon Sep 17 00:00:00 2001 From: wangear Date: Wed, 31 Mar 2021 17:10:14 +0900 Subject: [PATCH] Fix overlapping fonts and crash on tapping anywhere on video after long-pressing 'Popup' button (#5813) * Overlapping fonts #5096 issue : #5096 * Overlapping fonts #5096 issue : #5096 changed : - If additional textView is overlapped, only title view shows. * Overlapping fonts #5096 issue : #5096 changed : - Remove treeObserve and hiding logic. - RelativeLayout -> ConstraintLayout. - layout size fixed -> wrap_content. - if text size is bigger, layout height bigger too. * Overlapping fonts #5096 issue : #5096 changed : - remove unusable variable * Crash on tapping anywhere on video after long-pressing 'Popup' button #5804 issue : #5804 changed : - checked null - fixed NullPointerException. --- .../holder/StreamInfoItemHolder.java | 4 +- .../player/event/BasePlayerGestureListener.kt | 8 +-- app/src/main/res/layout/list_channel_item.xml | 52 +++++++++++-------- app/src/main/res/layout/list_stream_item.xml | 51 ++++++++++-------- 4 files changed, 67 insertions(+), 48 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/info_list/holder/StreamInfoItemHolder.java b/app/src/main/java/org/schabi/newpipe/info_list/holder/StreamInfoItemHolder.java index 1915ff283..a84c98404 100644 --- a/app/src/main/java/org/schabi/newpipe/info_list/holder/StreamInfoItemHolder.java +++ b/app/src/main/java/org/schabi/newpipe/info_list/holder/StreamInfoItemHolder.java @@ -4,8 +4,6 @@ import android.text.TextUtils; import android.view.ViewGroup; import android.widget.TextView; -import androidx.preference.PreferenceManager; - import org.schabi.newpipe.R; import org.schabi.newpipe.extractor.InfoItem; import org.schabi.newpipe.extractor.stream.StreamInfoItem; @@ -14,6 +12,8 @@ import org.schabi.newpipe.info_list.InfoItemBuilder; import org.schabi.newpipe.local.history.HistoryRecordManager; import org.schabi.newpipe.util.Localization; +import androidx.preference.PreferenceManager; + import static org.schabi.newpipe.MainActivity.DEBUG; /* diff --git a/app/src/main/java/org/schabi/newpipe/player/event/BasePlayerGestureListener.kt b/app/src/main/java/org/schabi/newpipe/player/event/BasePlayerGestureListener.kt index 989c78c57..29ae7c5c3 100644 --- a/app/src/main/java/org/schabi/newpipe/player/event/BasePlayerGestureListener.kt +++ b/app/src/main/java/org/schabi/newpipe/player/event/BasePlayerGestureListener.kt @@ -229,8 +229,10 @@ abstract class BasePlayerGestureListener( // because the soft input is visible (the draggable area is currently resized). player.updateScreenSize() player.checkPopupPositionBounds() - initialPopupX = player.popupLayoutParams!!.x - initialPopupY = player.popupLayoutParams!!.y + player.popupLayoutParams?.let { + initialPopupX = it.x + initialPopupY = it.y + } return super.onDown(e) } @@ -466,7 +468,7 @@ abstract class BasePlayerGestureListener( // /////////////////////////////////////////////////////////////////// private fun getDisplayPortion(e: MotionEvent): DisplayPortion { - return if (player.playerType == MainPlayer.PlayerType.POPUP) { + return if (player.playerType == MainPlayer.PlayerType.POPUP && player.popupLayoutParams != null) { when { e.x < player.popupLayoutParams!!.width / 3.0 -> DisplayPortion.LEFT e.x > player.popupLayoutParams!!.width * 2.0 / 3.0 -> DisplayPortion.RIGHT diff --git a/app/src/main/res/layout/list_channel_item.xml b/app/src/main/res/layout/list_channel_item.xml index d6a9a51e4..baaddd814 100644 --- a/app/src/main/res/layout/list_channel_item.xml +++ b/app/src/main/res/layout/list_channel_item.xml @@ -1,31 +1,19 @@ - - - - + + + diff --git a/app/src/main/res/layout/list_stream_item.xml b/app/src/main/res/layout/list_stream_item.xml index e35168bba..b1d3ec49b 100644 --- a/app/src/main/res/layout/list_stream_item.xml +++ b/app/src/main/res/layout/list_stream_item.xml @@ -1,9 +1,10 @@ - + android:progressDrawable="?progress_horizontal_drawable" + app:layout_constraintEnd_toEndOf="@+id/itemThumbnailView" + app:layout_constraintStart_toStartOf="@+id/itemThumbnailView" + app:layout_constraintTop_toBottomOf="@+id/itemThumbnailView" /> - +