Skip to content

Commit

Permalink
build v0.9.1.15
Browse files Browse the repository at this point in the history
- Show separate warnings for inactive location an bluetooth services
- minor bugfixes
  • Loading branch information
marq24 committed Dec 10, 2020
1 parent e90620b commit 0f65850
Show file tree
Hide file tree
Showing 14 changed files with 143 additions and 97 deletions.
2 changes: 1 addition & 1 deletion DOWNLOAD.md
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion README_de.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
2 changes: 1 addition & 1 deletion README_fr.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

Expand Down
145 changes: 76 additions & 69 deletions app/src/main/java/com/emacberry/uuid0xfd6fscan/ScannerActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
59 changes: 41 additions & 18 deletions app/src/main/java/com/emacberry/uuid0xfd6fscan/ScannerService.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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));
Expand All @@ -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 {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}
}

Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}
Expand All @@ -1527,4 +1550,4 @@ public void onReceive(Context context, Intent intent) {
registerReceiver(mLocationProviderStateReceiver, filter);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Loading

0 comments on commit 0f65850

Please sign in to comment.