Loading src/com/android/launcher3/allapps/AllAppsTransitionController.java +10 −10 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ import com.android.launcher3.LauncherState; import com.android.launcher3.LauncherStateManager.AnimationConfig; import com.android.launcher3.LauncherStateManager.StateHandler; import com.android.launcher3.R; import com.android.launcher3.allapps.SearchUiManager.OnScrollRangeChangeListener; import com.android.launcher3.anim.AnimationSuccessListener; import com.android.launcher3.anim.AnimatorSetBuilder; import com.android.launcher3.anim.PropertySetter; Loading @@ -39,8 +38,7 @@ import com.android.launcher3.util.Themes; * If release velocity < THRES1, snap according to either top or bottom depending on whether it's * closer to top or closer to the page indicator. */ public class AllAppsTransitionController implements OnScrollRangeChangeListener, StateHandler, OnDeviceProfileChangeListener { public class AllAppsTransitionController implements StateHandler, OnDeviceProfileChangeListener { public static final Property<AllAppsTransitionController, Float> ALL_APPS_PROGRESS = new Property<AllAppsTransitionController, Float>(Float.class, "allAppsProgress") { Loading Loading @@ -71,11 +69,11 @@ public class AllAppsTransitionController private float mShiftRange; // changes depending on the orientation private float mProgress; // [0, 1], mShiftRange * mProgress = shiftCurrent private static final float DEFAULT_SHIFT_RANGE = 10; private float mScrollRangeDelta = 0; public AllAppsTransitionController(Launcher l) { mLauncher = l; mShiftRange = DEFAULT_SHIFT_RANGE; mShiftRange = mLauncher.getDeviceProfile().heightPx; mProgress = 1f; mIsDarkTheme = Themes.getAttrBoolean(mLauncher, R.attr.isMainColorDark); Loading @@ -95,6 +93,7 @@ public class AllAppsTransitionController @Override public void onDeviceProfileChanged(DeviceProfile dp) { mIsVerticalLayout = dp.isVerticalBarLayout(); setScrollRangeDelta(mScrollRangeDelta); if (mIsVerticalLayout) { mAppsView.setAlpha(1); Loading Loading @@ -205,13 +204,14 @@ public class AllAppsTransitionController public void setupViews(AllAppsContainerView appsView) { mAppsView = appsView; mAppsView.getSearchUiManager().addOnScrollRangeChangeListener(this); } @Override public void onScrollRangeChanged(int scrollRange) { mShiftRange = scrollRange; setProgress(mProgress); /** * Updates the total scroll range but does not update the UI. */ public void setScrollRangeDelta(float delta) { mScrollRangeDelta = delta; mShiftRange = mLauncher.getDeviceProfile().heightPx - mScrollRangeDelta; } /** Loading src/com/android/launcher3/allapps/SearchUiManager.java +0 −17 Original line number Diff line number Diff line Loading @@ -15,8 +15,6 @@ */ package com.android.launcher3.allapps; import android.support.animation.SpringAnimation; import android.support.annotation.NonNull; import android.view.KeyEvent; /** Loading @@ -29,11 +27,6 @@ public interface SearchUiManager { */ void initialize(AllAppsContainerView containerView); /** * A {@link SpringAnimation} that will be used when the user flings. */ @NonNull SpringAnimation getSpringForFling(); /** * Notifies the search manager to close any active search session. */ Loading @@ -44,14 +37,4 @@ public interface SearchUiManager { * some UI beforehand. */ void preDispatchKeyEvent(KeyEvent keyEvent); void addOnScrollRangeChangeListener(OnScrollRangeChangeListener listener); /** * Callback for listening to changes in the vertical scroll range when opening all-apps. */ interface OnScrollRangeChangeListener { void onScrollRangeChanged(int scrollRange); } } src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java +12 −31 Original line number Diff line number Diff line Loading @@ -23,10 +23,6 @@ import static com.android.launcher3.graphics.IconNormalizer.ICON_VISIBLE_AREA_FA import android.content.Context; import android.graphics.Rect; import android.support.animation.FloatValueHolder; import android.support.animation.SpringAnimation; import android.support.animation.SpringForce; import android.support.annotation.NonNull; import android.text.Selection; import android.text.Spannable; import android.text.SpannableString; Loading @@ -39,6 +35,7 @@ import android.view.ViewGroup.MarginLayoutParams; import com.android.launcher3.DeviceProfile; import com.android.launcher3.ExtendedEditText; import com.android.launcher3.Insettable; import com.android.launcher3.Launcher; import com.android.launcher3.R; import com.android.launcher3.allapps.AllAppsContainerView; Loading @@ -55,7 +52,7 @@ import java.util.ArrayList; */ public class AppsSearchContainerLayout extends ExtendedEditText implements SearchUiManager, AllAppsSearchBarController.Callbacks, AllAppsStore.OnUpdateListener { AllAppsStore.OnUpdateListener, Insettable { private final Launcher mLauncher; Loading @@ -64,7 +61,6 @@ public class AppsSearchContainerLayout extends ExtendedEditText private AlphabeticalAppsList mApps; private AllAppsContainerView mAppsView; private SpringAnimation mSpring; public AppsSearchContainerLayout(Context context) { this(context, null); Loading @@ -91,9 +87,6 @@ public class AppsSearchContainerLayout extends ExtendedEditText spanned.setSpan(new TintedDrawableSpan(getContext(), R.drawable.ic_allapps_search), 0, 1, Spannable.SPAN_EXCLUSIVE_INCLUSIVE); setHint(spanned); // Note: This spring does nothing. mSpring = new SpringAnimation(new FloatValueHolder()).setSpring(new SpringForce(0)); } @Override Loading Loading @@ -145,11 +138,6 @@ public class AppsSearchContainerLayout extends ExtendedEditText new DefaultAppSearchAlgorithm(mApps.getApps()), this, mLauncher, this); } @Override public @NonNull SpringAnimation getSpringForFling() { return mSpring; } @Override public void onAppsUpdated() { mSearchBarController.refreshSearchResult(); Loading Loading @@ -206,22 +194,15 @@ public class AppsSearchContainerLayout extends ExtendedEditText } @Override public void addOnScrollRangeChangeListener(final OnScrollRangeChangeListener listener) { mLauncher.getHotseat().addOnLayoutChangeListener(new OnLayoutChangeListener() { @Override public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) { public void setInsets(Rect insets) { DeviceProfile dp = mLauncher.getDeviceProfile(); if (!dp.isVerticalBarLayout()) { Rect insets = dp.getInsets(); int hotseatBottom = bottom - dp.hotseatBarBottomPaddingPx - insets.bottom; if (dp.isVerticalBarLayout()) { mLauncher.getAllAppsController().setScrollRangeDelta(0); } else { MarginLayoutParams mlp = ((MarginLayoutParams) getLayoutParams()); int myBot = mlp.topMargin + (int) getTranslationY() + mlp.height; listener.onScrollRangeChanged(hotseatBottom - myBot); } else { listener.onScrollRangeChanged(bottom); } mLauncher.getAllAppsController().setScrollRangeDelta( dp.hotseatBarBottomPaddingPx + myBot); } }); } } Loading
src/com/android/launcher3/allapps/AllAppsTransitionController.java +10 −10 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ import com.android.launcher3.LauncherState; import com.android.launcher3.LauncherStateManager.AnimationConfig; import com.android.launcher3.LauncherStateManager.StateHandler; import com.android.launcher3.R; import com.android.launcher3.allapps.SearchUiManager.OnScrollRangeChangeListener; import com.android.launcher3.anim.AnimationSuccessListener; import com.android.launcher3.anim.AnimatorSetBuilder; import com.android.launcher3.anim.PropertySetter; Loading @@ -39,8 +38,7 @@ import com.android.launcher3.util.Themes; * If release velocity < THRES1, snap according to either top or bottom depending on whether it's * closer to top or closer to the page indicator. */ public class AllAppsTransitionController implements OnScrollRangeChangeListener, StateHandler, OnDeviceProfileChangeListener { public class AllAppsTransitionController implements StateHandler, OnDeviceProfileChangeListener { public static final Property<AllAppsTransitionController, Float> ALL_APPS_PROGRESS = new Property<AllAppsTransitionController, Float>(Float.class, "allAppsProgress") { Loading Loading @@ -71,11 +69,11 @@ public class AllAppsTransitionController private float mShiftRange; // changes depending on the orientation private float mProgress; // [0, 1], mShiftRange * mProgress = shiftCurrent private static final float DEFAULT_SHIFT_RANGE = 10; private float mScrollRangeDelta = 0; public AllAppsTransitionController(Launcher l) { mLauncher = l; mShiftRange = DEFAULT_SHIFT_RANGE; mShiftRange = mLauncher.getDeviceProfile().heightPx; mProgress = 1f; mIsDarkTheme = Themes.getAttrBoolean(mLauncher, R.attr.isMainColorDark); Loading @@ -95,6 +93,7 @@ public class AllAppsTransitionController @Override public void onDeviceProfileChanged(DeviceProfile dp) { mIsVerticalLayout = dp.isVerticalBarLayout(); setScrollRangeDelta(mScrollRangeDelta); if (mIsVerticalLayout) { mAppsView.setAlpha(1); Loading Loading @@ -205,13 +204,14 @@ public class AllAppsTransitionController public void setupViews(AllAppsContainerView appsView) { mAppsView = appsView; mAppsView.getSearchUiManager().addOnScrollRangeChangeListener(this); } @Override public void onScrollRangeChanged(int scrollRange) { mShiftRange = scrollRange; setProgress(mProgress); /** * Updates the total scroll range but does not update the UI. */ public void setScrollRangeDelta(float delta) { mScrollRangeDelta = delta; mShiftRange = mLauncher.getDeviceProfile().heightPx - mScrollRangeDelta; } /** Loading
src/com/android/launcher3/allapps/SearchUiManager.java +0 −17 Original line number Diff line number Diff line Loading @@ -15,8 +15,6 @@ */ package com.android.launcher3.allapps; import android.support.animation.SpringAnimation; import android.support.annotation.NonNull; import android.view.KeyEvent; /** Loading @@ -29,11 +27,6 @@ public interface SearchUiManager { */ void initialize(AllAppsContainerView containerView); /** * A {@link SpringAnimation} that will be used when the user flings. */ @NonNull SpringAnimation getSpringForFling(); /** * Notifies the search manager to close any active search session. */ Loading @@ -44,14 +37,4 @@ public interface SearchUiManager { * some UI beforehand. */ void preDispatchKeyEvent(KeyEvent keyEvent); void addOnScrollRangeChangeListener(OnScrollRangeChangeListener listener); /** * Callback for listening to changes in the vertical scroll range when opening all-apps. */ interface OnScrollRangeChangeListener { void onScrollRangeChanged(int scrollRange); } }
src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java +12 −31 Original line number Diff line number Diff line Loading @@ -23,10 +23,6 @@ import static com.android.launcher3.graphics.IconNormalizer.ICON_VISIBLE_AREA_FA import android.content.Context; import android.graphics.Rect; import android.support.animation.FloatValueHolder; import android.support.animation.SpringAnimation; import android.support.animation.SpringForce; import android.support.annotation.NonNull; import android.text.Selection; import android.text.Spannable; import android.text.SpannableString; Loading @@ -39,6 +35,7 @@ import android.view.ViewGroup.MarginLayoutParams; import com.android.launcher3.DeviceProfile; import com.android.launcher3.ExtendedEditText; import com.android.launcher3.Insettable; import com.android.launcher3.Launcher; import com.android.launcher3.R; import com.android.launcher3.allapps.AllAppsContainerView; Loading @@ -55,7 +52,7 @@ import java.util.ArrayList; */ public class AppsSearchContainerLayout extends ExtendedEditText implements SearchUiManager, AllAppsSearchBarController.Callbacks, AllAppsStore.OnUpdateListener { AllAppsStore.OnUpdateListener, Insettable { private final Launcher mLauncher; Loading @@ -64,7 +61,6 @@ public class AppsSearchContainerLayout extends ExtendedEditText private AlphabeticalAppsList mApps; private AllAppsContainerView mAppsView; private SpringAnimation mSpring; public AppsSearchContainerLayout(Context context) { this(context, null); Loading @@ -91,9 +87,6 @@ public class AppsSearchContainerLayout extends ExtendedEditText spanned.setSpan(new TintedDrawableSpan(getContext(), R.drawable.ic_allapps_search), 0, 1, Spannable.SPAN_EXCLUSIVE_INCLUSIVE); setHint(spanned); // Note: This spring does nothing. mSpring = new SpringAnimation(new FloatValueHolder()).setSpring(new SpringForce(0)); } @Override Loading Loading @@ -145,11 +138,6 @@ public class AppsSearchContainerLayout extends ExtendedEditText new DefaultAppSearchAlgorithm(mApps.getApps()), this, mLauncher, this); } @Override public @NonNull SpringAnimation getSpringForFling() { return mSpring; } @Override public void onAppsUpdated() { mSearchBarController.refreshSearchResult(); Loading Loading @@ -206,22 +194,15 @@ public class AppsSearchContainerLayout extends ExtendedEditText } @Override public void addOnScrollRangeChangeListener(final OnScrollRangeChangeListener listener) { mLauncher.getHotseat().addOnLayoutChangeListener(new OnLayoutChangeListener() { @Override public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) { public void setInsets(Rect insets) { DeviceProfile dp = mLauncher.getDeviceProfile(); if (!dp.isVerticalBarLayout()) { Rect insets = dp.getInsets(); int hotseatBottom = bottom - dp.hotseatBarBottomPaddingPx - insets.bottom; if (dp.isVerticalBarLayout()) { mLauncher.getAllAppsController().setScrollRangeDelta(0); } else { MarginLayoutParams mlp = ((MarginLayoutParams) getLayoutParams()); int myBot = mlp.topMargin + (int) getTranslationY() + mlp.height; listener.onScrollRangeChanged(hotseatBottom - myBot); } else { listener.onScrollRangeChanged(bottom); } mLauncher.getAllAppsController().setScrollRangeDelta( dp.hotseatBarBottomPaddingPx + myBot); } }); } }