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

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

Separing the overview states for normal and quickstep builds

In QuickStep, adding a placeholder ScrollView and changing the state logic
appropriately to handle that

Change-Id: I10223c0692788d6e5dbf8c408c01cafb4e39bd2c
parent 8b0a647a
Loading
Loading
Loading
Loading
+48 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     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.
-->
<com.android.quickstep.RecentsView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:theme="@style/HomeScreenElementTheme"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center_horizontal|bottom"
    android:gravity="top">

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:orientation="horizontal">

        <View
            android:layout_width="300dp"
            android:layout_height="match_parent"
            android:background="#44FF0000"
            android:layout_marginEnd="10dp"/>

        <View
            android:layout_width="300dp"
            android:layout_height="match_parent"
            android:background="#4400FF00"
            android:layout_marginEnd="10dp"/>

        <View
            android:layout_width="300dp"
            android:layout_height="match_parent"
            android:background="#440000FF" />
    </LinearLayout>

</com.android.quickstep.RecentsView>
 No newline at end of file
+5 −22
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ 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;

/**
 * Definition for overview state
@@ -44,36 +45,18 @@ public class OverviewState extends LauncherState {

    @Override
    public float[] getWorkspaceScaleAndTranslation(Launcher launcher) {
        DeviceProfile grid = launcher.getDeviceProfile();
        Workspace ws = launcher.getWorkspace();
        Rect insets = launcher.getDragLayer().getInsets();

        int overviewButtonBarHeight = grid.getOverviewModeButtonBarHeight();
        int scaledHeight = (int) (SCALE_FACTOR * ws.getNormalChildHeight());
        Rect workspacePadding = grid.getWorkspacePadding(null);
        int workspaceTop = insets.top + workspacePadding.top;
        int workspaceBottom = ws.getViewportHeight() - insets.bottom - workspacePadding.bottom;
        int overviewTop = insets.top;
        int overviewBottom = ws.getViewportHeight() - insets.bottom - overviewButtonBarHeight;
        int workspaceOffsetTopEdge =
                workspaceTop + ((workspaceBottom - workspaceTop) - scaledHeight) / 2;
        int overviewOffsetTopEdge = overviewTop + (overviewBottom - overviewTop - scaledHeight) / 2;
        return new float[] {SCALE_FACTOR, -workspaceOffsetTopEdge + overviewOffsetTopEdge };
        // TODO: Find a better transition
        return new float[] {SCALE_FACTOR, 0};
    }

    @Override
    public void onStateEnabled(Launcher launcher) {
        launcher.getWorkspace().setPageRearrangeEnabled(true);

        if (isAccessibilityEnabled(launcher)) {
            launcher.getOverviewPanel().getChildAt(0).performAccessibilityAction(
                    AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS, null);
        }
        ((RecentsView) launcher.getOverviewPanel()).setViewVisible(true);
    }

    @Override
    public void onStateDisabled(Launcher launcher) {
        launcher.getWorkspace().setPageRearrangeEnabled(false);
        ((RecentsView) launcher.getOverviewPanel()).setViewVisible(false);
    }

    @Override
+6 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.launcher3.uioverrides;

import android.view.View.AccessibilityDelegate;

import com.android.launcher3.Launcher;
import com.android.launcher3.VerticalSwipeController;
import com.android.launcher3.util.TouchController;
@@ -25,4 +27,8 @@ public class UiFactory {
    public static TouchController[] createTouchControllers(Launcher launcher) {
        return new TouchController[] {new VerticalSwipeController(launcher)};
    }

    public static AccessibilityDelegate newPageIndicatorAccessibilityDelegate() {
        return null;
    }
}
+41 −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.quickstep;

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

/**
 * A placeholder view for recents
 */
public class RecentsView extends HorizontalScrollView {
    public RecentsView(Context context) {
        this(context, null);
    }

    public RecentsView(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public RecentsView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        setAlpha(0);
    }

    public void setViewVisible(boolean isVisible) { }
}
+2 −4
Original line number Diff line number Diff line
@@ -14,11 +14,9 @@
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<LinearLayout
<com.android.launcher3.uioverrides.OverviewPanel
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:launcher="http://schemas.android.com/apk/res-auto"
      android:theme="@style/HomeScreenElementTheme"
      launcher:layout_ignoreInsets="true"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_gravity="center_horizontal|bottom"
@@ -73,4 +71,4 @@
        android:textColor="?attr/workspaceTextColor"
        android:textSize="12sp" />

</LinearLayout>
 No newline at end of file
</com.android.launcher3.uioverrides.OverviewPanel>
 No newline at end of file
Loading