From 2efdf0933376e9d466662420abddafdbb44d3a84 Mon Sep 17 00:00:00 2001 From: FineFindus <63370021+FineFindus@users.noreply.github.com> Date: Fri, 10 Mar 2023 19:41:45 +0100 Subject: [PATCH] fix: disable group divider on EMUI Fixes an issues, where the forth menu item does not show up, when the divider is enabled on EMUI devices --- .../org/joinmastodon/android/fragments/HomeTabFragment.java | 2 +- .../main/java/org/joinmastodon/android/ui/utils/UiUtils.java | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/HomeTabFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/HomeTabFragment.java index 37ce0e002..adf202bce 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/HomeTabFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/HomeTabFragment.java @@ -358,7 +358,7 @@ public class HomeTabFragment extends MastodonToolbarFragment implements Scrollab addListsToOverflowMenu(); addHashtagsToOverflowMenu(); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P && !UiUtils.isEMUI()) { m.setGroupDividerEnabled(true); } } diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/utils/UiUtils.java b/mastodon/src/main/java/org/joinmastodon/android/ui/utils/UiUtils.java index c720958a5..ee413c9be 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/utils/UiUtils.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/utils/UiUtils.java @@ -1143,6 +1143,10 @@ public class UiUtils { return !TextUtils.isEmpty(getSystemProperty("ro.miui.ui.version.code")); } + public static boolean isEMUI() { + return !TextUtils.isEmpty(getSystemProperty("ro.build.version.emui")); + } + public static int alphaBlendColors(int color1, int color2, float alpha) { float alpha0 = 1f - alpha; int r = Math.round(((color1 >> 16) & 0xFF) * alpha0 + ((color2 >> 16) & 0xFF) * alpha);