diff options
6 files changed, 42 insertions, 5 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 0a39a43d..004127d6 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -67,7 +67,7 @@ <activity android:name=".permission.ui.GrantPermissionsActivity" android:configChanges="orientation|keyboardHidden|screenSize" android:excludeFromRecents="true" - android:theme="@android:style/Theme.DeviceDefault.Light.Dialog.NoActionBar"> + android:theme="@android:style/Theme.Material.DayNight.Dialog.NoActionBar"> <intent-filter> <action android:name="android.content.pm.action.REQUEST_PERMISSIONS" /> <category android:name="android.intent.category.DEFAULT" /> diff --git a/res/values-night/colors.xml b/res/values-night/colors.xml new file mode 100755 index 00000000..ebcd7be7 --- /dev/null +++ b/res/values-night/colors.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2015 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. +--> + +<resources> + <color name="grant_permissions_app_color">#deffffff</color> + <color name="grant_permissions_progress_color">#60ffffff</color> +</resources> + diff --git a/src/com/android/packageinstaller/permission/ui/AppPermissionsFragment.java b/src/com/android/packageinstaller/permission/ui/AppPermissionsFragment.java index 2310306a..827c806b 100644 --- a/src/com/android/packageinstaller/permission/ui/AppPermissionsFragment.java +++ b/src/com/android/packageinstaller/permission/ui/AppPermissionsFragment.java @@ -243,8 +243,10 @@ public final class AppPermissionsFragment extends SettingsWithHeader SwitchPreference preference = new SwitchPreference(activity); preference.setOnPreferenceChangeListener(this); preference.setKey(group.getName()); - preference.setIcon(Utils.loadDrawable(activity.getPackageManager(), - group.getIconPkg(), group.getIconResId())); + Drawable icon = Utils.loadDrawable(activity.getPackageManager(), + group.getIconPkg(), group.getIconResId()); + preference.setIcon(Utils.applyTint(getContext(), icon, + android.R.attr.colorControlNormal)); preference.setTitle(group.getLabel()); preference.setPersistent(false); preference.setEnabled(!group.isPolicyFixed()); diff --git a/src/com/android/packageinstaller/permission/ui/GrantPermissionsActivity.java b/src/com/android/packageinstaller/permission/ui/GrantPermissionsActivity.java index 6f824ea0..3a6644e7 100644 --- a/src/com/android/packageinstaller/permission/ui/GrantPermissionsActivity.java +++ b/src/com/android/packageinstaller/permission/ui/GrantPermissionsActivity.java @@ -156,7 +156,7 @@ public class GrantPermissionsActivity extends Activity implements // Bold/color the app name. int appLabelStart = message.toString().indexOf(appLabel.toString(), 0); int appLabelLength = appLabel.length(); - int color = getResources().getColor(R.color.grant_permissions_app_color, null); + int color = getColor(R.color.grant_permissions_app_color); message.setSpan(new ForegroundColorSpan(color), appLabelStart, appLabelStart + appLabelLength, 0); diff --git a/src/com/android/packageinstaller/permission/ui/ManagePermissionsFragment.java b/src/com/android/packageinstaller/permission/ui/ManagePermissionsFragment.java index 5158b5e8..4437e5cf 100644 --- a/src/com/android/packageinstaller/permission/ui/ManagePermissionsFragment.java +++ b/src/com/android/packageinstaller/permission/ui/ManagePermissionsFragment.java @@ -22,12 +22,14 @@ import android.content.ActivityNotFoundException; import android.content.Intent; import android.content.res.Resources; import android.content.res.Resources.Theme; +import android.graphics.drawable.Drawable; import android.os.Bundle; import android.preference.Preference; import android.preference.Preference.OnPreferenceClickListener; import android.preference.PreferenceFragment; import android.preference.PreferenceScreen; import android.util.Log; +import android.util.TypedValue; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; @@ -161,7 +163,8 @@ public final class ManagePermissionsFragment extends PreferenceFragment Preference preference = new Preference(activity); preference.setOnPreferenceClickListener(this); preference.setKey(group.getName()); - preference.setIcon(group.getIcon()); + preference.setIcon(Utils.applyTint(getContext(), group.getIcon(), + android.R.attr.colorControlNormal)); preference.setTitle(group.getLabel()); preference.setPersistent(false); diff --git a/src/com/android/packageinstaller/permission/utils/Utils.java b/src/com/android/packageinstaller/permission/utils/Utils.java index 7abb2627..7bbe5982 100644 --- a/src/com/android/packageinstaller/permission/utils/Utils.java +++ b/src/com/android/packageinstaller/permission/utils/Utils.java @@ -17,10 +17,13 @@ package com.android.packageinstaller.permission.utils; import android.Manifest; +import android.content.Context; import android.content.pm.PackageManager; import android.content.res.Resources; +import android.content.res.Resources.Theme; import android.graphics.drawable.Drawable; import android.util.Log; +import android.util.TypedValue; public class Utils { private static final String LOG_TAG = "Utils"; @@ -56,4 +59,12 @@ public class Utils { } } } + + public static Drawable applyTint(Context context, Drawable icon, int attr) { + Theme theme = context.getTheme(); + TypedValue typedValue = new TypedValue(); + theme.resolveAttribute(attr, typedValue, true); + icon.setTint(context.getColor(typedValue.resourceId)); + return icon; + } } |