Merge "Adding status bar scrim, reducing extra work updating configuration values."

This commit is contained in:
Winson Chung
2014-06-18 00:58:49 +00:00
committed by Android (Google) Code Review
13 changed files with 81 additions and 30 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 219 B

After

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 193 B

After

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 242 B

After

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 265 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 B

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 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.
-->
<ImageView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|top"
android:scaleType="fitXY"
android:src="@drawable/recents_status_gradient" />

View File

@@ -32,8 +32,9 @@
android:id="@+id/application_icon"
android:layout_width="@dimen/recents_task_view_application_icon_size"
android:layout_height="@dimen/recents_task_view_application_icon_size"
android:layout_marginStart="16dp"
android:layout_gravity="center_vertical|start" />
android:layout_marginStart="8dp"
android:layout_gravity="center_vertical|start"
android:padding="8dp" />
<TextView
android:id="@+id/activity_description"
android:layout_width="match_parent"

View File

@@ -212,7 +212,7 @@
<dimen name="glowpadview_inner_radius">15dip</dimen>
<!-- The size of the application icon in the recents task view. -->
<dimen name="recents_task_view_application_icon_size">32dp</dimen>
<dimen name="recents_task_view_application_icon_size">48dp</dimen>
<!-- The size of the activity icon in the recents task view. -->
<dimen name="recents_task_view_activity_icon_size">60dp</dimen>

View File

@@ -72,6 +72,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
FrameLayout mContainerView;
RecentsView mRecentsView;
View mEmptyView;
View mStatusBarScrimView;
View mNavBarScrimView;
FullScreenTransitionView mFullScreenshotView;
@@ -180,13 +181,11 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
AlternateRecentsComponent.EXTRA_TRIGGERED_FROM_ALT_TAB, false);
mConfig.launchedWithNoRecentTasks = !root.hasTasks();
if (mConfig.shouldAnimateNavBarScrim()) {
// Hide the scrim if we animate into Recents with window transitions
mNavBarScrimView.setVisibility(View.INVISIBLE);
} else {
// Show the scrim if we animate into Recents without window transitions
mNavBarScrimView.setVisibility(View.VISIBLE);
}
// Show the scrim if we animate into Recents without window transitions
mNavBarScrimView.setVisibility(mConfig.hasNavBarScrim() &&
!mConfig.shouldAnimateNavBarScrim() ? View.VISIBLE : View.INVISIBLE);
mStatusBarScrimView.setVisibility(mConfig.hasStatusBarScrim() &&
!mConfig.shouldAnimateStatusBarScrim() ? View.VISIBLE : View.INVISIBLE);
// Add the default no-recents layout
if (mConfig.launchedWithNoRecentTasks) {
@@ -325,6 +324,10 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
// Create the empty view
LayoutInflater inflater = LayoutInflater.from(this);
mEmptyView = inflater.inflate(R.layout.recents_empty, mContainerView, false);
mStatusBarScrimView = inflater.inflate(R.layout.recents_status_bar_scrim, mContainerView, false);
mStatusBarScrimView.setLayoutParams(new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.TOP));
mNavBarScrimView = inflater.inflate(R.layout.recents_nav_bar_scrim, mContainerView, false);
mNavBarScrimView.setLayoutParams(new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
@@ -336,6 +339,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
}
mContainerView = new FrameLayout(this);
mContainerView.addView(mStatusBarScrimView);
mContainerView.addView(mRecentsView);
mContainerView.addView(mEmptyView);
if (Constants.DebugFlags.App.EnableScreenshotAppTransition) {
@@ -563,8 +567,18 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
}
public void onEnterAnimationTriggered() {
// Fade in the scrim
if (mConfig.shouldAnimateNavBarScrim() && mConfig.hasNavBarScrim()) {
// Fade in the scrims
if (mConfig.hasStatusBarScrim() && mConfig.shouldAnimateStatusBarScrim()) {
mStatusBarScrimView.setVisibility(View.VISIBLE);
mStatusBarScrimView.setTranslationY(-mStatusBarScrimView.getMeasuredHeight());
mStatusBarScrimView.animate()
.translationY(0)
.setStartDelay(mConfig.taskBarEnterAnimDelay)
.setDuration(mConfig.navBarScrimEnterDuration)
.setInterpolator(mConfig.quintOutInterpolator)
.start();
}
if (mConfig.hasNavBarScrim() && mConfig.shouldAnimateNavBarScrim()) {
mNavBarScrimView.setVisibility(View.VISIBLE);
mNavBarScrimView.setTranslationY(mNavBarScrimView.getMeasuredHeight());
mNavBarScrimView.animate()
@@ -579,7 +593,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
@Override
public void onExitAnimationTriggered() {
// Fade out the scrim
if (mConfig.shouldAnimateNavBarScrim() && mConfig.hasNavBarScrim()) {
if (mConfig.hasNavBarScrim() && mConfig.shouldAnimateNavBarScrim()) {
mNavBarScrimView.animate()
.translationY(mNavBarScrimView.getMeasuredHeight())
.setStartDelay(0)

View File

@@ -106,12 +106,30 @@ public class RecentsConfiguration {
public boolean developerOptionsEnabled;
/** Private constructor */
private RecentsConfiguration() {}
private RecentsConfiguration(Context context) {
// Properties that don't have to be reloaded with each configuration change can be loaded
// here.
// Interpolators
fastOutSlowInInterpolator = AnimationUtils.loadInterpolator(context,
com.android.internal.R.interpolator.fast_out_slow_in);
fastOutLinearInInterpolator = AnimationUtils.loadInterpolator(context,
com.android.internal.R.interpolator.fast_out_linear_in);
linearOutSlowInInterpolator = AnimationUtils.loadInterpolator(context,
com.android.internal.R.interpolator.linear_out_slow_in);
quintOutInterpolator = AnimationUtils.loadInterpolator(context,
com.android.internal.R.interpolator.decelerate_quint);
// Check if the developer options are enabled
ContentResolver cr = context.getContentResolver();
developerOptionsEnabled = Settings.Global.getInt(cr,
Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0) != 0;
}
/** Updates the configuration to the current context */
public static RecentsConfiguration reinitialize(Context context) {
if (sInstance == null) {
sInstance = new RecentsConfiguration();
sInstance = new RecentsConfiguration(context);
}
sInstance.update(context);
return sInstance;
@@ -132,16 +150,6 @@ public class RecentsConfiguration {
animationPxMovementPerSecond =
res.getDimensionPixelSize(R.dimen.recents_animation_movement_in_dps_per_second);
// Interpolators
fastOutSlowInInterpolator = AnimationUtils.loadInterpolator(context,
com.android.internal.R.interpolator.fast_out_slow_in);
fastOutLinearInInterpolator = AnimationUtils.loadInterpolator(context,
com.android.internal.R.interpolator.fast_out_linear_in);
linearOutSlowInInterpolator = AnimationUtils.loadInterpolator(context,
com.android.internal.R.interpolator.linear_out_slow_in);
quintOutInterpolator = AnimationUtils.loadInterpolator(context,
com.android.internal.R.interpolator.decelerate_quint);
// Filtering
filteringCurrentViewsMinAnimDuration =
res.getInteger(R.integer.recents_filter_animate_current_views_min_duration);
@@ -217,11 +225,6 @@ public class RecentsConfiguration {
navBarScrimEnterDuration =
res.getInteger(R.integer.recents_nav_bar_scrim_enter_duration);
// Check if the developer options are enabled
ContentResolver cr = context.getContentResolver();
developerOptionsEnabled = Settings.Global.getInt(cr,
Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0) != 0;
if (Console.Enabled) {
Console.log(Constants.Log.UI.MeasureAndLayout,
"[RecentsConfiguration|orientation]", isLandscape ? "Landscape" : "Portrait",
@@ -257,6 +260,16 @@ public class RecentsConfiguration {
return searchBarAppWidgetId >= 0;
}
/** Returns whether the status bar scrim should be animated when shown for the first time. */
public boolean shouldAnimateStatusBarScrim() {
return launchedFromHome;
}
/** Returns whether the status bar scrim should be visible. */
public boolean hasStatusBarScrim() {
return !launchedWithNoRecentTasks;
}
/** Returns whether the nav bar scrim should be animated when shown for the first time. */
public boolean shouldAnimateNavBarScrim() {
return true;