From 12d9cf0036c5cf41423de4bed12d0abbe9c869ca Mon Sep 17 00:00:00 2001 From: wangear Date: Fri, 12 Mar 2021 20:30:50 +0900 Subject: [PATCH 1/5] Overlapping fonts #5096 issue : #5096 changed : sp -> dp --- app/src/main/res/values-land/dimens.xml | 6 +++--- app/src/main/res/values-sw600dp-land/dimens.xml | 6 +++--- app/src/main/res/values/dimens.xml | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/src/main/res/values-land/dimens.xml b/app/src/main/res/values-land/dimens.xml index b152fb1ae8c..7de55e2e75f 100644 --- a/app/src/main/res/values-land/dimens.xml +++ b/app/src/main/res/values-land/dimens.xml @@ -4,10 +4,10 @@ 18sp - 16sp + 16dp 12sp - 14sp - 14sp + 14dp + 14dp 18sp diff --git a/app/src/main/res/values-sw600dp-land/dimens.xml b/app/src/main/res/values-sw600dp-land/dimens.xml index b578744d7bb..ca1e1eae64b 100644 --- a/app/src/main/res/values-sw600dp-land/dimens.xml +++ b/app/src/main/res/values-sw600dp-land/dimens.xml @@ -4,10 +4,10 @@ 21sp - 14sp + 14dp 11sp - 12sp - 12sp + 12dp + 12dp 3dp 6dp diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index ea26be57e15..de490c0f244 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -15,10 +15,10 @@ 16sp - 14sp + 14dp 11sp - 11sp - 12sp + 11dp + 12dp 16sp From b5ce2ebe296e333486f420b7af84ea46b566382d Mon Sep 17 00:00:00 2001 From: wangear Date: Sat, 13 Mar 2021 14:23:35 +0900 Subject: [PATCH 2/5] Overlapping fonts #5096 issue : #5096 changed : - rollback dp->sp. - If additional textView is overlapped, only title view shows. --- .../holder/StreamInfoItemHolder.java | 25 +++++++++++++++++-- app/src/main/res/values-land/dimens.xml | 6 ++--- .../main/res/values-sw600dp-land/dimens.xml | 6 ++--- app/src/main/res/values/dimens.xml | 6 ++--- 4 files changed, 32 insertions(+), 11 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 1915ff28323..b0ea111cd7f 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 @@ -1,11 +1,11 @@ package org.schabi.newpipe.info_list.holder; import android.text.TextUtils; +import android.view.View; import android.view.ViewGroup; +import android.view.ViewTreeObserver; 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 +14,8 @@ import org.schabi.newpipe.local.history.HistoryRecordManager; import org.schabi.newpipe.util.Localization; +import androidx.preference.PreferenceManager; + import static org.schabi.newpipe.MainActivity.DEBUG; /* @@ -42,6 +44,8 @@ public class StreamInfoItemHolder extends StreamMiniInfoItemHolder { public final TextView itemAdditionalDetails; + public final TextView itemVideoTitleView; + public final TextView itemUploaderView; public StreamInfoItemHolder(final InfoItemBuilder infoItemBuilder, final ViewGroup parent) { this(infoItemBuilder, R.layout.list_stream_item, parent); @@ -51,6 +55,8 @@ public StreamInfoItemHolder(final InfoItemBuilder infoItemBuilder, final int lay final ViewGroup parent) { super(infoItemBuilder, layoutId, parent); itemAdditionalDetails = itemView.findViewById(R.id.itemAdditionalDetails); + itemVideoTitleView = itemView.findViewById(R.id.itemVideoTitleView); + itemUploaderView = itemView.findViewById(R.id.itemUploaderView); } @Override @@ -64,6 +70,21 @@ public void updateFromItem(final InfoItem infoItem, final StreamInfoItem item = (StreamInfoItem) infoItem; itemAdditionalDetails.setText(getStreamInfoDetailLine(item)); + itemAdditionalDetails.getViewTreeObserver() + .addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { + @Override + public boolean onPreDraw() { + itemAdditionalDetails.getViewTreeObserver().removeOnPreDrawListener(this); + if (itemAdditionalDetails.getTop() <= itemVideoTitleView.getBottom()) { + itemAdditionalDetails.setVisibility(View.INVISIBLE); + } else if (itemAdditionalDetails.getTop() <= itemUploaderView.getBottom()) { + itemAdditionalDetails.setVisibility(View.INVISIBLE); + } else { + itemAdditionalDetails.setVisibility(View.VISIBLE); + } + return true; + } + }); } private String getStreamInfoDetailLine(final StreamInfoItem infoItem) { diff --git a/app/src/main/res/values-land/dimens.xml b/app/src/main/res/values-land/dimens.xml index 7de55e2e75f..b152fb1ae8c 100644 --- a/app/src/main/res/values-land/dimens.xml +++ b/app/src/main/res/values-land/dimens.xml @@ -4,10 +4,10 @@ 18sp - 16dp + 16sp 12sp - 14dp - 14dp + 14sp + 14sp 18sp diff --git a/app/src/main/res/values-sw600dp-land/dimens.xml b/app/src/main/res/values-sw600dp-land/dimens.xml index ca1e1eae64b..b578744d7bb 100644 --- a/app/src/main/res/values-sw600dp-land/dimens.xml +++ b/app/src/main/res/values-sw600dp-land/dimens.xml @@ -4,10 +4,10 @@ 21sp - 14dp + 14sp 11sp - 12dp - 12dp + 12sp + 12sp 3dp 6dp diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index de490c0f244..ea26be57e15 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -15,10 +15,10 @@ 16sp - 14dp + 14sp 11sp - 11dp - 12dp + 11sp + 12sp 16sp From fb02db7a05f7004481cd9865beeffb2b53b0ab5f Mon Sep 17 00:00:00 2001 From: wangear Date: Tue, 23 Mar 2021 11:04:06 +0900 Subject: [PATCH 3/5] 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. --- .../holder/StreamInfoItemHolder.java | 17 ------ app/src/main/res/layout/list_channel_item.xml | 52 +++++++++++-------- app/src/main/res/layout/list_stream_item.xml | 51 ++++++++++-------- 3 files changed, 60 insertions(+), 60 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 b0ea111cd7f..16cedd70f9e 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 @@ -1,9 +1,7 @@ package org.schabi.newpipe.info_list.holder; import android.text.TextUtils; -import android.view.View; import android.view.ViewGroup; -import android.view.ViewTreeObserver; import android.widget.TextView; import org.schabi.newpipe.R; @@ -70,21 +68,6 @@ public void updateFromItem(final InfoItem infoItem, final StreamInfoItem item = (StreamInfoItem) infoItem; itemAdditionalDetails.setText(getStreamInfoDetailLine(item)); - itemAdditionalDetails.getViewTreeObserver() - .addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { - @Override - public boolean onPreDraw() { - itemAdditionalDetails.getViewTreeObserver().removeOnPreDrawListener(this); - if (itemAdditionalDetails.getTop() <= itemVideoTitleView.getBottom()) { - itemAdditionalDetails.setVisibility(View.INVISIBLE); - } else if (itemAdditionalDetails.getTop() <= itemUploaderView.getBottom()) { - itemAdditionalDetails.setVisibility(View.INVISIBLE); - } else { - itemAdditionalDetails.setVisibility(View.VISIBLE); - } - return true; - } - }); } private String getStreamInfoDetailLine(final StreamInfoItem infoItem) { diff --git a/app/src/main/res/layout/list_channel_item.xml b/app/src/main/res/layout/list_channel_item.xml index d6a9a51e42b..baaddd814d2 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 e35168bba96..b1d3ec49bf5 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" /> - + From bd25eff0c6379be1adf1bd7b8ac8f92e620cf176 Mon Sep 17 00:00:00 2001 From: wangear Date: Tue, 23 Mar 2021 11:16:49 +0900 Subject: [PATCH 4/5] Overlapping fonts #5096 issue : #5096 changed : - remove unusable variable --- .../schabi/newpipe/info_list/holder/StreamInfoItemHolder.java | 4 ---- 1 file changed, 4 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 16cedd70f9e..a84c9840416 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 @@ -42,8 +42,6 @@ public class StreamInfoItemHolder extends StreamMiniInfoItemHolder { public final TextView itemAdditionalDetails; - public final TextView itemVideoTitleView; - public final TextView itemUploaderView; public StreamInfoItemHolder(final InfoItemBuilder infoItemBuilder, final ViewGroup parent) { this(infoItemBuilder, R.layout.list_stream_item, parent); @@ -53,8 +51,6 @@ public StreamInfoItemHolder(final InfoItemBuilder infoItemBuilder, final int lay final ViewGroup parent) { super(infoItemBuilder, layoutId, parent); itemAdditionalDetails = itemView.findViewById(R.id.itemAdditionalDetails); - itemVideoTitleView = itemView.findViewById(R.id.itemVideoTitleView); - itemUploaderView = itemView.findViewById(R.id.itemUploaderView); } @Override From 875ed82c79a92eb8cf8d0fdbcef4cfc451d03bb1 Mon Sep 17 00:00:00 2001 From: wangear Date: Wed, 31 Mar 2021 14:19:51 +0900 Subject: [PATCH 5/5] Crash on tapping anywhere on video after long-pressing 'Popup' button #5804 issue : #5804 changed : - checked null - fixed NullPointerException. --- .../newpipe/player/event/BasePlayerGestureListener.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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 989c78c57cb..29ae7c5c318 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