Loading packages/SystemUI/res/layout/qs_panel.xml +3 −1 Original line number Diff line number Diff line Loading @@ -18,7 +18,9 @@ android:id="@+id/quick_settings_container" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/qs_background_primary"> android:background="@drawable/qs_background_primary" android:clipToPadding="false" android:clipChildren="false"> <com.android.systemui.qs.QSPanel android:id="@+id/quick_settings_panel" Loading packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java +18 −9 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha public static final float EXPANDED_TILE_DELAY = .7f; private final ArrayList<View> mAllViews = new ArrayList<>(); private final ArrayList<View> mTopFiveQs = new ArrayList<>(); private final QuickQSPanel mQuickQsPanel; private final QSPanel mQsPanel; private final QSContainer mQsContainer; Loading Loading @@ -86,7 +87,10 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha firstPageDelayedBuilder.setStartDelay(EXPANDED_TILE_DELAY); firstPageBuilder.setListener(this); translationYBuilder.setInterpolator(TRANSLATION_Y_INTERPOLATOR); // Fade in the tiles/labels as we reach the final position. firstPageDelayedBuilder.addFloat(mQsPanel.getTileLayout(), "alpha", 0, 1); mAllViews.clear(); mTopFiveQs.clear(); for (QSTile<?> tile : tiles) { QSTileBaseView tileView = mQsPanel.getTileView(tile); final TextView label = ((QSTileView) tileView).getLabel(); Loading @@ -104,21 +108,17 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha translationYBuilder.addFloat(quickTileView, "translationY", 0, yDiff); // Counteract the parent translation on the tile. So we have a static base to // animate off from. // animate the label position off from. firstPageBuilder.addFloat(tileView, "translationY", mQsPanel.getHeight(), 0); // Move the real tile's icon and label from the quick tile position to its final // Move the real tile's label from the quick tile position to its final // location. firstPageBuilder.addFloat(tileIcon, "translationX", -xDiff, 0); translationYBuilder.addFloat(tileIcon, "translationY", -yDiff, 0); firstPageBuilder.addFloat(label, "translationX", -xDiff, 0); translationYBuilder.addFloat(label, "translationY", -yDiff, 0); // Fade in the label as we reach the final position. firstPageDelayedBuilder.addFloat(label, "alpha", 0, 1); mTopFiveQs.add(tileIcon); mAllViews.add(tileIcon); mAllViews.add(quickTileView); } else { firstPageDelayedBuilder.addFloat(tileView, "alpha", 0, 1); } mAllViews.add(tileView); mAllViews.add(label); Loading Loading @@ -159,17 +159,26 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha @Override public void onAnimationAtStart() { } @Override public void onAnimationAtEnd() { mQuickQsPanel.setVisibility(View.INVISIBLE); final int N = mTopFiveQs.size(); for (int i = 0; i < N; i++) { mTopFiveQs.get(i).setVisibility(View.VISIBLE); } } @Override public void onAnimationStarted() { mQuickQsPanel.setVisibility(View.VISIBLE); if (mOnFirstPage) { final int N = mTopFiveQs.size(); for (int i = 0; i < N; i++) { mTopFiveQs.get(i).setVisibility(View.INVISIBLE); } } } private void clearAnimationState() { Loading packages/SystemUI/src/com/android/systemui/qs/TouchAnimator.java +24 −29 Original line number Diff line number Diff line Loading @@ -14,8 +14,6 @@ package com.android.systemui.qs; import android.animation.Keyframe; import android.util.Log; import android.util.MathUtils; import android.util.Property; import android.view.View; Loading @@ -34,7 +32,6 @@ import java.util.List; public class TouchAnimator { private final Object[] mTargets; private final Property[] mProperties; private final KeyframeSet[] mKeyframeSets; private final float mStartDelay; private final float mEndDelay; Loading @@ -43,10 +40,9 @@ public class TouchAnimator { private final Listener mListener; private float mLastT; private TouchAnimator(Object[] targets, Property[] properties, KeyframeSet[] keyframeSets, private TouchAnimator(Object[] targets, KeyframeSet[] keyframeSets, float startDelay, float endDelay, Interpolator interpolator, Listener listener) { mTargets = targets; mProperties = properties; mKeyframeSets = keyframeSets; mStartDelay = startDelay; mEndDelay = endDelay; Loading @@ -73,8 +69,7 @@ public class TouchAnimator { mLastT = t; } for (int i = 0; i < mTargets.length; i++) { Object value = mKeyframeSets[i].getValue(t); mProperties[i].set(mTargets[i], value); mKeyframeSets[i].setValue(t, mTargets[i]); } } Loading Loading @@ -111,7 +106,6 @@ public class TouchAnimator { public static class Builder { private List<Object> mTargets = new ArrayList<>(); private List<Property> mProperties = new ArrayList<>(); private List<KeyframeSet> mValues = new ArrayList<>(); private float mStartDelay; Loading @@ -120,18 +114,17 @@ public class TouchAnimator { private Listener mListener; public Builder addFloat(Object target, String property, float... values) { add(target, property, KeyframeSet.ofFloat(values)); add(target, KeyframeSet.ofFloat(getProperty(target, property), values)); return this; } public Builder addInt(Object target, String property, int... values) { add(target, property, KeyframeSet.ofInt(values)); add(target, KeyframeSet.ofInt(getProperty(target, property), values)); return this; } private void add(Object target, String property, KeyframeSet keyframeSet) { private void add(Object target, KeyframeSet keyframeSet) { mTargets.add(target); mProperties.add(getProperty(target, property)); mValues.add(keyframeSet); } Loading Loading @@ -183,7 +176,6 @@ public class TouchAnimator { public TouchAnimator build() { return new TouchAnimator(mTargets.toArray(new Object[mTargets.size()]), mProperties.toArray(new Property[mProperties.size()]), mValues.toArray(new KeyframeSet[mValues.size()]), mStartDelay, mEndDelay, mInterpolator, mListener); } Loading @@ -199,54 +191,57 @@ public class TouchAnimator { mFrameWidth = 1 / (float) (size - 1); } Object getValue(float fraction) { void setValue(float fraction, Object target) { int i; for (i = 1; i < mSize - 1 && fraction > mFrameWidth; i++); float amount = fraction / mFrameWidth; return interpolate(i, amount); interpolate(i, amount, target); } protected abstract Object interpolate(int index, float amount); protected abstract void interpolate(int index, float amount, Object target); public static KeyframeSet ofInt(int... values) { return new IntKeyframeSet(values); public static KeyframeSet ofInt(Property property, int... values) { return new IntKeyframeSet((Property<?, Integer>) property, values); } public static KeyframeSet ofFloat(float... values) { return new FloatKeyframeSet(values); public static KeyframeSet ofFloat(Property property, float... values) { return new FloatKeyframeSet((Property<?, Float>) property, values); } } private static class FloatKeyframeSet extends KeyframeSet { private static class FloatKeyframeSet<T> extends KeyframeSet { private final float[] mValues; private final Property<T, Float> mProperty; public FloatKeyframeSet(float[] values) { public FloatKeyframeSet(Property<T, Float> property, float[] values) { super(values.length); mProperty = property; mValues = values; } @Override protected Object interpolate(int index, float amount) { protected void interpolate(int index, float amount, Object target) { float firstFloat = mValues[index - 1]; float secondFloat = mValues[index]; return firstFloat + (secondFloat - firstFloat) * amount; mProperty.set((T) target, firstFloat + (secondFloat - firstFloat) * amount); } } private static class IntKeyframeSet extends KeyframeSet { private static class IntKeyframeSet<T> extends KeyframeSet { private final int[] mValues; private final Property<T, Integer> mProperty; public IntKeyframeSet(int[] values) { public IntKeyframeSet(Property<T, Integer> property, int[] values) { super(values.length); mProperty = property; mValues = values; } @Override protected Object interpolate(int index, float amount) { protected void interpolate(int index, float amount, Object target) { int firstFloat = mValues[index - 1]; int secondFloat = mValues[index]; return (int) (firstFloat + (secondFloat - firstFloat) * amount); mProperty.set((T) target, (int) (firstFloat + (secondFloat - firstFloat) * amount)); } } } packages/SystemUI/src/com/android/systemui/statusbar/phone/ExpandableIndicator.java +1 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ public class ExpandableIndicator extends ImageView { final AnimatedVectorDrawable avd = (AnimatedVectorDrawable) getContext() .getDrawable(res).getConstantState().newDrawable(); setImageDrawable(avd); avd.forceAnimationOnUI(); avd.start(); } } packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickStatusBarHeader.java +0 −9 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.content.res.Configuration; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.graphics.drawable.RippleDrawable; import android.util.AttributeSet; Loading Loading @@ -129,14 +128,6 @@ public class QuickStatusBarHeader extends BaseStatusBarHeader implements ((RippleDrawable) getBackground()).setForceSoftware(true); ((RippleDrawable) mSettingsButton.getBackground()).setForceSoftware(true); addOnLayoutChangeListener(new View.OnLayoutChangeListener() { @Override public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) { setClipBounds(new Rect(getPaddingLeft(), 0, getWidth() - getPaddingRight(), getHeight())); } }); updateResources(); } Loading Loading
packages/SystemUI/res/layout/qs_panel.xml +3 −1 Original line number Diff line number Diff line Loading @@ -18,7 +18,9 @@ android:id="@+id/quick_settings_container" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/qs_background_primary"> android:background="@drawable/qs_background_primary" android:clipToPadding="false" android:clipChildren="false"> <com.android.systemui.qs.QSPanel android:id="@+id/quick_settings_panel" Loading
packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java +18 −9 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha public static final float EXPANDED_TILE_DELAY = .7f; private final ArrayList<View> mAllViews = new ArrayList<>(); private final ArrayList<View> mTopFiveQs = new ArrayList<>(); private final QuickQSPanel mQuickQsPanel; private final QSPanel mQsPanel; private final QSContainer mQsContainer; Loading Loading @@ -86,7 +87,10 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha firstPageDelayedBuilder.setStartDelay(EXPANDED_TILE_DELAY); firstPageBuilder.setListener(this); translationYBuilder.setInterpolator(TRANSLATION_Y_INTERPOLATOR); // Fade in the tiles/labels as we reach the final position. firstPageDelayedBuilder.addFloat(mQsPanel.getTileLayout(), "alpha", 0, 1); mAllViews.clear(); mTopFiveQs.clear(); for (QSTile<?> tile : tiles) { QSTileBaseView tileView = mQsPanel.getTileView(tile); final TextView label = ((QSTileView) tileView).getLabel(); Loading @@ -104,21 +108,17 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha translationYBuilder.addFloat(quickTileView, "translationY", 0, yDiff); // Counteract the parent translation on the tile. So we have a static base to // animate off from. // animate the label position off from. firstPageBuilder.addFloat(tileView, "translationY", mQsPanel.getHeight(), 0); // Move the real tile's icon and label from the quick tile position to its final // Move the real tile's label from the quick tile position to its final // location. firstPageBuilder.addFloat(tileIcon, "translationX", -xDiff, 0); translationYBuilder.addFloat(tileIcon, "translationY", -yDiff, 0); firstPageBuilder.addFloat(label, "translationX", -xDiff, 0); translationYBuilder.addFloat(label, "translationY", -yDiff, 0); // Fade in the label as we reach the final position. firstPageDelayedBuilder.addFloat(label, "alpha", 0, 1); mTopFiveQs.add(tileIcon); mAllViews.add(tileIcon); mAllViews.add(quickTileView); } else { firstPageDelayedBuilder.addFloat(tileView, "alpha", 0, 1); } mAllViews.add(tileView); mAllViews.add(label); Loading Loading @@ -159,17 +159,26 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha @Override public void onAnimationAtStart() { } @Override public void onAnimationAtEnd() { mQuickQsPanel.setVisibility(View.INVISIBLE); final int N = mTopFiveQs.size(); for (int i = 0; i < N; i++) { mTopFiveQs.get(i).setVisibility(View.VISIBLE); } } @Override public void onAnimationStarted() { mQuickQsPanel.setVisibility(View.VISIBLE); if (mOnFirstPage) { final int N = mTopFiveQs.size(); for (int i = 0; i < N; i++) { mTopFiveQs.get(i).setVisibility(View.INVISIBLE); } } } private void clearAnimationState() { Loading
packages/SystemUI/src/com/android/systemui/qs/TouchAnimator.java +24 −29 Original line number Diff line number Diff line Loading @@ -14,8 +14,6 @@ package com.android.systemui.qs; import android.animation.Keyframe; import android.util.Log; import android.util.MathUtils; import android.util.Property; import android.view.View; Loading @@ -34,7 +32,6 @@ import java.util.List; public class TouchAnimator { private final Object[] mTargets; private final Property[] mProperties; private final KeyframeSet[] mKeyframeSets; private final float mStartDelay; private final float mEndDelay; Loading @@ -43,10 +40,9 @@ public class TouchAnimator { private final Listener mListener; private float mLastT; private TouchAnimator(Object[] targets, Property[] properties, KeyframeSet[] keyframeSets, private TouchAnimator(Object[] targets, KeyframeSet[] keyframeSets, float startDelay, float endDelay, Interpolator interpolator, Listener listener) { mTargets = targets; mProperties = properties; mKeyframeSets = keyframeSets; mStartDelay = startDelay; mEndDelay = endDelay; Loading @@ -73,8 +69,7 @@ public class TouchAnimator { mLastT = t; } for (int i = 0; i < mTargets.length; i++) { Object value = mKeyframeSets[i].getValue(t); mProperties[i].set(mTargets[i], value); mKeyframeSets[i].setValue(t, mTargets[i]); } } Loading Loading @@ -111,7 +106,6 @@ public class TouchAnimator { public static class Builder { private List<Object> mTargets = new ArrayList<>(); private List<Property> mProperties = new ArrayList<>(); private List<KeyframeSet> mValues = new ArrayList<>(); private float mStartDelay; Loading @@ -120,18 +114,17 @@ public class TouchAnimator { private Listener mListener; public Builder addFloat(Object target, String property, float... values) { add(target, property, KeyframeSet.ofFloat(values)); add(target, KeyframeSet.ofFloat(getProperty(target, property), values)); return this; } public Builder addInt(Object target, String property, int... values) { add(target, property, KeyframeSet.ofInt(values)); add(target, KeyframeSet.ofInt(getProperty(target, property), values)); return this; } private void add(Object target, String property, KeyframeSet keyframeSet) { private void add(Object target, KeyframeSet keyframeSet) { mTargets.add(target); mProperties.add(getProperty(target, property)); mValues.add(keyframeSet); } Loading Loading @@ -183,7 +176,6 @@ public class TouchAnimator { public TouchAnimator build() { return new TouchAnimator(mTargets.toArray(new Object[mTargets.size()]), mProperties.toArray(new Property[mProperties.size()]), mValues.toArray(new KeyframeSet[mValues.size()]), mStartDelay, mEndDelay, mInterpolator, mListener); } Loading @@ -199,54 +191,57 @@ public class TouchAnimator { mFrameWidth = 1 / (float) (size - 1); } Object getValue(float fraction) { void setValue(float fraction, Object target) { int i; for (i = 1; i < mSize - 1 && fraction > mFrameWidth; i++); float amount = fraction / mFrameWidth; return interpolate(i, amount); interpolate(i, amount, target); } protected abstract Object interpolate(int index, float amount); protected abstract void interpolate(int index, float amount, Object target); public static KeyframeSet ofInt(int... values) { return new IntKeyframeSet(values); public static KeyframeSet ofInt(Property property, int... values) { return new IntKeyframeSet((Property<?, Integer>) property, values); } public static KeyframeSet ofFloat(float... values) { return new FloatKeyframeSet(values); public static KeyframeSet ofFloat(Property property, float... values) { return new FloatKeyframeSet((Property<?, Float>) property, values); } } private static class FloatKeyframeSet extends KeyframeSet { private static class FloatKeyframeSet<T> extends KeyframeSet { private final float[] mValues; private final Property<T, Float> mProperty; public FloatKeyframeSet(float[] values) { public FloatKeyframeSet(Property<T, Float> property, float[] values) { super(values.length); mProperty = property; mValues = values; } @Override protected Object interpolate(int index, float amount) { protected void interpolate(int index, float amount, Object target) { float firstFloat = mValues[index - 1]; float secondFloat = mValues[index]; return firstFloat + (secondFloat - firstFloat) * amount; mProperty.set((T) target, firstFloat + (secondFloat - firstFloat) * amount); } } private static class IntKeyframeSet extends KeyframeSet { private static class IntKeyframeSet<T> extends KeyframeSet { private final int[] mValues; private final Property<T, Integer> mProperty; public IntKeyframeSet(int[] values) { public IntKeyframeSet(Property<T, Integer> property, int[] values) { super(values.length); mProperty = property; mValues = values; } @Override protected Object interpolate(int index, float amount) { protected void interpolate(int index, float amount, Object target) { int firstFloat = mValues[index - 1]; int secondFloat = mValues[index]; return (int) (firstFloat + (secondFloat - firstFloat) * amount); mProperty.set((T) target, (int) (firstFloat + (secondFloat - firstFloat) * amount)); } } }
packages/SystemUI/src/com/android/systemui/statusbar/phone/ExpandableIndicator.java +1 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ public class ExpandableIndicator extends ImageView { final AnimatedVectorDrawable avd = (AnimatedVectorDrawable) getContext() .getDrawable(res).getConstantState().newDrawable(); setImageDrawable(avd); avd.forceAnimationOnUI(); avd.start(); } }
packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickStatusBarHeader.java +0 −9 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.content.res.Configuration; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.graphics.drawable.RippleDrawable; import android.util.AttributeSet; Loading Loading @@ -129,14 +128,6 @@ public class QuickStatusBarHeader extends BaseStatusBarHeader implements ((RippleDrawable) getBackground()).setForceSoftware(true); ((RippleDrawable) mSettingsButton.getBackground()).setForceSoftware(true); addOnLayoutChangeListener(new View.OnLayoutChangeListener() { @Override public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) { setClipBounds(new Rect(getPaddingLeft(), 0, getWidth() - getPaddingRight(), getHeight())); } }); updateResources(); } Loading