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

Commit c47d8a02 authored by Steven Ng's avatar Steven Ng Committed by Android (Google) Code Review
Browse files

Merge "Add a scrim underneath the top section of search & recommendation UI" into sc-dev

parents d727db3c 3503e6fa
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2021 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.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="rectangle">
            <solid android:color="?android:attr/colorBackground" />
            <padding android:top="16dp"/>
        </shape>
    </item>
    <item android:gravity="center">
        <shape android:shape="rectangle">
            <solid android:color="?android:attr/textColorSecondary" />
            <size android:width="48dp" android:height="2dp" />
        </shape>
    </item>
</layer-list>
 No newline at end of file
+22 −13
Original line number Diff line number Diff line
@@ -18,35 +18,44 @@
    android:id="@+id/search_and_recommendations_container"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingHorizontal="16dp"
    android:layout_marginBottom="16dp"
    android:orientation="vertical"
    android:clipToPadding="false">
    android:orientation="vertical">

    <View
        android:id="@+id/collapse_handle"
        android:layout_width="48dp"
        android:layout_height="2dp"
        android:layout_marginTop="16dp"
        android:elevation="2dp"
        android:layout_gravity="center_horizontal"
        android:background="?android:attr/textColorSecondary"/>
        android:layout_width="match_parent"
        android:layout_height="18dp"
        android:elevation="0.1dp"
        android:background="@drawable/bg_widgets_picker_handle"/>

    <TextView
        android:id="@+id/title"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center_horizontal"
        android:textSize="24sp"
        android:layout_marginTop="16dp"
        android:layout_marginTop="24dp"
        android:textColor="?android:attr/textColorSecondary"
        android:text="@string/widget_button_text"/>

    <FrameLayout
        android:id="@+id/search_bar_container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:elevation="0.1dp"
        android:background="?android:attr/colorBackground"
        android:paddingBottom="8dp"
        android:clipToPadding="false">
        <include layout="@layout/widgets_search_bar" />
    </FrameLayout>

    <com.android.launcher3.widget.picker.WidgetsRecommendationTableLayout
        android:id="@+id/recommended_widget_table"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginHorizontal="16dp"
        android:layout_marginTop="8dp"
        android:background="@drawable/widgets_recommendation_background"
        android:paddingVertical="@dimen/recommended_widgets_table_vertical_padding"
        android:layout_marginTop="16dp"
        android:visibility="gone" />
</com.android.launcher3.widget.picker.SearchAndRecommendationsView>
+3 −4
Original line number Diff line number Diff line
@@ -5,10 +5,9 @@
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:layout_marginTop="16dp"
    android:layout_marginBottom="1dp"
    android:background="@drawable/bg_widgets_searchbox"
    android:elevation="2dp">
    android:layout_marginTop="24dp"
    android:layout_marginHorizontal="16dp"
    android:background="@drawable/bg_widgets_searchbox">

    <com.android.launcher3.ExtendedEditText
        android:id="@+id/widgets_search_bar_edit_text"
+4 −4
Original line number Diff line number Diff line
@@ -101,7 +101,7 @@ final class SearchAndRecommendationsScrollController implements
        mCurrentRecyclerView.setOnContentChangeListener(mOnContentChangeListener);
        mViewHolder.mHeaderTitle.setTranslationY(0);
        mViewHolder.mRecommendedWidgetsTable.setTranslationY(0);
        mViewHolder.mSearchBar.setTranslationY(0);
        mViewHolder.mSearchBarContainer.setTranslationY(0);

        if (mHasWorkProfile) {
            mPrimaryWorkTabsView.setTranslationY(0);
@@ -120,7 +120,7 @@ final class SearchAndRecommendationsScrollController implements
        mCollapsibleHeightForRecommendation =
                measureHeightWithVerticalMargins(mViewHolder.mHeaderTitle)
                        + measureHeightWithVerticalMargins(mViewHolder.mCollapseHandle)
                        + measureHeightWithVerticalMargins((View) mViewHolder.mSearchBar)
                        + measureHeightWithVerticalMargins((View) mViewHolder.mSearchBarContainer)
                        + measureHeightWithVerticalMargins(mViewHolder.mRecommendedWidgetsTable);

        int topContainerHeight = measureHeightWithVerticalMargins(mViewHolder.mContainer);
@@ -243,7 +243,7 @@ final class SearchAndRecommendationsScrollController implements

        if (mCollapsibleHeightForSearch > 0) {
            int searchYDisplacement = Math.max(-recyclerViewYOffset, -mCollapsibleHeightForSearch);
            mViewHolder.mSearchBar.setTranslationY(searchYDisplacement);
            mViewHolder.mSearchBarContainer.setTranslationY(searchYDisplacement);
        }

        if (mHasWorkProfile && mCollapsibleHeightForTabs > 0) {
@@ -255,7 +255,7 @@ final class SearchAndRecommendationsScrollController implements
    /** Resets any previous view translation. */
    public void reset() {
        mViewHolder.mHeaderTitle.setTranslationY(0);
        mViewHolder.mSearchBar.setTranslationY(0);
        mViewHolder.mSearchBarContainer.setTranslationY(0);
        if (mHasWorkProfile) {
            mPrimaryWorkTabsView.setTranslationY(0);
        }
+2 −0
Original line number Diff line number Diff line
@@ -713,6 +713,7 @@ public class WidgetsFullSheet extends BaseWidgetSheet
    final class SearchAndRecommendationViewHolder {
        final SearchAndRecommendationsView mContainer;
        final View mCollapseHandle;
        final View mSearchBarContainer;
        final WidgetsSearchBar mSearchBar;
        final TextView mHeaderTitle;
        final WidgetsRecommendationTableLayout mRecommendedWidgetsTable;
@@ -721,6 +722,7 @@ public class WidgetsFullSheet extends BaseWidgetSheet
                SearchAndRecommendationsView searchAndRecommendationContainer) {
            mContainer = searchAndRecommendationContainer;
            mCollapseHandle = mContainer.findViewById(R.id.collapse_handle);
            mSearchBarContainer = mContainer.findViewById(R.id.search_bar_container);
            mSearchBar = mContainer.findViewById(R.id.widgets_search_bar);
            mHeaderTitle = mContainer.findViewById(R.id.title);
            mRecommendedWidgetsTable = mContainer.findViewById(R.id.recommended_widget_table);