From 4b09464638cdb8f8732f655ce135ce497ed46af7 Mon Sep 17 00:00:00 2001 From: Laurentiu Date: Wed, 28 Feb 2024 18:06:13 +0200 Subject: [PATCH] convert to mph --- .gitignore | 3 +++ safeDispatch/release/output-metadata.json | 20 ------------------- .../safedispatch/GoogleMapsInfoBubble.java | 4 ++-- .../safedispatch/TabLayoutActivity.java | 11 +++++++++- 4 files changed, 15 insertions(+), 23 deletions(-) delete mode 100644 safeDispatch/release/output-metadata.json diff --git a/.gitignore b/.gitignore index 2389820..e62dd85 100644 --- a/.gitignore +++ b/.gitignore @@ -184,3 +184,6 @@ $RECYCLE.BIN/ /.idea/misc.xml /.idea /.idea/modules.xml + +/safeDispatch/debug +/safeDispatch/release diff --git a/safeDispatch/release/output-metadata.json b/safeDispatch/release/output-metadata.json deleted file mode 100644 index cc14311..0000000 --- a/safeDispatch/release/output-metadata.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "version": 3, - "artifactType": { - "type": "APK", - "kind": "Directory" - }, - "applicationId": "com.safemobile.safedispatch", - "variantName": "release", - "elements": [ - { - "type": "SINGLE", - "filters": [], - "attributes": [], - "versionCode": 8000091, - "versionName": "8.0.91", - "outputFile": "SafeDispatchMobile_v.8.0.91-release.apk" - } - ], - "elementType": "File" -} \ No newline at end of file diff --git a/safeDispatch/src/main/java/com/safemobile/safedispatch/GoogleMapsInfoBubble.java b/safeDispatch/src/main/java/com/safemobile/safedispatch/GoogleMapsInfoBubble.java index 3384f86..ae77ab0 100644 --- a/safeDispatch/src/main/java/com/safemobile/safedispatch/GoogleMapsInfoBubble.java +++ b/safeDispatch/src/main/java/com/safemobile/safedispatch/GoogleMapsInfoBubble.java @@ -101,7 +101,7 @@ public class GoogleMapsInfoBubble implements GoogleMap.InfoWindowAdapter { timeGMT = vehicle.timeGMT; address = vehicle.Address != null ? vehicle.Address : ""; name = vehicle.name; - speed = String.format(context.getResources().getString(R.string.speedMph), vehicle.speed); + speed = String.format(context.getResources().getString(R.string.speedMph), (int)(0.621371192 * vehicle.speed)); gpsLocation = "[" + String.format("%.4f", vehicle.lat) + "," + String.format("%.4f",vehicle.lng) + "]"; } else { HistPos histPos = histPosList.get(position); @@ -109,7 +109,7 @@ public class GoogleMapsInfoBubble implements GoogleMap.InfoWindowAdapter { //positionTime = new Date((new Date()).getTime() - histPos.timeGMT); timeGMT = histPos.timeGMT; address = histPos.Address != null ? histPos.Address : ""; - speed = String.format(context.getResources().getString(R.string.speedMph), histPos.speed); + speed = String.format(context.getResources().getString(R.string.speedMph), (int)(0.621371192 * histPos.speed)); gpsLocation = "[" + String.format("%.4f", histPos.lat) + "," + String.format("%.4f",histPos.lng) + "]"; } diff --git a/safeDispatch/src/main/java/com/safemobile/safedispatch/TabLayoutActivity.java b/safeDispatch/src/main/java/com/safemobile/safedispatch/TabLayoutActivity.java index 2acf71b..21d84b0 100644 --- a/safeDispatch/src/main/java/com/safemobile/safedispatch/TabLayoutActivity.java +++ b/safeDispatch/src/main/java/com/safemobile/safedispatch/TabLayoutActivity.java @@ -2354,7 +2354,16 @@ public class TabLayoutActivity extends AbstractSDParentActivity { // cancel old notification mNotificationManager.cancel(icon); - PendingIntent pendingIntent = PendingIntent.getActivity(context, NOTIFICATION_ACTIVITY_RESULT, intent, PendingIntent.FLAG_CANCEL_CURRENT); + PendingIntent pendingIntent; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { + pendingIntent = PendingIntent.getActivity(context, NOTIFICATION_ACTIVITY_RESULT, intent, PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_MUTABLE); + + }else { + pendingIntent = PendingIntent.getActivity(context, NOTIFICATION_ACTIVITY_RESULT, intent, PendingIntent.FLAG_CANCEL_CURRENT); + + } + + createNotificationChannel(icon, contentTitle, contentText, pendingIntent); }