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

Commit 7a620d36 authored by sfufa@google.com's avatar sfufa@google.com
Browse files

[Search] Hide A-Z list when search is entered from QSB

preview attached to bug report

Bug: 201781284
Test: manual
Change-Id: I572360d2d49b38577a7d77115aede4c3269d42e9
parent 3b6b03b7
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -53,8 +53,6 @@

    <!-- Accessibility title for the row of all-apps containing app predictions. [CHAR LIMIT=50] -->
    <string name="title_app_suggestions">App suggestions</string>
    <!-- Label for the header text of the All Apps section in All Apps view, used to separate Predicted Apps and Actions section from All Apps section. [CHAR_LIMIT=50] -->
    <string name="all_apps_label">All apps</string>
    <!-- Text of the tip when user lands in all apps view for the first time, indicating where the tip toast points to is the predicted apps section. [CHAR_LIMIT=50] -->
    <string name="all_apps_prediction_tip">Your predicted apps</string>

+11 −2
Original line number Diff line number Diff line
@@ -42,10 +42,19 @@
        <include layout="@layout/floating_header_content" />

        <include layout="@layout/all_apps_personal_work_tabs" />

        <Button
            android:id="@+id/all_apps_button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:text="@string/all_apps_label"
            android:background="@drawable/padded_rounded_action_button"
            android:visibility="gone"/>

    </com.android.launcher3.allapps.FloatingHeaderView>

    <include
        layout="@layout/search_container_all_apps"/>
    <include layout="@layout/search_container_all_apps" />

    <include layout="@layout/all_apps_fast_scroller" />
</com.android.launcher3.allapps.LauncherAllAppsContainerView>
 No newline at end of file
+1 −0
Original line number Diff line number Diff line
@@ -103,6 +103,7 @@
    <dimen name="all_apps_tabs_vertical_padding">6dp</dimen>
    <dimen name="all_apps_divider_height">2dp</dimen>
    <dimen name="all_apps_divider_width">128dp</dimen>
    <dimen name="all_apps_content_fade_in_offset">150dp</dimen>

    <dimen name="all_apps_tip_bottom_margin">8dp</dimen>
    <!-- The size of corner radius of the arrow in the arrow toast. -->
+5 −4
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
/*
* Copyright (C) 2008 The Android Open Source Project
*
@@ -132,6 +131,8 @@
    <string name="all_apps_search_market_message">Search for more apps</string>
    <!-- Label for an icon representing any generic app. [CHAR_LIMIT=50] -->
    <string name="label_application">App</string>
    <!-- Label for the header text of the All Apps section in All Apps view, used to separate Predicted Apps and Actions section from All Apps section. [CHAR_LIMIT=50] -->
    <string name="all_apps_label">All apps</string>

    <!-- Popup items -->
    <!-- Text to display as the header above notifications. [CHAR_LIMIT=30] -->
+51 −0
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ public class FloatingHeaderView extends LinearLayout implements
        ValueAnimator.AnimatorUpdateListener, PluginListener<AllAppsRow>, Insettable,
        OnHeightUpdatedListener {

    private static final long ALL_APPS_CONTENT_ANIM_DURATION = 150;
    private final Rect mRVClip = new Rect(0, 0, Integer.MAX_VALUE, Integer.MAX_VALUE);
    private final Rect mHeaderClip = new Rect(0, 0, Integer.MAX_VALUE, Integer.MAX_VALUE);
    private final ValueAnimator mAnimator = ValueAnimator.ofInt(0, 0);
@@ -108,6 +109,14 @@ public class FloatingHeaderView extends LinearLayout implements
    // enabled or disabled, and represent the current set of all rows.
    private FloatingHeaderRow[] mAllRows = FloatingHeaderRow.NO_ROWS;


    // members for handling suggestion state
    private final ValueAnimator mAllAppsContentAnimator = ValueAnimator.ofFloat(0, 0);
    private View mAllAppsButton;
    private int mAllAppsContentFadeInOffset;
    private boolean mInSuggestionMode = false;


    public FloatingHeaderView(@NonNull Context context) {
        this(context, null);
    }
@@ -118,12 +127,20 @@ public class FloatingHeaderView extends LinearLayout implements
                .getDimensionPixelSize(R.dimen.all_apps_header_top_padding);
        mHeaderProtectionSupported = context.getResources().getBoolean(
                R.bool.config_header_protection_supported);
        mAllAppsContentFadeInOffset = context.getResources()
                .getDimensionPixelSize(R.dimen.all_apps_content_fade_in_offset);
        mAllAppsContentAnimator.setDuration(ALL_APPS_CONTENT_ANIM_DURATION);
        mAllAppsContentAnimator.addUpdateListener(this::onAllAppsContentAnimationUpdate);
    }

    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();
        mTabLayout = findViewById(R.id.tabs);
        mAllAppsButton = findViewById(R.id.all_apps_button);
        if (mAllAppsButton != null) {
            mAllAppsButton.setOnClickListener(this::onAllAppsButtonClicked);
        }

        // Find all floating header rows.
        ArrayList<FloatingHeaderRow> rows = new ArrayList<>();
@@ -312,6 +329,7 @@ public class FloatingHeaderView extends LinearLayout implements
        }

        mTabLayout.setTranslationY(mTranslationY);
        setSuggestionMode(false);

        int clipHeight = mHeaderTopPadding - getPaddingBottom();
        mRVClip.top = mTabsHidden ? clipHeight : 0;
@@ -347,6 +365,7 @@ public class FloatingHeaderView extends LinearLayout implements
            mTranslationY = 0;
            applyVerticalMove();
        }
        setSuggestionMode(false);
        mHeaderCollapsed = false;
        mSnappedScrolledY = -mMaxTranslation;
        mCurrentRV.scrollToTop();
@@ -442,6 +461,38 @@ public class FloatingHeaderView extends LinearLayout implements
        }
        return Math.max(getHeight() - getPaddingTop() + mTranslationY, 0);
    }

    /**
     * When suggestion mode is enabled, hides AllApps content view and shows AllApps button.
     */
    public void setSuggestionMode(boolean isSuggestMode) {
        if (mInSuggestionMode == isSuggestMode || mAllAppsButton == null) return;
        if (!FeatureFlags.ENABLE_ONE_SEARCH.get()) return;
        AllAppsContainerView allApps = (AllAppsContainerView) getParent();
        mInSuggestionMode = isSuggestMode;
        if (isSuggestMode) {
            mTabLayout.setVisibility(GONE);
            mAllAppsButton.setVisibility(VISIBLE);
            allApps.getContentView().setVisibility(GONE);
        } else {
            mTabLayout.setVisibility(mTabsHidden ? GONE : VISIBLE);
            mAllAppsButton.setVisibility(GONE);
            allApps.getContentView().setVisibility(VISIBLE);
        }
    }

    private void onAllAppsButtonClicked(View view) {
        setSuggestionMode(false);
        mAllAppsContentAnimator.start();
    }

    private void onAllAppsContentAnimationUpdate(ValueAnimator valueAnimator) {
        float prog = valueAnimator.getAnimatedFraction();
        View allAppsList = ((AllAppsContainerView) getParent()).getContentView();
        allAppsList.setAlpha(255 * prog);
        allAppsList.setTranslationY((1 - prog) * mAllAppsContentFadeInOffset);
    }

}