Search in sources :

Example 1 with AllAppsRecyclerView

use of com.android.launcher3.allapps.AllAppsRecyclerView in project android_packages_apps_Launcher3 by crdroidandroid.

the class AllAppsContainerView method replaceRVContainer.

private void replaceRVContainer(boolean showTabs) {
    for (int i = 0; i < mAH.length; i++) {
        AllAppsRecyclerView rv = mAH[i].recyclerView;
        if (rv != null) {
            rv.setLayoutManager(null);
            rv.setAdapter(null);
        }
    }
    View oldView = getRecyclerViewContainer();
    int index = indexOfChild(oldView);
    removeView(oldView);
    int layout = showTabs ? R.layout.all_apps_tabs : R.layout.all_apps_rv_layout;
    View newView = getLayoutInflater().inflate(layout, this, false);
    addView(newView, index);
    if (TestProtocol.sDebugTracing) {
        Log.d(TestProtocol.WORK_PROFILE_REMOVED, "should show tabs:" + showTabs, new Exception());
    }
    if (showTabs) {
        mViewPager = (AllAppsPagedView) newView;
        mViewPager.initParentViews(this);
        mViewPager.getPageIndicator().setOnActivePageChangedListener(this);
        setupWorkToggle();
    } else {
        mViewPager = null;
        removeWorkToggle();
    }
}
Also used : View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) ScrimView(com.android.launcher3.views.ScrimView) Paint(android.graphics.Paint) Point(android.graphics.Point)

Example 2 with AllAppsRecyclerView

use of com.android.launcher3.allapps.AllAppsRecyclerView in project android_packages_apps_Trebuchet by LineageOS.

the class SDWorkModeTest method testAllAppsList_workProfile.

@Test
public void testAllAppsList_workProfile() throws Exception {
    ShadowUserManager sum = Shadow.extract(mTargetContext.getSystemService(UserManager.class));
    sum.addUser(SYSTEM_USER, "me", FLAG_SYSTEM);
    sum.addUser(WORK_PROFILE_ID, "work", FLAG_PROFILE);
    SecondaryDisplayLauncher launcher = loadLauncher();
    launcher.showAppDrawer(true);
    doLayout(launcher);
    AllAppsRecyclerView rv1 = launcher.getAppsView().getActiveRecyclerView();
    verifyRecyclerViewCount(rv1);
    assertNotNull(launcher.getAppsView().getWorkModeSwitch());
    assertTrue(launcher.getAppsView().getRecyclerViewContainer() instanceof AllAppsPagedView);
    AllAppsPagedView pagedView = (AllAppsPagedView) launcher.getAppsView().getRecyclerViewContainer();
    pagedView.snapToPageImmediately(1);
    doLayout(launcher);
    AllAppsRecyclerView rv2 = launcher.getAppsView().getActiveRecyclerView();
    verifyRecyclerViewCount(rv2);
    assertNotSame(rv1, rv2);
}
Also used : ShadowUserManager(org.robolectric.shadows.ShadowUserManager) AllAppsRecyclerView(com.android.launcher3.allapps.AllAppsRecyclerView) ShadowUserManager(org.robolectric.shadows.ShadowUserManager) UserManager(android.os.UserManager) AllAppsPagedView(com.android.launcher3.allapps.AllAppsPagedView) Test(org.junit.Test)

Example 3 with AllAppsRecyclerView

use of com.android.launcher3.allapps.AllAppsRecyclerView in project Neo-Launcher by NeoApplications.

the class ConfigBuilder method setAllAppsSearchView.

private void setAllAppsSearchView() {
    View view = null;
    AllAppsRecyclerView appsView = getAppsView();
    GridLayoutManager.SpanSizeLookup spanSizeLookup = ((GridLayoutManager) appsView.getLayoutManager()).getSpanSizeLookup();
    int allAppsCols = Math.min(mActivity.getDeviceProfile().inv.numColsDrawer, appsView.getChildCount());
    int childCount = appsView.getChildCount();
    BubbleTextView[] bubbleTextViewArr = new BubbleTextView[allAppsCols];
    int i4 = -1;
    for (int i = 0; i < childCount; i++) {
        RecyclerView.ViewHolder childViewHolder = appsView.getChildViewHolder(appsView.getChildAt(i));
        if (childViewHolder.itemView instanceof BubbleTextView) {
            int spanGroupIndex = spanSizeLookup.getSpanGroupIndex(childViewHolder.getLayoutPosition(), allAppsCols);
            if (spanGroupIndex >= 0) {
                if (i4 >= 0) {
                    if (spanGroupIndex != i4) {
                        view = childViewHolder.itemView;
                        break;
                    }
                }
                i4 = spanGroupIndex;
                int index = ((GridLayoutManager.LayoutParams) childViewHolder.itemView.getLayoutParams()).getSpanIndex();
                bubbleTextViewArr[index] = (BubbleTextView) childViewHolder.itemView;
            }
        }
    }
    if (bubbleTextViewArr.length == 0 || bubbleTextViewArr[0] == null) {
        Log.e("ConfigBuilder", "No icons rendered in all apps");
        setHotseatSearchView();
        return;
    }
    mBubbleTextView = bubbleTextViewArr[0];
    mNano.allAppsCols = allAppsCols;
    int iconCountOffset = 0;
    for (int i = 0; i < bubbleTextViewArr.length; i++) {
        if (bubbleTextViewArr[i] == null) {
            iconCountOffset = allAppsCols - i;
            allAppsCols = i;
            break;
        }
    }
    co = appsView.getChildViewHolder(bubbleTextViewArr[0]).getItemViewType() == 4;
    Columns lastColumn = getViewBounds(bubbleTextViewArr[allAppsCols - 1]);
    Columns firstColumn = getViewBounds(bubbleTextViewArr[0]);
    if (Utilities.isRtl(mActivity.getResources())) {
        Columns temp = lastColumn;
        lastColumn = firstColumn;
        firstColumn = temp;
    }
    int iconWidth = lastColumn.iconDistance;
    int totalIconDistance = lastColumn.edgeMargin - firstColumn.edgeMargin;
    int iconDistance = totalIconDistance / allAppsCols;
    firstColumn.iconDistance = iconWidth + totalIconDistance;
    if (Utilities.isRtl(mActivity.getResources())) {
        firstColumn.edgeMargin -= iconCountOffset * iconWidth;
        firstColumn.iconDistance += iconCountOffset * iconWidth;
    } else {
        firstColumn.iconDistance += iconCountOffset * (iconDistance + iconWidth);
    }
    mNano.apps = firstColumn;
    if (!this.co) {
        firstColumn.innerMargin -= firstColumn.height;
    } else if (view != null) {
        Columns viewBounds3 = getViewBounds(view);
        viewBounds3.iconDistance = firstColumn.iconDistance;
        mNano.appsView = viewBounds3;
    }
    updateHotseatSearchDimens();
}
Also used : GridLayoutManager(androidx.recyclerview.widget.GridLayoutManager) AllAppsRecyclerView(com.android.launcher3.allapps.AllAppsRecyclerView) Columns(com.google.android.apps.nexuslauncher.search.nano.SearchProto.Columns) RecyclerView(androidx.recyclerview.widget.RecyclerView) AllAppsRecyclerView(com.android.launcher3.allapps.AllAppsRecyclerView) BubbleTextView(com.android.launcher3.BubbleTextView) BubbleTextView(com.android.launcher3.BubbleTextView) View(android.view.View) SearchView(com.google.android.apps.nexuslauncher.search.nano.SearchProto.SearchView) RecyclerView(androidx.recyclerview.widget.RecyclerView) AllAppsRecyclerView(com.android.launcher3.allapps.AllAppsRecyclerView) Point(android.graphics.Point)

Example 4 with AllAppsRecyclerView

use of com.android.launcher3.allapps.AllAppsRecyclerView in project android_packages_apps_Launcher3 by crdroidandroid.

the class SDWorkModeTest method testAllAppsList_workProfile.

@Test
public void testAllAppsList_workProfile() throws Exception {
    ShadowUserManager sum = Shadow.extract(mTargetContext.getSystemService(UserManager.class));
    sum.addUser(SYSTEM_USER, "me", FLAG_SYSTEM);
    sum.addProfile(SYSTEM_USER, WORK_PROFILE_ID, "work", FLAG_PROFILE);
    SecondaryDisplayLauncher launcher = loadLauncher();
    launcher.showAppDrawer(true);
    doLayout(launcher);
    AllAppsRecyclerView rv1 = launcher.getAppsView().getActiveRecyclerView();
    verifyRecyclerViewCount(rv1);
    assertNotNull(launcher.getAppsView().getWorkModeSwitch());
    assertTrue(launcher.getAppsView().getRecyclerViewContainer() instanceof AllAppsPagedView);
    AllAppsPagedView pagedView = (AllAppsPagedView) launcher.getAppsView().getRecyclerViewContainer();
    pagedView.snapToPageImmediately(1);
    doLayout(launcher);
    AllAppsRecyclerView rv2 = launcher.getAppsView().getActiveRecyclerView();
    verifyRecyclerViewCount(rv2);
    assertNotSame(rv1, rv2);
}
Also used : ShadowUserManager(org.robolectric.shadows.ShadowUserManager) AllAppsRecyclerView(com.android.launcher3.allapps.AllAppsRecyclerView) UserManager(android.os.UserManager) ShadowUserManager(org.robolectric.shadows.ShadowUserManager) AllAppsPagedView(com.android.launcher3.allapps.AllAppsPagedView) Test(org.junit.Test)

Aggregations

AllAppsRecyclerView (com.android.launcher3.allapps.AllAppsRecyclerView)3 Point (android.graphics.Point)2 UserManager (android.os.UserManager)2 View (android.view.View)2 RecyclerView (androidx.recyclerview.widget.RecyclerView)2 AllAppsPagedView (com.android.launcher3.allapps.AllAppsPagedView)2 Test (org.junit.Test)2 ShadowUserManager (org.robolectric.shadows.ShadowUserManager)2 Paint (android.graphics.Paint)1 GridLayoutManager (androidx.recyclerview.widget.GridLayoutManager)1 BubbleTextView (com.android.launcher3.BubbleTextView)1 ScrimView (com.android.launcher3.views.ScrimView)1 Columns (com.google.android.apps.nexuslauncher.search.nano.SearchProto.Columns)1 SearchView (com.google.android.apps.nexuslauncher.search.nano.SearchProto.SearchView)1