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

Commit f01f25b5 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fixing actions view getting visible sometimes" into ub-launcher3-rvc-dev

parents 12cf1e54 01d8541f
Loading
Loading
Loading
Loading
+17 −9
Original line number Diff line number Diff line
@@ -13,8 +13,10 @@
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<merge xmlns:android="http://schemas.android.com/apk/res/android">

    <com.android.quickstep.views.LauncherRecentsView
    xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/overview_panel"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:accessibilityPaneTitle="@string/accessibility_recent_apps"
@@ -22,3 +24,9 @@
        android:clipToPadding="false"
        android:theme="@style/HomeScreenElementTheme"
        android:visibility="invisible" />

    <include
        android:id="@+id/overview_actions_view"
        layout="@layout/overview_actions_container" />

</merge>
+6 −17
Original line number Diff line number Diff line
@@ -15,20 +15,14 @@
 */
package com.android.launcher3.uioverrides;

import static com.android.launcher3.LauncherAnimUtils.VIEW_ALPHA;
import static com.android.launcher3.LauncherState.OVERVIEW_BUTTONS;
import static com.android.launcher3.anim.Interpolators.AGGRESSIVE_EASE_IN_OUT;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_FADE;
import static com.android.quickstep.views.RecentsView.CONTENT_ALPHA;
import static com.android.quickstep.views.RecentsView.FULLSCREEN_PROGRESS;

import android.annotation.TargetApi;
import android.os.Build;
import android.util.FloatProperty;
import android.view.Surface;
import android.view.View;
import android.view.animation.Interpolator;

import androidx.annotation.NonNull;

@@ -38,6 +32,7 @@ import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.anim.PropertySetter;
import com.android.launcher3.states.StateAnimationConfig;
import com.android.launcher3.util.MultiValueAlpha;
import com.android.quickstep.views.ClearAllButton;
import com.android.quickstep.views.LauncherRecentsView;
import com.android.quickstep.views.RecentsView;
@@ -61,7 +56,7 @@ public final class RecentsViewStateController extends
            mRecentsView.updateEmptyMessage();
            mRecentsView.resetTaskVisuals();
        }
        setAlphas(PropertySetter.NO_ANIM_PROPERTY_SETTER, state, LINEAR);
        setAlphas(PropertySetter.NO_ANIM_PROPERTY_SETTER, state);
        mRecentsView.setFullscreenProgress(state.getOverviewFullscreenProgress());
    }

@@ -79,23 +74,17 @@ public final class RecentsViewStateController extends
                    AnimationSuccessListener.forRunnable(mRecentsView::resetTaskVisuals));
        }

        setAlphas(builder, toState,
                config.getInterpolator(ANIM_OVERVIEW_FADE, AGGRESSIVE_EASE_IN_OUT));
        setAlphas(builder, toState);
        builder.setFloat(mRecentsView, FULLSCREEN_PROGRESS,
                toState.getOverviewFullscreenProgress(), LINEAR);
    }

    private void setAlphas(PropertySetter propertySetter, LauncherState state,
            Interpolator actionInterpolator) {
    private void setAlphas(PropertySetter propertySetter, LauncherState state) {
        float buttonAlpha = (state.getVisibleElements(mLauncher) & OVERVIEW_BUTTONS) != 0 ? 1 : 0;
        propertySetter.setFloat(mRecentsView.getClearAllButton(), ClearAllButton.VISIBILITY_ALPHA,
                buttonAlpha, LINEAR);

        View actionsView = mLauncher.getActionsView();
        int launcherRotation = mRecentsView.getPagedViewOrientedState().getLauncherRotation();
        if (actionsView != null && launcherRotation == Surface.ROTATION_0) {
            propertySetter.setViewAlpha(actionsView, buttonAlpha, actionInterpolator);
        }
        propertySetter.setFloat(mLauncher.getActionsView().getVisibilityAlpha(),
                MultiValueAlpha.VALUE, buttonAlpha, LINEAR);
    }

    @Override
+4 −3
Original line number Diff line number Diff line
@@ -42,9 +42,10 @@ import java.util.function.Supplier;
public class ImageActionsApi {

    private static final String TAG = BuildConfig.APPLICATION_ID + "ImageActionsApi";
    private final Context mContext;
    private final Supplier<Bitmap> mBitmapSupplier;
    private final SystemUiProxy mSystemUiProxy;

    protected final Context mContext;
    protected final Supplier<Bitmap> mBitmapSupplier;
    protected final SystemUiProxy mSystemUiProxy;

    public ImageActionsApi(Context context, Supplier<Bitmap> bitmapSupplier) {
        mContext = context;
+1 −0
Original line number Diff line number Diff line
@@ -71,6 +71,7 @@ public final class RecentsActivity extends BaseRecentsActivity {
        mRecentsRootView = findViewById(R.id.drag_layer);
        mFallbackRecentsView = findViewById(R.id.overview_panel);
        mRecentsRootView.recreateControllers();
        mFallbackRecentsView.init(findViewById(R.id.overview_actions_view));
    }

    @Override
+36 −25
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.quickstep;

import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS;
import static com.android.launcher3.util.MainThreadInitializedObject.forOverride;

import android.content.Context;
@@ -84,32 +83,33 @@ public class TaskOverlayFactory implements ResourceBasedOverride {
    /**
     * Overlay on each task handling Overview Action Buttons.
     */
    public static class TaskOverlay {
    public static class TaskOverlay<T extends OverviewActionsView> {

        private final Context mApplicationContext;
        private OverviewActionsView mActionsView;
        private final TaskThumbnailView mThumbnailView;
        protected final TaskThumbnailView mThumbnailView;

        private T mActionsView;

        protected TaskOverlay(TaskThumbnailView taskThumbnailView) {
            mApplicationContext = taskThumbnailView.getContext().getApplicationContext();
            mThumbnailView = taskThumbnailView;
        }

        protected T getActionsView() {
            if (mActionsView == null) {
                mActionsView = BaseActivity.fromContext(mThumbnailView.getContext()).findViewById(
                        R.id.overview_actions_view);
            }
            return mActionsView;
        }

        /**
         * Called when the current task is interactive for the user
         */
        public void initOverlay(Task task, ThumbnailData thumbnail, Matrix matrix) {
            ImageActionsApi imageApi = new ImageActionsApi(
                    mApplicationContext, mThumbnailView::getThumbnail);

            if (mActionsView == null && ENABLE_OVERVIEW_ACTIONS.get()
                    && SysUINavigationMode.removeShelfFromOverview(mApplicationContext)) {
                mActionsView = BaseActivity.fromContext(mThumbnailView.getContext()).findViewById(
                        R.id.overview_actions_view);
            }
            if (mActionsView != null) {
                mActionsView.setListener(new OverviewActionsView.Listener() {
            getActionsView().setCallbacks(new OverlayUICallbacks() {
                @Override
                public void onShare() {
                    imageApi.startShareActivity();
@@ -123,7 +123,6 @@ public class TaskOverlayFactory implements ResourceBasedOverride {
            });
        }

        }

        /**
         * Called when the overlay is no longer used.
@@ -161,4 +160,16 @@ public class TaskOverlayFactory implements ResourceBasedOverride {
            return Insets.of(0, 0, 0, 0);
        }
    }

    /**
     * Callbacks the Ui can generate. This is the only way for a Ui to call methods on the
     * controller.
     */
    public interface OverlayUICallbacks {
        /** User has indicated they want to share the current task. */
        void onShare();

        /** User has indicated they want to screenshot the current task. */
        void onScreenshot();
    }
}
Loading