SystemUI: Custom statusbar logo color options [1/2]
Signed-off-by: MOVZX <movzx@yahoo.com>
This commit is contained in:
@@ -7015,6 +7015,18 @@ public final class Settings {
|
||||
*/
|
||||
public static final String STATUS_BAR_LOGO_STYLE = "status_bar_logo_style";
|
||||
|
||||
/**
|
||||
* Statusbar logo custom color
|
||||
* @hide
|
||||
*/
|
||||
public static final String STATUS_BAR_LOGO_COLOR = "status_bar_logo_color";
|
||||
|
||||
/**
|
||||
* Statusbar logo custom color picker
|
||||
* @hide
|
||||
*/
|
||||
public static final String STATUS_BAR_LOGO_COLOR_PICKER = "status_bar_logo_color_picker";
|
||||
|
||||
/**
|
||||
* Whether to show or hide alert slider notifications on supported devices
|
||||
* @hide
|
||||
|
||||
@@ -19,8 +19,10 @@ package com.android.systemui.statusbar.logo;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.database.ContentObserver;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Handler;
|
||||
@@ -30,6 +32,8 @@ import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.android.settingslib.Utils;
|
||||
|
||||
import com.android.systemui.Dependency;
|
||||
import com.android.systemui.plugins.DarkIconDispatcher;
|
||||
import com.android.systemui.plugins.DarkIconDispatcher.DarkReceiver;
|
||||
@@ -47,6 +51,8 @@ public abstract class LogoImage extends ImageView implements DarkReceiver {
|
||||
public int mLogoPosition;
|
||||
private int mLogoStyle;
|
||||
private int mTintColor = Color.WHITE;
|
||||
private int mLogoColor;
|
||||
private int mLogoColorCustom;
|
||||
|
||||
class SettingsObserver extends ContentObserver {
|
||||
|
||||
@@ -64,6 +70,12 @@ public abstract class LogoImage extends ImageView implements DarkReceiver {
|
||||
resolver.registerContentObserver(
|
||||
Settings.System.getUriFor(Settings.System.STATUS_BAR_LOGO_STYLE),
|
||||
false, this);
|
||||
resolver.registerContentObserver(Settings.System.getUriFor(
|
||||
Settings.System.STATUS_BAR_LOGO_COLOR),
|
||||
false, this);
|
||||
resolver.registerContentObserver(Settings.System.getUriFor(
|
||||
Settings.System.STATUS_BAR_LOGO_COLOR_PICKER),
|
||||
false, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -228,7 +240,14 @@ public abstract class LogoImage extends ImageView implements DarkReceiver {
|
||||
break;
|
||||
}
|
||||
|
||||
drawable.setTint(mTintColor);
|
||||
if (mLogoColor == 0) {
|
||||
drawable.setTint(mTintColor);
|
||||
} else if (mLogoColor == 1) {
|
||||
ColorStateList colorAccent = Utils.getColorAccent(mContext);
|
||||
setImageTintList(colorAccent);
|
||||
} else {
|
||||
setColorFilter(mLogoColorCustom, PorterDuff.Mode.SRC_IN);
|
||||
}
|
||||
setImageDrawable(drawable);
|
||||
}
|
||||
|
||||
@@ -239,6 +258,10 @@ public abstract class LogoImage extends ImageView implements DarkReceiver {
|
||||
Settings.System.STATUS_BAR_LOGO_POSITION, 0, UserHandle.USER_CURRENT);
|
||||
mLogoStyle = Settings.System.getIntForUser(mContext.getContentResolver(),
|
||||
Settings.System.STATUS_BAR_LOGO_STYLE, 0, UserHandle.USER_CURRENT);
|
||||
mLogoColor = Settings.System.getIntForUser(mContext.getContentResolver(),
|
||||
Settings.System.STATUS_BAR_LOGO_COLOR, 0, UserHandle.USER_CURRENT);
|
||||
mLogoColorCustom = Settings.System.getIntForUser(mContext.getContentResolver(),
|
||||
Settings.System.STATUS_BAR_LOGO_COLOR_PICKER, 0xff1a73e8, UserHandle.USER_CURRENT);
|
||||
if (!mShowLogo || !isLogoVisible()) {
|
||||
setImageDrawable(null);
|
||||
setVisibility(View.GONE);
|
||||
|
||||
Reference in New Issue
Block a user