From db2ffb118de399dd07de9595985f9ca4141c25f6 Mon Sep 17 00:00:00 2001 From: 12aw Date: Mon, 20 Sep 2021 15:51:11 +0200 Subject: [PATCH 1/6] removed firebase, changed version code and number --- Movim/build.gradle | 4 +- Movim/src/main/AndroidManifest.xml | 16 -- .../java/com/movim/movim/MainActivity.java | 169 +++++++++++--- .../com/movim/movim/NotificationService.java | 216 ------------------ .../java/com/movim/movim/VisioActivity.java | 11 +- 5 files changed, 138 insertions(+), 278 deletions(-) delete mode 100644 Movim/src/main/java/com/movim/movim/NotificationService.java diff --git a/Movim/build.gradle b/Movim/build.gradle index dccae43..df51b2a 100644 --- a/Movim/build.gradle +++ b/Movim/build.gradle @@ -8,8 +8,8 @@ android { applicationId "com.movim.movim" minSdkVersion 21 targetSdkVersion 30 - versionCode 15 - versionName "0.19" + versionCode 16 + versionName "0.19.1" } buildTypes { diff --git a/Movim/src/main/AndroidManifest.xml b/Movim/src/main/AndroidManifest.xml index 6b6306c..a2fc713 100644 --- a/Movim/src/main/AndroidManifest.xml +++ b/Movim/src/main/AndroidManifest.xml @@ -19,22 +19,6 @@ android:roundIcon="@mipmap/ic_logo_round" android:label="@string/app_name" android:theme="@style/AppTheme"> - - - - - - - - > notifs; private static MainActivity instance; private ValueCallback mUploadMessageArray; @@ -61,6 +74,7 @@ public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { setTheme(R.style.SplashTheme); + this.notifs = new HashMap>(); super.onCreate(savedInstanceState); @@ -77,17 +91,6 @@ protected void onCreate(Bundle savedInstanceState) { webview.getSettings().setAppCacheEnabled(true); webview.getSettings().setMediaPlaybackRequiresUserGesture(false); - FirebaseMessaging.getInstance().getToken() - .addOnCompleteListener(new OnCompleteListener() { - @Override - public void onComplete(@NonNull Task task) { - if (!task.isSuccessful()) { - Log.w(TAG, "Fetching FCM registration token failed", task.getException()); - return; - } - firebaseToken = task.getResult(); - } - }); if (Build.VERSION.SDK_INT >= 21) { webview.getSettings().setAllowUniversalAccessFromFileURLs(true); @@ -128,9 +131,6 @@ public void onProgressChanged(WebView view, int progress) { if (progress == 100) { progressbar.setVisibility(ProgressBar.GONE); - if (!firebaseToken.isEmpty()) { - webview.loadUrl("javascript:Presence.setFirebaseToken('" + firebaseToken + "')"); - } } } @@ -228,7 +228,7 @@ public void onClick(DialogInterface dialog, int whichButton) { @Override protected void onStop () { super.onStop() ; - startService( new Intent( this, NotificationService. class )) ; + startService( new Intent( this, NotificationManager. class )) ; } private boolean checkAndRequestPermissions() { @@ -266,7 +266,7 @@ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permis @Override public void onNewIntent(Intent intent) { if (intent.getAction() != null) { - //this.notifs.remove(intent.getAction()); + this.notifs.remove(intent.getAction()); webview.loadUrl(intent.getAction()); } } @@ -310,10 +310,6 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) { mUploadMessageArray = null; } - @JavascriptInterface - public void clearFirebaseToken() { - firebaseToken = ""; - } @JavascriptInterface public void openVisio(String url) { @@ -328,26 +324,110 @@ public void showToast(String toast) { Toast.makeText(this, toast, Toast.LENGTH_SHORT).show(); } + @JavascriptInterface public void clearNotifications(String action) { - Intent notificationService = new Intent(this, NotificationService.class); - notificationService.setAction("clear"); - notificationService.putExtra("action", action); - startService(notificationService); + NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); + notificationManager.cancel(action, 0); + + if (this.notifs.get(action) != null) { + this.notifs.remove(action); + } + + this.updateNotifications(); } @JavascriptInterface public void showNotification(String title, String body, String picture, String action) { - Intent notificationService = new Intent(this, NotificationService.class); - notificationService.setAction("notify"); - notificationService.putExtra("title", title); - notificationService.putExtra("body", body); - notificationService.putExtra("picture", picture); - notificationService.putExtra("action", action); - startService(notificationService); + Bitmap pictureBitmap = getBitmapFromURL(picture); + + Intent i = new Intent(this, MainActivity.class); + if (action != null) { + i.setAction(action); + i.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP); + } + PendingIntent pi = PendingIntent.getActivity(this, 0, i, PendingIntent.FLAG_UPDATE_CURRENT); + + // The deleteIntent declaration + Intent deleteIntent = new Intent(action); + PendingIntent pendingDeleteIntent = PendingIntent.getBroadcast(this, 0, deleteIntent, + PendingIntent.FLAG_UPDATE_CURRENT); + registerReceiver(receiver, new IntentFilter(action)); + + // Integer counter; + List messages = null; + + // There is already pending notifications + if (this.notifs.get(action) != null) { + messages = this.notifs.get(action); + } else { + messages = new ArrayList(); + } + + messages.add(body); + + if (messages.size() > 5) { + messages.remove(0); + } + + this.notifs.put(action, messages); + + // We create the inbox + NotificationCompat.InboxStyle style = new NotificationCompat.InboxStyle(); + for (int j = 0; j < messages.size(); j++) { + style.addLine(messages.get(j)); + } + + style.setBigContentTitle(title); + + NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); + + String channelId = "channel-movim"; + String channelName = "Movim"; + String groupId = "movim"; + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { + NotificationChannel mChannel = new NotificationChannel(channelId, channelName, NotificationManager.IMPORTANCE_DEFAULT); + notificationManager.createNotificationChannel(mChannel); + } + + Notification notification = new NotificationCompat.Builder(this, channelId) + .setSmallIcon(R.drawable.ic_stat_name) + .setLargeIcon(pictureBitmap) + .setContentTitle(title) + .setContentText(body) + .setContentIntent(pi) + .setDeleteIntent(pendingDeleteIntent).setAutoCancel(true).setColor(Color.parseColor("#3F51B5")) + .setLights(Color.parseColor("#3F51B5"), 1000, 5000) + .setNumber(messages.size()) + .setStyle(style) + .setGroup(groupId) + .build(); + notificationManager.notify(action, 0, notification); + + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { + Notification summaryNotification = new NotificationCompat.Builder(this, channelId) + .setSmallIcon(R.drawable.ic_stat_name) + .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.ic_vectorial)) + .setGroup(groupId) + .setGroupSummary(true) + .setAutoCancel(true) + .build(); + notificationManager.notify("summary", 0, summaryNotification); + } } - /*private final BroadcastReceiver receiver = new BroadcastReceiver() { + protected void updateNotifications() { + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { + NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); + int counter = notificationManager.getActiveNotifications().length; + + if (counter <= 1) { + notificationManager.cancel("summary", 0); + } + } + } + + private final BroadcastReceiver receiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (intent.getAction() != null) { @@ -355,7 +435,22 @@ public void onReceive(Context context, Intent intent) { } unregisterReceiver(this); } - };*/ + }; + + public static Bitmap getBitmapFromURL(String src) { + try { + URL url = new URL(src); + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + connection.setDoInput(true); + connection.connect(); + InputStream input = connection.getInputStream(); + Bitmap myBitmap = BitmapFactory.decodeStream(input); + return myBitmap; + } catch (IOException e) { + e.printStackTrace(); + return null; + } + } public boolean onKeyUp(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_MENU) { diff --git a/Movim/src/main/java/com/movim/movim/NotificationService.java b/Movim/src/main/java/com/movim/movim/NotificationService.java deleted file mode 100644 index 3254ac8..0000000 --- a/Movim/src/main/java/com/movim/movim/NotificationService.java +++ /dev/null @@ -1,216 +0,0 @@ -package com.movim.movim; - -import android.app.Notification; -import android.app.NotificationChannel; -import android.app.NotificationManager; -import android.app.PendingIntent; -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; -import android.graphics.Color; - -import androidx.core.app.NotificationCompat; - -import com.google.firebase.messaging.CommonNotificationBuilder; -import com.google.firebase.messaging.FirebaseMessagingService; -import com.google.firebase.messaging.RemoteMessage; - -import java.io.IOException; -import java.io.InputStream; -import java.net.HttpURLConnection; -import java.net.URL; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -public class NotificationService extends FirebaseMessagingService { - private HashMap> notifs; - - @Override - protected Intent getStartCommandIntent(Intent intent) { - handleIntent(intent); - return super.getStartCommandIntent(intent); - } - - @Override - public void handleIntent(Intent intent) { - if (intent.getAction() != null) { - if (intent.getAction().equals("update")) { - updateNotification(); - } - - if (intent.getAction().equals("clear")) { - clearNotifications(intent.getStringExtra("action")); - } - - // Coming from within the application - if (intent.getAction().equals("notify")) { - showNotification( - intent.getStringExtra("title"), - intent.getStringExtra("body"), - intent.getStringExtra("image"), - intent.getStringExtra("action") - ); - } - - super.handleIntent(intent); - } - } - - @Override - public void onCreate() { - this.notifs = new HashMap>(); - super.onCreate(); - } - - @Override - public void onMessageReceived(RemoteMessage remoteMessage) { - if (remoteMessage.getData().size() > 0) { - if (remoteMessage.getData().get("clear") != null) { - clearNotifications( - remoteMessage.getData().get("action") - ); - } else { - showNotification( - remoteMessage.getData().get("title"), - remoteMessage.getData().get("body"), - remoteMessage.getData().get("image"), - remoteMessage.getData().get("action") - ); - } - } - - //super.onMessageReceived(remoteMessage); - } - - private final BroadcastReceiver receiver = new BroadcastReceiver() { - @Override - public void onReceive(Context context, Intent intent) { - if (intent.getAction() != null) { - clearNotifications(intent.getAction()); - } - unregisterReceiver(this); - } - }; - - public void showNotification(String title, String body, String picture, String action) { - Bitmap pictureBitmap = getBitmapFromURL(picture); - - Intent i = new Intent(this, MainActivity.class); - if (action != null) { - i.setAction(action); - i.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP); - } - PendingIntent pi = PendingIntent.getActivity(this, 0, i, PendingIntent.FLAG_UPDATE_CURRENT); - - // The deleteIntent declaration - Intent deleteIntent = new Intent(action); - PendingIntent pendingDeleteIntent = PendingIntent.getBroadcast(this, 0, deleteIntent, - PendingIntent.FLAG_UPDATE_CURRENT); - registerReceiver(receiver, new IntentFilter(action)); - - // Integer counter; - List messages = null; - - // There is already pending notifications - if (this.notifs.get(action) != null) { - messages = this.notifs.get(action); - } else { - messages = new ArrayList(); - } - - messages.add(body); - - if (messages.size() > 3) { - messages.remove(0); - } - - this.notifs.put(action, messages); - - // We create the inbox - NotificationCompat.InboxStyle style = new NotificationCompat.InboxStyle(); - for (int j = 0; j < messages.size(); j++) { - style.addLine(messages.get(j)); - } - - style.setBigContentTitle(title); - - NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); - - String channelId = "channel-movim"; - String channelName = "Movim"; - String groupId = "movim"; - if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { - NotificationChannel mChannel = new NotificationChannel(channelId, channelName, NotificationManager.IMPORTANCE_DEFAULT); - notificationManager.createNotificationChannel(mChannel); - } - - NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, channelId) - .setSmallIcon(R.drawable.ic_stat_name) - .setLargeIcon(pictureBitmap) - .setContentTitle(title) - .setContentText(body) - .setContentIntent(pi) - .setDeleteIntent(pendingDeleteIntent).setAutoCancel(true).setColor(Color.parseColor("#3F51B5")) - .setLights(Color.parseColor("#3F51B5"), 1000, 5000) - .setNumber(messages.size()) - .setStyle(style) - .setGroup(groupId); - - Notification notification = notificationBuilder.setVibrate(new long[]{0L}).build(); - notificationManager.notify(action, 0, notification); - - if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { - Notification summaryNotification = new NotificationCompat.Builder(this, channelId) - .setSmallIcon(R.drawable.ic_stat_name) - .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.ic_vectorial)) - .setGroup(groupId) - .setGroupSummary(true) - .setAutoCancel(true) - .setVibrate(new long[]{0L}) - .build(); - notificationManager.notify("summary", 0, summaryNotification); - } - } - - public void clearNotifications(String action) { - NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); - notificationManager.cancel(action, 0); - - if (this.notifs.get(action) != null) { - this.notifs.remove(action); - } - - this.updateNotification(); - } - - public void updateNotification() { - if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { - NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); - - int counter = notificationManager.getActiveNotifications().length; - - if (counter <= 1) { - notificationManager.cancel("summary", 0); - } - } - } - - public static Bitmap getBitmapFromURL(String src) { - try { - URL url = new URL(src); - HttpURLConnection connection = (HttpURLConnection) url.openConnection(); - connection.setDoInput(true); - connection.connect(); - InputStream input = connection.getInputStream(); - Bitmap myBitmap = BitmapFactory.decodeStream(input); - return myBitmap; - } catch (IOException e) { - e.printStackTrace(); - return null; - } - } -} diff --git a/Movim/src/main/java/com/movim/movim/VisioActivity.java b/Movim/src/main/java/com/movim/movim/VisioActivity.java index 3bae095..72802bc 100644 --- a/Movim/src/main/java/com/movim/movim/VisioActivity.java +++ b/Movim/src/main/java/com/movim/movim/VisioActivity.java @@ -89,9 +89,9 @@ public boolean shouldOverrideUrlLoading(WebView view, String url) { .build(); notificationManager.notify("call", 0, notification); - Intent notificationService = new Intent(this, NotificationService.class); - notificationService.setAction("update"); - startService(notificationService); + if (MainActivity.getInstance() != null) { + MainActivity.getInstance().updateNotifications(); + } } protected void onDestroy() { @@ -100,10 +100,7 @@ protected void onDestroy() { NotificationManager notificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE); notificationManager.cancel("call", 0); - - Intent notificationService = new Intent(this, NotificationService.class); - notificationService.setAction("update"); - startService(notificationService); + MainActivity.getInstance().updateNotifications(); } private void endCall() { From f5ed6fbbbbabcb1ca19b7595a5ffc3878c12cc3f Mon Sep 17 00:00:00 2001 From: 12aw Date: Mon, 20 Sep 2021 16:39:28 +0200 Subject: [PATCH 2/6] changed request permission numbers --- Movim/src/main/java/com/movim/movim/MainActivity.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Movim/src/main/java/com/movim/movim/MainActivity.java b/Movim/src/main/java/com/movim/movim/MainActivity.java index a2f4c67..cd22d3e 100644 --- a/Movim/src/main/java/com/movim/movim/MainActivity.java +++ b/Movim/src/main/java/com/movim/movim/MainActivity.java @@ -68,8 +68,8 @@ public class MainActivity extends Activity { private static MainActivity instance; private ValueCallback mUploadMessageArray; - private final static int FILE_REQUEST_CODE = 1; - private final static int CAMERA_REQUEST_CODE = 2; + private final static int FILE_REQUEST_CODE = 0; + private final static int CAMERA_REQUEST_CODE = 1; @Override protected void onCreate(Bundle savedInstanceState) { From f23b0b33b7639d0fe84f91fe0010801c676c10b8 Mon Sep 17 00:00:00 2001 From: Arne Date: Wed, 29 Sep 2021 02:04:28 +0200 Subject: [PATCH 3/6] updated back key function, webview links external --- .../java/com/movim/movim/MainActivity.java | 88 +++++++------------ 1 file changed, 34 insertions(+), 54 deletions(-) diff --git a/Movim/src/main/java/com/movim/movim/MainActivity.java b/Movim/src/main/java/com/movim/movim/MainActivity.java index cd22d3e..f8ac939 100644 --- a/Movim/src/main/java/com/movim/movim/MainActivity.java +++ b/Movim/src/main/java/com/movim/movim/MainActivity.java @@ -16,16 +16,19 @@ import android.app.Notification; import android.app.NotificationChannel; import android.app.NotificationManager; -import android.app.PendingIntent; -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.IntentFilter; -import android.content.pm.PackageManager; + import androidx.annotation.NonNull; import androidx.core.app.ActivityCompat; +import androidx.core.app.NotificationCompat; +import androidx.core.content.ContextCompat; +import android.app.PendingIntent; +import android.content.BroadcastReceiver; +import android.content.Context; import android.content.DialogInterface; import android.content.Intent; +import android.content.IntentFilter; +import android.content.pm.PackageManager; import android.content.res.Configuration; import android.graphics.Bitmap; import android.graphics.BitmapFactory; @@ -35,15 +38,10 @@ import android.net.http.SslError; import android.os.Build; import android.os.Bundle; - -import androidx.core.app.NotificationCompat; -import androidx.core.content.ContextCompat; import android.text.InputType; -import android.util.Log; import android.view.KeyEvent; import android.view.View; import android.view.Window; -import android.view.WindowManager; import android.webkit.HttpAuthHandler; import android.webkit.JavascriptInterface; import android.webkit.PermissionRequest; @@ -57,24 +55,20 @@ import android.widget.ProgressBar; import android.widget.Toast; -import com.google.android.gms.tasks.OnCompleteListener; -import com.google.android.gms.tasks.Task; - @SuppressLint("SetJavaScriptEnabled") public class MainActivity extends Activity { + private final static int FILE_REQUEST_CODE = 1; + private final static int CAMERA_REQUEST_CODE = 2; private WebView webview; private ProgressBar progressbar; private HashMap> notifs; private static MainActivity instance; private ValueCallback mUploadMessageArray; - private final static int FILE_REQUEST_CODE = 0; - private final static int CAMERA_REQUEST_CODE = 1; @Override protected void onCreate(Bundle savedInstanceState) { setTheme(R.style.SplashTheme); - this.notifs = new HashMap>(); super.onCreate(savedInstanceState); @@ -91,7 +85,7 @@ protected void onCreate(Bundle savedInstanceState) { webview.getSettings().setAppCacheEnabled(true); webview.getSettings().setMediaPlaybackRequiresUserGesture(false); - + if (Build.VERSION.SDK_INT >= 21) { webview.getSettings().setAllowUniversalAccessFromFileURLs(true); getWindow().setNavigationBarColor(Color.parseColor("#000000")); @@ -182,12 +176,12 @@ public void onReceivedSslError(WebView view, final SslErrorHandler handler, SslE } public void onReceivedHttpAuthRequest(final WebView view, final HttpAuthHandler handler, final String host, - final String realm) { + final String realm) { final String[] httpAuth = new String[2]; final String[] viewAuth = view.getHttpAuthUsernamePassword(host, realm); final EditText usernameInput = new EditText(MainActivity.getInstance()); final EditText passwordInput = new EditText(MainActivity.getInstance()); - + httpAuth[0] = viewAuth != null ? viewAuth[0] : new String(); httpAuth[1] = viewAuth != null ? viewAuth[1] : new String(); @@ -225,13 +219,8 @@ public void onClick(DialogInterface dialog, int whichButton) { instance = this; } - @Override - protected void onStop () { - super.onStop() ; - startService( new Intent( this, NotificationManager. class )) ; - } - private boolean checkAndRequestPermissions() { + private void checkAndRequestPermissions() { int permissionCamera = ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA); int permissionRecordAudio = ContextCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO); @@ -244,10 +233,8 @@ private boolean checkAndRequestPermissions() { } if (!listPermissionsNeeded.isEmpty()) { ActivityCompat.requestPermissions(this, listPermissionsNeeded.toArray(new String[listPermissionsNeeded.size()]), CAMERA_REQUEST_CODE); - return false; } - return true; } @Override @@ -275,42 +262,26 @@ public void onNewIntent(Intent intent) { @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); - }; + } public static MainActivity getInstance() { return instance; } - @Override - protected void onResume() { - super.onResume(); - if (mUploadMessageArray == null) - return; - - mUploadMessageArray.onReceiveValue(new Uri[]{}); - mUploadMessageArray = null; - } - @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); - if (requestCode != FILE_REQUEST_CODE || mUploadMessageArray == null) { + if (requestCode != FILE_REQUEST_CODE || resultCode != Activity.RESULT_OK || data.getData() == null) return; - } - Uri[] results = null; - if (resultCode == Activity.RESULT_OK) { - String dataString = data.getDataString(); - if (dataString != null) { - results = new Uri[]{Uri.parse(dataString)}; - } - } - mUploadMessageArray.onReceiveValue(results); + if (mUploadMessageArray == null) + return; + + mUploadMessageArray.onReceiveValue(new Uri[] { data.getData() }); mUploadMessageArray = null; } - @JavascriptInterface public void openVisio(String url) { Intent intent = new Intent(this, VisioActivity.class); @@ -324,7 +295,6 @@ public void showToast(String toast) { Toast.makeText(this, toast, Toast.LENGTH_SHORT).show(); } - @JavascriptInterface public void clearNotifications(String action) { NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); @@ -355,7 +325,7 @@ public void showNotification(String title, String body, String picture, String a registerReceiver(receiver, new IntentFilter(action)); // Integer counter; - List messages = null; + List messages; // There is already pending notifications if (this.notifs.get(action) != null) { @@ -385,7 +355,7 @@ public void showNotification(String title, String body, String picture, String a String channelId = "channel-movim"; String channelName = "Movim"; String groupId = "movim"; - if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { NotificationChannel mChannel = new NotificationChannel(channelId, channelName, NotificationManager.IMPORTANCE_DEFAULT); notificationManager.createNotificationChannel(mChannel); } @@ -404,7 +374,7 @@ public void showNotification(String title, String body, String picture, String a .build(); notificationManager.notify(action, 0, notification); - if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { Notification summaryNotification = new NotificationCompat.Builder(this, channelId) .setSmallIcon(R.drawable.ic_stat_name) .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.ic_vectorial)) @@ -417,7 +387,7 @@ public void showNotification(String title, String body, String picture, String a } protected void updateNotifications() { - if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); int counter = notificationManager.getActiveNotifications().length; @@ -463,4 +433,14 @@ public boolean onKeyUp(int keyCode, KeyEvent event) { } return super.onKeyUp(keyCode, event); } + + @Override + public boolean onKeyDown(int keyCode, KeyEvent event) { + if ((keyCode == KeyEvent.KEYCODE_BACK) && webview.canGoBack()) { + webview.goBack(); + return true; + } + return super.onKeyDown(keyCode, event); + } + } \ No newline at end of file From a92f64f6b30cddbaa5148509a0d1dee08da2f1b2 Mon Sep 17 00:00:00 2001 From: Arne Date: Wed, 29 Sep 2021 02:07:49 +0200 Subject: [PATCH 4/6] versioncode 17, versionname 0.19.2 --- Movim/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Movim/build.gradle b/Movim/build.gradle index df51b2a..e68c997 100644 --- a/Movim/build.gradle +++ b/Movim/build.gradle @@ -8,8 +8,8 @@ android { applicationId "com.movim.movim" minSdkVersion 21 targetSdkVersion 30 - versionCode 16 - versionName "0.19.1" + versionCode 17 + versionName "0.19.2" } buildTypes { From abc8dd4df35163f0d543acdfd8d6f28bf06de18a Mon Sep 17 00:00:00 2001 From: Arne Date: Wed, 29 Sep 2021 02:23:08 +0200 Subject: [PATCH 5/6] reformat AndroidManifest.xml --- Movim/src/main/AndroidManifest.xml | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/Movim/src/main/AndroidManifest.xml b/Movim/src/main/AndroidManifest.xml index a2fc713..bff4f41 100644 --- a/Movim/src/main/AndroidManifest.xml +++ b/Movim/src/main/AndroidManifest.xml @@ -14,21 +14,19 @@ - - + android:launchMode="singleTask" + android:exported="true"> - - @@ -36,21 +34,18 @@ android:name=".VisioActivity" android:configChanges="orientation|screenSize" android:label="@string/call" - android:launchMode="standard" + android:theme="@style/SplashTheme" android:taskAffinity=".MainActivity" - android:theme="@style/SplashTheme" /> + android:launchMode="standard" /> + android:theme="@style/SplashTheme" + android:exported="true"> - - \ No newline at end of file From 68b1948862d35f95744385e8f49e871df02dcf6c Mon Sep 17 00:00:00 2001 From: Arne Date: Wed, 29 Sep 2021 02:28:28 +0200 Subject: [PATCH 6/6] removed firebase, changed to sdk 29, updated dependencies --- Movim/build.gradle | 17 ++++++++--------- build.gradle | 13 ++++++++++--- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/Movim/build.gradle b/Movim/build.gradle index e68c997..746a372 100644 --- a/Movim/build.gradle +++ b/Movim/build.gradle @@ -1,13 +1,12 @@ apply plugin: 'com.android.application' -apply plugin: 'com.google.gms.google-services' android { - compileSdkVersion 30 + compileSdkVersion 29 defaultConfig { applicationId "com.movim.movim" minSdkVersion 21 - targetSdkVersion 30 + targetSdkVersion 29 versionCode 17 versionName "0.19.2" } @@ -21,9 +20,9 @@ android { } dependencies { - implementation 'androidx.legacy:legacy-support-v4:1.0.0' - implementation 'androidx.appcompat:appcompat:1.0.0' - implementation 'androidx.constraintlayout:constraintlayout:1.1.3' - implementation platform('com.google.firebase:firebase-bom:26.3.0') - implementation 'com.google.firebase:firebase-messaging' -} + //noinspection GradleCompatible + implementation 'com.android.support:support-v4:28.0.0' + //noinspection GradleCompatible + implementation 'com.android.support:appcompat-v7:28.0.0' + implementation 'com.android.support.constraint:constraint-layout:2.0.4' +} \ No newline at end of file diff --git a/build.gradle b/build.gradle index 3c55f66..f535d68 100644 --- a/build.gradle +++ b/build.gradle @@ -2,17 +2,24 @@ buildscript { repositories { jcenter() + maven { + url 'https://maven.google.com/' + name 'Google' + } google() } dependencies { - classpath 'com.google.gms:google-services:4.3.4' - classpath 'com.android.tools.build:gradle:4.2.0' + classpath 'com.android.tools.build:gradle:4.2.2' } } allprojects { repositories { jcenter() + maven { + url 'https://maven.google.com/' + name 'Google' + } google() } -} +} \ No newline at end of file