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

Commit 66176c74 authored by Brandon Dayauon's avatar Brandon Dayauon Committed by Android (Google) Code Review
Browse files

Merge "Make all apps text focusable by accessibility." into 24D1-dev

parents a876ea9e deb2e2c3
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -28,14 +28,15 @@ import android.text.StaticLayout;
import android.text.TextPaint;
import android.util.AttributeSet;
import android.view.View;
import android.view.accessibility.AccessibilityManager;

import androidx.annotation.ColorInt;
import androidx.core.content.ContextCompat;

import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.allapps.FloatingHeaderRow;
import com.android.launcher3.allapps.FloatingHeaderView;
import com.android.launcher3.util.Themes;

/**
 * A view which shows a horizontal divider
@@ -54,6 +55,7 @@ public class AppsDividerView extends View implements FloatingHeaderRow {

    private final @ColorInt int mStrokeColor;
    private final @ColorInt int mAllAppsLabelTextColor;
    private final AccessibilityManager mAccessibilityManager;

    private Layout mAllAppsLabelLayout;
    private boolean mShowAllAppsLabel;
@@ -87,7 +89,8 @@ public class AppsDividerView extends View implements FloatingHeaderRow {
        mAllAppsLabelTextColor = ContextCompat.getColor(context,
                R.color.material_color_on_surface_variant);

        mShowAllAppsLabel = !ALL_APPS_VISITED_COUNT.hasReachedMax(context);
        mAccessibilityManager = AccessibilityManager.getInstance(context);
        setShowAllAppsLabel(!ALL_APPS_VISITED_COUNT.hasReachedMax(context));
    }

    public void setup(FloatingHeaderView parent, FloatingHeaderRow[] rows, boolean tabsHidden) {
@@ -99,6 +102,9 @@ public class AppsDividerView extends View implements FloatingHeaderRow {

    /** {@code true} if all apps label should be shown in place of divider. */
    public void setShowAllAppsLabel(boolean showAllAppsLabel) {
        if (mAccessibilityManager.isEnabled() && !Utilities.isRunningInTestHarness()) {
            showAllAppsLabel = true;
        }
        if (showAllAppsLabel != mShowAllAppsLabel) {
            mShowAllAppsLabel = showAllAppsLabel;
            updateDividerType();
@@ -148,6 +154,7 @@ public class AppsDividerView extends View implements FloatingHeaderRow {
            mDividerType = dividerType;
            int topPadding;
            int bottomPadding;
            setContentDescription(null);
            switch (dividerType) {
                case LINE:
                    topPadding = 0;
@@ -161,6 +168,7 @@ public class AppsDividerView extends View implements FloatingHeaderRow {
                    bottomPadding = getResources()
                            .getDimensionPixelSize(R.dimen.all_apps_label_bottom_padding);
                    mPaint.setColor(mAllAppsLabelTextColor);
                    setContentDescription(mAllAppsLabelLayout.getText());
                    break;
                case NONE:
                default:
+4 −9
Original line number Diff line number Diff line
@@ -136,21 +136,16 @@ public class QuickstepOnboardingPrefs {
            });
        }

        if (!ALL_APPS_VISITED_COUNT.hasReachedMax(launcher)) {
        if (!Utilities.isRunningInTestHarness()) {
            launcher.getStateManager().addStateListener(new StateListener<LauncherState>() {
                @Override
                public void onStateTransitionComplete(LauncherState finalState) {
                    if (finalState == ALL_APPS) {
                        ALL_APPS_VISITED_COUNT.increment(launcher);
                        return;
                    }

                    boolean hasReachedMaxCount = ALL_APPS_VISITED_COUNT.hasReachedMax(launcher);
                    launcher.getAppsView().getFloatingHeaderView().findFixedRowByType(
                            AppsDividerView.class).setShowAllAppsLabel(!hasReachedMaxCount);
                    if (hasReachedMaxCount) {
                        launcher.getStateManager().removeStateListener(this);
                    }
                    launcher.getAppsView().getFloatingHeaderView()
                            .findFixedRowByType(AppsDividerView.class)
                            .setShowAllAppsLabel(!ALL_APPS_VISITED_COUNT.hasReachedMax(launcher));
                }
            });
        }