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

Commit c4fa8c31 authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Changing the state UI logic for normal build and quickStep build

> Creating ShareHandlers for managing UI
> In normal build, hotseat is hidden in overview, while in QuickStepBuild, it is visible

Change-Id: I5f8d35c75b861d912d93fce186b5dd74106184c3
parent 16764588
Loading
Loading
Loading
Loading
+2 −7
Original line number Diff line number Diff line
@@ -16,16 +16,11 @@
package com.android.launcher3.uioverrides;

import static com.android.launcher3.LauncherAnimUtils.OVERVIEW_TRANSITION_MS;
import static com.android.launcher3.Utilities.isAccessibilityEnabled;

import android.graphics.Rect;
import android.view.View;
import android.view.accessibility.AccessibilityNodeInfo;

import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.Workspace;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
import com.android.quickstep.RecentsView;

@@ -37,7 +32,7 @@ public class OverviewState extends LauncherState {
    // The percent to shrink the workspace during overview mode
    public static final float SCALE_FACTOR = 0.7f;

    private static final int STATE_FLAGS = FLAG_SHOW_SCRIM | FLAG_MULTI_PAGE | FLAG_HIDE_HOTSEAT;
    private static final int STATE_FLAGS = FLAG_SHOW_SCRIM | FLAG_MULTI_PAGE;

    public OverviewState(int id) {
        super(id, ContainerType.WORKSPACE, OVERVIEW_TRANSITION_MS, 1f, STATE_FLAGS);
@@ -46,7 +41,7 @@ public class OverviewState extends LauncherState {
    @Override
    public float[] getWorkspaceScaleAndTranslation(Launcher launcher) {
        // TODO: Find a better transition
        return new float[] {SCALE_FACTOR, 0};
        return new float[] {0f, 0};
    }

    @Override
+53 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 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.
 */
package com.android.launcher3.uioverrides;

import static com.android.launcher3.WorkspaceStateTransitionAnimation.NO_ANIM_PROPERTY_SETTER;

import android.animation.AnimatorSet;

import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.LauncherStateManager.AnimationConfig;
import com.android.launcher3.LauncherStateManager.StateHandler;
import com.android.launcher3.WorkspaceStateTransitionAnimation.AnimatedPropertySetter;
import com.android.launcher3.WorkspaceStateTransitionAnimation.PropertySetter;
import com.android.launcher3.anim.AnimationLayerSet;

public class RecentsViewStateController implements StateHandler {

    private final Launcher mLauncher;

    public RecentsViewStateController(Launcher launcher) {
        mLauncher = launcher;
    }

    @Override
    public void setState(LauncherState state) {
        setState(state, NO_ANIM_PROPERTY_SETTER);
    }

    @Override
    public void setStateWithAnimation(LauncherState toState, AnimationLayerSet layerViews,
            AnimatorSet anim, AnimationConfig config) {
        setState(toState, new AnimatedPropertySetter(config.duration, layerViews, anim));
    }

    private void setState(LauncherState state, PropertySetter setter) {
        setter.setViewAlpha(null, mLauncher.getOverviewPanel(),
                state == LauncherState.OVERVIEW ? 1 : 0);
    }
}
+7 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.launcher3.uioverrides;
import android.view.View.AccessibilityDelegate;

import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherStateManager.StateHandler;
import com.android.launcher3.VerticalSwipeController;
import com.android.launcher3.util.TouchController;

@@ -31,4 +32,10 @@ public class UiFactory {
    public static AccessibilityDelegate newPageIndicatorAccessibilityDelegate() {
        return null;
    }

    public static StateHandler[] getStateHandler(Launcher launcher) {
        return new StateHandler[] {
                launcher.getAllAppsController(), launcher.getWorkspace(),
                new RecentsViewStateController(launcher)};
    }
}
+23 −1
Original line number Diff line number Diff line
@@ -17,13 +17,19 @@
package com.android.quickstep;

import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.widget.HorizontalScrollView;

import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Insettable;
import com.android.launcher3.Launcher;
import com.android.launcher3.R;

/**
 * A placeholder view for recents
 */
public class RecentsView extends HorizontalScrollView {
public class RecentsView extends HorizontalScrollView implements Insettable {
    public RecentsView(Context context) {
        this(context, null);
    }
@@ -35,7 +41,23 @@ public class RecentsView extends HorizontalScrollView {
    public RecentsView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        setAlpha(0);
        setVisibility(INVISIBLE);
    }

    public void setViewVisible(boolean isVisible) { }

    @Override
    public void setInsets(Rect insets) {
        MarginLayoutParams lp = (MarginLayoutParams) getLayoutParams();
        lp.topMargin = insets.top;
        lp.bottomMargin = insets.bottom;
        lp.leftMargin = insets.left;
        lp.rightMargin = insets.right;

        DeviceProfile dp = Launcher.getLauncher(getContext()).getDeviceProfile();
        if (!dp.isVerticalBarLayout()) {
             lp.bottomMargin += dp.hotseatBarSizePx + getResources().getDimensionPixelSize(
                     R.dimen.dynamic_grid_min_page_indicator_size);
        }
    }
}
+5 −1
Original line number Diff line number Diff line
@@ -339,7 +339,7 @@ public class Launcher extends BaseActivity

        mDragController = new DragController(this);
        mAllAppsController = new AllAppsTransitionController(this);
        mStateManager = new LauncherStateManager(this, mAllAppsController);
        mStateManager = new LauncherStateManager(this);

        mAppWidgetManager = AppWidgetManagerCompat.getInstance(this);

@@ -1287,6 +1287,10 @@ public class Launcher extends BaseActivity
        }
    }

    public AllAppsTransitionController getAllAppsController() {
        return mAllAppsController;
    }

    public DragLayer getDragLayer() {
        return mDragLayer;
    }
Loading