Themable volume and power dialogs

Test: visual
Bug: 63903361
Change-Id: I3e4dc74e960f212985712120341d3a80543c96db
This commit is contained in:
Lucas Dupin
2017-07-24 17:44:25 -07:00
parent b63b011419
commit 448786cc5f
11 changed files with 26 additions and 19 deletions

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#ffffffff" />
<solid android:color="?android:attr/colorPrimary" />
<corners
android:bottomLeftRadius="@dimen/corner_size"
android:topLeftRadius="@dimen/corner_size"

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#ffeeeeee" />
<solid android:color="?android:attr/colorPrimaryDark" />
<corners
android:bottomLeftRadius="@dimen/corner_size"
android:topLeftRadius="0dp"

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#ffffffff" />
<solid android:color="?android:attr/colorPrimary" />
<corners
android:bottomLeftRadius="@dimen/corner_size"
android:topLeftRadius="@dimen/corner_size"

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#ffeeeeee" />
<solid android:color="?android:attr/colorPrimaryDark" />
<corners
android:bottomLeftRadius="@dimen/corner_size"
android:topLeftRadius="0dp"

View File

@@ -14,5 +14,5 @@
limitations under the License.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="?android:attr/colorPrimary" />
<solid android:color="?android:attr/colorBackgroundFloating" />
</shape>

View File

@@ -6,6 +6,7 @@
android:layout_marginBottom="0dp"
android:paddingTop="@dimen/global_actions_top_padding"
android:clipToPadding="false"
android:theme="@style/qs_theme"
android:clipChildren="false">
<LinearLayout

View File

@@ -21,6 +21,7 @@
android:layout_marginBottom="@dimen/volume_dialog_margin_bottom"
android:background="@drawable/volume_dialog_background"
android:paddingTop="@dimen/volume_dialog_padding_top"
android:theme="@style/qs_theme"
android:translationZ="4dp" >
<LinearLayout

View File

@@ -22,7 +22,8 @@ import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.util.Log;
import com.android.settingslib.Utils;
public class HardwareBgDrawable extends LayerDrawable {
@@ -43,22 +44,25 @@ public class HardwareBgDrawable extends LayerDrawable {
}
mRoundTop = roundTop;
mLayers = layers;
mLayers[1].setTint(0xffeeeeee);
}
private static Drawable[] getLayers(Context context, boolean roundTop, boolean roundEnd) {
int drawable = roundEnd ? R.drawable.rounded_bg_full : R.drawable.rounded_bg;
final Drawable[] layers;
if (roundTop) {
return new Drawable[]{
layers = new Drawable[]{
context.getDrawable(drawable).mutate(),
context.getDrawable(drawable).mutate(),
};
} else {
layers = new Drawable[]{
context.getDrawable(drawable).mutate(),
context.getDrawable(roundEnd ? R.drawable.rounded_full_bg_bottom
: R.drawable.rounded_bg_bottom).mutate(),
};
}
return new Drawable[]{
context.getDrawable(drawable).mutate(),
context.getDrawable(roundEnd ? R.drawable.rounded_full_bg_bottom
: R.drawable.rounded_bg_bottom).mutate(),
};
layers[1].setTint(Utils.getColorAttr(context, android.R.attr.colorPrimaryDark));
return layers;
}
public void setCutPoint(int point) {

View File

@@ -68,6 +68,7 @@ import android.text.TextUtils;
import android.util.ArraySet;
import android.util.Log;
import android.util.MathUtils;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -143,7 +144,7 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener, DialogIn
* @param context everything needs a context :(
*/
public GlobalActionsDialog(Context context, GlobalActionsManager windowManagerFuncs) {
mContext = context;
mContext = new ContextThemeWrapper(context, com.android.systemui.R.style.qs_theme);
mWindowManagerFuncs = windowManagerFuncs;
mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
mDreamManager = IDreamManager.Stub.asInterface(
@@ -1226,7 +1227,7 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener, DialogIn
public ActionsDialog(Context context, OnClickListener clickListener, MyAdapter adapter,
OnItemLongClickListener longClickListener) {
super(context, com.android.systemui.R.style.Theme_SystemUI_Dialog_GlobalActions);
mContext = getContext();
mContext = context;
mAdapter = adapter;
mClickListener = clickListener;
mLongClickListener = longClickListener;

View File

@@ -15,6 +15,7 @@
package com.android.systemui.globalactions;
import com.android.systemui.Dependency;
import com.android.systemui.R;
import com.android.systemui.plugins.GlobalActions;
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
import com.android.systemui.statusbar.policy.KeyguardMonitor;
@@ -38,9 +39,7 @@ public class GlobalActionsImpl implements GlobalActions {
@Override
public void showGlobalActions(GlobalActionsManager manager) {
if (mGlobalActions == null) {
final ContextThemeWrapper context = new ContextThemeWrapper(mContext,
android.R.style.Theme_Material_Light);
mGlobalActions = new GlobalActionsDialog(context, manager);
mGlobalActions = new GlobalActionsDialog(mContext, manager);
}
mGlobalActions.showDialog(mKeyguardMonitor.isShowing(),
mDeviceProvisionedController.isDeviceProvisioned());

View File

@@ -53,6 +53,7 @@ import android.util.DisplayMetrics;
import android.util.Log;
import android.util.Slog;
import android.util.SparseBooleanArray;
import android.view.ContextThemeWrapper;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
@@ -151,7 +152,7 @@ public class VolumeDialogImpl implements VolumeDialog, TunerService.Tunable {
private TunerZenModePanel mZenPanel;
public VolumeDialogImpl(Context context) {
mContext = context;
mContext = new ContextThemeWrapper(context, com.android.systemui.R.style.qs_theme);
mZenModeController = Dependency.get(ZenModeController.class);
mController = Dependency.get(VolumeDialogController.class);
mKeyguard = (KeyguardManager) mContext.getSystemService(Context.KEYGUARD_SERVICE);