Compare commits

..

No commits in common. "8a9ea703c7014bb54a6beec44a4ee292ede49138" and "0ba536e323565c135ff4bf151b586a3b123ed6e0" have entirely different histories.

4 changed files with 80 additions and 103 deletions

View File

@ -11,9 +11,9 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 8000091,
"versionName": "8.0.91",
"outputFile": "SafeDispatchMobile_v.8.0.91-release.apk"
"versionCode": 8000035,
"versionName": "8.0.35",
"outputFile": "SafeDispatchMobile_v.8.0.35-release.apk"
}
],
"elementType": "File"

View File

@ -60,7 +60,6 @@ import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Dialog;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
@ -75,7 +74,6 @@ import android.content.res.Configuration;
import android.content.res.Resources;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
@ -96,8 +94,6 @@ import android.widget.Toast;
import android.widget.TabHost.TabSpec;
import androidx.annotation.NonNull;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
public class TabLayoutActivity extends AbstractSDParentActivity {
@ -1861,6 +1857,16 @@ public class TabLayoutActivity extends AbstractSDParentActivity {
SM.Debug("Unit imei:" + tempArr[0]);
String unitIMEI = tempArr[0];
//==============
// alarms tab
//==============
if (AppParams.crtTab == AppParams.Tabs.alarms) {
SM.Debug("currentActivity instanceof AlarmActivity - newSMS | " + tempArr[0] + " | " + tempArr[1]);
getAlarms(AppParams.USERID);
}
// if tab is not TextTab
if (tabHost.getCurrentTab() != 5 /* Text tab */) {
// change Visual Elements
setImei(unitIMEI);
switch (msg.opCode) {
@ -1919,11 +1925,6 @@ public class TabLayoutActivity extends AbstractSDParentActivity {
}
}
}
//list for SMS
if (AppParams.crtTab == AppParams.Tabs.alarms) {
SM.Debug("currentActivity instanceof AlarmActivity - newSMS | " + tempArr[0] + " | " + tempArr[1]);
getAlarms(AppParams.USERID);
}
}
@ -2210,47 +2211,23 @@ public class TabLayoutActivity extends AbstractSDParentActivity {
Notification notification = new Notification(icon, tickerText, System.currentTimeMillis());
// set intent to be opened on NotificationClick
/* Notification */
Intent notificationIntent = new Intent(this, NotificationActivity.class);
notificationIntent.putExtra("key", iconValue);
// cancel old notification
mNotificationManager.cancel(icon);
PendingIntent contentIntent = PendingIntent.getActivity(context, NOTIFICATION_ACTIVITY_RESULT, notificationIntent, PendingIntent.FLAG_CANCEL_CURRENT);
// flag that the notification will be closed when clicked
notification.flags |= Notification.FLAG_AUTO_CANCEL;
notification.number = 1; // the same notification will be shown;
notification.tickerText = tickerText; // notification text when arrives
notification.sound = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.new_sms);
Intent intent = new Intent(this, NotificationActivity.class);
intent.putExtra("key", iconValue);
// cancel old notification
mNotificationManager.cancel(icon);
PendingIntent pendingIntent = PendingIntent.getActivity(context, NOTIFICATION_ACTIVITY_RESULT, intent, PendingIntent.FLAG_CANCEL_CURRENT);
createNotificationChannel(icon, contentTitle, contentText, pendingIntent);
}
private void createNotificationChannel(int icon, String title, String text, PendingIntent pendingIntent) {
// Create the NotificationChannel, but only on API 26+ because
// the NotificationChannel class is new and not in the support library
String notificationChannelID = String.valueOf(icon);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
CharSequence name = "Notification Channel";
int importance = NotificationManager.IMPORTANCE_HIGH;
NotificationChannel channel = new NotificationChannel(notificationChannelID, name, importance);
// Register the channel with the system; you can't change the importance
// or other notification behaviors after this
NotificationManager notificationManager = getSystemService(NotificationManager.class);
notificationManager.createNotificationChannel(channel);
}
NotificationCompat.Builder builder = new NotificationCompat.Builder(context, notificationChannelID)
.setSmallIcon(icon)
.setContentTitle(title)
.setContentText(text)
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
.setAutoCancel(true)
.setContentIntent(pendingIntent);
NotificationManagerCompat managerCompat = NotificationManagerCompat.from(context);
managerCompat.notify(icon, builder.build());
// add notification to the manager
mNotificationManager.notify(icon, notification);
}
// return vehicle according to imei