diff options
author | Winson Chung <winsonc@google.com> | 2014-06-09 18:33:08 -0700 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2014-06-10 12:56:24 -0700 |
commit | b13c46e8b78272c4398068eed41f49ee4d403bcc (patch) | |
tree | 525e6bd6192d7116c480e2b1dfe60d2d9c74b873 /packages | |
parent | d478a3a0d8af2bf690c07cdfeb69a80faf2f29e5 (diff) | |
download | frameworks_base-b13c46e8b78272c4398068eed41f49ee4d403bcc.zip frameworks_base-b13c46e8b78272c4398068eed41f49ee4d403bcc.tar.gz frameworks_base-b13c46e8b78272c4398068eed41f49ee4d403bcc.tar.bz2 |
Updating Recents to make the cards slightly more visible.
Change-Id: I876d39f4aac4007a3fe0c509ccb7db130f27a737
Diffstat (limited to 'packages')
14 files changed, 48 insertions, 21 deletions
diff --git a/packages/SystemUI/res/drawable-hdpi/recents_lower_gradient.9.png b/packages/SystemUI/res/drawable-hdpi/recents_lower_gradient.9.png Binary files differnew file mode 100644 index 0000000..d4fdbf3 --- /dev/null +++ b/packages/SystemUI/res/drawable-hdpi/recents_lower_gradient.9.png diff --git a/packages/SystemUI/res/drawable-hdpi/recents_nav_bar_background.9.png b/packages/SystemUI/res/drawable-hdpi/recents_nav_bar_background.9.png Binary files differdeleted file mode 100644 index 6cd1176..0000000 --- a/packages/SystemUI/res/drawable-hdpi/recents_nav_bar_background.9.png +++ /dev/null diff --git a/packages/SystemUI/res/drawable-mdpi/recents_lower_gradient.9.png b/packages/SystemUI/res/drawable-mdpi/recents_lower_gradient.9.png Binary files differnew file mode 100644 index 0000000..9fc1a3b --- /dev/null +++ b/packages/SystemUI/res/drawable-mdpi/recents_lower_gradient.9.png diff --git a/packages/SystemUI/res/drawable-mdpi/recents_nav_bar_background.9.png b/packages/SystemUI/res/drawable-mdpi/recents_nav_bar_background.9.png Binary files differdeleted file mode 100644 index 7237f09..0000000 --- a/packages/SystemUI/res/drawable-mdpi/recents_nav_bar_background.9.png +++ /dev/null diff --git a/packages/SystemUI/res/drawable-xhdpi/recents_lower_gradient.9.png b/packages/SystemUI/res/drawable-xhdpi/recents_lower_gradient.9.png Binary files differnew file mode 100644 index 0000000..f38de93 --- /dev/null +++ b/packages/SystemUI/res/drawable-xhdpi/recents_lower_gradient.9.png diff --git a/packages/SystemUI/res/drawable-xhdpi/recents_nav_bar_background.9.png b/packages/SystemUI/res/drawable-xhdpi/recents_nav_bar_background.9.png Binary files differdeleted file mode 100644 index 8d56a1d..0000000 --- a/packages/SystemUI/res/drawable-xhdpi/recents_nav_bar_background.9.png +++ /dev/null diff --git a/packages/SystemUI/res/drawable-xxhdpi/recents_lower_gradient.9.png b/packages/SystemUI/res/drawable-xxhdpi/recents_lower_gradient.9.png Binary files differnew file mode 100644 index 0000000..8194605 --- /dev/null +++ b/packages/SystemUI/res/drawable-xxhdpi/recents_lower_gradient.9.png diff --git a/packages/SystemUI/res/drawable-xxhdpi/recents_nav_bar_background.9.png b/packages/SystemUI/res/drawable-xxhdpi/recents_nav_bar_background.9.png Binary files differdeleted file mode 100644 index aed300b..0000000 --- a/packages/SystemUI/res/drawable-xxhdpi/recents_nav_bar_background.9.png +++ /dev/null diff --git a/packages/SystemUI/res/layout/recents_nav_bar_scrim.xml b/packages/SystemUI/res/layout/recents_nav_bar_scrim.xml index 463fee8..4245d49 100644 --- a/packages/SystemUI/res/layout/recents_nav_bar_scrim.xml +++ b/packages/SystemUI/res/layout/recents_nav_bar_scrim.xml @@ -20,4 +20,4 @@ android:layout_height="wrap_content" android:layout_gravity="center_horizontal|bottom" android:scaleType="fitXY" - android:src="@drawable/recents_nav_bar_background" />
\ No newline at end of file + android:src="@drawable/recents_lower_gradient" />
\ No newline at end of file diff --git a/packages/SystemUI/src/com/android/systemui/recents/Constants.java b/packages/SystemUI/src/com/android/systemui/recents/Constants.java index 76e88a5..147ff62 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/Constants.java +++ b/packages/SystemUI/src/com/android/systemui/recents/Constants.java @@ -106,7 +106,7 @@ public class Constants { // The height of the peek space relative to the stack height public static final float StackPeekHeightPct = 0.1f; // The min scale of the last card in the peek area - public static final float StackPeekMinScale = 0.9f; + public static final float StackPeekMinScale = 0.8f; // The number of cards we see in the peek space public static final int StackPeekNumCards = 3; } diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java index 8680786..96344d5 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java @@ -41,6 +41,8 @@ import com.android.systemui.recents.model.SpaceNode; import com.android.systemui.recents.model.TaskStack; import com.android.systemui.recents.views.RecentsView; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Set; @@ -79,6 +81,19 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView boolean mVisible; boolean mTaskLaunched; + private static Method sPropertyMethod; + static { + try { + Class<?> c = Class.forName("android.view.GLES20Canvas"); + sPropertyMethod = c.getDeclaredMethod("setProperty", String.class, String.class); + if (!sPropertyMethod.isAccessible()) sPropertyMethod.setAccessible(true); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } catch (NoSuchMethodException e) { + e.printStackTrace(); + } + } + // Broadcast receiver to handle messages from our RecentsService BroadcastReceiver mServiceBroadcastReceiver = new BroadcastReceiver() { @Override @@ -139,21 +154,12 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView // Add the default no-recents layout if (stacks.size() == 1 && stacks.get(0).getTaskCount() == 0) { mEmptyView.setVisibility(View.VISIBLE); - - // Dim the background even more - WindowManager.LayoutParams wlp = getWindow().getAttributes(); - wlp.dimAmount = Constants.Values.Window.DarkBackgroundDim; - getWindow().setAttributes(wlp); - getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); } else { mEmptyView.setVisibility(View.GONE); - - // Un-dim the background - WindowManager.LayoutParams wlp = getWindow().getAttributes(); - wlp.dimAmount = 0f; - getWindow().setAttributes(wlp); - getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); } + + // Dim the background + mRecentsView.setBackgroundColor(0x80000000); } /** Attempts to allocate and bind the search bar app widget */ @@ -277,6 +283,9 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView LayoutInflater inflater = LayoutInflater.from(this); mEmptyView = inflater.inflate(R.layout.recents_empty, mContainerView, false); mNavBarScrimView = inflater.inflate(R.layout.recents_nav_bar_scrim, mContainerView, false); + mNavBarScrimView.setLayoutParams(new FrameLayout.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, + ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.BOTTOM)); mContainerView = new FrameLayout(this); mContainerView.addView(mRecentsView); @@ -296,6 +305,16 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView if (savedInstanceState != null) { onConfigurationChange(); } + + // XXX: Update the shadows + try { + sPropertyMethod.invoke(null, "ambientShadowStrength", String.valueOf(35f)); + sPropertyMethod.invoke(null, "ambientRatio", String.valueOf(0.5f)); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } catch (InvocationTargetException e) { + e.printStackTrace(); + } } void onConfigurationChange() { diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java index 5830e37..8d9f8be 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java @@ -156,10 +156,12 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal float boundedT = Math.max(t, -(numPeekCards + 1)); // Set the scale relative to its position + int numFrontScaledCards = 3; float minScale = Constants.Values.TaskStackView.StackPeekMinScale; float scaleRange = 1f - minScale; - float scaleInc = scaleRange / numPeekCards; - float scale = Math.max(minScale, Math.min(1f, 1f + (boundedT * scaleInc))); + float scaleInc = scaleRange / (numPeekCards + numFrontScaledCards); + float scale = Math.max(minScale, Math.min(1f, minScale + + ((boundedT + (numPeekCards + 1)) * scaleInc))); float scaleYOffset = ((1f - scale) * mTaskRect.height()) / 2; transform.scale = scale; @@ -171,6 +173,12 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal transform.translationY = (int) (boundedT * overlapHeight - scaleYOffset); } + // Set the z translation + RecentsConfiguration config = RecentsConfiguration.getInstance(); + int minZ = config.taskViewTranslationZMinPx; + int incZ = config.taskViewTranslationZIncrementPx; + transform.translationZ = (int) Math.max(minZ, minZ + ((boundedT + numPeekCards) * incZ)); + // Set the alphas transform.dismissAlpha = Math.max(-1f, Math.min(0f, t + 1)) + 1f; diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java index 632c816..5df5e4d 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java @@ -142,8 +142,6 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.On void updateViewPropertiesToTaskTransform(TaskViewTransform animateFromTransform, TaskViewTransform toTransform, int duration) { RecentsConfiguration config = RecentsConfiguration.getInstance(); - int minZ = config.taskViewTranslationZMinPx; - int incZ = config.taskViewTranslationZIncrementPx; // Update the bar view mBarView.updateViewPropertiesToTaskTransform(animateFromTransform, toTransform, duration); @@ -153,14 +151,14 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.On if (animateFromTransform != null) { setTranslationY(animateFromTransform.translationY); if (Constants.DebugFlags.App.EnableShadows) { - setTranslationZ(Math.max(minZ, minZ + (animateFromTransform.t * incZ))); + setTranslationZ(animateFromTransform.translationZ); } setScaleX(animateFromTransform.scale); setScaleY(animateFromTransform.scale); setAlpha(animateFromTransform.alpha); } if (Constants.DebugFlags.App.EnableShadows) { - animate().translationZ(Math.max(minZ, minZ + (toTransform.t * incZ))); + animate().translationZ(toTransform.translationZ); } animate().translationY(toTransform.translationY) .scaleX(toTransform.scale) @@ -179,7 +177,7 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.On } else { setTranslationY(toTransform.translationY); if (Constants.DebugFlags.App.EnableShadows) { - setTranslationZ(Math.max(minZ, minZ + (toTransform.t * incZ))); + setTranslationZ(toTransform.translationZ); } setScaleX(toTransform.scale); setScaleY(toTransform.scale); diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewTransform.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewTransform.java index e6391a8..3c3ebd7 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewTransform.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewTransform.java @@ -22,6 +22,7 @@ import android.graphics.Rect; /* The transform state for a task view */ public class TaskViewTransform { public int translationY = 0; + public int translationZ = 0; public float scale = 1f; public float alpha = 1f; public float dismissAlpha = 1f; @@ -35,6 +36,7 @@ public class TaskViewTransform { public TaskViewTransform(TaskViewTransform o) { translationY = o.translationY; + translationZ = o.translationZ; scale = o.scale; alpha = o.alpha; dismissAlpha = o.dismissAlpha; |