summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorJohn Spurlock <jspurlock@google.com>2014-05-29 22:20:14 -0400
committerJohn Spurlock <jspurlock@google.com>2014-05-29 22:20:14 -0400
commit2078caf79763eae70c5c41817925c648c7529655 (patch)
tree18b71082dee7c4eca1880591092d24a5edc173e5 /packages
parent3bd4feec3d5e5c2432a350b9ae4d7f2d8b8c69d8 (diff)
downloadframeworks_base-2078caf79763eae70c5c41817925c648c7529655.zip
frameworks_base-2078caf79763eae70c5c41817925c648c7529655.tar.gz
frameworks_base-2078caf79763eae70c5c41817925c648c7529655.tar.bz2
VolumeZen: shadow protection for volume dialog.
Bug:15186962 Change-Id: I8525e62348e2cc8b68b938d2f7d986f5cbe0273f
Diffstat (limited to 'packages')
-rw-r--r--packages/SystemUI/res/values/dimens.xml3
-rw-r--r--packages/SystemUI/src/com/android/systemui/volume/VolumePanel.java19
2 files changed, 19 insertions, 3 deletions
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 4aacd4a..61ed3cf 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -308,4 +308,7 @@
<!-- Volume panel dialog width -->
<dimen name="volume_panel_width">300dp</dimen>
+
+ <!-- Volume panel z depth -->
+ <dimen name="volume_panel_z">3dp</dimen>
</resources>
diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumePanel.java b/packages/SystemUI/src/com/android/systemui/volume/VolumePanel.java
index fae0e01..cbfc641 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/VolumePanel.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/VolumePanel.java
@@ -25,6 +25,8 @@ import android.content.DialogInterface.OnDismissListener;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Resources;
+import android.graphics.PixelFormat;
+import android.graphics.drawable.ColorDrawable;
import android.media.AudioManager;
import android.media.AudioService;
import android.media.AudioSystem;
@@ -45,6 +47,7 @@ import android.view.ViewStub;
import android.view.Window;
import android.view.WindowManager;
import android.view.WindowManager.LayoutParams;
+import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
@@ -304,17 +307,26 @@ public class VolumePanel extends Handler {
lp.y = res.getDimensionPixelOffset(com.android.systemui.R.dimen.volume_panel_top);
lp.width = res.getDimensionPixelSize(com.android.systemui.R.dimen.volume_panel_width);
lp.type = LayoutParams.TYPE_VOLUME_OVERLAY;
+ lp.format = PixelFormat.TRANSLUCENT;
lp.windowAnimations = R.style.Animation_VolumePanel;
- window.setBackgroundDrawableResource(com.android.systemui.R.drawable.qs_panel_background);
window.setAttributes(lp);
window.setGravity(Gravity.TOP);
window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
window.requestFeature(Window.FEATURE_NO_TITLE);
window.addFlags(LayoutParams.FLAG_NOT_FOCUSABLE
| LayoutParams.FLAG_NOT_TOUCH_MODAL
- | LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH);
+ | LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH
+ | LayoutParams.FLAG_HARDWARE_ACCELERATED);
mDialog.setCanceledOnTouchOutside(true);
- mDialog.setContentView(layoutId);
+ // temporary workaround for no window shadows
+ final FrameLayout layout = new FrameLayout(mContext);
+ final int z = res.getDimensionPixelSize(com.android.systemui.R.dimen.volume_panel_z);
+ layout.setPadding(z, z, z, z);
+ final View v = LayoutInflater.from(mContext).inflate(layoutId, layout, false);
+ v.setBackgroundResource(com.android.systemui.R.drawable.qs_panel_background);
+ v.setElevation(z);
+ layout.addView(v);
+ mDialog.setContentView(layout);
mDialog.setOnDismissListener(new OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
@@ -324,6 +336,7 @@ public class VolumePanel extends Handler {
});
mDialog.create();
+ mDialog.getWindow().setBackgroundDrawable(new ColorDrawable(0x00000000));
mView = window.findViewById(R.id.content);
mView.setOnTouchListener(new View.OnTouchListener() {