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();
}
}
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);
}
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();
}
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);
}
Aggregations