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

Commit c71f5b34 authored by Lei Yu's avatar Lei Yu Committed by Android (Google) Code Review
Browse files

Merge "Add TileColorPicker to remove hardcoded tile state color"

parents 3c9ce1cd 76471a5d
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2016 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_enabled="false"
          android:alpha="0.25"
          android:color="?android:attr/colorForeground"/>
    <item android:state_activated="false"
          android:alpha="0.3"
          android:color="?android:attr/colorForeground"/>
    <item android:color="?android:attr/colorForeground"/>
</selector>
 No newline at end of file
+2 −1
Original line number Diff line number Diff line
@@ -20,7 +20,8 @@
    android:width="48dp"
    android:viewportHeight="48"
    android:viewportWidth="48"
    android:tint="@color/qs_tile_tint_unavailable" >
    android:alpha="0.25"
    android:tint="?android:attr/colorControlNormal" >
    <group
        android:name="ic_hotspot"
        android:translateX="23.97354"
+0 −4
Original line number Diff line number Diff line
@@ -144,10 +144,6 @@

    <color name="remote_input_accent">#eeeeee</color>

    <color name="qs_tile_tint_unavailable">#40ffffff</color>
    <color name="qs_tile_tint_inactive">#4dffffff</color>
    <color name="qs_tile_tint_active">#ffffffff</color>

    <!-- Keyboard shortcuts colors -->
    <color name="ksh_application_group_color">#fff44336</color>
    <color name="ksh_keyword_color">#d9000000</color>
+6 −0
Original line number Diff line number Diff line
@@ -491,6 +491,12 @@ public class BatteryMeterDrawable extends Drawable implements

    @Override
    public void setColorFilter(@Nullable ColorFilter colorFilter) {
        mFramePaint.setColorFilter(colorFilter);
        mBatteryPaint.setColorFilter(colorFilter);
        mWarningTextPaint.setColorFilter(colorFilter);
        mTextPaint.setColorFilter(colorFilter);
        mBoltPaint.setColorFilter(colorFilter);
        mPlusPaint.setColorFilter(colorFilter);
    }

    @Override
+4 −19
Original line number Diff line number Diff line
@@ -15,6 +15,9 @@
 */
package com.android.systemui.qs.external;

import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.WindowManager.LayoutParams.TYPE_QS_DIALOG;

import android.app.ActivityManager;
import android.content.ComponentName;
import android.content.Context;
@@ -24,7 +27,6 @@ import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo;
import android.content.pm.ServiceInfo;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Icon;
import android.net.Uri;
import android.os.Binder;
import android.os.IBinder;
@@ -37,19 +39,14 @@ import android.text.SpannableStringBuilder;
import android.text.style.ForegroundColorSpan;
import android.util.Log;
import android.view.IWindowManager;
import android.view.WindowManager;
import android.view.WindowManagerGlobal;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.systemui.R;
import com.android.systemui.qs.QSTile;
import com.android.systemui.qs.external.TileLifecycleManager.TileChangeListener;
import com.android.systemui.statusbar.phone.QSTileHost;
import libcore.util.Objects;

import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.WindowManager.LayoutParams.TYPE_QS_DIALOG;

public class CustomTile extends QSTile<QSTile.State> implements TileChangeListener {
    public static final String PREFIX = "custom(";

@@ -301,7 +298,7 @@ public class CustomTile extends QSTile<QSTile.State> implements TileChangeListen
            tileState = Tile.STATE_UNAVAILABLE;
            drawable = mDefaultIcon.loadDrawable(mAppContext);
        }
        int color = mContext.getColor(getColor(tileState));
        final int color = TileColorPicker.getInstance(mContext).getColor(tileState);
        drawable.setTint(color);
        state.icon = mHasRes ? new DrawableIconWithRes(drawable, icon.getResId())
                : new DrawableIcon(drawable);
@@ -335,18 +332,6 @@ public class CustomTile extends QSTile<QSTile.State> implements TileChangeListen
        });
    }

    private static int getColor(int state) {
        switch (state) {
            case Tile.STATE_UNAVAILABLE:
                return R.color.qs_tile_tint_unavailable;
            case Tile.STATE_INACTIVE:
                return R.color.qs_tile_tint_inactive;
            case Tile.STATE_ACTIVE:
                return R.color.qs_tile_tint_active;
        }
        return 0;
    }

    public static String toSpec(ComponentName name) {
        return PREFIX + name.flattenToShortString() + ")";
    }
Loading