mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 19:49:33 +01:00
spotbugs: remove unused code, replace multiple strings with constants
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
a0e1c11ca2
commit
6bbc7dd84a
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user