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

Commit 81b4c7bb authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Adding a custom view for DragHandle

> Separating page indicator and drag handle
> Page indicator always draws irrespactive of oriantation
> Drag handle is responsible for accessibility interactions
> Adding assissibility actions for DragHandle

Bug: 72500733
Change-Id: I9030337456964af1bdf77f1c01956452321f9229
parent 864ae5a2
Loading
Loading
Loading
Loading
+23 −0
Original line number Original line Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2018 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.views.QuickstepDragIndicator
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/drag_indicator"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:contentDescription="@string/accessibility_desc_recent_apps"
    android:scaleType="centerInside"
    android:tint="?attr/workspaceTextColor" />
+3 −0
Original line number Original line Diff line number Diff line
@@ -29,4 +29,7 @@


    <!-- Text that shows above the navigation bar after launching a few apps -->
    <!-- Text that shows above the navigation bar after launching a few apps -->
    <string name="recents_swipe_up_onboarding">Swipe up from the bottom to switch apps</string>
    <string name="recents_swipe_up_onboarding">Swipe up from the bottom to switch apps</string>

    <!-- Content description for the recent apps panel (not shown on the screen). [CHAR LIMIT=NONE] -->
    <string name="accessibility_desc_recent_apps">Overview</string>
</resources>
</resources>
 No newline at end of file
+3 −2
Original line number Original line Diff line number Diff line
@@ -113,8 +113,9 @@ public class OverviewState extends LauncherState {
            // TODO: Remove hotseat from overview
            // TODO: Remove hotseat from overview
            return HOTSEAT_ICONS;
            return HOTSEAT_ICONS;
        } else {
        } else {
            return launcher.getAppsView().getFloatingHeaderView().hasVisibleContent()
            return HOTSEAT_SEARCH_BOX | DRAG_HANDLE_INDICATOR |
                    ? HOTSEAT_EXTRA | ALL_APPS_HEADER_EXTRA : HOTSEAT_ICONS | HOTSEAT_EXTRA;
                    (launcher.getAppsView().getFloatingHeaderView().hasVisibleContent()
                            ? ALL_APPS_HEADER_EXTRA : HOTSEAT_ICONS);
        }
        }
    }
    }


+0 −15
Original line number Original line Diff line number Diff line
@@ -21,14 +21,10 @@ import static com.android.quickstep.OverviewInteractionState.KEY_SWIPE_UP_ENABLE


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


import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.Hotseat;
import com.android.launcher3.Launcher;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherStateManager.StateHandler;
import com.android.launcher3.LauncherStateManager.StateHandler;
import com.android.launcher3.R;
import com.android.launcher3.util.TouchController;
import com.android.launcher3.util.TouchController;
import com.android.quickstep.OverviewInteractionState;
import com.android.quickstep.OverviewInteractionState;
import com.android.quickstep.RecentsModel;
import com.android.quickstep.RecentsModel;
@@ -59,10 +55,6 @@ public class UiFactory {
        }
        }
    }
    }


    public static AccessibilityDelegate newPageIndicatorAccessibilityDelegate() {
        return null;
    }

    public static StateHandler[] getStateHandler(Launcher launcher) {
    public static StateHandler[] getStateHandler(Launcher launcher) {
        return new StateHandler[] {
        return new StateHandler[] {
                launcher.getAllAppsController(), launcher.getWorkspace(),
                launcher.getAllAppsController(), launcher.getWorkspace(),
@@ -99,11 +91,4 @@ public class UiFactory {
            model.onTrimMemory(level);
            model.onTrimMemory(level);
        }
        }
    }
    }

    public static View[] getHotseatExtraContent(Hotseat hotseat) {
        return new View[] {
                hotseat.findViewById(R.id.drag_indicator),
                hotseat.findViewById(R.id.search_container_hotseat),
        };
    }
}
}
+78 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2018 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.views;

import static com.android.launcher3.LauncherState.ALL_APPS;
import static com.android.launcher3.LauncherState.OVERVIEW;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.accessibility.AccessibilityNodeInfo;

import com.android.launcher3.R;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
import com.android.launcher3.userevent.nano.LauncherLogProto.ControlType;
import com.android.launcher3.views.LauncherDragIndicator;

public class QuickstepDragIndicator extends LauncherDragIndicator {

    public QuickstepDragIndicator(Context context) {
        super(context);
    }

    public QuickstepDragIndicator(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public QuickstepDragIndicator(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    private boolean isInOverview() {
        return mLauncher.isInState(OVERVIEW);
    }

    @Override
    public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
        super.onInitializeAccessibilityNodeInfo(info);
        if (isInOverview()) {
            info.setContentDescription(getContext().getString(R.string.all_apps_button_label));
        }
    }

    @Override
    protected void initCustomActions(AccessibilityNodeInfo info) {
        if (!isInOverview()) {
            super.initCustomActions(info);
        }
    }

    @Override
    public void onClick(View view) {
        if (isInOverview()) {
            mLauncher.getUserEventDispatcher().logActionOnControl(
                    Action.Touch.TAP, ControlType.ALL_APPS_BUTTON, ContainerType.TASKSWITCHER);
            mLauncher.getStateManager().goToState(ALL_APPS);
            super.onClick(view);
        } else {
            mLauncher.getUserEventDispatcher().logActionOnControl(
                    Action.Touch.TAP, ControlType.ALL_APPS_BUTTON, ContainerType.WORKSPACE);
            mLauncher.getStateManager().goToState(OVERVIEW);
        }
    }
}
Loading