Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 81bd3f57 authored by Tony Wickham's avatar Tony Wickham Committed by Android (Google) Code Review
Browse files

Merge "Separate some elements to set visibility separately" into ub-launcher3-master

parents 40b80597 bd6f05e0
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ import android.view.View;
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
import com.android.launcher3.allapps.AllAppsContainerView;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;

@@ -86,7 +85,7 @@ public class AllAppsState extends LauncherState {

    @Override
    public int getVisibleElements(Launcher launcher) {
        return ALL_APPS_HEADER | ALL_APPS_CONTENT;
        return ALL_APPS_HEADER | ALL_APPS_HEADER_EXTRA | ALL_APPS_CONTENT;
    }

    @Override
+4 −3
Original line number Diff line number Diff line
@@ -111,16 +111,17 @@ public class OverviewState extends LauncherState {
    public int getVisibleElements(Launcher launcher) {
        if (launcher.getDeviceProfile().isVerticalBarLayout()) {
            // TODO: Remove hotseat from overview
            return HOTSEAT;
            return HOTSEAT_ICONS;
        } else {
            return launcher.getAppsView().getFloatingHeaderView().hasVisibleContent()
                    ? ALL_APPS_HEADER : HOTSEAT;
                    ? HOTSEAT_EXTRA | ALL_APPS_HEADER_EXTRA : HOTSEAT_ICONS | HOTSEAT_EXTRA;
        }
    }

    @Override
    public float getVerticalProgress(Launcher launcher) {
        if (getVisibleElements(launcher) == HOTSEAT) {
        if ((getVisibleElements(launcher) & ALL_APPS_HEADER_EXTRA) == 0) {
            // We have no all apps content, so we're still at the fully down progress.
            return super.getVerticalProgress(launcher);
        }
        return 1 - (getDefaultSwipeHeight(launcher)
+7 −0
Original line number Diff line number Diff line
@@ -17,11 +17,14 @@
package com.android.launcher3.uioverrides;

import android.content.Context;
import android.view.View;
import android.view.View.AccessibilityDelegate;

import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.Hotseat;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherStateManager.StateHandler;
import com.android.launcher3.R;
import com.android.launcher3.util.TouchController;
import com.android.quickstep.OverviewInteractionState;
import com.android.quickstep.RecentsModel;
@@ -84,4 +87,8 @@ public class UiFactory {
            model.onTrimMemory(level);
        }
    }

    public static View getHotseatExtraContent(Hotseat hotseat) {
        return hotseat.findViewById(R.id.search_container_hotseat);
    }
}
+9 −4
Original line number Diff line number Diff line
@@ -46,9 +46,11 @@ public class LauncherState {
     * Note that workspace is not included here as in that case, we animate individual pages
     */
    public static final int NONE = 0;
    public static final int HOTSEAT = 1 << 0;
    public static final int ALL_APPS_HEADER = 1 << 1;
    public static final int ALL_APPS_CONTENT = 1 << 2;
    public static final int HOTSEAT_ICONS = 1 << 0;
    public static final int HOTSEAT_EXTRA = 1 << 1; // e.g. a search box
    public static final int ALL_APPS_HEADER = 1 << 2;
    public static final int ALL_APPS_HEADER_EXTRA = 1 << 3; // e.g. app predictions
    public static final int ALL_APPS_CONTENT = 1 << 4;

    protected static final int FLAG_SHOW_SCRIM = 1 << 0;
    protected static final int FLAG_MULTI_PAGE = 1 << 1;
@@ -193,7 +195,10 @@ public class LauncherState {
    }

    public int getVisibleElements(Launcher launcher) {
        return HOTSEAT;
        if (launcher.getDeviceProfile().isVerticalBarLayout()) {
            return HOTSEAT_ICONS;
        }
        return HOTSEAT_ICONS | HOTSEAT_EXTRA;
    }

    /**
+10 −12
Original line number Diff line number Diff line
@@ -18,16 +18,10 @@ package com.android.launcher3;

import static com.android.launcher3.LauncherAnimUtils.DRAWABLE_ALPHA;
import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY;
import static com.android.launcher3.LauncherState.HOTSEAT;
import static com.android.launcher3.LauncherState.HOTSEAT_EXTRA;
import static com.android.launcher3.LauncherState.HOTSEAT_ICONS;
import static com.android.launcher3.anim.PropertySetter.NO_ANIM_PROPERTY_SETTER;
import static com.android.launcher3.compat.AccessibilityManagerCompat.isAccessibilityEnabled;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
import android.util.Property;

import android.view.View;

import com.android.launcher3.LauncherState.PageAlphaProvider;
@@ -36,6 +30,7 @@ import com.android.launcher3.anim.AnimatorSetBuilder;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.anim.PropertySetter;
import com.android.launcher3.graphics.ViewScrim;
import com.android.launcher3.uioverrides.UiFactory;

/**
 * Manages the animations between each of the workspace states.
@@ -85,11 +80,14 @@ public class WorkspaceStateTransitionAnimation {
                scaleAndTranslation[2], Interpolators.ZOOM_IN);

        int elements = state.getVisibleElements(mLauncher);
        float hotseatAlpha = (elements & HOTSEAT) != 0 ? 1 : 0;
        propertySetter.setViewAlpha(mLauncher.getHotseat(), hotseatAlpha,
        float hotseatIconsAlpha = (elements & HOTSEAT_ICONS) != 0 ? 1 : 0;
        float hotseatExtraAlpha = (elements & HOTSEAT_EXTRA) != 0 ? 1 : 0;
        propertySetter.setViewAlpha(mLauncher.getHotseat().getLayout(), hotseatIconsAlpha,
                pageAlphaProvider.interpolator);
        propertySetter.setViewAlpha(UiFactory.getHotseatExtraContent(mLauncher.getHotseat()),
                hotseatExtraAlpha, pageAlphaProvider.interpolator);
        propertySetter.setViewAlpha(mLauncher.getWorkspace().getPageIndicator(),
                hotseatAlpha, pageAlphaProvider.interpolator);
                hotseatIconsAlpha, pageAlphaProvider.interpolator);

        // Set scrim
        propertySetter.setFloat(ViewScrim.get(mWorkspace), ViewScrim.PROGRESS,
Loading