Fix 3253629: Improve Recents panel animation performance.
This change improves animation by enabling hardware acceleration and reducing the size of the blue glow. Change-Id: Ie8b7668b9b1f1ae91211875c2fa11b305a317d64
This commit is contained in:
@@ -28,8 +28,8 @@
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView android:id="@+id/recents_no_recents"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/recent_tasks_empty"
|
||||
android:textSize="22dip"
|
||||
android:gravity="center_horizontal|center_vertical"
|
||||
@@ -42,15 +42,19 @@
|
||||
android:layout_weight="1"
|
||||
/>
|
||||
|
||||
<LinearLayout android:id="@+id/recents_container"
|
||||
android:layout_width="match_parent"
|
||||
<LinearLayout android:id="@+id/recents_glow"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginBottom="16dip"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_marginRight="100dip"
|
||||
android:background="@drawable/recents_blue_glow"
|
||||
/>
|
||||
android:orientation="horizontal"
|
||||
android:background="@drawable/recents_blue_glow">
|
||||
|
||||
<LinearLayout android:id="@+id/recents_container"
|
||||
android:layout_width="356dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginRight="100dip"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.android.systemui.statusbar.tablet.RecentAppsPanel>
|
||||
|
||||
@@ -20,13 +20,9 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.LayoutTransition;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.PropertyValuesHolder;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.ActivityManagerNative;
|
||||
import android.app.IThumbnailReceiver;
|
||||
import android.app.ActivityManager.RunningTaskInfo;
|
||||
import android.content.Context;
|
||||
@@ -50,12 +46,10 @@ import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.animation.AnimationSet;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.ImageView.ScaleType;
|
||||
|
||||
import com.android.systemui.R;
|
||||
|
||||
@@ -68,6 +62,7 @@ public class RecentAppsPanel extends LinearLayout implements StatusBarPanel, OnC
|
||||
private TabletStatusBar mBar;
|
||||
private TextView mNoRecents;
|
||||
private LinearLayout mRecentsContainer;
|
||||
private View mRecentsGlowView;
|
||||
private ArrayList<ActivityDescription> mActivityDescriptions;
|
||||
private int mIconDpi;
|
||||
private AnimatorSet mAnimationSet;
|
||||
@@ -145,6 +140,7 @@ public class RecentAppsPanel extends LinearLayout implements StatusBarPanel, OnC
|
||||
super.onFinishInflate();
|
||||
mNoRecents = (TextView) findViewById(R.id.recents_no_recents);
|
||||
mRecentsContainer = (LinearLayout) findViewById(R.id.recents_container);
|
||||
mRecentsGlowView = findViewById(R.id.recents_glow);
|
||||
mBackgroundProtector = (View) findViewById(R.id.recents_bg_protect);
|
||||
|
||||
// In order to save space, we make the background texture repeat in the Y direction
|
||||
@@ -308,11 +304,6 @@ public class RecentAppsPanel extends LinearLayout implements StatusBarPanel, OnC
|
||||
private void updateUiElements(Configuration config, boolean animate) {
|
||||
mRecentsContainer.removeAllViews();
|
||||
|
||||
|
||||
// TODO: disabled until I have a chance to tune animations with UX
|
||||
animate = false;
|
||||
|
||||
|
||||
final float initialAlpha = 0.0f;
|
||||
final int first = 0;
|
||||
final boolean isPortrait = config.orientation == Configuration.ORIENTATION_PORTRAIT;
|
||||
@@ -339,8 +330,8 @@ public class RecentAppsPanel extends LinearLayout implements StatusBarPanel, OnC
|
||||
if (animate) {
|
||||
view.setAlpha(initialAlpha);
|
||||
ObjectAnimator anim = ObjectAnimator.ofFloat(view, "alpha", initialAlpha, 1.0f);
|
||||
anim.setDuration(25);
|
||||
anim.setStartDelay((last-i)*25);
|
||||
anim.setDuration(200);
|
||||
anim.setStartDelay((last-i)*80);
|
||||
anim.setInterpolator(interp);
|
||||
anims.add(anim);
|
||||
}
|
||||
@@ -349,11 +340,12 @@ public class RecentAppsPanel extends LinearLayout implements StatusBarPanel, OnC
|
||||
int views = mRecentsContainer.getChildCount();
|
||||
mNoRecents.setVisibility(View.GONE); // views == 0 ? View.VISIBLE : View.GONE);
|
||||
mRecentsContainer.setVisibility(views > 0 ? View.VISIBLE : View.GONE);
|
||||
mRecentsGlowView.setVisibility(views > 0 ? View.VISIBLE : View.GONE);
|
||||
|
||||
if (animate) {
|
||||
ObjectAnimator anim = ObjectAnimator.ofFloat(mRecentsContainer, "alpha",
|
||||
if (animate && views > 0) {
|
||||
ObjectAnimator anim = ObjectAnimator.ofFloat(mRecentsGlowView, "alpha",
|
||||
initialAlpha, 1.0f);
|
||||
anim.setDuration(last*25);
|
||||
anim.setDuration((last-first)*80);
|
||||
anim.setInterpolator(interp);
|
||||
anims.add(anim);
|
||||
}
|
||||
@@ -361,7 +353,7 @@ public class RecentAppsPanel extends LinearLayout implements StatusBarPanel, OnC
|
||||
if (animate) {
|
||||
ObjectAnimator anim = ObjectAnimator.ofFloat(mBackgroundProtector, "alpha",
|
||||
initialAlpha, 1.0f);
|
||||
anim.setDuration(last*25);
|
||||
anim.setDuration(last*80);
|
||||
anim.setInterpolator(interp);
|
||||
anims.add(anim);
|
||||
}
|
||||
|
||||
@@ -244,7 +244,8 @@ public class TabletStatusBar extends StatusBar {
|
||||
WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL,
|
||||
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
|
||||
| WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM
|
||||
| WindowManager.LayoutParams.FLAG_SPLIT_TOUCH,
|
||||
| WindowManager.LayoutParams.FLAG_SPLIT_TOUCH
|
||||
| WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
|
||||
PixelFormat.TRANSLUCENT);
|
||||
lp.gravity = Gravity.BOTTOM | Gravity.LEFT;
|
||||
lp.setTitle("RecentsPanel");
|
||||
|
||||
Reference in New Issue
Block a user