android.support.annotation.Px Java Examples

The following examples show how to use android.support.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: VerticalRuler.java    From BooheeRuler with MIT License 6 votes vote down vote up
@Override
public void scrollTo(@Px int x, @Px int y) {
    if (y < mMinPosition) {
        goStartEdgeEffect(y);
        y = mMinPosition;
    }
    if (y > mMaxPosition) {
        goEndEdgeEffect(y);
        y = mMaxPosition;
    }
    if (y != getScrollY()) {
        super.scrollTo(x, y);
    }

    mCurrentScale = scrollYtoScale(y);
    if (mRulerCallback != null) {
        mRulerCallback.onScaleChanging(Math.round(mCurrentScale));
    }

}
 
Example #2
Source File: HorizontalRuler.java    From BooheeRuler with MIT License 6 votes vote down vote up
@Override
public void scrollTo(@Px int x, @Px int y) {
    Log.i(TAG, "scrollTo x: " + x);
    if (x < mMinPosition) {
        goStartEdgeEffect(x);
        x = mMinPosition;
    }
    if (x > mMaxPosition) {
        goEndEdgeEffect(x);
        x = mMaxPosition;
    }
    if (x != getScrollX()) {
        super.scrollTo(x, y);
    }

    mCurrentScale = scrollXtoScale(x);
    if (mRulerCallback != null) {
        mRulerCallback.onScaleChanging(Math.round(mCurrentScale));
    }

}
 
Example #3
Source File: GetStickyHeaderPosition.java    From zulip-android with Apache License 2.0 5 votes vote down vote up
private void matchMarginsToPadding(MarginLayoutParams layoutParams) {
    @Px int leftMargin = orientation == LinearLayoutManager.VERTICAL ?
            recyclerView.getPaddingLeft() : 0;
    @Px int topMargin = orientation == LinearLayoutManager.VERTICAL ?
            0 : recyclerView.getPaddingTop();
    @Px int rightMargin = orientation == LinearLayoutManager.VERTICAL ?
            recyclerView.getPaddingRight() : 0;
    layoutParams.setMargins(leftMargin, topMargin, rightMargin, 0);
}
 
Example #4
Source File: DocumentView.java    From ViewPrinter with Apache License 2.0 5 votes vote down vote up
@Override
public void setPadding(@Px int left, @Px int top, @Px int right, @Px int bottom) {
    if (mPager != null) {
        mPager.setPadding(left, top, right, bottom);
    } else {
        // Pass to ourselves. We will remove it in the constructor.
        super.setPadding(left, top, right, bottom);
    }
}
 
Example #5
Source File: ShadowContainer.java    From BlurPopupWindow with Apache License 2.0 5 votes vote down vote up
@Override
public void setPadding(@Px int left, @Px int top, @Px int right, @Px int bottom) {
	left += mShadowRadius;
	top += mShadowRadius;
	right += mShadowRadius;
	bottom += mShadowRadius;
	super.setPadding(left, top, right, bottom);
}
 
Example #6
Source File: FastTextLayoutView.java    From FastTextView with Apache License 2.0 5 votes vote down vote up
@Override
public void layout(@Px int l, @Px int t, @Px int r, @Px int b) {
  TEST_STATS.layoutStart();
  for (int i = 0; i < Const.LOOP_COUNT; i++) {
    // TODO for test
    super.layout(l, t, r, b);
  }
  TEST_STATS.layoutEnd();
}
 
Example #7
Source File: FastTextView.java    From FastTextView with Apache License 2.0 5 votes vote down vote up
@Override
public void layout(@Px int l, @Px int t, @Px int r, @Px int b) {
  TEST_STATS.layoutStart();
  for (int i = 0; i < Const.LOOP_COUNT; i++) {
    // TODO for test
    super.layout(l, t, r, b);
  }
  TEST_STATS.layoutEnd();
}
 
Example #8
Source File: TestTextView.java    From FastTextView with Apache License 2.0 5 votes vote down vote up
@Override
public void layout(@Px int l, @Px int t, @Px int r, @Px int b) {
  TEST_STATS.layoutStart();
  for (int i = 0; i < Const.LOOP_COUNT; i++) {
    // TODO for test
    super.layout(l, t, r, b);
  }
  TEST_STATS.layoutEnd();
}
 
Example #9
Source File: BaseLayoutMargin.java    From recycler-view-margin-decoration with Apache License 2.0 5 votes vote down vote up
void setPadding( RecyclerView rv,
                 @Px int top,
                 @Px int bottom,
                 @Px int left,
                 @Px int right ){
    rv.setClipToPadding( false );
    rv.setScrollBarStyle( SCROLLBARS_OUTSIDE_OVERLAY );
    rv.setPadding( left, top, right, bottom );
}
 
Example #10
Source File: TypedArrayHelper.java    From CameraButton with Apache License 2.0 5 votes vote down vote up
@Px
static int getDimension(Context context,
                        TypedArray array,
                        @StyleableRes int attr,
                        @DimenRes int defaultDimenRes) {

    return array.getDimensionPixelOffset(
            attr, context.getResources().getDimensionPixelSize(defaultDimenRes));
}
 
Example #11
Source File: CameraButton.java    From CameraButton with Apache License 2.0 4 votes vote down vote up
@Px
public int getStrokeWidth() {
    return mStrokeWidth;
}
 
Example #12
Source File: Utils.java    From chips-input-layout with MIT License 4 votes vote down vote up
static int dp(@Px int px) {
    final float density = Resources.getSystem()
            .getDisplayMetrics().density;
    return (int)(px * density);
}
 
Example #13
Source File: StickyHeaderHandler.java    From StickyHeaderRecyclerView with Apache License 2.0 4 votes vote down vote up
private void matchMarginsToPadding(MarginLayoutParams layoutParams) {
    @Px int leftMargin = orientation == LinearLayoutManager.VERTICAL ? mRecyclerView.getPaddingLeft() : 0;
    @Px int topMargin = orientation == LinearLayoutManager.VERTICAL ? 0 : mRecyclerView.getPaddingTop();
    @Px int rightMargin = orientation == LinearLayoutManager.VERTICAL ? mRecyclerView.getPaddingRight() : 0;
    layoutParams.setMargins(leftMargin, topMargin, rightMargin, 0);
}
 
Example #14
Source File: Spans.java    From spanner with Apache License 2.0 4 votes vote down vote up
/**
 *
 * @see android.text.style.LineHeightSpan.Standard
 */
@RequiresApi(api = Build.VERSION_CODES.Q)
public static Span lineHeight(@Px @IntRange(from = 1) final int height) {
    return new Span(new LineHeightSpanBuilder(height));
}
 
Example #15
Source File: CameraButton.java    From CameraButton with Apache License 2.0 4 votes vote down vote up
/**
 * @return the radius of inner circle in pixels
 */
@Px
public int getMainCircleRadius() {
    return mMainCircleRadius;
}
 
Example #16
Source File: CameraButton.java    From CameraButton with Apache License 2.0 4 votes vote down vote up
/**
 * @return the radius in pixels of inner circle when button is expanded
 */
@Px
public int getMainCircleRadiusExpanded() {
    return mMainCircleRadiusExpanded;
}
 
Example #17
Source File: HoldingButton.java    From HoldingButton with Apache License 2.0 4 votes vote down vote up
@Px
public int getTotalRadius() {
    return (int) (mRadius + mAmplitudeRadius);
}
 
Example #18
Source File: CameraButton.java    From CameraButton with Apache License 2.0 4 votes vote down vote up
public void setStrokeWidth(@Px int width) {
    mStrokeWidth = Constraints.checkDimension(width);
    invalidate();
}
 
Example #19
Source File: CameraButton.java    From CameraButton with Apache License 2.0 4 votes vote down vote up
@Px
public int getProgressArcWidth() {
    return mProgressArcWidth;
}
 
Example #20
Source File: CameraButton.java    From CameraButton with Apache License 2.0 4 votes vote down vote up
public void setProgressArcWidth(@Px int width) {
    mProgressArcWidth = Constraints.checkDimension(width);
    invalidate();
}
 
Example #21
Source File: CameraButton.java    From CameraButton with Apache License 2.0 4 votes vote down vote up
/**
 * @return an size of the icons in pixels which are drawn inside the button
 */
@Px
public int getIconSize() {
    return mIconSize;
}
 
Example #22
Source File: SwipeMenuItem.java    From SwipeRecyclerView-master with Apache License 2.0 4 votes vote down vote up
public SwipeMenuItem setTextSize(@Px int titleSize) {
    this.titleSize = titleSize;
    return this;
}
 
Example #23
Source File: BookLoadingView.java    From BookLoadingView with Apache License 2.0 4 votes vote down vote up
public void setLineStrokeWidth(@Px int strokeWidth) {
    mTextMaskView.setStrokeWidth(strokeWidth);
}
 
Example #24
Source File: BookLoadingView.java    From BookLoadingView with Apache License 2.0 4 votes vote down vote up
public void setTickStrokeWidth(@Px int strokeWidth) {
    mTickView.setStrokeWidth(strokeWidth);
}
 
Example #25
Source File: BookLoadingView.java    From BookLoadingView with Apache License 2.0 4 votes vote down vote up
public void setTextSize(@Px int size) {
    mLoadingTV.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
}
 
Example #26
Source File: QTabView.java    From VerticalTabLayout with Apache License 2.0 4 votes vote down vote up
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
@Override
public void setPaddingRelative(@Px int start, @Px int top, @Px int end, @Px int bottom) {
    mTitle.setPaddingRelative(start, top, end, bottom);
}
 
Example #27
Source File: QTabView.java    From VerticalTabLayout with Apache License 2.0 4 votes vote down vote up
@Override
public void setPadding(@Px int left, @Px int top, @Px int right, @Px int bottom) {
    mTitle.setPadding(left, top, right, bottom);
}
 
Example #28
Source File: CustomView.java    From AndroidPlayground with MIT License 4 votes vote down vote up
@Override
public void layout(@Px int l, @Px int t, @Px int r, @Px int b) {
    Log.d("CustomView", "layout");
    super.layout(l, t, r, b);
}
 
Example #29
Source File: IDividerItemDecoration.java    From AndroidUiKit with Apache License 2.0 4 votes vote down vote up
/**
 * @param horizontalDividerWidth the horizontal width in pixels
 * @return
 */
public IDividerItemDecoration setHorizontalDividerWidth(@Px int horizontalDividerWidth) {
    this.mHorizontalDividerWidth = horizontalDividerWidth;
    return this;
}
 
Example #30
Source File: GraphNodeContainerView.java    From GraphView with Apache License 2.0 4 votes vote down vote up
/**
 * Sets a new value for the thickness of the lines between the nodes.
 *
 * @param lineThickness new value for the thickness
 */
public void setLineThickness(@Px int lineThickness) {
    this.lineThickness = lineThickness;
    initPaint();
    invalidate();
}