From 9929dce76b5186cfde0aa1c4c17fdeea2b27b4ae Mon Sep 17 00:00:00 2001 From: Yuriy Liskov Date: Thu, 12 Mar 2026 18:02:09 +0200 Subject: [PATCH] Fix API 28+ GridLayoutManager navigation is totally broken --- MediaServiceCore | 2 +- smarttubetv/build.gradle | 8 ++++---- .../MarqueeTextViewCompat.java | 3 +++ .../smartyoutubetv2/tv/util/ViewUtil.java | 17 +++++++++++++++++ 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/MediaServiceCore b/MediaServiceCore index 7e0a31bee..abf1a2390 160000 --- a/MediaServiceCore +++ b/MediaServiceCore @@ -1 +1 @@ -Subproject commit 7e0a31bee01bcf171280243dc9096e0a7ab99c96 +Subproject commit abf1a23900b1e4ce4a897406cf6572eb57105970 diff --git a/smarttubetv/build.gradle b/smarttubetv/build.gradle index 6b3885a56..5badb0173 100644 --- a/smarttubetv/build.gradle +++ b/smarttubetv/build.gradle @@ -57,8 +57,8 @@ android { applicationId "app.smarttube" minSdkVersion project.properties.minSdkVersion targetSdkVersion project.properties.targetSdkVersion - versionCode 2293 - versionName "31.03" + versionCode 2296 + versionName "31.06" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" buildConfigField "long", "TIMESTAMP", System.currentTimeMillis() + "L" @@ -127,11 +127,11 @@ android { productFlavors { stbeta { applicationId "org.smarttube.beta" - targetSdkVersion 27 // Since 28+ GridLayoutManager navigation is totally broken + targetSdkVersion project.properties.compileSdkVersion } ststable { applicationId "org.smarttube.stable" - targetSdkVersion 27 // Since 28+ GridLayoutManager navigation is totally broken + targetSdkVersion project.properties.compileSdkVersion } stfdroid { applicationId "app.smarttube.fdroid" diff --git a/smarttubetv/src/main/java/com/liskovsoft/smartyoutubetv2/tv/ui/widgets/marqueetextviewcompat/MarqueeTextViewCompat.java b/smarttubetv/src/main/java/com/liskovsoft/smartyoutubetv2/tv/ui/widgets/marqueetextviewcompat/MarqueeTextViewCompat.java index 777a0db2b..aba9f48c3 100644 --- a/smarttubetv/src/main/java/com/liskovsoft/smartyoutubetv2/tv/ui/widgets/marqueetextviewcompat/MarqueeTextViewCompat.java +++ b/smarttubetv/src/main/java/com/liskovsoft/smartyoutubetv2/tv/ui/widgets/marqueetextviewcompat/MarqueeTextViewCompat.java @@ -18,6 +18,7 @@ import android.widget.TextView; import androidx.annotation.Nullable; import com.liskovsoft.smartyoutubetv2.tv.R; +import com.liskovsoft.smartyoutubetv2.tv.util.ViewUtil; @SuppressLint("AppCompatCustomView") public class MarqueeTextViewCompat extends TextView { @@ -126,6 +127,8 @@ public class MarqueeTextViewCompat extends TextView { mTextView.setEllipsize(TruncateAt.END); super.setEllipsize(TruncateAt.END); // Important: disable marquee on the container view + + ViewUtil.fixApi28BrokenGridNavigation(this); } @Override diff --git a/smarttubetv/src/main/java/com/liskovsoft/smartyoutubetv2/tv/util/ViewUtil.java b/smarttubetv/src/main/java/com/liskovsoft/smartyoutubetv2/tv/util/ViewUtil.java index 7c53ee1d7..d51991a4f 100644 --- a/smarttubetv/src/main/java/com/liskovsoft/smartyoutubetv2/tv/util/ViewUtil.java +++ b/smarttubetv/src/main/java/com/liskovsoft/smartyoutubetv2/tv/util/ViewUtil.java @@ -244,4 +244,21 @@ public class ViewUtil { frameLayout.setLayoutParams(flp); } } + + /** + * Fix SDK 28+ GridLayoutManager broken navigation when using Japanese fonts + */ + public static void fixApi28BrokenGridNavigation(TextView textView) { + if (VERSION.SDK_INT >= 28) { + // 1. Disable dynamic line spacing for special characters (prevents expansion for CJK glyphs) + textView.setFallbackLineSpacing(false); + } + + // 2. Remove system font padding to ensure consistent baseline and height + textView.setIncludeFontPadding(false); + + // 3. Add fixed internal padding to create a "safe zone" for both Latin and Japanese text + int paddingExtra = (int) (4 * textView.getResources().getDisplayMetrics().density); + textView.setPadding(textView.getPaddingLeft(), paddingExtra, textView.getPaddingRight(), paddingExtra); + } }