From b8aa6dc9823fdbd53c2d80d6d9275e7a7d06b63c Mon Sep 17 00:00:00 2001 From: dosse91 Date: Sun, 14 Jun 2020 11:24:19 +0200 Subject: [PATCH] Added warning for MIUI users --- .../java/com/dosse/airpods/MainActivity.java | 24 +++++++++++++++++++ .../app/src/main/res/values-de/strings.xml | 3 +++ .../app/src/main/res/values-es/strings.xml | 3 +++ .../app/src/main/res/values-fr/strings.xml | 3 +++ .../app/src/main/res/values-it/strings.xml | 3 +++ .../src/main/res/values-iw-rIL/strings.xml | 3 +++ .../app/src/main/res/values-nl/strings.xml | 3 +++ .../app/src/main/res/values-ru/strings.xml | 3 +++ .../app/src/main/res/values-uk/strings.xml | 3 +++ .../src/main/res/values-zh-rCN/strings.xml | 3 +++ OpenPods/app/src/main/res/values/strings.xml | 3 +++ 11 files changed, 54 insertions(+) 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 149635d..ed1df5d 100644 --- a/OpenPods/app/src/main/java/com/dosse/airpods/MainActivity.java +++ b/OpenPods/app/src/main/java/com/dosse/airpods/MainActivity.java @@ -3,6 +3,7 @@ package com.dosse.airpods; import android.Manifest; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothManager; +import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; @@ -12,9 +13,11 @@ import android.view.Menu; import android.view.MenuItem; import androidx.annotation.NonNull; +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 { @@ -46,6 +49,27 @@ 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{ + getApplicationContext().openFileInput("miuiwarn").close(); + }catch (Throwable ignored){ + AlertDialog.Builder builder = new AlertDialog.Builder(getApplicationContext()); + builder.setTitle(R.string.miui_warning); + builder.setMessage(R.string.miui_warning_desc); + builder.setNeutralButton(R.string.miui_warning_continue, (dialog, which) -> { + try { + getApplicationContext().openFileOutput("miuiwarn", Context.MODE_PRIVATE).close(); + } catch (Throwable t) {} + }); + builder.show(); + } + + } + }catch(Throwable ignored){} } else { startActivity(new Intent(MainActivity.this, IntroActivity.class)); finish(); diff --git a/OpenPods/app/src/main/res/values-de/strings.xml b/OpenPods/app/src/main/res/values-de/strings.xml index d014143..e79a140 100644 --- a/OpenPods/app/src/main/res/values-de/strings.xml +++ b/OpenPods/app/src/main/res/values-de/strings.xml @@ -6,6 +6,9 @@ Die App zeigt eine Benachrichtigung, wenn deine AirPods verbunden sind Du kannst die App jetzt verstecken, wenn du möchtest Einstellungen + MIUI detected + The ROM running on this device has known compatibility issues. You can continue but OpenPods may not work properly. + Continue Es sieht so aus, als hätte dieses Gerät kein Bluetooth LE Du musst Standortinformationen aktivieren, damit OpenPods den Status deiner AirPods auslesen kann diff --git a/OpenPods/app/src/main/res/values-es/strings.xml b/OpenPods/app/src/main/res/values-es/strings.xml index 9e2e7ce..d43b32e 100644 --- a/OpenPods/app/src/main/res/values-es/strings.xml +++ b/OpenPods/app/src/main/res/values-es/strings.xml @@ -6,6 +6,9 @@ Esta aplicación mostrará una notificación cuando tus AirPods estén conectados. Puedes ocultar la app si lo prefieres. Ajustes + MIUI detected + The ROM running on this device has known compatibility issues. You can continue but OpenPods may not work properly. + Continue Parece que éste dispositivo no tiene Bluetooth LE. Necesitas activar la Localización para permitir que OpenPods lea el estado. diff --git a/OpenPods/app/src/main/res/values-fr/strings.xml b/OpenPods/app/src/main/res/values-fr/strings.xml index a4e2aea..f40c083 100644 --- a/OpenPods/app/src/main/res/values-fr/strings.xml +++ b/OpenPods/app/src/main/res/values-fr/strings.xml @@ -6,6 +6,9 @@ Cette application affichera une notification lorsque vos AirPods seront connectés. Vous pouvez masquer cette application si vous voulez. Réglages + MIUI detected + The ROM running on this device has known compatibility issues. You can continue but OpenPods may not work properly. + Continue Il semble que cet appareil ne dispose pas de Bluetooth LE. Vous devez activer la localisation pour permettre aux OpenPod de lire l\'état de vous AirPods. diff --git a/OpenPods/app/src/main/res/values-it/strings.xml b/OpenPods/app/src/main/res/values-it/strings.xml index 5ffa2fa..292b037 100644 --- a/OpenPods/app/src/main/res/values-it/strings.xml +++ b/OpenPods/app/src/main/res/values-it/strings.xml @@ -6,6 +6,9 @@ L\'app mostrerà una notifica quando le tue AirPods sono connesse Puoi nascondere l\'app se vuoi Impostazioni + MIUI rilevata + La ROM di questo dispositivo ha dei problemi di compatibilità noti. Puoi continuare ma OpenPods potrebbe non funzionare correttamente. + Continua Questo dispositivo non supporta Bluetooth LE Attiva la posizione per permttere a OpenPods di leggere lo stato 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 902c680..cb20d44 100644 --- a/OpenPods/app/src/main/res/values-iw-rIL/strings.xml +++ b/OpenPods/app/src/main/res/values-iw-rIL/strings.xml @@ -6,6 +6,9 @@ האפליקציה תשלח התראה כאשר האיירפודס מחוברות אתה יכול להסתיר אפליקציה זו הגדרות + MIUI detected + The ROM running on this device has known compatibility issues. You can continue but OpenPods may not work properly. + Continue נראה כי מכשיר זה אינו תומך ב-Bluetooth LE אתה צריך להפעיל שיתוף מיקום בכדי לאפשר ל-OpenPods לקרוא את סטטוס האוזניות diff --git a/OpenPods/app/src/main/res/values-nl/strings.xml b/OpenPods/app/src/main/res/values-nl/strings.xml index f386956..1e5077a 100644 --- a/OpenPods/app/src/main/res/values-nl/strings.xml +++ b/OpenPods/app/src/main/res/values-nl/strings.xml @@ -6,6 +6,9 @@ De app toont een melding zodra je je AirPods verbindt Als je wilt, kun je deze app verbergen Instellingen + MIUI detected + The ROM running on this device has known compatibility issues. You can continue but OpenPods may not work properly. + Continue Het lijkt erop dat dit apparaat niet beschikt over Bluetooth LE Schakel je locatie in zodat OpenPods de status kan uitlezen diff --git a/OpenPods/app/src/main/res/values-ru/strings.xml b/OpenPods/app/src/main/res/values-ru/strings.xml index fa616d9..7e3d71c 100644 --- a/OpenPods/app/src/main/res/values-ru/strings.xml +++ b/OpenPods/app/src/main/res/values-ru/strings.xml @@ -6,6 +6,9 @@ Приложение покажет уведомление, когда будет установлено соединение с AirPods Вы можете скрыть это приложение, если хотите Настройки + MIUI detected + The ROM running on this device has known compatibility issues. You can continue but OpenPods may not work properly. + Continue Похоже, что Bluetooth LE не поддерживается на Вашем устройстве Вам нужно включить местоположение, чтобы разрешить OpenPods читать статус diff --git a/OpenPods/app/src/main/res/values-uk/strings.xml b/OpenPods/app/src/main/res/values-uk/strings.xml index 1e1a0c7..4ae6789 100644 --- a/OpenPods/app/src/main/res/values-uk/strings.xml +++ b/OpenPods/app/src/main/res/values-uk/strings.xml @@ -6,6 +6,9 @@ Цей додаток покаже сповіщення, коли Ваші AirPods будуть підключені Ви можете сховати цей додаток, якщо бажаєте Налаштування + MIUI detected + The ROM running on this device has known compatibility issues. You can continue but OpenPods may not work properly. + Continue Схоже, що цей пристрій не підтримує Bluetooth LE Вам потрібно ввімкнути місцезнаходження, для того, щоб дозволити OpenPods читати статус diff --git a/OpenPods/app/src/main/res/values-zh-rCN/strings.xml b/OpenPods/app/src/main/res/values-zh-rCN/strings.xml index 9785559..ef60171 100644 --- a/OpenPods/app/src/main/res/values-zh-rCN/strings.xml +++ b/OpenPods/app/src/main/res/values-zh-rCN/strings.xml @@ -6,6 +6,9 @@ 当您的 AirPods 接入时,我们会在通知栏显示通知 您可以隐藏此应用 Settings + MIUI detected + The ROM running on this device has known compatibility issues. You can continue but OpenPods may not work properly. + Continue 看起来您的设备并不支持蓝牙 您需要开启定位来让 OpenPods 读取状态 diff --git a/OpenPods/app/src/main/res/values/strings.xml b/OpenPods/app/src/main/res/values/strings.xml index 303a9f6..4e4e3c7 100644 --- a/OpenPods/app/src/main/res/values/strings.xml +++ b/OpenPods/app/src/main/res/values/strings.xml @@ -8,6 +8,9 @@ The app will show a notification when your AirPods are connected You can hide this app if you want Settings + MIUI detected + The ROM running on this device has known compatibility issues. You can continue but OpenPods may not work properly. + Continue It looks like this device doesn\'t have Bluetooth LE You need to turn on Location to allow OpenPods to read the status