From 12096fb42788331975f1a40c5696e82e2d2c49e7 Mon Sep 17 00:00:00 2001 From: FineFindus Date: Wed, 8 Nov 2023 20:25:25 +0100 Subject: [PATCH] fix: disable group divider on EMUI --- .../android/ui/displayitems/HeaderStatusDisplayItem.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/ui/displayitems/HeaderStatusDisplayItem.java b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/HeaderStatusDisplayItem.java index 52c9dc46..42fbd79f 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/HeaderStatusDisplayItem.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/HeaderStatusDisplayItem.java @@ -136,7 +136,7 @@ public class HeaderStatusDisplayItem extends StatusDisplayItem{ optionsMenu=new PopupMenu(activity, more); optionsMenu.inflate(R.menu.post); - if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.P) + if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.P && !UiUtils.isEMUI()) optionsMenu.getMenu().setGroupDividerEnabled(true); optionsMenu.setOnMenuItemClickListener(menuItem->{ Account account=item.user; 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 34e37f97..1d3999fc 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 @@ -685,6 +685,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);