Browse Source

More refactoring

Signed-off-by: Mario Danic <mario@lovelyhq.com>
Mario Danic 7 years ago
parent
commit
89352e902d

+ 4 - 4
app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/OperationsMenuController.java

@@ -43,7 +43,7 @@ import com.nextcloud.talk.controllers.base.BaseController;
 import com.nextcloud.talk.events.BottomSheetLockEvent;
 import com.nextcloud.talk.persistence.entities.UserEntity;
 import com.nextcloud.talk.utils.ApplicationWideMessageHolder;
-import com.nextcloud.talk.utils.ColorUtils;
+import com.nextcloud.talk.utils.DisplayUtils;
 import com.nextcloud.talk.utils.bundle.BundleKeys;
 import com.nextcloud.talk.utils.database.user.UserUtils;
 
@@ -199,10 +199,10 @@ public class OperationsMenuController extends BaseController {
         progressBar.setVisibility(View.GONE);
 
         if (everythingOK) {
-            resultImageView.setImageDrawable(ColorUtils.getTintedDrawable(getResources(), R.drawable
+            resultImageView.setImageDrawable(DisplayUtils.getTintedDrawable(getResources(), R.drawable
                     .ic_check_circle_black_24dp, R.color.nc_darkGreen));
         } else {
-            resultImageView.setImageDrawable(ColorUtils.getTintedDrawable(getResources(), R.drawable
+            resultImageView.setImageDrawable(DisplayUtils.getTintedDrawable(getResources(), R.drawable
                     .ic_cancel_black_24dp, R.color.nc_darkRed));
         }
 
@@ -219,7 +219,7 @@ public class OperationsMenuController extends BaseController {
         if (everythingOK) {
             eventBus.post(new BottomSheetLockEvent(true, 2500, true, true));
         } else {
-            resultImageView.setImageDrawable(ColorUtils.getTintedDrawable(getResources(), R.drawable
+            resultImageView.setImageDrawable(DisplayUtils.getTintedDrawable(getResources(), R.drawable
                     .ic_cancel_black_24dp, R.color.nc_darkRed));
             okButton.setOnClickListener(v -> eventBus.post(new BottomSheetLockEvent(true, 0, operationCode != 99,
                     true)));

+ 0 - 35
app/src/main/java/com/nextcloud/talk/utils/ColorUtils.java

@@ -1,35 +0,0 @@
-/*
- * Nextcloud Talk application
- *
- * @author Mario Danic
- * Copyright (C) 2017 Mario Danic (mario@lovelyhq.com)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-package com.nextcloud.talk.utils;
-
-import android.content.res.Resources;
-import android.graphics.drawable.Drawable;
-import android.support.annotation.ColorRes;
-import android.support.annotation.DrawableRes;
-
-public class ColorUtils {
-    public static Drawable getTintedDrawable(Resources res, @DrawableRes int drawableResId, @ColorRes int colorResId) {
-        Drawable drawable = res.getDrawable(drawableResId);
-        int color = res.getColor(colorResId);
-        drawable.setTint(color);
-        return drawable;
-    }
-}

+ 9 - 0
app/src/main/java/com/nextcloud/talk/utils/DisplayUtils.java

@@ -23,7 +23,10 @@ package com.nextcloud.talk.utils;
 import android.annotation.SuppressLint;
 import android.content.Context;
 import android.content.res.Resources;
+import android.graphics.drawable.Drawable;
 import android.os.Build;
+import android.support.annotation.ColorRes;
+import android.support.annotation.DrawableRes;
 import android.support.v7.widget.AppCompatDrawableManager;
 import android.util.DisplayMetrics;
 import android.util.Log;
@@ -66,4 +69,10 @@ public class DisplayUtils {
         }
     }
 
+    public static Drawable getTintedDrawable(Resources res, @DrawableRes int drawableResId, @ColorRes int colorResId) {
+        Drawable drawable = res.getDrawable(drawableResId);
+        int color = res.getColor(colorResId);
+        drawable.setTint(color);
+        return drawable;
+    }
 }

+ 0 - 1
app/src/main/java/com/nextcloud/talk/utils/database/user/UserUtils.java

@@ -42,7 +42,6 @@ public class UserUtils {
 
     UserUtils(ReactiveEntityStore<Persistable> dataStore) {
         this.dataStore = dataStore;
-
     }
 
     public boolean anyUserExists() {