use of com.android.launcher3.InsettableFrameLayout.LayoutParams in project android_packages_apps_Trebuchet by LineageOS.
the class PredictionRowView method applyPredictionApps.
private void applyPredictionApps() {
if (getChildCount() != mNumPredictedAppsPerRow) {
while (getChildCount() > mNumPredictedAppsPerRow) {
removeViewAt(0);
}
LayoutInflater inflater = mLauncher.getAppsView().getLayoutInflater();
while (getChildCount() < mNumPredictedAppsPerRow) {
BubbleTextView icon = (BubbleTextView) inflater.inflate(R.layout.all_apps_icon, this, false);
icon.setOnClickListener(PREDICTION_CLICK_LISTENER);
icon.setOnLongClickListener(ItemLongClickListener.INSTANCE_ALL_APPS);
icon.setLongPressTimeoutFactor(1f);
icon.setOnFocusChangeListener(mFocusHelper);
LayoutParams lp = (LayoutParams) icon.getLayoutParams();
// Ensure the all apps icon height matches the workspace icons in portrait mode.
lp.height = mLauncher.getDeviceProfile().allAppsCellHeightPx;
lp.width = 0;
lp.weight = 1;
addView(icon);
}
}
int predictionCount = mPredictedApps.size();
int iconColor = setColorAlphaBound(mIconTextColor, mIconCurrentTextAlpha);
for (int i = 0; i < getChildCount(); i++) {
BubbleTextView icon = (BubbleTextView) getChildAt(i);
icon.reset();
if (predictionCount > i) {
icon.setVisibility(View.VISIBLE);
if (mPredictedApps.get(i) instanceof AppInfo) {
icon.applyFromApplicationInfo((AppInfo) mPredictedApps.get(i));
} else if (mPredictedApps.get(i) instanceof WorkspaceItemInfo) {
icon.applyFromWorkspaceItem((WorkspaceItemInfo) mPredictedApps.get(i));
}
icon.setTextColor(iconColor);
} else {
icon.setVisibility(predictionCount == 0 ? GONE : INVISIBLE);
}
}
boolean predictionsEnabled = predictionCount > 0;
if (predictionsEnabled != mPredictionsEnabled) {
mPredictionsEnabled = predictionsEnabled;
mLauncher.reapplyUi(false);
updateVisibility();
}
mParent.onHeightUpdated();
}
use of com.android.launcher3.InsettableFrameLayout.LayoutParams in project android_packages_apps_Trebuchet by LineageOS.
the class BaseDragLayer method onLayout.
protected void onLayout(boolean changed, int l, int t, int r, int b) {
super.onLayout(changed, l, t, r, b);
int count = getChildCount();
for (int i = 0; i < count; i++) {
View child = getChildAt(i);
final FrameLayout.LayoutParams flp = (FrameLayout.LayoutParams) child.getLayoutParams();
if (flp instanceof LayoutParams) {
final LayoutParams lp = (LayoutParams) flp;
if (lp.customPosition) {
child.layout(lp.x, lp.y, lp.x + lp.width, lp.y + lp.height);
}
}
}
}
use of com.android.launcher3.InsettableFrameLayout.LayoutParams in project Neo-Launcher by NeoApplications.
the class ConfigBuilder method setHotseatSearchView.
private void setHotseatSearchView() {
mNano.allAppsCols = mActivity.getDeviceProfile().inv.numColumns;
final int width = mActivity.getHotseat().getWidth();
final int dimensionPixelSize = mActivity.getResources().getDimensionPixelSize(R.dimen.dynamic_grid_edge_margin);
final Columns appCol = new Columns();
appCol.edgeMargin = dimensionPixelSize;
appCol.iconDistance = width - dimensionPixelSize - dimensionPixelSize;
appCol.height = mActivity.getDeviceProfile().allAppsCellHeightPx;
mNano.apps = appCol;
updateHotseatSearchDimens();
AlphabeticalAppsList apps = getAppsView().getApps();
mBubbleTextView = (BubbleTextView) mActivity.getLayoutInflater().inflate(R.layout.all_apps_icon, getAppsView(), false);
ViewGroup.LayoutParams layoutParams = mBubbleTextView.getLayoutParams();
layoutParams.height = appCol.height;
layoutParams.width = appCol.iconDistance / mNano.allAppsCols;
if (!apps.getApps().isEmpty()) {
mBubbleTextView.applyFromApplicationInfo(apps.getApps().get(0));
}
mBubbleTextView.measure(View.MeasureSpec.makeMeasureSpec(layoutParams.width, View.MeasureSpec.EXACTLY), View.MeasureSpec.makeMeasureSpec(layoutParams.height, View.MeasureSpec.EXACTLY));
mBubbleTextView.layout(0, 0, layoutParams.width, layoutParams.height);
final ArrayList<AppIndex> list = new ArrayList<>(mNano.allAppsCols);
mNano.index = list.toArray(new AppIndex[0]);
}
use of com.android.launcher3.InsettableFrameLayout.LayoutParams in project Neo-Launcher by NeoApplications.
the class IconPreview method applyPreviewIcons.
private void applyPreviewIcons() {
for (int i = 0; i < 5; i++) {
BubbleTextView icon = (BubbleTextView) mLauncher.getLayoutInflater().inflate(R.layout.all_apps_icon, this, false);
LayoutParams lp = (LayoutParams) icon.getLayoutParams();
lp.height = mLauncher.getDeviceProfile().allAppsCellHeightPx;
lp.width = 0;
lp.weight = 1;
addView(icon);
}
for (int i = 0; i < 5; i++) {
BubbleTextView icon = (BubbleTextView) getChildAt(i);
icon.reset();
icon.setVisibility(View.VISIBLE);
icon.applyFromApplicationInfo((AppInfo) mPreviewApps.get(getRandomApp()));
icon.setTextColor(mIconTextColor);
}
mLauncher.reapplyUi();
}
use of com.android.launcher3.InsettableFrameLayout.LayoutParams in project Neo-Launcher by NeoApplications.
the class SuperGContainerView method onMeasure.
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int qsbOverlapMargin = -getResources().getDimensionPixelSize(R.dimen.qsb_overlap_margin);
DeviceProfile deviceProfile = LauncherAppState.getIDP(getContext()).getDeviceProfile(getContext());
int size = MeasureSpec.getSize(widthMeasureSpec) - qsbOverlapMargin;
int qsbWidth;
int marginStart;
if (deviceProfile.isVerticalBarLayout()) {
qsbWidth = size;
marginStart = qsbOverlapMargin + getResources().getDimensionPixelSize(R.dimen.qsb_button_elevation);
} else {
Rect workspacePadding = deviceProfile.workspacePadding;
int fullWidth = size - workspacePadding.left - workspacePadding.right;
qsbWidth = DeviceProfile.calculateCellWidth(fullWidth, deviceProfile.inv.numColumns) * deviceProfile.inv.numColumns;
marginStart = 0;
}
if (mQsbView != null) {
LayoutParams layoutParams = (LayoutParams) mQsbView.getLayoutParams();
layoutParams.width = qsbWidth / deviceProfile.inv.numColumns;
if (deviceProfile.isVerticalBarLayout()) {
layoutParams.width = Math.max(layoutParams.width, getResources().getDimensionPixelSize(R.dimen.qsb_min_width_with_mic));
} else {
layoutParams.width = Math.max(layoutParams.width, getResources().getDimensionPixelSize(R.dimen.qsb_min_width_portrait));
}
layoutParams.setMarginStart(marginStart);
layoutParams.resolveLayoutDirection(layoutParams.getLayoutDirection());
}
if (mConnectorView != null) {
LayoutParams layoutParams = (LayoutParams) mConnectorView.getLayoutParams();
layoutParams.width = marginStart + layoutParams.height / 2;
}
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
Aggregations