Loading res/animator/all_apps_fastscroll_icon_anim.xml 0 → 100644 +49 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="UTF-8"?> <!-- Copyright 2017, 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. --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_activated="true"> <set> <objectAnimator android:duration="225" android:propertyName="scaleX" android:valueTo="1.15" android:valueType="floatType" /> <objectAnimator android:duration="225" android:propertyName="scaleY" android:valueTo="1.15" android:valueType="floatType" /> </set> </item> <item> <set> <objectAnimator android:duration="275" android:propertyName="scaleX" android:valueTo="1" android:valueType="floatType" /> <objectAnimator android:duration="275" android:propertyName="scaleY" android:valueTo="1" android:valueType="floatType" /> </set> </item> </selector> No newline at end of file res/animator-v21/overview_button_anim.xml→res/animator/overview_button_anim.xml +0 −0 File moved. View file res/layout/all_apps_icon.xml +1 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ android:id="@+id/icon" android:layout_width="match_parent" android:layout_height="wrap_content" android:stateListAnimator="@animator/all_apps_fastscroll_icon_anim" launcher:iconDisplay="all_apps" launcher:centerVertically="true" android:paddingLeft="4dp" Loading src/com/android/launcher3/BaseRecyclerViewFastScrollBar.java +0 −4 Original line number Diff line number Diff line Loading @@ -36,10 +36,6 @@ import com.android.launcher3.util.Themes; */ public class BaseRecyclerViewFastScrollBar { public interface FastScrollFocusableView { void setFastScrollFocusState(final FastBitmapDrawable.State focusState, boolean animated); } private static final Property<BaseRecyclerViewFastScrollBar, Integer> TRACK_WIDTH = new Property<BaseRecyclerViewFastScrollBar, Integer>(Integer.class, "width") { Loading src/com/android/launcher3/BubbleTextView.java +16 −72 Original line number Diff line number Diff line Loading @@ -53,8 +53,7 @@ import java.text.NumberFormat; * because we want to make the bubble taller than the text and TextView's clip is * too aggressive. */ public class BubbleTextView extends TextView implements BaseRecyclerViewFastScrollBar.FastScrollFocusableView, ItemInfoUpdateReceiver { public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver { // Dimensions in DP private static final float AMBIENT_SHADOW_RADIUS = 2.5f; Loading @@ -67,6 +66,8 @@ public class BubbleTextView extends TextView private static final int DISPLAY_ALL_APPS = 1; private static final int DISPLAY_FOLDER = 2; private static final int[] STATE_PRESSED = new int[] {android.R.attr.state_pressed}; private final Launcher mLauncher; private Drawable mIcon; private final boolean mCenterVertically; Loading Loading @@ -232,14 +233,21 @@ public class BubbleTextView extends TextView } @Override public void setPressed(boolean pressed) { super.setPressed(pressed); public void refreshDrawableState() { if (!mIgnorePressedStateChange) { updateIconState(); super.refreshDrawableState(); } } @Override protected int[] onCreateDrawableState(int extraSpace) { final int[] drawableState = super.onCreateDrawableState(extraSpace + 1); if (mStayPressed) { mergeDrawableStates(drawableState, STATE_PRESSED); } return drawableState; } /** Returns the icon for this view. */ public Drawable getIcon() { return mIcon; Loading @@ -250,17 +258,6 @@ public class BubbleTextView extends TextView return mLayoutHorizontal; } private void updateIconState() { if (mIcon instanceof FastBitmapDrawable) { FastBitmapDrawable d = (FastBitmapDrawable) mIcon; if (isPressed() || mStayPressed) { d.animateState(FastBitmapDrawable.State.PRESSED); } else { d.animateState(FastBitmapDrawable.State.NORMAL); } } } @Override public void setOnLongClickListener(OnLongClickListener l) { super.setOnLongClickListener(l); Loading Loading @@ -334,7 +331,7 @@ public class BubbleTextView extends TextView this, mPressedBackground); } updateIconState(); refreshDrawableState(); } void clearPressedBackground() { Loading Loading @@ -364,7 +361,7 @@ public class BubbleTextView extends TextView mPressedBackground = null; mIgnorePressedStateChange = false; updateIconState(); refreshDrawableState(); return result; } Loading Loading @@ -544,10 +541,6 @@ public class BubbleTextView extends TextView @Override public void reapplyItemInfo(ItemInfoWithIcon info) { if (getTag() == info) { FastBitmapDrawable.State prevState = FastBitmapDrawable.State.NORMAL; if (mIcon instanceof FastBitmapDrawable) { prevState = ((FastBitmapDrawable) mIcon).getCurrentState(); } mIconLoadRequest = null; mDisableRelayout = true; Loading @@ -566,12 +559,6 @@ public class BubbleTextView extends TextView applyFromPackageItemInfo((PackageItemInfo) info); } // If we are reapplying over an old icon, then we should update the new icon to the same // state as the old icon if (mIcon instanceof FastBitmapDrawable) { ((FastBitmapDrawable) mIcon).setState(prevState); } mDisableRelayout = false; } } Loading @@ -593,34 +580,6 @@ public class BubbleTextView extends TextView } } @Override public void setFastScrollFocusState(final FastBitmapDrawable.State focusState, boolean animated) { // We can only set the fast scroll focus state on a FastBitmapDrawable if (!(mIcon instanceof FastBitmapDrawable)) { return; } FastBitmapDrawable d = (FastBitmapDrawable) mIcon; if (animated) { FastBitmapDrawable.State prevState = d.getCurrentState(); if (d.animateState(focusState)) { // If the state was updated, then update the view accordingly animate().scaleX(focusState.viewScale) .scaleY(focusState.viewScale) .setStartDelay(getStartDelayForStateChange(prevState, focusState)) .setDuration(d.getDurationForStateChange(prevState, focusState)) .start(); } } else { if (d.setState(focusState)) { // If the state was updated, then update the view accordingly animate().cancel(); setScaleX(focusState.viewScale); setScaleY(focusState.viewScale); } } } /** * Returns true if the view can show custom shortcuts. */ Loading @@ -629,21 +588,6 @@ public class BubbleTextView extends TextView .isEmpty(); } /** * Returns the start delay when animating between certain {@link FastBitmapDrawable} states. */ private static int getStartDelayForStateChange(final FastBitmapDrawable.State fromState, final FastBitmapDrawable.State toState) { switch (toState) { case NORMAL: switch (fromState) { case FAST_SCROLL_HIGHLIGHTED: return FastBitmapDrawable.FAST_SCROLL_INACTIVE_DURATION / 4; } } return 0; } /** * Interface to be implemented by the grand parent to allow click shadow effect. */ Loading Loading
res/animator/all_apps_fastscroll_icon_anim.xml 0 → 100644 +49 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="UTF-8"?> <!-- Copyright 2017, 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. --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_activated="true"> <set> <objectAnimator android:duration="225" android:propertyName="scaleX" android:valueTo="1.15" android:valueType="floatType" /> <objectAnimator android:duration="225" android:propertyName="scaleY" android:valueTo="1.15" android:valueType="floatType" /> </set> </item> <item> <set> <objectAnimator android:duration="275" android:propertyName="scaleX" android:valueTo="1" android:valueType="floatType" /> <objectAnimator android:duration="275" android:propertyName="scaleY" android:valueTo="1" android:valueType="floatType" /> </set> </item> </selector> No newline at end of file
res/animator-v21/overview_button_anim.xml→res/animator/overview_button_anim.xml +0 −0 File moved. View file
res/layout/all_apps_icon.xml +1 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ android:id="@+id/icon" android:layout_width="match_parent" android:layout_height="wrap_content" android:stateListAnimator="@animator/all_apps_fastscroll_icon_anim" launcher:iconDisplay="all_apps" launcher:centerVertically="true" android:paddingLeft="4dp" Loading
src/com/android/launcher3/BaseRecyclerViewFastScrollBar.java +0 −4 Original line number Diff line number Diff line Loading @@ -36,10 +36,6 @@ import com.android.launcher3.util.Themes; */ public class BaseRecyclerViewFastScrollBar { public interface FastScrollFocusableView { void setFastScrollFocusState(final FastBitmapDrawable.State focusState, boolean animated); } private static final Property<BaseRecyclerViewFastScrollBar, Integer> TRACK_WIDTH = new Property<BaseRecyclerViewFastScrollBar, Integer>(Integer.class, "width") { Loading
src/com/android/launcher3/BubbleTextView.java +16 −72 Original line number Diff line number Diff line Loading @@ -53,8 +53,7 @@ import java.text.NumberFormat; * because we want to make the bubble taller than the text and TextView's clip is * too aggressive. */ public class BubbleTextView extends TextView implements BaseRecyclerViewFastScrollBar.FastScrollFocusableView, ItemInfoUpdateReceiver { public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver { // Dimensions in DP private static final float AMBIENT_SHADOW_RADIUS = 2.5f; Loading @@ -67,6 +66,8 @@ public class BubbleTextView extends TextView private static final int DISPLAY_ALL_APPS = 1; private static final int DISPLAY_FOLDER = 2; private static final int[] STATE_PRESSED = new int[] {android.R.attr.state_pressed}; private final Launcher mLauncher; private Drawable mIcon; private final boolean mCenterVertically; Loading Loading @@ -232,14 +233,21 @@ public class BubbleTextView extends TextView } @Override public void setPressed(boolean pressed) { super.setPressed(pressed); public void refreshDrawableState() { if (!mIgnorePressedStateChange) { updateIconState(); super.refreshDrawableState(); } } @Override protected int[] onCreateDrawableState(int extraSpace) { final int[] drawableState = super.onCreateDrawableState(extraSpace + 1); if (mStayPressed) { mergeDrawableStates(drawableState, STATE_PRESSED); } return drawableState; } /** Returns the icon for this view. */ public Drawable getIcon() { return mIcon; Loading @@ -250,17 +258,6 @@ public class BubbleTextView extends TextView return mLayoutHorizontal; } private void updateIconState() { if (mIcon instanceof FastBitmapDrawable) { FastBitmapDrawable d = (FastBitmapDrawable) mIcon; if (isPressed() || mStayPressed) { d.animateState(FastBitmapDrawable.State.PRESSED); } else { d.animateState(FastBitmapDrawable.State.NORMAL); } } } @Override public void setOnLongClickListener(OnLongClickListener l) { super.setOnLongClickListener(l); Loading Loading @@ -334,7 +331,7 @@ public class BubbleTextView extends TextView this, mPressedBackground); } updateIconState(); refreshDrawableState(); } void clearPressedBackground() { Loading Loading @@ -364,7 +361,7 @@ public class BubbleTextView extends TextView mPressedBackground = null; mIgnorePressedStateChange = false; updateIconState(); refreshDrawableState(); return result; } Loading Loading @@ -544,10 +541,6 @@ public class BubbleTextView extends TextView @Override public void reapplyItemInfo(ItemInfoWithIcon info) { if (getTag() == info) { FastBitmapDrawable.State prevState = FastBitmapDrawable.State.NORMAL; if (mIcon instanceof FastBitmapDrawable) { prevState = ((FastBitmapDrawable) mIcon).getCurrentState(); } mIconLoadRequest = null; mDisableRelayout = true; Loading @@ -566,12 +559,6 @@ public class BubbleTextView extends TextView applyFromPackageItemInfo((PackageItemInfo) info); } // If we are reapplying over an old icon, then we should update the new icon to the same // state as the old icon if (mIcon instanceof FastBitmapDrawable) { ((FastBitmapDrawable) mIcon).setState(prevState); } mDisableRelayout = false; } } Loading @@ -593,34 +580,6 @@ public class BubbleTextView extends TextView } } @Override public void setFastScrollFocusState(final FastBitmapDrawable.State focusState, boolean animated) { // We can only set the fast scroll focus state on a FastBitmapDrawable if (!(mIcon instanceof FastBitmapDrawable)) { return; } FastBitmapDrawable d = (FastBitmapDrawable) mIcon; if (animated) { FastBitmapDrawable.State prevState = d.getCurrentState(); if (d.animateState(focusState)) { // If the state was updated, then update the view accordingly animate().scaleX(focusState.viewScale) .scaleY(focusState.viewScale) .setStartDelay(getStartDelayForStateChange(prevState, focusState)) .setDuration(d.getDurationForStateChange(prevState, focusState)) .start(); } } else { if (d.setState(focusState)) { // If the state was updated, then update the view accordingly animate().cancel(); setScaleX(focusState.viewScale); setScaleY(focusState.viewScale); } } } /** * Returns true if the view can show custom shortcuts. */ Loading @@ -629,21 +588,6 @@ public class BubbleTextView extends TextView .isEmpty(); } /** * Returns the start delay when animating between certain {@link FastBitmapDrawable} states. */ private static int getStartDelayForStateChange(final FastBitmapDrawable.State fromState, final FastBitmapDrawable.State toState) { switch (toState) { case NORMAL: switch (fromState) { case FAST_SCROLL_HIGHLIGHTED: return FastBitmapDrawable.FAST_SCROLL_INACTIVE_DURATION / 4; } } return 0; } /** * Interface to be implemented by the grand parent to allow click shadow effect. */ Loading