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 Project: BooheeRuler   Author: totond   File: VerticalRuler.java    License: 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 Project: BooheeRuler   Author: totond   File: HorizontalRuler.java    License: 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 Project: recycler-view-margin-decoration   Author: TheKhaeng   File: BaseLayoutMargin.java    License: 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 #4
Source Project: ViewPrinter   Author: natario1   File: DocumentView.java    License: 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 Project: BlurPopupWindow   Author: kyleduo   File: ShadowContainer.java    License: 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 Project: FastTextView   Author: lsjwzh   File: FastTextLayoutView.java    License: 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 Project: FastTextView   Author: lsjwzh   File: FastTextView.java    License: 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 Project: FastTextView   Author: lsjwzh   File: TestTextView.java    License: 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 Project: CameraButton   Author: hluhovskyi   File: TypedArrayHelper.java    License: 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 #10
Source Project: zulip-android   Author: zulip   File: GetStickyHeaderPosition.java    License: 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 #11
Source Project: StickyHeaderRecyclerView   Author: smuyyh   File: StickyHeaderHandler.java    License: 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 #12
Source Project: GraphView   Author: Team-Blox   File: GraphNodeContainerView.java    License: 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();
}
 
Example #13
Source Project: relight   Author: ittianyu   File: RecyclerWidget.java    License: Apache License 2.0 4 votes vote down vote up
public RecyclerWidget<V> smoothScrollBy(@Px int dx, @Px int dy) {
    view.smoothScrollBy(dx, dy);
    return self();
}
 
Example #14
Source Project: relight   Author: ittianyu   File: RecyclerWidget.java    License: Apache License 2.0 4 votes vote down vote up
public RecyclerWidget<V> smoothScrollBy(@Px int dx, @Px int dy, @Nullable Interpolator interpolator) {
    view.smoothScrollBy(dx, dy, interpolator);
    return self();
}
 
Example #15
Source Project: relight   Author: ittianyu   File: RecyclerWidget.java    License: Apache License 2.0 4 votes vote down vote up
public RecyclerWidget<V> offsetChildrenVertical(@Px int dy) {
    view.offsetChildrenVertical(dy);
    return self();
}
 
Example #16
Source Project: relight   Author: ittianyu   File: RecyclerWidget.java    License: Apache License 2.0 4 votes vote down vote up
public RecyclerWidget<V> offsetChildrenHorizontal(@Px int dx) {
    view.offsetChildrenHorizontal(dx);
    return self();
}
 
Example #17
Source Project: recycler-view-margin-decoration   Author: TheKhaeng   File: BaseLayoutMargin.java    License: Apache License 2.0 4 votes vote down vote up
BaseLayoutMargin( int spanCount, @Px int spacing ){
    this.spanCount = spanCount;
    this.spacing = spacing;
    this.marginDelegate = new MarginDelegate( spanCount, spacing );
}
 
Example #18
Source Project: recycler-view-margin-decoration   Author: TheKhaeng   File: BaseLayoutMargin.java    License: Apache License 2.0 4 votes vote down vote up
void setPadding( RecyclerView rv, @Px int margin ){
    this.setPadding( rv, margin, margin, margin, margin );
}
 
Example #19
Source Project: recycler-view-margin-decoration   Author: TheKhaeng   File: MarginDelegate.java    License: Apache License 2.0 4 votes vote down vote up
MarginDelegate( int spanCount, @Px int spaceItem ){
    this.spanCount = spanCount;
    this.spaceItem = spaceItem;
}
 
Example #20
Source Project: recycler-view-margin-decoration   Author: TheKhaeng   File: LayoutMarginDecoration.java    License: Apache License 2.0 4 votes vote down vote up
public LayoutMarginDecoration( @Px int spacing ){
    super( 1, spacing );
}
 
Example #21
Source Project: recycler-view-margin-decoration   Author: TheKhaeng   File: LayoutMarginDecoration.java    License: Apache License 2.0 4 votes vote down vote up
public LayoutMarginDecoration( int spanCount, @Px int spacing ){
    super( spanCount, spacing );
}
 
Example #22
Source Project: recycler-view-margin-decoration   Author: TheKhaeng   File: LayoutMarginDecoration.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void setPadding( RecyclerView rv, @Px int margin ){
    super.setPadding( rv, margin );
}
 
Example #23
Source Project: recycler-view-margin-decoration   Author: TheKhaeng   File: LayoutMarginDecoration.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void setPadding( RecyclerView rv, @Px int top, @Px int bottom, @Px int left, @Px int right ){
    super.setPadding( rv, top, bottom, left, right );
}
 
Example #24
Source Project: chat21-android-sdk   Author: chat21   File: MessageListActivity.java    License: GNU Affero General Public License v3.0 4 votes vote down vote up
private void setUpEmojiPopup() {
        emojiPopup = EmojiPopup.Builder.fromRootView(rootView)
                .setOnEmojiBackspaceClickListener(new OnEmojiBackspaceClickListener() {
                    @Override
                    public void onEmojiBackspaceClick(final View v) {
                        Log.d(TAG, "Clicked on Backspace");
                    }
                })
                .setOnEmojiClickListener(new OnEmojiClickListener() {
                    @Override
                    public void onEmojiClick(@NonNull final EmojiImageView imageView, @NonNull final Emoji emoji) {
                        Log.d(TAG, "Clicked on emoji");
                    }
                })
                .setOnEmojiPopupShownListener(new OnEmojiPopupShownListener() {
                    @Override
                    public void onEmojiPopupShown() {
                        emojiButton.setImageResource(R.drawable.ic_keyboard_24dp);
                    }
                })
                .setOnSoftKeyboardOpenListener(new OnSoftKeyboardOpenListener() {
                    @Override
                    public void onKeyboardOpen(@Px final int keyBoardHeight) {
                        Log.d(TAG, "Opened soft keyboard");
                    }
                })
//                .setOnEmojiPopupDismissListener(new OnEmojiPopupDismissListener() {
//                    @Override
//                    public void onEmojiPopupDismiss() {
//                        emojiButton.setImageResource(R.drawable.emoji_ios_category_people);
//                    }
//                })

                .setOnEmojiPopupDismissListener(new OnEmojiPopupDismissListener() {
                    @Override
                    public void onEmojiPopupDismiss() {
                        emojiButton.setImageResource(R.drawable.emoji_ios_category_people);
                    }
                })
                .setOnSoftKeyboardCloseListener(new OnSoftKeyboardCloseListener() {
                    @Override
                    public void onKeyboardClose() {
                        Log.d(TAG, "Closed soft keyboard");
                    }
                })
                .build(editText);
    }
 
Example #25
Source Project: Android-Spans   Author: SimonMarquis   File: Span.java    License: Apache License 2.0 4 votes vote down vote up
public static Node absoluteSize(@Px Integer size, Object... nodes) {
    return new SpanNode(new AbsoluteSizeSpan(size), nodes);
}
 
Example #26
Source Project: Android-Spans   Author: SimonMarquis   File: Span.java    License: Apache License 2.0 4 votes vote down vote up
public static Node absoluteSize(@Px Integer size, Boolean dip, Object... nodes) {
    return new SpanNode(new AbsoluteSizeSpan(size, dip), nodes);
}
 
Example #27
Source Project: Android-Spans   Author: SimonMarquis   File: Span.java    License: Apache License 2.0 4 votes vote down vote up
public static Node bullet(@Px Integer gapWidth, Object... nodes) {
    return new SpanNode(new BulletSpan(gapWidth), nodes);
}
 
Example #28
Source Project: Android-Spans   Author: SimonMarquis   File: Span.java    License: Apache License 2.0 4 votes vote down vote up
public static Node drawableMargin(Drawable drawable, @Px Integer padding, Object... nodes) {
    return new SpanNode(new DrawableMarginSpan(drawable, padding), nodes);
}
 
Example #29
Source Project: Android-Spans   Author: SimonMarquis   File: Span.java    License: Apache License 2.0 4 votes vote down vote up
public static Node iconMargin(Bitmap bitmap, @Px Integer padding, Object... nodes) {
    return new SpanNode(new IconMarginSpan(bitmap, padding), nodes);
}
 
Example #30
Source Project: bubble-layout   Author: tylersuehr7   File: BubbleLayout.java    License: MIT License 4 votes vote down vote up
public void setBubbleBorderWidth(@Px int width) {
    this.bubbleBorderWidth = width;
    invalidate();
}