androidx.annotation.Px Java Examples
The following examples show how to use
androidx.annotation.Px.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StickerKeyboardPageAdapter.java From mollyim-android with GNU General Public License v3.0 | 6 votes |
public void bind(@NonNull GlideRequests glideRequests, @Nullable EventListener eventListener, @NonNull StickerRecord sticker, @Px int size) { currentSticker = sticker; itemView.getLayoutParams().height = size; itemView.getLayoutParams().width = size; itemView.requestLayout(); glideRequests.load(new DecryptableUri(sticker.getUri())) .transition(DrawableTransitionOptions.withCrossFade()) .into(image); if (eventListener != null) { image.setOnClickListener(v -> eventListener.onStickerClicked(sticker)); image.setOnLongClickListener(v -> { eventListener.onStickerLongClicked(v); return true; }); } else { image.setOnClickListener(null); image.setOnLongClickListener(null); } }
Example #2
Source File: Border.java From litho with Apache License 2.0 | 5 votes |
/** * Specifies the border radius for all corners * * @param radius The desired border radius for all corners */ public Builder radiusPx(@Px int radius) { checkNotBuilt(); for (int i = 0; i < RADIUS_COUNT; ++i) { mBorder.mRadius[i] = radius; } return this; }
Example #3
Source File: CodeScannerView.java From code-scanner with MIT License | 5 votes |
/** * Set size of the frame corners * * @param size Size in pixels */ public void setFrameCornersSize(@Px final int size) { if (size < 0) { throw new IllegalArgumentException("Frame corners size can't be negative"); } mViewFinderView.setFrameCornersSize(size); }
Example #4
Source File: DefaultInternalNode.java From litho with Apache License 2.0 | 5 votes |
@Px @Override public int getHeight() { if (YogaConstants.isUndefined(mResolvedHeight)) { mResolvedHeight = mYogaNode.getLayoutHeight(); } return (int) mResolvedHeight; }
Example #5
Source File: AbstractPowerMenu.java From PowerMenu with Apache License 2.0 | 5 votes |
/** * sets the measured height of the popup menu list. * * @param height the measured height of the popup menu list. */ protected void setMeasuredHeight(@Px int height) { this.menuWindow.setHeight(height); FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) menuListView.getLayoutParams(); layoutParams.height = height - contentViewPadding; getMenuListView().setLayoutParams(layoutParams); }
Example #6
Source File: DefaultInternalNode.java From litho with Apache License 2.0 | 5 votes |
@Px @Override public int getWidth() { if (YogaConstants.isUndefined(mResolvedWidth)) { mResolvedWidth = mYogaNode.getLayoutWidth(); } return (int) mResolvedWidth; }
Example #7
Source File: DefaultInternalNode.java From litho with Apache License 2.0 | 5 votes |
@Px @Override public int getY() { if (YogaConstants.isUndefined(mResolvedY)) { mResolvedY = mYogaNode.getLayoutY(); } return (int) mResolvedY; }
Example #8
Source File: DefaultInternalNode.java From litho with Apache License 2.0 | 5 votes |
@Px @Override public int getX() { if (YogaConstants.isUndefined(mResolvedX)) { mResolvedX = mYogaNode.getLayoutX(); } return (int) mResolvedX; }
Example #9
Source File: SampleItemDecoration.java From Markwon with Apache License 2.0 | 5 votes |
SampleItemDecoration( @ColorInt int oddItemBackgroundColor, @Px int bottomPadding, @Px int dividerHeight, @ColorInt int dividerColor) { this.oddItemBackgroundColor = oddItemBackgroundColor; this.bottomPadding = bottomPadding; this.dividerHeight = dividerHeight; this.dividerColor = dividerColor; paint.setStyle(Paint.Style.FILL); }
Example #10
Source File: DefaultInternalNode.java From litho with Apache License 2.0 | 5 votes |
@Override public void setBorderWidth(YogaEdge edge, @Px int borderWidth) { if (mNestedTreeProps != null && mNestedTreeProps.mIsNestedTreeHolder) { NestedTreeProps props = getOrCreateNestedTreeProps(); if (props.mNestedTreeBorderWidth == null) { props.mNestedTreeBorderWidth = new Edges(); } props.mNestedTreeBorderWidth.set(edge, borderWidth); } else { mYogaNode.setBorder(edge, borderWidth); } }
Example #11
Source File: CodeScannerView.java From code-scanner with MIT License | 5 votes |
/** * Set current frame corners radius * * @param radius Frame corners radius in pixels */ public void setFrameCornersRadius(@Px final int radius) { if (radius < 0) { throw new IllegalArgumentException("Frame corners radius can't be negative"); } mViewFinderView.setFrameCornersRadius(radius); }
Example #12
Source File: DefaultInternalNode.java From litho with Apache License 2.0 | 5 votes |
@Override public void paddingPx(YogaEdge edge, @Px int padding) { mPrivateFlags |= PFLAG_PADDING_IS_SET; if (mNestedTreeProps != null && mNestedTreeProps.mIsNestedTreeHolder) { getNestedTreePadding().set(edge, padding); setIsPaddingPercent(edge, false); } else { mYogaNode.setPadding(edge, padding); } }
Example #13
Source File: CommonPropsHolder.java From litho with Apache License 2.0 | 5 votes |
@Override public void positionPx(YogaEdge edge, @Px int position) { mPrivateFlags |= PFLAG_POSITION_IS_SET; if (mPositions == null) { mPositions = new Edges(); } mPositions.set(edge, position); }
Example #14
Source File: AbstractPowerMenu.java From PowerMenu with Apache License 2.0 | 5 votes |
/** * sets the width of the popup menu. * * @param width width of the popup menu. */ public void setWidth(@Px int width) { this.menuWindow.setWidth(width); FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) menuListView.getLayoutParams(); layoutParams.width = width - contentViewPadding; getMenuListView().setLayoutParams(layoutParams); }
Example #15
Source File: TableEntryTheme.java From Markwon with Apache License 2.0 | 5 votes |
@Px @Override public int tableBorderWidth(@NonNull Paint paint) { return tableBorderWidth < 0 ? (int) (paint.getStrokeWidth() + .5F) : tableBorderWidth; }
Example #16
Source File: TableEntry.java From Markwon with Apache License 2.0 | 5 votes |
private void ensureTableBorderBackground(@NonNull View view, @Px int borderWidth, @ColorInt int borderColor) { if (borderWidth == 0) { view.setBackground(null); } else { final Drawable drawable = view.getBackground(); if (!(drawable instanceof TableBorderDrawable)) { final TableBorderDrawable borderDrawable = new TableBorderDrawable(); borderDrawable.update(borderWidth, borderColor); view.setBackground(borderDrawable); } else { ((TableBorderDrawable) drawable).update(borderWidth, borderColor); } } }
Example #17
Source File: PinView.java From PinView with Apache License 2.0 | 5 votes |
/** * Sets the width (in pixels) of cursor. * * @attr ref R.styleable#PinView_cursorWidth * @see #getCursorWidth() */ public void setCursorWidth(@Px int width) { mCursorWidth = width; if (isCursorVisible()) { invalidateCursor(true); } }
Example #18
Source File: StickerKeyboardPageAdapter.java From mollyim-android with GNU General Public License v3.0 | 5 votes |
void setStickers(@NonNull List<StickerRecord> stickers, @Px int stickerSize) { this.stickers.clear(); this.stickers.addAll(stickers); this.stickerSize = stickerSize; notifyDataSetChanged(); }
Example #19
Source File: CodeScannerView.java From code-scanner with MIT License | 5 votes |
/** * Set frame thickness * * @param thickness Frame thickness in pixels */ public void setFrameThickness(@Px final int thickness) { if (thickness < 0) { throw new IllegalArgumentException("Frame thickness can't be negative"); } mViewFinderView.setFrameThickness(thickness); }
Example #20
Source File: CommonPropsHolder.java From litho with Apache License 2.0 | 4 votes |
@Override public void maxWidthPx(@Px int maxWidth) { getOrCreateLayoutProps().maxWidthPx(maxWidth); }
Example #21
Source File: ViewUtils.java From FCM-for-Mojo with GNU General Public License v3.0 | 4 votes |
public static void setPaddingVertical(View v, @Px int paddingVertical) { v.setPaddingRelative(v.getPaddingStart(), paddingVertical, v.getPaddingEnd(), paddingVertical); }
Example #22
Source File: CommonPropsHolder.java From litho with Apache License 2.0 | 4 votes |
@Override public void touchExpansionPx(YogaEdge edge, @Px int touchExpansion) { getOrCreateOtherProps().touchExpansionPx(edge, touchExpansion); }
Example #23
Source File: Node.java From litho with Apache License 2.0 | 4 votes |
/** @return the resolved bottom padding for the Node */ @Px int getPaddingBottom();
Example #24
Source File: TableBorderDrawable.java From Markwon with Apache License 2.0 | 4 votes |
void update(@Px int borderWidth, @ColorInt int color) { paint.setStrokeWidth(borderWidth); paint.setColor(color); invalidateSelf(); }
Example #25
Source File: MenuListAdapter.java From PowerMenu with Apache License 2.0 | 4 votes |
@Override public void setTextSize(@Px int size) { this.textSize = size; }
Example #26
Source File: CommonPropsHolder.java From litho with Apache License 2.0 | 4 votes |
@Override public void positionPx(YogaEdge edge, @Px int position) { getOrCreateLayoutProps().positionPx(edge, position); }
Example #27
Source File: DefaultInternalNode.java From litho with Apache License 2.0 | 4 votes |
@Override public void maxWidthPx(@Px int maxWidth) { mPrivateFlags |= PFLAG_MAX_WIDTH_IS_SET; mYogaNode.setMaxWidth(maxWidth); }
Example #28
Source File: BorderColorDrawable.java From litho with Apache License 2.0 | 4 votes |
public Builder borderRightWidth(@Px int borderRight) { mState.mBorderRightWidth = borderRight; return this; }
Example #29
Source File: BorderColorDrawable.java From litho with Apache License 2.0 | 4 votes |
public Builder borderLeftWidth(@Px int borderLeft) { mState.mBorderLeftWidth = borderLeft; return this; }
Example #30
Source File: DefaultInternalNode.java From litho with Apache License 2.0 | 4 votes |
@Override public void positionPx(YogaEdge edge, @Px int position) { mPrivateFlags |= PFLAG_POSITION_IS_SET; mYogaNode.setPosition(edge, position); }