diff --git a/app/src/main/java/com/nextcloud/talk/jobs/NotificationWorker.java b/app/src/main/java/com/nextcloud/talk/jobs/NotificationWorker.java index 240915f61..12362217c 100644 --- a/app/src/main/java/com/nextcloud/talk/jobs/NotificationWorker.java +++ b/app/src/main/java/com/nextcloud/talk/jobs/NotificationWorker.java @@ -107,6 +107,8 @@ import retrofit2.Retrofit; @AutoInjector(NextcloudTalkApplication.class) public class NotificationWorker extends Worker { public static final String TAG = "NotificationWorker"; + private static final String CHAT = "chat"; + private static final String ROOM = "room"; @Inject AppPreferences appPreferences; @@ -274,7 +276,7 @@ public class NotificationWorker extends Worker { smallIcon = R.drawable.ic_logo; - if (decryptedPushMessage.getType().equals("chat") || decryptedPushMessage.getType().equals("room")) { + if (CHAT.equals(decryptedPushMessage.getType()) || ROOM.equals(decryptedPushMessage.getType())) { category = Notification.CATEGORY_MESSAGE; } else { category = Notification.CATEGORY_CALL; @@ -289,7 +291,7 @@ public class NotificationWorker extends Worker { break; default: // assuming one2one - if (decryptedPushMessage.getType().equals("chat") || decryptedPushMessage.getType().equals("room")) { + if (CHAT.equals(decryptedPushMessage.getType()) || ROOM.equals(decryptedPushMessage.getType())) { largeIcon = BitmapFactory.decodeResource(context.getResources(), R.drawable.ic_comment); } else { largeIcon = BitmapFactory.decodeResource(context.getResources(), R.drawable.ic_call_black_24dp); @@ -339,7 +341,7 @@ public class NotificationWorker extends Worker { Long.toString(crc32.getValue()), groupName);*/ - if (decryptedPushMessage.getType().equals("chat") || decryptedPushMessage.getType().equals("room")) { + if (CHAT.equals(decryptedPushMessage.getType()) || ROOM.equals(decryptedPushMessage.getType())) { AudioAttributes.Builder audioAttributesBuilder = new AudioAttributes.Builder().setContentType (AudioAttributes.CONTENT_TYPE_SONIFICATION); audioAttributesBuilder.setUsage(AudioAttributes.USAGE_NOTIFICATION_COMMUNICATION_INSTANT); @@ -517,7 +519,7 @@ public class NotificationWorker extends Worker { AudioAttributes.Builder audioAttributesBuilder = new AudioAttributes.Builder().setContentType (AudioAttributes.CONTENT_TYPE_SONIFICATION); - if (decryptedPushMessage.getType().equals("chat") || decryptedPushMessage.getType().equals("room")) { + if (CHAT.equals(decryptedPushMessage.getType()) || ROOM.equals(decryptedPushMessage.getType())) { audioAttributesBuilder.setUsage(AudioAttributes.USAGE_NOTIFICATION_COMMUNICATION_INSTANT); } else { audioAttributesBuilder.setUsage(AudioAttributes.USAGE_NOTIFICATION_COMMUNICATION_REQUEST); diff --git a/app/src/main/java/com/nextcloud/talk/utils/DisplayUtils.java b/app/src/main/java/com/nextcloud/talk/utils/DisplayUtils.java index 12d007c89..a0b1fc9da 100644 --- a/app/src/main/java/com/nextcloud/talk/utils/DisplayUtils.java +++ b/app/src/main/java/com/nextcloud/talk/utils/DisplayUtils.java @@ -318,7 +318,6 @@ public class DisplayUtils { return chip; } - public static Spannable searchAndReplaceWithMentionSpan(Context context, Spannable text, String id, String label, String type, UserEntity conversationUser, @@ -355,7 +354,6 @@ public class DisplayUtils { } return spannableString; - } public static Spannable searchAndColor(Spannable text, String searchText, @ColorInt int color) { @@ -469,26 +467,8 @@ public class DisplayUtils { */ public static void themeSearchView(SearchView searchView, Context context) { // hacky as no default way is provided - int fontColor = context.getResources().getColor(R.color.fontAppbar); SearchView.SearchAutoComplete editText = searchView.findViewById(R.id.search_src_text); editText.setTextSize(16); editText.setHintTextColor(context.getResources().getColor(R.color.fontSecondaryAppbar)); } - - public static boolean isDarkModeActive(Context context, AppPreferences prefs) { - if (prefs.getTheme().equals("night_yes")) { - return true; - } - - int currentNightMode = - context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; - switch (currentNightMode) { - case Configuration.UI_MODE_NIGHT_NO: - return false; - case Configuration.UI_MODE_NIGHT_YES: - return true; - default: - return false; - } - } }