From 6f2e5a63d70945410832cb7e40bad73b9620f878 Mon Sep 17 00:00:00 2001 From: Grishka Date: Mon, 19 Dec 2022 20:27:56 +0300 Subject: [PATCH] =?UTF-8?q?This=20is=20officially=20the=20first=20Xiaomi?= =?UTF-8?q?=20workaround=20in=20this=20app=20=F0=9F=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #469 --- .../android/fragments/ProfileFragment.java | 2 +- .../org/joinmastodon/android/ui/utils/UiUtils.java | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java index 53ee3d297..50be8f64c 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java @@ -281,7 +281,7 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList username+="@"+AccountSessionManager.getInstance().getAccount(accountID).domain; } getActivity().getSystemService(ClipboardManager.class).setPrimaryClip(ClipData.newPlainText(null, "@"+username)); - if(Build.VERSION.SDK_INT props=Class.forName("android.os.SystemProperties"); + Method get=props.getMethod("get", String.class); + return (String)get.invoke(null, key); + }catch(Exception ignore){} + return null; + } + + public static boolean isMIUI(){ + return !TextUtils.isEmpty(getSystemProperty("ro.miui.ui.version.code")); + } }