소스 검색

spotbugs: remove unused code, replace multiple strings with constants

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Andy Scherzinger 4 년 전
부모
커밋
6bbc7dd84a
2개의 변경된 파일6개의 추가작업 그리고 24개의 파일을 삭제
  1. 6 4
      app/src/main/java/com/nextcloud/talk/jobs/NotificationWorker.java
  2. 0 20
      app/src/main/java/com/nextcloud/talk/utils/DisplayUtils.java

+ 6 - 4
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);

+ 0 - 20
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;
-        }
-    }
 }