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

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

Adding a carent in the scrim

> Caret is only visible when the accessibility is enabled
> It is visible in NOTMAL and OVERVIEW state and moves out of the
  scrim along with the scrim.
> Acts as an accessible target for various options

Bug: 78172350
Bug: 79215734
Change-Id: I8a968b67e36901859649546295f6491d49cc9ce9
parent 578890ad
Loading
Loading
Loading
Loading
+0 −23
Original line number 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" />
+0 −1
Original line number Diff line number Diff line
@@ -50,5 +50,4 @@
    <dimen name="clear_all_container_width">168dp</dimen>

    <dimen name="shelf_surface_radius">16dp</dimen>
    <dimen name="shelf_surface_top_padding">4dp</dimen>
</resources>
+2 −2
Original line number Diff line number Diff line
@@ -92,9 +92,9 @@ public class OverviewState extends LauncherState {
    @Override
    public int getVisibleElements(Launcher launcher) {
        if (launcher.getDeviceProfile().isVerticalBarLayout()) {
            return DRAG_HANDLE_INDICATOR;
            return 0;
        } else {
            return HOTSEAT_SEARCH_BOX | DRAG_HANDLE_INDICATOR |
            return HOTSEAT_SEARCH_BOX |
                    (launcher.getAppsView().getFloatingHeaderView().hasVisibleContent()
                            ? ALL_APPS_HEADER_EXTRA : HOTSEAT_ICONS);
        }
+1 −2
Original line number Diff line number Diff line
@@ -43,8 +43,7 @@ public class LayoutUtils {
            extraSpace = 0;
        } else {
            Resources res = context.getResources();
            extraSpace = dp.hotseatBarSizePx + res.getDimension(R.dimen.shelf_surface_top_padding)
                    + res.getDimension(R.dimen.shelf_surface_radius);
            extraSpace = dp.hotseatBarSizePx + res.getDimension(R.dimen.vertical_drag_handle_size);
        }
        calculateTaskSize(context, dp, extraSpace, MULTI_WINDOW_STRATEGY_HALF_SCREEN, outRect);
    }
+0 −70
Original line number 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);
        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) {
        mLauncher.getUserEventDispatcher().logActionOnControl(Action.Touch.TAP,
                ControlType.ALL_APPS_BUTTON,
                isInOverview() ? ContainerType.TASKSWITCHER : ContainerType.WORKSPACE);
        mLauncher.getStateManager().goToState(ALL_APPS);
    }
}
Loading