use of com.android.launcher3.BubbleTextView in project android_packages_apps_Launcher3 by ArrowOS.
the class SecondaryDragLayer method onIconLongClicked.
private boolean onIconLongClicked(View v) {
if (!(v instanceof BubbleTextView)) {
return false;
}
if (PopupContainerWithArrow.getOpen(mActivity) != null) {
// There is already an items container open, so don't open this one.
v.clearFocus();
return false;
}
ItemInfo item = (ItemInfo) v.getTag();
if (!ShortcutUtil.supportsShortcuts(item)) {
return false;
}
final PopupContainerWithArrow container = (PopupContainerWithArrow) mActivity.getLayoutInflater().inflate(R.layout.popup_container, mActivity.getDragLayer(), false);
container.populateAndShow((BubbleTextView) v, mActivity.getPopupDataProvider().getShortcutCountForItem(item), Collections.emptyList(), Arrays.asList(mPinnedAppsAdapter.getSystemShortcut(item), APP_INFO.getShortcut(mActivity, item)));
v.getParent().requestDisallowInterceptTouchEvent(true);
return true;
}
use of com.android.launcher3.BubbleTextView in project android_packages_apps_Launcher3 by ArrowOS.
the class PreviewItemManager method prepareCreateAnimation.
Drawable prepareCreateAnimation(final View destView) {
Drawable animateDrawable = ((BubbleTextView) destView).getIcon();
computePreviewDrawingParams(animateDrawable.getIntrinsicWidth(), destView.getMeasuredWidth());
mReferenceDrawable = animateDrawable;
return animateDrawable;
}
use of com.android.launcher3.BubbleTextView in project android_packages_apps_Launcher3 by ArrowOS.
the class FolderPagedView method createNewView.
@SuppressLint("InflateParams")
public View createNewView(WorkspaceItemInfo item) {
if (item == null) {
return null;
}
final BubbleTextView textView = mViewCache.getView(R.layout.folder_application, getContext(), null);
textView.applyFromWorkspaceItem(item);
textView.setOnClickListener(ItemClickHandler.INSTANCE);
textView.setOnLongClickListener(mFolder);
textView.setOnFocusChangeListener(mFocusIndicatorHelper);
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) textView.getLayoutParams();
if (lp == null) {
textView.setLayoutParams(new CellLayout.LayoutParams(item.cellX, item.cellY, item.spanX, item.spanY));
} else {
lp.cellX = item.cellX;
lp.cellY = item.cellY;
lp.cellHSpan = lp.cellVSpan = 1;
}
return textView;
}
use of com.android.launcher3.BubbleTextView in project android_packages_apps_Launcher3 by ArrowOS.
the class FolderPagedView method arrangeChildren.
/**
* Updates position and rank of all the children in the view.
* It essentially removes all views from all the pages and then adds them again in appropriate
* page.
*
* @param list the ordered list of children.
*/
@SuppressLint("RtlHardcoded")
public void arrangeChildren(List<View> list) {
int itemCount = list.size();
ArrayList<CellLayout> pages = new ArrayList<>();
for (int i = 0; i < getChildCount(); i++) {
CellLayout page = (CellLayout) getChildAt(i);
page.removeAllViews();
pages.add(page);
}
mOrganizer.setFolderInfo(mFolder.getInfo());
setupContentDimensions(itemCount);
Iterator<CellLayout> pageItr = pages.iterator();
CellLayout currentPage = null;
int position = 0;
int rank = 0;
for (int i = 0; i < itemCount; i++) {
View v = list.size() > i ? list.get(i) : null;
if (currentPage == null || position >= mOrganizer.getMaxItemsPerPage()) {
// Next page
if (pageItr.hasNext()) {
currentPage = pageItr.next();
} else {
currentPage = createAndAddNewPage();
}
position = 0;
}
if (v != null) {
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) v.getLayoutParams();
ItemInfo info = (ItemInfo) v.getTag();
lp.setCellXY(mOrganizer.getPosForRank(rank));
currentPage.addViewToCellLayout(v, -1, info.getViewId(), lp, true);
if (mOrganizer.isItemInPreview(rank) && v instanceof BubbleTextView) {
((BubbleTextView) v).verifyHighRes();
}
}
rank++;
position++;
}
// Remove extra views.
boolean removed = false;
while (pageItr.hasNext()) {
removeView(pageItr.next());
removed = true;
}
if (removed) {
setCurrentPage(0);
}
setEnableOverscroll(getPageCount() > 1);
// Update footer
mPageIndicator.setVisibility(getPageCount() > 1 ? View.VISIBLE : View.GONE);
// Set the gravity as LEFT or RIGHT instead of START, as START depends on the actual text.
mFolder.mFolderName.setGravity(getPageCount() > 1 ? (mIsRtl ? Gravity.RIGHT : Gravity.LEFT) : Gravity.CENTER_HORIZONTAL);
}
use of com.android.launcher3.BubbleTextView in project android_packages_apps_Launcher3 by ArrowOS.
the class BaseDraggingActivity method getActivityLaunchOptions.
@NonNull
public ActivityOptionsWrapper getActivityLaunchOptions(View v, @Nullable ItemInfo item) {
int left = 0, top = 0;
int width = v.getMeasuredWidth(), height = v.getMeasuredHeight();
if (v instanceof BubbleTextView) {
// Launch from center of icon, not entire view
Drawable icon = ((BubbleTextView) v).getIcon();
if (icon != null) {
Rect bounds = icon.getBounds();
left = (width - bounds.width()) / 2;
top = v.getPaddingTop();
width = bounds.width();
height = bounds.height();
}
}
ActivityOptions options = ActivityOptions.makeClipRevealAnimation(v, left, top, width, height);
RunnableList callback = new RunnableList();
addOnResumeCallback(callback::executeAllAndDestroy);
return new ActivityOptionsWrapper(options, callback);
}
Aggregations