From 0f6585045bd60f3447f0d3df8f4c4c8f52d2040c Mon Sep 17 00:00:00 2001 From: Matthias Marquardt Date: Thu, 10 Dec 2020 13:43:26 +0100 Subject: [PATCH] build v0.9.1.15 - Show separate warnings for inactive location an bluetooth services - minor bugfixes --- DOWNLOAD.md | 2 +- README_de.md | 2 +- README_en.md | 2 +- README_fr.md | 2 +- app/build.gradle | 4 +- .../uuid0xfd6fscan/ScannerActivity.java | 145 +++++++++--------- .../uuid0xfd6fscan/ScannerService.java | 59 ++++--- .../ui/main/PlaceholderFragment.java | 5 +- app/src/main/res/values-de/strings.xml | 7 +- app/src/main/res/values-fr/strings.xml | 3 + app/src/main/res/values/strings.xml | 3 + build.gradle | 2 +- .../android/de-DE/changelogs/9115.txt | 2 + .../android/en-US/changelogs/9115.txt | 2 + 14 files changed, 143 insertions(+), 97 deletions(-) create mode 100644 fastlane/metadata/android/de-DE/changelogs/9115.txt create mode 100644 fastlane/metadata/android/en-US/changelogs/9115.txt diff --git a/DOWNLOAD.md b/DOWNLOAD.md index 4c79a30..30581e8 100644 --- a/DOWNLOAD.md +++ b/DOWNLOAD.md @@ -1,4 +1,4 @@ ## Download APK Please download the APK here from GitHub: -[Download current UUID0xFD6FTracer.apk](https://github.com/marq24/UUID0xFD6FTracer/releases/tag/0.9.1.14) +[Download current UUID0xFD6FTracer.apk](https://github.com/marq24/UUID0xFD6FTracer/releases/tag/0.9.1.15) diff --git a/README_de.md b/README_de.md index 12ae48a..f746bea 100644 --- a/README_de.md +++ b/README_de.md @@ -21,7 +21,7 @@ https://f-droid.org/app/com.emacberry.uuid0xfd6fscan https://www.amazon.de/gp/product/B08CY7JY1P #### Installation auch als Sideload möglich (erfordert 'Installation von unsicheren Quellen zulassen') -[Download des aktuellen UUID0xFD6FTracer.apk direkt hier von GitHub](https://github.com/marq24/UUID0xFD6FTracer/releases/download/0.9.1.14/UUID0xFD6F_v0.9.1.14.apk) +[Download des aktuellen UUID0xFD6FTracer.apk direkt hier von GitHub](https://github.com/marq24/UUID0xFD6FTracer/releases/download/0.9.1.15/UUID0xFD6F_v0.9.1.15.apk) ##### Kein Download via GooglePlay? Google hat ein zweites Mal entschieden die App aus dem Store zu entfernen, diesmal mit dem Hinweis darauf, dass der App diff --git a/README_en.md b/README_en.md index d5c7a15..905dfbf 100644 --- a/README_en.md +++ b/README_en.md @@ -18,7 +18,7 @@ https://f-droid.org/app/com.emacberry.uuid0xfd6fscan https://www.amazon.com/gp/product/B08CY7JY1P ### Sideload the APK (requires 'allow insecure apps' setting) -[Download Latest from UUID0xFD6FTracer.apk](https://github.com/marq24/UUID0xFD6FTracer/releases/download/0.9.1.14/UUID0xFD6F_v0.9.1.14.apk) +[Download Latest from UUID0xFD6FTracer.apk](https://github.com/marq24/UUID0xFD6FTracer/releases/download/0.9.1.15/UUID0xFD6F_v0.9.1.15.apk) ## Settings & Configuration Additional information about the settings and options can be found on the separate [SETTINGS.md](./SETTINGS.md). diff --git a/README_fr.md b/README_fr.md index dba4ae6..9c7f03f 100644 --- a/README_fr.md +++ b/README_fr.md @@ -18,7 +18,7 @@ https://f-droid.org/app/com.emacberry.uuid0xfd6fscan https://www.amazon.com/gp/product/B08CY7JY1P ### Charger le fichier APK (nécessite le paramètre "Autoriser les applications non sécurisées") -[Télécharger la dernière à partir de UUID0xFD6FTracer.apk](https://github.com/marq24/UUID0xFD6FTracer/releases/download/0.9.1.14/UUID0xFD6F_v0.9.1.14.apk) +[Télécharger la dernière à partir de UUID0xFD6FTracer.apk](https://github.com/marq24/UUID0xFD6FTracer/releases/download/0.9.1.15/UUID0xFD6F_v0.9.1.15.apk) --- #### Cette application ne sera pas disponible via le PlayStore de Google diff --git a/app/build.gradle b/app/build.gradle index 97f6e7f..0001154 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -8,8 +8,8 @@ android { applicationId "com.emacberry.uuid0xfd6fscan" minSdkVersion 23 targetSdkVersion 30 - versionCode 9114 - versionName "0.9.1.14" + versionCode 9115 + versionName "0.9.1.15" //testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/app/src/main/java/com/emacberry/uuid0xfd6fscan/ScannerActivity.java b/app/src/main/java/com/emacberry/uuid0xfd6fscan/ScannerActivity.java index d2f0c9a..37f8233 100644 --- a/app/src/main/java/com/emacberry/uuid0xfd6fscan/ScannerActivity.java +++ b/app/src/main/java/com/emacberry/uuid0xfd6fscan/ScannerActivity.java @@ -503,87 +503,94 @@ public void newBeconEvent(String addr, final int sizeTotal, final int sizeENF, f } private void setActiveBeaconCount(final int sizeTotal, final int sizeENF, final int sizeSCF, final SignalStrengthGroupInfo[] ranges){ - // setting the initial TEXT.. if(mViewPager != null) { Fragment info = ((SectionsPagerAdapter) mViewPager.getAdapter()).getItem(0); if (info instanceof PlaceholderFragment) { - if(mScannerService != null && mScannerService.mShowBtIsOffWarning){ + boolean mShowBTWarn = mScannerService != null && mScannerService.mShowBtIsOffWarning; + boolean mShowLocWarn = mScannerService != null && !mScannerService.isLocationProviderEnabled(); + if(!mShowBTWarn && !mShowLocWarn){ + updateGui((PlaceholderFragment) info, sizeTotal, sizeENF, sizeSCF, ranges); + } else if(mShowBTWarn && mShowLocWarn){ + ((PlaceholderFragment) info).setNoBluetoothInfoText(getString(R.string.act_enable_both)); + } else if(mShowBTWarn) { ((PlaceholderFragment) info).setNoBluetoothInfoText(getString(R.string.act_enable_bt)); - } else if(mScannerService != null && !mScannerService.isLocationProviderEnabled()) { + } else if(mShowLocWarn) { ((PlaceholderFragment) info).setNoBluetoothInfoText(getString(R.string.act_enable_location)); - } else { - String total; + } + } + }; + } - // rendering TOTAL INFO BLOCK... - if (mShowTotal) { - total = String.format(getString(R.string.act_total_beacons), sizeTotal); - } else { - total = null; - } + private void updateGui(PlaceholderFragment info, final int sizeTotal, final int sizeENF, final int sizeSCF, final SignalStrengthGroupInfo[] ranges){ + String total; - // rendering the ExposureNotification and/or StopCovidFrance info - if (sizeENF > -1 && sizeSCF > -1) { - // dual mode... - ((PlaceholderFragment) info).setText( - total, - String.format(getString(R.string.act_active_enf_beacons), sizeENF), - String.format(getString(R.string.act_active_scf_beacons), sizeSCF) - ); - } else if (sizeENF > -1) { - // default ExposureNotificationFramework mode - ((PlaceholderFragment) info).setText( - total, - String.format(getString(R.string.act_active_beacons), sizeENF), - null); - } else { - // StopCovid France mode - ((PlaceholderFragment) info).setText(total, - null, - String.format(getString(R.string.act_active_scf_beacons), sizeSCF)); - } + // rendering TOTAL INFO BLOCK... + if (mShowTotal && sizeTotal >-1) { + total = String.format(getString(R.string.act_total_beacons), sizeTotal); + } else { + total = null; + } - // render the additional "ranges" - if(ranges != null){ - switch (ranges.length){ - default: - // default: - // DO NOTHING - unknown number of available fields... - ((PlaceholderFragment) info).setRangeInfo(null, null, null, null); - break; + // rendering the ExposureNotification and/or StopCovidFrance info + if (sizeENF > -1 && sizeSCF > -1) { + // dual mode... + info.setText( + total, + String.format(getString(R.string.act_active_enf_beacons), sizeENF), + String.format(getString(R.string.act_active_scf_beacons), sizeSCF) + ); + } else if (sizeENF > -1) { + // default ExposureNotificationFramework mode + info.setText( + total, + String.format(getString(R.string.act_active_beacons), sizeENF), + null); + } else if (sizeSCF > -1){ + // StopCovid France mode + info.setText(total, + null, + String.format(getString(R.string.act_active_scf_beacons), sizeSCF)); + } - case 2: - // ONLY GOOD/BAD => threshold is defined... - // we might want to show additionally the number of - // BAD signals?! - for now we skip this... - ((PlaceholderFragment) info).setRangeInfo( - null, null, null, - String.format(getString(R.string.act_BAD), ranges[1].size)); - break; + // render the additional "ranges" + if(ranges != null){ + switch (ranges.length){ + default: + // default: + // DO NOTHING - unknown number of available fields... + info.setRangeInfo(null, null, null, null); + break; - case 3: - // NEAR|MEDIUM|FAR - ((PlaceholderFragment) info).setRangeInfo( - String.format(getString(R.string.act_NEAR), ranges[0].size), - String.format(getString(R.string.act_MEDIUM), ranges[1].size), - String.format(getString(R.string.act_FAR), ranges[2].size), - null); - break; + case 2: + // ONLY GOOD/BAD => threshold is defined... + // we might want to show additionally the number of + // BAD signals?! - for now we skip this... + info.setRangeInfo( + null, null, null, + String.format(getString(R.string.act_BAD), ranges[1].size)); + break; - case 4: - // NEAR|MEDIUM|FAR|BAD - ((PlaceholderFragment) info).setRangeInfo( - String.format(getString(R.string.act_NEAR), ranges[0].size), - String.format(getString(R.string.act_MEDIUM), ranges[1].size), - String.format(getString(R.string.act_FAR), ranges[2].size), - String.format(getString(R.string.act_BAD), ranges[3].size)); - break; - } - } else{ - ((PlaceholderFragment) info).setRangeInfo(null, null, null, null); - } - } + case 3: + // NEAR|MEDIUM|FAR + info.setRangeInfo( + String.format(getString(R.string.act_NEAR), ranges[0].size), + String.format(getString(R.string.act_MEDIUM), ranges[1].size), + String.format(getString(R.string.act_FAR), ranges[2].size), + null); + break; + + case 4: + // NEAR|MEDIUM|FAR|BAD + info.setRangeInfo( + String.format(getString(R.string.act_NEAR), ranges[0].size), + String.format(getString(R.string.act_MEDIUM), ranges[1].size), + String.format(getString(R.string.act_FAR), ranges[2].size), + String.format(getString(R.string.act_BAD), ranges[3].size)); + break; } - }; + } else{ + info.setRangeInfo(null, null, null, null); + } } private class MyOnTabListenerAndroidX implements ActionBar.TabListener { diff --git a/app/src/main/java/com/emacberry/uuid0xfd6fscan/ScannerService.java b/app/src/main/java/com/emacberry/uuid0xfd6fscan/ScannerService.java index 88d2e1a..37c0ca2 100644 --- a/app/src/main/java/com/emacberry/uuid0xfd6fscan/ScannerService.java +++ b/app/src/main/java/com/emacberry/uuid0xfd6fscan/ScannerService.java @@ -47,6 +47,7 @@ public class ScannerService extends Service implements SharedPreferences.OnShare protected static final String INTENT_EXTRA_STOP = "STOP_SCAN"; protected static final String INTENT_EXTRA_STARTBT = "START_BT"; protected static final String INTENT_EXTRA_STARTLOC = "START_LOC"; + protected static final String INTENT_EXTRA_STARTBOTH = "START_BOTH"; // SERVICE STUFF: // http://stackoverflow.com/questions/9740593/android-create-service-that-runs-when-application-stops @@ -339,13 +340,19 @@ private void handleIntentInt(@Nullable Intent intent) { Log.d(LOG_TAG, "start intent extras: " + intent.getExtras()); if (intent.hasExtra(INTENT_EXTRA_START)) { startScan(true); - } else if (intent.hasExtra(INTENT_EXTRA_STOP)) { + } + + if (intent.hasExtra(INTENT_EXTRA_STOP)) { stopScan(true); - } else if (intent.hasExtra(INTENT_EXTRA_STARTBT)) { + } + + if (intent.hasExtra(INTENT_EXTRA_STARTBT) || intent.hasExtra(INTENT_EXTRA_STARTBOTH)) { if (mBluetoothAdapter != null) { mBluetoothAdapter.enable(); } - } else if (intent.hasExtra(INTENT_EXTRA_STARTLOC)) { + } + + if (intent.hasExtra(INTENT_EXTRA_STARTLOC) || intent.hasExtra(INTENT_EXTRA_STARTBOTH)) { Intent i = new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(i); @@ -727,13 +734,9 @@ private NotificationCompat.Builder getNotificationBuilder() { intent.putExtra(ScannerActivity.INTENT_EXTRA_SERVICE_ACTION, true); builder.setContentIntent(PendingIntent.getActivity(this, intent.hashCode(), intent, PendingIntent.FLAG_CANCEL_CURRENT)); - if (mShowBtIsOffWarning) { - builder.setContentText(getString(R.string.app_service_msgNoBt)); - builder.addAction(-1, this.getString(R.string.menu_start_bt_action), getServiceIntent(INTENT_EXTRA_STARTBT)); - } else if(!isLocationProviderEnabled()){ - builder.setContentText(getString(R.string.app_service_msgNoLocation)); - builder.addAction(-1, this.getString(R.string.menu_start_location_action), getServiceIntent(INTENT_EXTRA_STARTLOC)); - } else { + boolean mShowLocWarn = !isLocationProviderEnabled(); + + if (!mShowBtIsOffWarning && !mShowLocWarn) { if (mScannIsRunning) { builder.setContentText(mNotifyTextScanning); builder.addAction(-1, this.getString(R.string.menu_stop_notify_action), getServiceIntent(INTENT_EXTRA_STOP)); @@ -751,7 +754,17 @@ private NotificationCompat.Builder getNotificationBuilder() { builder.setContentText(getText(R.string.app_service_msgOffNoPermissions)); } } + }else if(mShowBtIsOffWarning && mShowLocWarn){ + builder.setContentText(getString(R.string.app_service_msgNoBoth)); + builder.addAction(-1, this.getString(R.string.menu_start_both_action), getServiceIntent(INTENT_EXTRA_STARTBOTH)); + }else if(mShowBtIsOffWarning){ + builder.setContentText(getString(R.string.app_service_msgNoBt)); + builder.addAction(-1, this.getString(R.string.menu_start_bt_action), getServiceIntent(INTENT_EXTRA_STARTBT)); + }else if(mShowLocWarn){ + builder.setContentText(getString(R.string.app_service_msgNoLocation)); + builder.addAction(-1, this.getString(R.string.menu_start_location_action), getServiceIntent(INTENT_EXTRA_STARTLOC)); } + if (android.os.Build.VERSION.SDK_INT > Build.VERSION_CODES.M) { builder.addAction(R.drawable.ic_outline_exit_to_app_24px, this.getString(R.string.menu_exit_notify_action), getTerminateAppIntent(ScannerActivity.INTENT_EXTRA_TERMINATE_APP)); } else { @@ -823,13 +836,8 @@ private void updateNotificationText(boolean force, int size) { } boolean notify = false; if (mBuilder != null) { - if (mShowBtIsOffWarning) { - mBuilder.setContentText(getText(R.string.app_service_msgNoBt)); - notify = true; - } else if(!isLocationProviderEnabled()) { - mBuilder.setContentText(getText(R.string.app_service_msgNoLocation)); - notify = true; - } else { + boolean mShowLocWarn = !isLocationProviderEnabled(); + if (!mShowBtIsOffWarning && !mShowLocWarn) { // if we have not any information about the current size that we should // display in the notification text we need to fetch it again... if (size == -1) { @@ -860,6 +868,15 @@ private void updateNotificationText(boolean force, int size) { notify = true; } } + }else if(mShowBtIsOffWarning && mShowLocWarn){ + mBuilder.setContentText(getText(R.string.app_service_msgNoBoth)); + notify = true; + }else if (mShowBtIsOffWarning) { + mBuilder.setContentText(getText(R.string.app_service_msgNoBt)); + notify = true; + } else if(mShowLocWarn) { + mBuilder.setContentText(getText(R.string.app_service_msgNoLocation)); + notify = true; } } @@ -1470,6 +1487,9 @@ public void onReceive(Context context, Intent intent) { mScannIsRunning = false; startScan(false); updateNotification(); + if (mGuiCallback != null) { + mGuiCallback.newBeconEvent(null, -1, -1, -1, null); + } } break; @@ -1517,6 +1537,9 @@ public void onReceive(Context context, Intent intent) { Log.w(LOG_TAG, "Location is disabled"); } updateNotification(); + if (mGuiCallback != null) { + mGuiCallback.newBeconEvent(null, -1, -1, -1, null); + } } iState = enabled; } @@ -1527,4 +1550,4 @@ public void onReceive(Context context, Intent intent) { registerReceiver(mLocationProviderStateReceiver, filter); } } -} +} \ No newline at end of file diff --git a/app/src/main/java/com/emacberry/uuid0xfd6fscan/ui/main/PlaceholderFragment.java b/app/src/main/java/com/emacberry/uuid0xfd6fscan/ui/main/PlaceholderFragment.java index 078f78d..14d2a9d 100644 --- a/app/src/main/java/com/emacberry/uuid0xfd6fscan/ui/main/PlaceholderFragment.java +++ b/app/src/main/java/com/emacberry/uuid0xfd6fscan/ui/main/PlaceholderFragment.java @@ -103,9 +103,12 @@ public void setText(String txtTOT, String txtENF, String txtSCF) { } public void setNoBluetoothInfoText(String info) { - updateTextView(info, mTOTTextView); + iTOTTextOnBind = updateTextView(info, mTOTTextView); updateTextView(null, mENFTextView); updateTextView(null, mSCFTextView); + iENFTextOnBind = null; + iSCFTextOnBind = null; + setRangeInfo(null, null, null, null); } public void setRangeInfo(String txtNEAR, String txtMEDIUM, String txtFAR, String txtBAD) { diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index d8363f4..cbe56d0 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -8,6 +8,7 @@ Bitte Apps starten, um den Scan erneut zu starten Aktivieren Sie bitte Bluetooth Aktivieren Sie bitte den Standortdienst + Aktivieren Sie Bluetooth & den Standortdienst Umgebung wird untersucht… [gefunden: %1$d] @@ -15,11 +16,14 @@ Service Beenden Beenden Start Scan - Stop Scan + Stop Scan Bluetooth aktivieren + Standort aktivieren + Dienste aktivieren Bitte aktivieren Sie Bluetooth Bitte aktivieren Sie den Standortdienst + Bitte aktivieren Sie Bluetooth & den Standortdienst Summe: %1$d Aktive Sender: %1$d ExpNotif. Sender: %1$d @@ -70,5 +74,4 @@ Alle gefundenen Beacons werden berücksichtigt (unabhägig von ihrer Signalstärke) Wenn die Signalstärke eines Beacons den angegebenen Schwellenwert unterschreitet wird dieses nicht berücksichtigt Schwellenwert [def. Wert: -98db] - Standort aktivieren \ No newline at end of file diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 5ee571e..70df04e 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -7,6 +7,7 @@ Veuillez démarrer l\'application pour redémarrer le scanner Activez Bluetooth Activez le service de localisation + Activez Bluetooth & le service de localisation Environnement de numérisation… [a trouvé: %1$d] Fermer l\'application @@ -16,9 +17,11 @@ Arrêter l\'analyse Lancer Bluetooth Lancer le service de localisation + Lancer la services Veuillez activer Bluetooth Veuillez activer le service de localisation + Veuillez activer Bluetooth & le service de localisation Total: %1$d Appareils actives: %1$d ExpNotif. actives: %1$d diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 26d2466..5d54fb7 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -9,6 +9,7 @@ Please start the App in order to restart the Scanner To use this feature, turn on Bluetooth To use this feature, turn on Location service + To use this feature, turn on Bluetooth & Location service Scanning Environment… [found: %1$d] @@ -20,9 +21,11 @@ Stop Scan Enable Bluetooth Enable Location service + Enable services Please enable Bluetooth Please enable Location service + Please enable Bluetooth & Location service Total: %1$d Active Beacons: %1$d ExpNotif. Beacons: %1$d diff --git a/build.gradle b/build.gradle index b58dc04..04baf1e 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:4.0.1' + classpath 'com.android.tools.build:gradle:4.1.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/fastlane/metadata/android/de-DE/changelogs/9115.txt b/fastlane/metadata/android/de-DE/changelogs/9115.txt new file mode 100644 index 0000000..83d4dc7 --- /dev/null +++ b/fastlane/metadata/android/de-DE/changelogs/9115.txt @@ -0,0 +1,2 @@ +- Differenzierte Anzeige von Warnunung bei inaktiven Diensten (Bluetooth/Standort) +- kleine bugfixes diff --git a/fastlane/metadata/android/en-US/changelogs/9115.txt b/fastlane/metadata/android/en-US/changelogs/9115.txt new file mode 100644 index 0000000..aa6fd94 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/9115.txt @@ -0,0 +1,2 @@ +- Show separate warnings for inactive location an bluetooth services +- minor bugfixes