Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 523ede8e authored by Bryan Owens's avatar Bryan Owens Committed by Clark Scheff
Browse files

Themes: Expose Hard colors for storage settings



Change-Id: I74d2492ed5e6f1d34cee065719cbc97d5c237829
Signed-off-by: default avatarBryan Owens <djbryan3540@gmail.com>
parent d0aba1ec
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -77,7 +77,14 @@ limitations under the License.
    <!-- Storage Summary Hard colors-->
    <color name="storage_summary_text_color">#ff607d8b</color>
    <color name="storage_summary_used_text_color">#8a000000</color>

    <color name="storage_volume_color_public">#ff9e9e9e</color>
    <color name="storage_volume_color_warning">#fff4511e</color>
    <color name="storage_volume_color_private1">#ff26a69a</color> <!-- teal -->
    <color name="storage_volume_color_private2">#ffab47bc</color> <!-- purple -->
    <color name="storage_volume_color_private3">#fff2a600</color> <!-- orange -->
    <color name="storage_volume_color_private4">#ffec407a</color> <!-- pink -->
    <color name="storage_volume_color_private5">#ffc0ca33</color> <!-- green -->
    <color name="eject_icon_tint_color">#8a000000</color>
    <!-- Contributors -->
    <color name="contributors_cloud_fg_color">@color/theme_accent</color>
    <color name="contributors_cloud_selected_color">#ff5252</color>
+16 −13
Original line number Diff line number Diff line
@@ -23,8 +23,8 @@ import android.app.Fragment;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.graphics.PorterDuff;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.storage.DiskInfo;
@@ -63,16 +63,10 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
    private static final String TAG_VOLUME_UNMOUNTED = "volume_unmounted";
    private static final String TAG_DISK_INIT = "disk_init";

    static final int COLOR_PUBLIC = Color.parseColor("#ff9e9e9e");
    static final int COLOR_WARNING = Color.parseColor("#fff4511e");

    static final int[] COLOR_PRIVATE = new int[] {
            Color.parseColor("#ff26a69a"),
            Color.parseColor("#ffab47bc"),
            Color.parseColor("#fff2a600"),
            Color.parseColor("#ffec407a"),
            Color.parseColor("#ffc0ca33"),
    };
    private int mPublicColor;

    private int[] mPrivateColors;

    private StorageManager mStorageManager;

@@ -108,6 +102,14 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
        mInternalSummary = new StorageSummaryPreference(context);

        setHasOptionsMenu(true);
        mPublicColor = context.getColor(R.color.storage_volume_color_public);
        mPrivateColors = new int[] {
                context.getColor(R.color.storage_volume_color_private1),
                context.getColor(R.color.storage_volume_color_private2),
                context.getColor(R.color.storage_volume_color_private3),
                context.getColor(R.color.storage_volume_color_private4),
                context.getColor(R.color.storage_volume_color_private5),
        };
    }

    private final StorageEventListener mStorageListener = new StorageEventListener() {
@@ -147,7 +149,7 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index

        for (VolumeInfo vol : volumes) {
            if (vol.getType() == VolumeInfo.TYPE_PRIVATE) {
                final int color = COLOR_PRIVATE[privateCount++ % COLOR_PRIVATE.length];
                final int color = mPrivateColors[privateCount++ % mPrivateColors.length];
                mInternalCategory.addPreference(
                        new StorageVolumePreference(context, vol, color));
                if (vol.isMountedReadable()) {
@@ -157,7 +159,7 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
                }
            } else if (vol.getType() == VolumeInfo.TYPE_PUBLIC) {
                mExternalCategory.addPreference(
                        new StorageVolumePreference(context, vol, COLOR_PUBLIC));
                        new StorageVolumePreference(context, vol, mPublicColor));
            }
        }

@@ -169,7 +171,8 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
                // TODO: add actual storage type to record
                final Drawable icon = context.getDrawable(R.drawable.ic_sim_sd);
                icon.mutate();
                icon.setTint(COLOR_PUBLIC);
                icon.setTint(mPublicColor);
                icon.setTintMode(PorterDuff.Mode.SRC_ATOP);

                final Preference pref = new Preference(context);
                pref.setKey(rec.getFsUuid());
+8 −2
Original line number Diff line number Diff line
@@ -18,8 +18,10 @@ package com.android.settings.deviceinfo;

import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.graphics.PorterDuff;
import android.os.storage.StorageManager;
import android.os.storage.VolumeInfo;
import android.preference.Preference;
@@ -77,7 +79,7 @@ public class StorageVolumePreference extends Preference {
            mUsedPercent = (int) ((usedBytes * 100) / totalBytes);

            if (freeBytes < mStorageManager.getStorageLowBytes(path)) {
                mColor = StorageSettings.COLOR_WARNING;
                mColor = context.getColor(R.color.storage_volume_color_warning);
                icon = context.getDrawable(R.drawable.ic_warning_24dp);
            }

@@ -88,6 +90,7 @@ public class StorageVolumePreference extends Preference {

        icon.mutate();
        icon.setTint(mColor);
        icon.setTintMode(PorterDuff.Mode.SRC_ATOP);
        setIcon(icon);

        if (volume.getType() == VolumeInfo.TYPE_PUBLIC
@@ -99,9 +102,12 @@ public class StorageVolumePreference extends Preference {

    @Override
    protected void onBindView(View view) {

        final ImageView unmount = (ImageView) view.findViewById(R.id.unmount);

        if (unmount != null) {
            unmount.setImageTintList(ColorStateList.valueOf(Color.parseColor("#8a000000")));
            unmount.setImageTintList(ColorStateList.valueOf(
                    getContext().getColor(R.color.eject_icon_tint_color)));
            unmount.setOnClickListener(mUnmountListener);
        }