Search in sources :

Example 71 with DeviceProfile

use of com.android.launcher3.DeviceProfile in project android_packages_apps_Trebuchet by LineageOS.

the class WorkspacePageIndicator method setInsets.

@Override
public void setInsets(Rect insets) {
    DeviceProfile grid = mLauncher.getDeviceProfile();
    FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) getLayoutParams();
    if (grid.isVerticalBarLayout()) {
        Rect padding = grid.workspacePadding;
        lp.leftMargin = padding.left + grid.workspaceCellPaddingXPx;
        lp.rightMargin = padding.right + grid.workspaceCellPaddingXPx;
        lp.bottomMargin = padding.bottom;
    } else {
        lp.leftMargin = lp.rightMargin = 0;
        lp.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
        lp.bottomMargin = grid.hotseatBarSizePx + insets.bottom;
    }
    setLayoutParams(lp);
}
Also used : DeviceProfile(com.android.launcher3.DeviceProfile) Rect(android.graphics.Rect) FrameLayout(android.widget.FrameLayout)

Example 72 with DeviceProfile

use of com.android.launcher3.DeviceProfile in project android_packages_apps_Trebuchet by LineageOS.

the class PortraitStatesTouchController method getHotseatTop.

public static int getHotseatTop(Launcher launcher) {
    DeviceProfile dp = launcher.getDeviceProfile();
    int hotseatHeight = dp.hotseatBarSizePx + dp.getInsets().bottom;
    return launcher.getDragLayer().getHeight() - hotseatHeight;
}
Also used : DeviceProfile(com.android.launcher3.DeviceProfile)

Example 73 with DeviceProfile

use of com.android.launcher3.DeviceProfile in project android_packages_apps_Trebuchet by LineageOS.

the class PreviewBackground method setup.

public void setup(Context context, ActivityContext activity, View invalidateDelegate, int availableSpaceX, int topPadding) {
    mInvalidateDelegate = invalidateDelegate;
    TypedArray ta = context.getTheme().obtainStyledAttributes(R.styleable.FolderIconPreview);
    mDotColor = ta.getColor(R.styleable.FolderIconPreview_folderDotColor, 0);
    mStrokeColor = ta.getColor(R.styleable.FolderIconPreview_folderIconBorderColor, 0);
    mBgColor = ta.getColor(R.styleable.FolderIconPreview_folderFillColor, 0);
    ta.recycle();
    DeviceProfile grid = activity.getDeviceProfile();
    previewSize = grid.folderIconSizePx;
    basePreviewOffsetX = (availableSpaceX - previewSize) / 2;
    basePreviewOffsetY = topPadding + grid.folderIconOffsetYPx;
    // Stroke width is 1dp
    mStrokeWidth = context.getResources().getDisplayMetrics().density;
    float radius = getScaledRadius();
    float shadowRadius = radius + mStrokeWidth;
    int shadowColor = Color.argb(SHADOW_OPACITY, 0, 0, 0);
    mShadowShader = new RadialGradient(0, 0, 1, new int[] { shadowColor, Color.TRANSPARENT }, new float[] { radius / shadowRadius, 1 }, Shader.TileMode.CLAMP);
    invalidate();
}
Also used : DeviceProfile(com.android.launcher3.DeviceProfile) TypedArray(android.content.res.TypedArray) RadialGradient(android.graphics.RadialGradient) Paint(android.graphics.Paint)

Example 74 with DeviceProfile

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

the class AllAppsQsbLayout method getScrollRangeDelta.

@Override
public float getScrollRangeDelta(Rect insets) {
    DeviceProfile wallpaperDeviceProfile = mLauncher.getWallpaperDeviceProfile();
    int i = (wallpaperDeviceProfile.hotseatBarSizePx - wallpaperDeviceProfile.hotseatCellHeightPx) - getLayoutParams().height;
    int bottom = insets.bottom;
    return ((getLayoutParams().height + Math.max(-mVerticalOffset, insets.top - mTopAdjusting)) + mVerticalOffset) + (bottom + (i - bottom) * 0.45f);
}
Also used : DeviceProfile(com.android.launcher3.DeviceProfile)

Example 75 with DeviceProfile

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

the class DateWidgetView method onMeasure.

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    Launcher launcher = OmegaUtilsKt.getLauncherOrNull(getContext());
    int marginEnd;
    if (launcher != null) {
        DeviceProfile deviceProfile = Launcher.getLauncher(getContext()).getDeviceProfile();
        int size = MeasureSpec.getSize(widthMeasureSpec) / deviceProfile.inv.numColumns;
        marginEnd = (size - deviceProfile.iconSizePx) / 2;
        mWidth = (deviceProfile.inv.numColumns - Math.max(1, (int) Math.ceil((double) (getResources().getDimension(R.dimen.qsb_min_width_with_mic) / ((float) size))))) * size;
        mText = "";
        update();
    } else {
        marginEnd = getResources().getDimensionPixelSize(R.dimen.smartspace_preview_widget_margin);
    }
    setMarginEnd(mDateText1, marginEnd);
    setMarginEnd(mDateText2, marginEnd);
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
Also used : DeviceProfile(com.android.launcher3.DeviceProfile) Launcher(com.android.launcher3.Launcher) TextPaint(android.text.TextPaint) Paint(android.graphics.Paint)

Aggregations

DeviceProfile (com.android.launcher3.DeviceProfile)333 Rect (android.graphics.Rect)123 Point (android.graphics.Point)83 InvariantDeviceProfile (com.android.launcher3.InvariantDeviceProfile)61 Paint (android.graphics.Paint)40 ArrayList (java.util.ArrayList)38 View (android.view.View)31 PagedOrientationHandler (com.android.launcher3.touch.PagedOrientationHandler)31 Context (android.content.Context)28 SuppressLint (android.annotation.SuppressLint)27 Size (android.util.Size)25 DragLayer (com.android.launcher3.dragndrop.DragLayer)25 ViewGroup (android.view.ViewGroup)23 Launcher (com.android.launcher3.Launcher)23 RecentsView (com.android.quickstep.views.RecentsView)23 RectF (android.graphics.RectF)22 PendingAnimation (com.android.launcher3.anim.PendingAnimation)22 FrameLayout (android.widget.FrameLayout)21 AnimatorPlaybackController (com.android.launcher3.anim.AnimatorPlaybackController)21 Drawable (android.graphics.drawable.Drawable)20