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

Commit 86a8fde1 authored by Mario Bertschler's avatar Mario Bertschler Committed by Android (Google) Code Review
Browse files

Merge "Implementation of PredictionRowView. > Enable to use floating for...

Merge "Implementation of PredictionRowView. > Enable to use floating for prediction row even without tabs. > Behind ALL_APPS_PREDICTION_ROW_VIEW feature flag. > Expand/Collapse personal/work tabs in stopped intermediate state." into ub-launcher3-master
parents 27887b2c 2153e1c8
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -35,8 +35,8 @@
        android:id="@+id/all_apps_header"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:clickable="true"
        android:paddingTop="30dp"
        android:paddingTop="@dimen/all_apps_header_top_padding"
        android:clipToPadding="false"
        android:layout_below="@id/search_container_all_apps" >

        <com.android.launcher3.allapps.PredictionRowView
@@ -44,6 +44,12 @@
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <include layout="@layout/all_apps_divider"
            android:id="@+id/divider"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/tabs" />

        <com.android.launcher3.views.SlidingTabStrip
            android:id="@+id/tabs"
            android:layout_width="match_parent"
@@ -67,7 +73,6 @@
                android:textColor="@color/all_apps_tab_text"
                android:background="?android:attr/selectableItemBackground"/>
        </com.android.launcher3.views.SlidingTabStrip>

    </RelativeLayout>

    <!-- Note: we are reusing/repurposing a system attribute for search layout, because of a
+1 −1
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@
    android:clipChildren="false"
    android:clipToPadding="false"
    android:descendantFocusability="afterDescendants"
    android:paddingTop="30dp">
    android:paddingTop="@dimen/all_apps_header_top_padding">

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

+2 −0
Original line number Diff line number Diff line
@@ -92,6 +92,8 @@
    <dimen name="all_apps_caret_workspace_offset">18dp</dimen>
    <dimen name="all_apps_header_tab_height">50dp</dimen>
    <dimen name="all_apps_tabs_indicator_height">2dp</dimen>
    <dimen name="all_apps_header_top_padding">36dp</dimen>
    <dimen name="all_apps_prediction_row_divider_height">17dp</dimen>

<!-- Search bar in All Apps -->
    <dimen name="all_apps_header_max_elevation">3dp</dimen>
+36 −12
Original line number Diff line number Diff line
@@ -281,6 +281,9 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource,
                mAH[i].recyclerView.scrollToTop();
            }
        }
        if (mFloatingHeaderHandler != null) {
            mFloatingHeaderHandler.reset();
        }
        // Reset the search bar and base recycler view after transitioning home
        mSearchUiManager.reset();
    }
@@ -301,6 +304,7 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource,
        });

        mHeader = findViewById(R.id.all_apps_header);
        mFloatingHeaderHandler = new FloatingHeaderHandler(mHeader);
        rebindAdapters(mUsingTabs);

        mSearchContainer = findViewById(R.id.search_container_all_apps);
@@ -431,10 +435,14 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource,
            mAH[AdapterHolder.WORK].setup(mViewPager.getChildAt(1), mWorkMatcher);
            setupWorkProfileTabs();
            setupHeader();
            mHeader.setVisibility(View.VISIBLE);
        } else {
            mHeader.setVisibility(View.GONE);
            mAH[AdapterHolder.MAIN].setup(findViewById(R.id.apps_list_view), null);
            if (FeatureFlags.ALL_APPS_PREDICTION_ROW_VIEW) {
                setupHeader();
            } else {
                mFloatingHeaderHandler = null;
                mHeader.setVisibility(View.GONE);
            }
        }

        applyTouchDelegate();
@@ -512,7 +520,7 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource,
    }

    public void setPredictedApps(List<ComponentKeyMapper<AppInfo>> apps) {
        if (mUsingTabs) {
        if (mFloatingHeaderHandler != null) {
            mFloatingHeaderHandler.getContentView().setPredictedApps(apps);
        }
        mAH[AdapterHolder.MAIN].appsList.setPredictedApps(apps);
@@ -535,15 +543,24 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource,
    }

    private void setupHeader() {
        mHeader.setVisibility(View.VISIBLE);
        int contentHeight = mLauncher.getDeviceProfile().allAppsCellHeightPx;
        if (!mUsingTabs) {
            contentHeight += getResources()
                    .getDimensionPixelSize(R.dimen.all_apps_prediction_row_divider_height);
        }
        RecyclerView mainRV = mAH[AdapterHolder.MAIN].recyclerView;
        RecyclerView workRV = mAH[AdapterHolder.WORK] != null
                ? mAH[AdapterHolder.WORK].recyclerView : null;
        mFloatingHeaderHandler = new FloatingHeaderHandler(mHeader, mainRV, workRV, contentHeight);
        mFloatingHeaderHandler.getContentView().setNumAppsPerRow(mNumPredictedAppsPerRow);
        mFloatingHeaderHandler.getContentView().setComponentToAppMap(mComponentToAppMap);
        RecyclerView workRV = mAH[AdapterHolder.WORK].recyclerView;
        mFloatingHeaderHandler.setup(mainRV, workRV, contentHeight);
        mFloatingHeaderHandler.getContentView().setup(mAH[AdapterHolder.MAIN].adapter,
                mComponentToAppMap, mNumPredictedAppsPerRow);

        int padding = contentHeight;
        if (!mUsingTabs) {
            padding += mHeader.getPaddingTop() + mHeader.getPaddingBottom();
        }
        for (int i = 0; i < mAH.length; i++) {
            mAH[i].paddingTopForTabs = contentHeight;
            mAH[i].paddingTopForTabs = padding;
            mAH[i].applyPadding();
        }
    }
@@ -556,9 +573,11 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource,

    public void onSearchResultsChanged() {
        for (int i = 0; i < mAH.length; i++) {
            if (mAH[i].recyclerView != null) {
                mAH[i].recyclerView.onSearchResultsChanged();
            }
        }
    }

    public void setRecyclerViewPaddingTop(int top) {
        for (int i = 0; i < mAH.length; i++) {
@@ -640,9 +659,14 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource,

        void applyPadding() {
            if (recyclerView != null) {
                int paddingTop = mUsingTabs ? paddingTopForTabs : padding.top;
                int paddingTop = mUsingTabs || FeatureFlags.ALL_APPS_PREDICTION_ROW_VIEW
                        ? paddingTopForTabs : padding.top;
                recyclerView.setPadding(padding.left, paddingTop, padding.right, padding.bottom);
            }
            if (mFloatingHeaderHandler != null) {
                mFloatingHeaderHandler.getContentView()
                        .setPadding(padding.left, 0 , padding.right, 0);
            }
        }

        void applyNumsPerRow() {
@@ -652,7 +676,7 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource,
                }
                adapter.setNumAppsPerRow(mNumAppsPerRow);
                appsList.setNumAppsPerRow(mNumAppsPerRow, mNumPredictedAppsPerRow);
                if (mUsingTabs && mFloatingHeaderHandler != null) {
                if (mFloatingHeaderHandler != null) {
                    mFloatingHeaderHandler.getContentView()
                            .setNumAppsPerRow(mNumPredictedAppsPerRow);
                }
+1 −1
Original line number Diff line number Diff line
@@ -460,7 +460,7 @@ public class AlphabeticalAppsList {
        mFastScrollerSections.clear();
        mAdapterItems.clear();

        if (!FeatureFlags.ALL_APPS_TABS_ENABLED) {
        if (!FeatureFlags.ALL_APPS_PREDICTION_ROW_VIEW) {
            if (DEBUG_PREDICTIONS) {
                if (mPredictedAppComponents.isEmpty() && !mApps.isEmpty()) {
                    mPredictedAppComponents.add(new ComponentKeyMapper<AppInfo>(new ComponentKey(mApps.get(0).componentName,
Loading