本文整理汇总了Java中com.android.launcher3.Launcher.getDeviceProfile方法的典型用法代码示例。如果您正苦于以下问题:Java Launcher.getDeviceProfile方法的具体用法?Java Launcher.getDeviceProfile怎么用?Java Launcher.getDeviceProfile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.android.launcher3.Launcher
的用法示例。
在下文中一共展示了Launcher.getDeviceProfile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getScaleAndPosition
import com.android.launcher3.Launcher; //导入方法依赖的package包/类
@Override
public float getScaleAndPosition(Bitmap preview, int[] outPos) {
Launcher launcher = Launcher.getLauncher(mView.getContext());
int iconSize = getDrawableBounds(mView.getBackground()).width();
float scale = launcher.getDragLayer().getLocationInDragLayer(mView, outPos);
int iconLeft = mView.getPaddingStart();
if (Utilities.isRtl(mView.getResources())) {
iconLeft = mView.getWidth() - iconSize - iconLeft;
}
outPos[0] += Math.round(scale * iconLeft + (scale * iconSize - preview.getWidth()) / 2 +
mPositionShift.x);
outPos[1] += Math.round((scale * mView.getHeight() - preview.getHeight()) / 2
+ mPositionShift.y);
float size = launcher.getDeviceProfile().iconSizePx;
return scale * iconSize / size;
}
示例2: AllAppsRecyclerViewContainerView
import com.android.launcher3.Launcher; //导入方法依赖的package包/类
public AllAppsRecyclerViewContainerView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
Launcher launcher = Launcher.getLauncher(context);
DeviceProfile grid = launcher.getDeviceProfile();
mTouchFeedbackView = new ClickShadowView(context);
// Make the feedback view large enough to hold the blur bitmap.
int size = grid.allAppsIconSizePx + mTouchFeedbackView.getExtraSize();
addView(mTouchFeedbackView, size, size);
}
示例3: fromXml
import com.android.launcher3.Launcher; //导入方法依赖的package包/类
public static FolderIcon fromXml(int resId, Launcher launcher, ViewGroup group,
FolderInfo folderInfo, IconCache iconCache) {
@SuppressWarnings("all") // suppress dead code warning
final boolean error = INITIAL_ITEM_ANIMATION_DURATION >= DROP_IN_ANIMATION_DURATION;
if (error) {
throw new IllegalStateException("DROP_IN_ANIMATION_DURATION must be greater than " +
"INITIAL_ITEM_ANIMATION_DURATION, as sequencing of adding first two items " +
"is dependent on this");
}
DeviceProfile grid = launcher.getDeviceProfile();
FolderIcon icon = (FolderIcon) LayoutInflater.from(launcher).inflate(resId, group, false);
// For performance and compatibility reasons we render the preview using a software layer.
// In particular, hardware path clipping has spotty ecosystem support and bad performance.
// Software rendering also allows us to use shadow layers.
icon.setLayerType(LAYER_TYPE_SOFTWARE, new Paint(Paint.FILTER_BITMAP_FLAG));
icon.setClipToPadding(false);
icon.mFolderName = (BubbleTextView) icon.findViewById(R.id.folder_icon_name);
icon.mFolderName.setText(folderInfo.title);
icon.mFolderName.setCompoundDrawablePadding(0);
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) icon.mFolderName.getLayoutParams();
lp.topMargin = grid.iconSizePx + grid.iconDrawablePaddingPx;
icon.setTag(folderInfo);
icon.setOnClickListener(launcher);
icon.mInfo = folderInfo;
icon.mLauncher = launcher;
icon.setContentDescription(launcher.getString(R.string.folder_name_format, folderInfo.title));
Folder folder = Folder.fromXml(launcher);
folder.setDragController(launcher.getDragController());
folder.setFolderIcon(icon);
folder.bind(folderInfo);
icon.setFolder(folder);
icon.setAccessibilityDelegate(launcher.getAccessibilityDelegate());
folderInfo.addListener(icon);
icon.setOnFocusChangeListener(launcher.mFocusHandler);
return icon;
}