This commit is contained in:
dosse91
2020-06-14 11:24:29 +02:00
10 changed files with 37 additions and 18 deletions
@@ -80,7 +80,7 @@ public class PodsService extends Service {
* <p>
* After decoding a beacon, the status is written to leftStatus, rightStatus, caseStatus, chargeL, chargeR, chargeCase so that the NotificationThread can use the information
*/
private static final ArrayList<ScanResult> recentBeacons = new ArrayList<>();
private static ArrayList<ScanResult> recentBeacons = new ArrayList<>();
private static final long RECENT_BEACONS_MAX_T_NS = 10000000000L; //10s
private void startAirPodsScanner () {
@@ -294,7 +294,7 @@ public class PodsService extends Service {
}
}
private final NotificationManager mNotifyManager;
private NotificationManager mNotifyManager;
@SuppressWarnings("WeakerAccess")
public NotificationThread () {
@@ -324,6 +324,7 @@ public class PodsService extends Service {
mBuilder.setShowWhen(false);
mBuilder.setOngoing(true);
mBuilder.setSmallIcon(R.mipmap.notification_icon);
mBuilder.setVisibility(NotificationCompat.VISIBILITY_PUBLIC);
for (; ; ) {
/*&&System.currentTimeMillis()-lastSeenConnected<TIMEOUT_CONNECTED*/
@@ -2,12 +2,14 @@ package com.dosse.airpods;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.widget.Toast;
import androidx.appcompat.app.AlertDialog;
import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat;
@@ -31,17 +33,24 @@ public class SettingsFragment extends PreferenceFragmentCompat {
mHideAppPreference = getPreferenceManager().findPreference("hideApp");
assert mHideAppPreference != null;
mHideAppPreference.setOnPreferenceClickListener(preference -> {
PackageManager p = requireContext().getPackageManager();
p.setComponentEnabledSetting(new ComponentName(context, MainActivity.class), PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
Toast.makeText(context, getString(R.string.hideClicked), Toast.LENGTH_LONG).show();
AlertDialog.Builder builder = new AlertDialog.Builder(requireContext());
builder.setTitle(R.string.hide_dialog);
builder.setMessage(R.string.hide_dialog_desc);
builder.setPositiveButton(R.string.hide_dialog_button, (dialog, which) -> {
PackageManager p = requireContext().getPackageManager();
p.setComponentEnabledSetting(new ComponentName(context, MainActivity.class), PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
Toast.makeText(context, getString(R.string.hideClicked), Toast.LENGTH_LONG).show();
try {
context.openFileOutput("hidden", Context.MODE_PRIVATE).close();
} catch (Throwable ignored) {
}
try {
context.openFileOutput("hidden", Context.MODE_PRIVATE).close();
} catch (Throwable ignored) {
}
enableDisableOptions();
requireActivity().finish();
enableDisableOptions();
requireActivity().finish();
});
builder.setNegativeButton(android.R.string.cancel, (dialog, which) -> dialog.dismiss());
builder.show();
return true;
});
@@ -19,6 +19,9 @@
<string name="batterySaver_desc">Aktiviere diesen Modus, wenn Bluetooth zu viel Batterieleistung erfordert</string>
<string name="hide">App verstecken</string>
<string name="hide_desc">Verstecke diese App vor dem Launcher</string>
<string name="hide_dialog">Sind Sie sich sicher?</string>
<string name="hide_dialog_desc">Sind Sie sich sicher, dass Sie diese App verstecken möchten? Es kann nur durch erneutes Installieren der App wieder rückgängig gemacht werden.</string>
<string name="hide_dialog_button">Verstecken</string>
<string name="hideClicked">Das Icon wird bald verschwinden</string>
<string name="about">Über</string>
@@ -19,6 +19,9 @@
<string name="batterySaver_desc">הפעל אם Bluetooth משתמש בהרבה סוללה</string>
<string name="hide">הסתר אפליקציה</string>
<string name="hide_desc">הסתר את האפליקציה ממסך הבית</string>
<string name="hide_dialog">האם אתה בטוח?</string>
<string name="hide_dialog_desc">האם אתה בטוח שאתה רוצה להסתיר את האפליקציה? ניתן לבטל זאת רק על ידי התקנה מחדש</string>
<string name="hide_dialog_button">הסתר</string>
<string name="hideClicked">האפליקציה תוסתר בקרוב</string>
<string name="about">אודות</string>
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="bgColorPrimary" >@android:color/transparent</color>
<color name="bgColorPrimary" >@android:color/transparent</color>
</resources>
@@ -7,5 +7,5 @@
<color name="textColorPrimary" >@android:color/primary_text_dark</color>
<color name="bgColorPrimary" >#000</color>
<color name="dgrey">@android:color/darker_gray</color>
<color name="dgrey" >@android:color/darker_gray</color>
</resources>
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="bgColorPrimary" >@android:color/transparent</color>
<color name="bgColorPrimary" >@android:color/transparent</color>
</resources>
+1 -1
View File
@@ -7,5 +7,5 @@
<color name="textColorPrimary" >@android:color/primary_text_light</color>
<color name="bgColorPrimary" >#FFF</color>
<color name="dgrey">#737373</color>
<color name="dgrey" >#737373</color>
</resources>
+4 -1
View File
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<resources xmlns:tools="http://schemas.android.com/tools">
<string name="app_name" translatable="false">OpenPods</string>
<string name="intro1">This app lets you check the status of your AirPods on any Android device</string>
@@ -21,6 +21,9 @@
<string name="batterySaver_desc">Enable this if Bluetooth uses a lot of battery</string>
<string name="hide">Hide app</string>
<string name="hide_desc">Hide this app from the launcher</string>
<string name="hide_dialog" tools:ignore="MissingTranslation">Are you sure?</string>
<string name="hide_dialog_desc" tools:ignore="MissingTranslation">Are you sure that you want to hide the App? This can only be undone by reinstalling it.</string>
<string name="hide_dialog_button" tools:ignore="MissingTranslation">Hide</string>
<string name="hideClicked">The icon will disappear soon</string>
<string name="about">About</string>
+2 -2
View File
@@ -1,6 +1,6 @@
#Wed Feb 26 15:58:48 CET 2020
#Mon Jun 08 20:04:20 IDT 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip