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

Commit 5c373445 authored by Andrew Sapperstein's avatar Andrew Sapperstein
Browse files

Update System UI to use theme colors.

Instead of using hardcoded values, use colorPrimary, colorAccent, etc
to style system UI. Required setting a theme on several views to
get the proper accent color in the right place.

Deletes a lot of hard-coded colors from the app.
Deletes an unused view: StatusBarHeaderView

BUG: 28625050
BUG: 29003410
BUG: 28625105
Change-Id: I46cd8eba7cf5afdab53c7882aa4aac5af46772a9
parent a87bbe85
Loading
Loading
Loading
Loading
+11 −0
Original line number Original line Diff line number Diff line
@@ -753,4 +753,15 @@ easier.


    <!-- DeviceDefault theme for the default system theme.  -->
    <!-- DeviceDefault theme for the default system theme.  -->
    <style name="Theme.DeviceDefault.System" parent="Theme.DeviceDefault.Light.DarkActionBar" />
    <style name="Theme.DeviceDefault.System" parent="Theme.DeviceDefault.Light.DarkActionBar" />

    <style name="ThemeOverlay.DeviceDefault" />

    <style name="ThemeOverlay.DeviceDefault.Accent">
        <item name="colorAccent">@color/accent_device_default_dark</item>
    </style>

    <style name="ThemeOverlay.DeviceDefault.Accent.Light">
        <item name="colorAccent">@color/accent_device_default_light</item>
    </style>

</resources>
</resources>
+10 −0
Original line number Original line Diff line number Diff line
package com.android.settingslib;
package com.android.settingslib;


import android.annotation.ColorInt;
import android.content.Context;
import android.content.Context;
import android.content.Intent;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageInfo;
@@ -8,6 +9,7 @@ import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.UserInfo;
import android.content.pm.UserInfo;
import android.content.pm.Signature;
import android.content.pm.Signature;
import android.content.res.Resources;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.BitmapFactory;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable;
@@ -154,6 +156,14 @@ public class Utils {
        return statusString;
        return statusString;
    }
    }


    @ColorInt
    public static int getColorAccent(Context context) {
        TypedArray ta = context.obtainStyledAttributes(new int[]{android.R.attr.colorAccent});
        @ColorInt int colorAccent = ta.getColor(0, 0);
        ta.recycle();
        return colorAccent;
    }

    /**
    /**
     * Determine whether a package is a "system package", in which case certain things (like
     * Determine whether a package is a "system package", in which case certain things (like
     * disabling notifications or disabling the package altogether) should be disallowed.
     * disabling notifications or disabling the package altogether) should be disallowed.
+1 −1
Original line number Original line Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_checked="true"
    <item android:state_checked="true"
          android:color="@*android:color/material_deep_teal_500" />
          android:color="?android:attr/colorAccent" />
    <item android:color="@android:color/black"
    <item android:color="@android:color/black"
          android:alpha=".54" />
          android:alpha=".54" />
</selector>
</selector>
 No newline at end of file
+20 −0
Original line number Original line 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">
    <!-- I really don't want to define this, but the View that uses this asset uses both the
         light and dark accent colors. -->
    <item android:alpha="0.6" android:drawable="@*android:color/accent_device_default_light" />
</selector>
+1 −1
Original line number Original line Diff line number Diff line
@@ -17,6 +17,6 @@
  -->
  -->


<selector xmlns:android="http://schemas.android.com/apk/res/android">
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_activated="true" android:color="@color/current_user_border_color" />
    <item android:state_activated="true" android:color="?android:attr/colorAccent" />
    <item android:color="@android:color/transparent" />
    <item android:color="@android:color/transparent" />
</selector>
</selector>
 No newline at end of file
Loading