فهرست منبع

move quota theming to drawer

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Andy Scherzinger 2 سال پیش
والد
کامیت
2a90cc316a

+ 7 - 5
app/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java

@@ -113,7 +113,6 @@ import com.owncloud.android.utils.svg.SVGorImage;
 import com.owncloud.android.utils.svg.SvgOrImageBitmapTranscoder;
 import com.owncloud.android.utils.svg.SvgOrImageDecoder;
 import com.owncloud.android.utils.theme.CapabilityUtils;
-import com.owncloud.android.utils.theme.newm3.ViewThemeUtils;
 
 import org.greenrobot.eventbus.EventBus;
 import org.greenrobot.eventbus.Subscribe;
@@ -148,6 +147,7 @@ public abstract class DrawerActivity extends ToolbarActivity
     private static final int MENU_ORDER_EXTERNAL_LINKS = 3;
     private static final int MENU_ITEM_EXTERNAL_LINK = 111;
     private static final int MAX_LOGO_SIZE_PX = 1000;
+    private static final int RELATIVE_THRESHOLD_WARNING = 80;
 
     /**
      * Reference to the drawer layout.
@@ -694,10 +694,12 @@ public abstract class DrawerActivity extends ToolbarActivity
 
         mQuotaProgressBar.setProgress(relative);
 
-        final int color = DisplayUtils.getRelativeInfoColor(this,
-                                                                        relative,
-                                                                        themeColorUtils);
-        viewThemeUtils.platform.themeHorizontalProgressBar(mQuotaProgressBar, color);
+        if (relative < RELATIVE_THRESHOLD_WARNING) {
+            viewThemeUtils.platform.themeHorizontalProgressBar(mQuotaProgressBar);
+        } else {
+            viewThemeUtils.platform.themeHorizontalProgressBar(mQuotaProgressBar,
+                                                               getResources().getColor(R.color.infolevel_warning));
+        }
 
         updateQuotaLink();
         showQuota(true);

+ 0 - 19
app/src/main/java/com/owncloud/android/utils/DisplayUtils.java

@@ -80,8 +80,6 @@ import com.owncloud.android.ui.fragment.OCFileListFragment;
 import com.owncloud.android.utils.glide.CustomGlideUriLoader;
 import com.owncloud.android.utils.svg.SvgDecoder;
 import com.owncloud.android.utils.svg.SvgDrawableTranscoder;
-import com.owncloud.android.utils.theme.ThemeColorUtils;
-import com.owncloud.android.utils.theme.ThemeDrawableUtils;
 import com.owncloud.android.utils.theme.newm3.ViewThemeUtils;
 
 import org.greenrobot.eventbus.EventBus;
@@ -128,7 +126,6 @@ public final class DisplayUtils {
 
     private static final String[] sizeSuffixes = {"B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"};
     private static final int[] sizeScales = {0, 0, 1, 1, 1, 2, 2, 2, 2};
-    private static final int RELATIVE_THRESHOLD_WARNING = 80;
     private static final String MIME_TYPE_UNKNOWN = "Unknown type";
 
     private static final String HTTP_PROTOCOL = "http://";
@@ -337,22 +334,6 @@ public final class DisplayUtils {
                                          showFuture);
     }
 
-
-    /**
-     * determines the info level color based on {@link #RELATIVE_THRESHOLD_WARNING}.
-     *
-     * @param context  the app's context
-     * @param relative relative value for which the info level color should be looked up
-     * @return info level color
-     */
-    public static int getRelativeInfoColor(Context context, int relative, ThemeColorUtils themeColorUtils) {
-        if (relative < RELATIVE_THRESHOLD_WARNING) {
-            return themeColorUtils.primaryColor(context, true);
-        } else {
-            return context.getResources().getColor(R.color.infolevel_warning);
-        }
-    }
-
     public static CharSequence getRelativeDateTimeString(Context c, long time, long minResolution,
                                                          long transitionResolution, int flags) {
         return getRelativeDateTimeString(c, time, minResolution, transitionResolution, flags, false);