From f42fd0e45f5b2b1a0c0d500f000c47d4b86ea9db Mon Sep 17 00:00:00 2001 From: Electric Date: Sun, 14 Jun 2020 16:06:11 +0300 Subject: [PATCH] Minor changes to MIUI Warning & Hebrew translation for new strings --- .../java/com/dosse/airpods/MainActivity.java | 23 +++++++++++-------- .../src/main/res/values-iw-rIL/strings.xml | 6 ++--- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/OpenPods/app/src/main/java/com/dosse/airpods/MainActivity.java b/OpenPods/app/src/main/java/com/dosse/airpods/MainActivity.java index 8c44ff5..96627c4 100644 --- a/OpenPods/app/src/main/java/com/dosse/airpods/MainActivity.java +++ b/OpenPods/app/src/main/java/com/dosse/airpods/MainActivity.java @@ -1,6 +1,7 @@ package com.dosse.airpods; import android.Manifest; +import android.annotation.SuppressLint; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothManager; import android.content.Context; @@ -16,7 +17,6 @@ import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; import androidx.core.content.ContextCompat; -import java.lang.reflect.Method; import java.util.Objects; public class MainActivity extends AppCompatActivity { @@ -49,25 +49,28 @@ public class MainActivity extends AppCompatActivity { if (ok) { Starter.startPodsService(getApplicationContext()); //Warn MIUI users that their rom has known issues - try{ - Class c = Class.forName("android.os.SystemProperties"); - String miuiVersion = (String) c.getMethod("get", String.class).invoke(c, "ro.miui.ui.version.code"); - if(miuiVersion!=null&&!miuiVersion.isEmpty()){ - try{ + try { + @SuppressLint("PrivateApi") Class c = Class.forName("android.os.SystemProperties"); + String miuiVersion = (String)c.getMethod("get", String.class).invoke(c, "ro.miui.ui.version.code"); + if (miuiVersion != null && !miuiVersion.isEmpty()) { + try { getApplicationContext().openFileInput("miuiwarn").close(); - }catch (Throwable ignored){ + } catch (Throwable ignored) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.miui_warning); builder.setMessage(R.string.miui_warning_desc); - builder.setNeutralButton(R.string.miui_warning_continue, (dialog, which) -> { + builder.setNeutralButton(R.string.miui_warning_continue, (dialog, which) -> dialog.dismiss()); + builder.setOnDismissListener(dialog -> { try { getApplicationContext().openFileOutput("miuiwarn", Context.MODE_PRIVATE).close(); - } catch (Throwable t) {} + } catch (Throwable ignored2) { + } }); builder.show(); } } - }catch(Throwable ignored){} + } catch (Throwable ignored) { + } } else { startActivity(new Intent(MainActivity.this, IntroActivity.class)); finish(); diff --git a/OpenPods/app/src/main/res/values-iw-rIL/strings.xml b/OpenPods/app/src/main/res/values-iw-rIL/strings.xml index e99c317..4a10282 100644 --- a/OpenPods/app/src/main/res/values-iw-rIL/strings.xml +++ b/OpenPods/app/src/main/res/values-iw-rIL/strings.xml @@ -6,9 +6,9 @@ האפליקציה תשלח התראה כאשר האיירפודס מחוברות אתה יכול להסתיר אפליקציה זו הגדרות - MIUI detected - The ROM running on this device has known compatibility issues. You can continue but OpenPods may not work properly. - Continue + MIUI נמצא + למערכת ההפעלה על מכשיר זה יש בעיות תאימות ידועות עם האפליקציה. אתה יכול להמשיך להשתמש ב-OpenPods אך לא בטוח שדברים יעבדו כמו שצריך. + המשך נראה כי מכשיר זה אינו תומך ב-Bluetooth LE אתה צריך להפעיל שיתוף מיקום בכדי לאפשר ל-OpenPods לקרוא את סטטוס האוזניות