use of com.android.launcher3.touch.PagedOrientationHandler in project android_packages_apps_Trebuchet by LineageOS.
the class ClearAllButton method onLayout.
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
PagedOrientationHandler orientationHandler = getRecentsView().getPagedOrientationHandler();
mScrollOffset = orientationHandler.getClearAllScrollOffset(getRecentsView(), mIsRtl);
}
use of com.android.launcher3.touch.PagedOrientationHandler in project android_packages_apps_Trebuchet by LineageOS.
the class ClearAllButton method onPageScroll.
@Override
public void onPageScroll(ScrollState scrollState) {
PagedOrientationHandler orientationHandler = getRecentsView().getPagedOrientationHandler();
float orientationSize = orientationHandler.getPrimaryValue(getWidth(), getHeight());
if (orientationSize == 0) {
return;
}
float shift = Math.min(scrollState.scrollFromEdge, orientationSize);
float translation = mIsRtl ? (mScrollOffset - shift) : (mScrollOffset + shift);
orientationHandler.setPrimaryAndResetSecondaryTranslate(this, translation);
mScrollAlpha = 1 - shift / orientationSize;
updateAlpha();
}
use of com.android.launcher3.touch.PagedOrientationHandler in project android_packages_apps_Trebuchet by LineageOS.
the class TaskView method onPageScroll.
@Override
public void onPageScroll(ScrollState scrollState) {
// Don't do anything if it's modal.
if (mModalness > 0) {
return;
}
float curveInterpolation = CURVE_INTERPOLATOR.getInterpolation(scrollState.linearInterpolation);
float curveScaleForCurveInterpolation = getCurveScaleForCurveInterpolation(curveInterpolation);
mSnapshotView.setDimAlpha(curveInterpolation * MAX_PAGE_SCRIM_ALPHA);
setCurveScale(curveScaleForCurveInterpolation);
mFooterAlpha = Utilities.boundToRange(1.0f - 2 * scrollState.linearInterpolation, 0f, 1f);
for (FooterWrapper footer : mFooters) {
if (footer != null) {
footer.mView.setAlpha(mFooterAlpha);
}
}
if (mMenuView != null) {
PagedOrientationHandler pagedOrientationHandler = getPagedOrientationHandler();
RecentsView recentsView = getRecentsView();
mMenuView.setPosition(getX() - recentsView.getScrollX(), getY() - recentsView.getScrollY(), pagedOrientationHandler);
mMenuView.setScaleX(getScaleX());
mMenuView.setScaleY(getScaleY());
}
}
use of com.android.launcher3.touch.PagedOrientationHandler in project android_packages_apps_Trebuchet by LineageOS.
the class TaskView method setOrientationState.
public void setOrientationState(RecentsOrientedState orientationState) {
PagedOrientationHandler orientationHandler = orientationState.getOrientationHandler();
boolean isRtl = getLayoutDirection() == LAYOUT_DIRECTION_RTL;
LayoutParams snapshotParams = (LayoutParams) mSnapshotView.getLayoutParams();
int thumbnailPadding = (int) getResources().getDimension(R.dimen.task_thumbnail_top_margin);
LayoutParams iconParams = (LayoutParams) mIconView.getLayoutParams();
switch(orientationHandler.getRotation()) {
case ROTATION_90:
iconParams.gravity = (isRtl ? START : END) | CENTER_VERTICAL;
iconParams.rightMargin = -thumbnailPadding;
iconParams.leftMargin = 0;
iconParams.topMargin = snapshotParams.topMargin / 2;
break;
case ROTATION_180:
iconParams.gravity = BOTTOM | CENTER_HORIZONTAL;
iconParams.bottomMargin = -thumbnailPadding;
iconParams.leftMargin = iconParams.topMargin = iconParams.rightMargin = 0;
break;
case ROTATION_270:
iconParams.gravity = (isRtl ? END : START) | CENTER_VERTICAL;
iconParams.leftMargin = -thumbnailPadding;
iconParams.rightMargin = 0;
iconParams.topMargin = snapshotParams.topMargin / 2;
break;
case Surface.ROTATION_0:
default:
iconParams.gravity = TOP | CENTER_HORIZONTAL;
iconParams.leftMargin = iconParams.topMargin = iconParams.rightMargin = 0;
break;
}
mIconView.setLayoutParams(iconParams);
mIconView.setRotation(orientationHandler.getDegreesRotated());
if (mMenuView != null) {
mMenuView.onRotationChanged();
}
}
use of com.android.launcher3.touch.PagedOrientationHandler in project android_packages_apps_Trebuchet by LineageOS.
the class DiscoveryBounce method showForOverviewIfNeeded.
private static void showForOverviewIfNeeded(Launcher launcher, boolean withDelay, PagedOrientationHandler orientationHandler) {
OnboardingPrefs onboardingPrefs = launcher.getOnboardingPrefs();
if (!launcher.isInState(OVERVIEW) || !launcher.hasBeenResumed() || launcher.isForceInvisible() || launcher.getDeviceProfile().isVerticalBarLayout() || !orientationHandler.isLayoutNaturalToLauncher() || onboardingPrefs.getBoolean(OnboardingPrefs.SHELF_BOUNCE_SEEN) || launcher.getSystemService(UserManager.class).isDemoUser() || Utilities.IS_RUNNING_IN_TEST_HARNESS) {
return;
}
if (withDelay) {
new Handler().postDelayed(() -> showForOverviewIfNeeded(launcher, false, orientationHandler), DELAY_MS);
return;
} else if (AbstractFloatingView.getTopOpenView(launcher) != null) {
// TODO: Move these checks to the top and call this method after invalidate handler.
return;
}
onboardingPrefs.incrementEventCount(OnboardingPrefs.SHELF_BOUNCE_COUNT);
new DiscoveryBounce(launcher, (1 - OVERVIEW.getVerticalProgress(launcher))).show(PREDICTION);
}
Aggregations