Java 类android.support.annotation.Px 实例源码

项目:Quran    文件:QuranPageLayout.java   
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
  View view = resolveView();
  if (view != null) {
    int width = getMeasuredWidth();
    int height = getMeasuredHeight();
    @Px int leftLineWidth = leftBorder == BorderMode.LINE ?
        1 : leftPageBorder.getIntrinsicWidth();
    @Px int rightLineWidth = rightBorder == BorderMode.HIDDEN ?
        0 : rightPageBorder.getIntrinsicWidth();
    int headerFooterHeight = 0;
    view.layout(leftLineWidth, headerFooterHeight,
        width - rightLineWidth, height - headerFooterHeight);
    super.onLayout(changed, l, t, r, b);
  }
}
项目:BooheeRuler    文件:VerticalRuler.java   
@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));
    }

}
项目:BooheeRuler    文件:HorizontalRuler.java   
@Override
public void scrollTo(@Px int x, @Px int y) {
    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));
    }

}
项目:GitHub    文件:Request.java   
/**
 * Resize the image to the specified size in pixels.
 * Use 0 as desired dimension to resize keeping aspect ratio.
 */
public Builder resize(@Px int targetWidth, @Px int targetHeight) {
  if (targetWidth < 0) {
    throw new IllegalArgumentException("Width must be positive number or 0.");
  }
  if (targetHeight < 0) {
    throw new IllegalArgumentException("Height must be positive number or 0.");
  }
  if (targetHeight == 0 && targetWidth == 0) {
    throw new IllegalArgumentException("At least one dimension has to be positive number.");
  }
  this.targetWidth = targetWidth;
  this.targetHeight = targetHeight;
  return this;
}
项目:android_ui    文件:RefreshDrawable.java   
/**
 * Sets the radius of the progress arc.
 *
 * @param radius The desired radius.
 * @see #getProgressRadius()
 */
public void setProgressRadius(@Px int radius) {
    if (mProgressRadius != radius) {
        this.mProgressRadius = radius;
        this.handleDrawablesSizeChange();
    }
}
项目:waterfall-toolbar    文件:WaterfallToolbar.java   
/**
 * @param value The elevation (in px) with which the toolbar starts
 * @return Own object
 */
public WaterfallToolbar setInitialElevationPx(@Px @NonNull final Integer value) {
    mInitialElevation = value;

    // gotta update elevation in case this value have
    // been set in a running and visible activity
    if (mIsSetup) adjustCardElevation();

    return this;
}
项目:waterfall-toolbar    文件:WaterfallToolbar.java   
/**
 * @param value The elevation (in px) the toolbar gets when it reaches final scroll elevation
 * @return Own object
 */
public WaterfallToolbar setFinalElevationPx(@Px @NonNull final Integer value) {
    mFinalElevation = value;

    // gotta update elevation in case this value have
    // been set in a running and visible activity
    if (mIsSetup) adjustCardElevation();

    return this;
}
项目:silly-android    文件:SillyAndroid.java   
/**
 * Sets the top and bottom padding to the given View, keeping the horizontal padding values as the were.
 *
 * @param view    Which view to set the padding to, must not be {@code null}
 * @param padding The vertical padding value
 */
public static void setPaddingVertical(@NonNull final View view, @Px final int padding) {
    final int paddingStart = Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 ? view.getPaddingStart() : view.getPaddingLeft();
    final int paddingEnd = Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 ? view.getPaddingEnd() : view.getPaddingRight();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        view.setPaddingRelative(paddingStart, padding, paddingEnd, padding);
    } else {
        view.setPadding(paddingStart, padding, paddingEnd, padding);
    }
}
项目:silly-android    文件:SillyAndroid.java   
/**
 * Sets the left/start and right/end padding to the given View, keeping the vertical padding values as the were.
 *
 * @param view    Which view to set the padding to, must not be {@code null}
 * @param padding The horizontal padding value
 */
public static void setPaddingHorizontal(@NonNull final View view, @Px final int padding) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        view.setPaddingRelative(padding, view.getPaddingTop(), padding, view.getPaddingBottom());
    } else {
        view.setPadding(padding, view.getPaddingTop(), padding, view.getPaddingBottom());
    }
}
项目:silly-android    文件:SillyAndroid.java   
/**
 * Converts a {@link Drawable} into a {@link Bitmap}. Includes an optimization in case the {@link Drawable} in question is already a
 * {@link BitmapDrawable}.
 *
 * @param drawable A Drawable instance to convert
 * @param width    The width of the new Bitmap
 * @param height   The height of the new Bitmap
 * @return A new {@link Bitmap} instance constraint to width and height dimensions supplied, never {@code null}
 */
@NonNull
@SuppressWarnings("unused")
public static Bitmap drawableToBitmap(@NonNull final Drawable drawable, @Px final int width, @Px final int height) {
    final Bitmap result = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
    final Canvas canvas = new Canvas(result);
    drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
    drawable.draw(canvas);
    return result;
}
项目:ViewPrinter    文件:DocumentView.java   
@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);
    }
}
项目:BlurPopupWindow    文件:ShadowContainer.java   
@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);
}
项目:RLibrary    文件:StickLayout2.java   
@Override
public void scrollTo(@Px int x, @Px int y) {
    int offset = Math.min(maxScrollY, edgeScroll ? y : Math.max(0, y));
    boolean layout = false;
    if (getScrollY() != offset) {
        layout = true;
    }
    super.scrollTo(0, offset);
    if (layout) {
        requestLayout();
    }
    if (mOnScrollListener != null) {
        mOnScrollListener.onScrollTo(offset);
    }
}
项目:RLibrary    文件:StickLayout.java   
@Override
public void scrollTo(@Px int x, @Px int y) {
    int offset = Math.min(maxScrollY, Math.max(0, y));
    boolean layout = false;
    if (getScrollY() != offset) {
        layout = true;
    }
    super.scrollTo(0, offset);
    if (layout) {
        requestLayout();
    }
    if (mOnScrollListener != null) {
        mOnScrollListener.onScrollTo(offset);
    }
}
项目:CameraButton    文件:TypedArrayHelper.java   
@Px
static int getDimension(Context context,
                        TypedArray array,
                        @StyleableRes int attr,
                        @DimenRes int defaultDimenRes) {

    return array.getDimensionPixelOffset(
            attr, context.getResources().getDimensionPixelSize(defaultDimenRes));
}
项目:FastTextView    文件:FastTextLayoutView.java   
@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();
}
项目:FastTextView    文件:FastTextView.java   
@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();
}
项目:FastTextView    文件:TestTextView.java   
@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();
}
项目:ZhihuUserProfile    文件:ZhihuUserProfileLayout.java   
@Override
public void scrollBy(@Px int x, @Px int y) {
    int targetY = getScrollY() + y;
    if (targetY >= mMaxScrollY) {
        targetY = mMaxScrollY;
    } else if (targetY <= 0) {
        targetY = 0;
    }
    super.scrollBy(x, targetY - getScrollY());
}
项目:ZhihuUserProfile    文件:ZhihuUserProfileLayout.java   
@Override
public void scrollTo(@Px int x, @Px int y) {
    if (y >= mMaxScrollY) {
        y = mMaxScrollY;
    } else if (y <= 0) {
        y = 0;
    }
    if (mOnCollapsingListener != null) {
        float progress = 1.0f - (float) y / (float) mMaxScrollY;
        if (BuildConfig.DEBUG) Log.d(TAG, "collapsing progress = " + progress);
        mOnCollapsingListener.onCollapsing(progress);
    }
    mCurrentScrollY = y;
    super.scrollTo(x, y);
}
项目:EasyAndroid    文件:AuthEditText.java   
/**
 * 设置文本大小,像素
 * @param size 文本大小
 */
public void setTextSize(@Px int size)
{
    if(size <= 0)
    {
        return;
    }

    this.textSize = size;
    for(TextView tv : list)
    {
        tv.setTextSize(textSize);
    }
}
项目:RLibrary    文件:RExTextView.java   
@Override
public void scrollTo(@Px int x, @Px int y) {
    if (maxShowLine > 0) {
        return;
    }
    super.scrollTo(x, y);
}
项目:Customerly-Android-SDK    文件:IU_Utils.java   
@Contract(pure = true)
@Px static int px(@Dimension(unit = Dimension.DP) int dp) {
    float dpi = Resources.getSystem().getDisplayMetrics().density;
    dpi = dpi > 100/*120, 160, 213, 240, 320, 480 or 640 dpi*/ ? dpi / 160f : dpi;
    dpi = dpi == 0 ? 1f : dpi;
    return (int) (dp * dpi);
}
项目:GitHub    文件:RefreshLayout.java   
@Override
public void scrollTo(@Px int x, @Px int y) {
    super.scrollTo(x, y);
}
项目:BookLoadingView    文件:BookLoadingView.java   
public void setTickStrokeWidth(@Px int strokeWidth) {
    mTickView.setStrokeWidth(strokeWidth);
}
项目:code-scanner    文件:ViewFinderView.java   
void setFrameThickness(@Px int thickness) {
    mFramePaint.setStrokeWidth(thickness);
    if (Utils.isLaidOut(this)) {
        invalidate();
    }
}
项目:code-scanner    文件:ViewFinderView.java   
void setFrameCornersSize(@Px int size) {
    mFrameCornerSize = size;
    if (Utils.isLaidOut(this)) {
        invalidate();
    }
}
项目:Android-Spans    文件:Span.java   
public static Node absoluteSize(@Px Integer size, Object... nodes) {
    return new SpanNode(new AbsoluteSizeSpan(size), nodes);
}
项目:Android-Spans    文件:Span.java   
public static Node absoluteSize(@Px Integer size, Boolean dip, Object... nodes) {
    return new SpanNode(new AbsoluteSizeSpan(size, dip), nodes);
}
项目:Android-Spans    文件:Span.java   
public static Node bullet(@Px Integer gapWidth, Object... nodes) {
    return new SpanNode(new BulletSpan(gapWidth), nodes);
}
项目:Android-Spans    文件:Span.java   
public static Node drawableMargin(Drawable drawable, @Px Integer padding, Object... nodes) {
    return new SpanNode(new DrawableMarginSpan(drawable, padding), nodes);
}
项目:Android-Spans    文件:Span.java   
public static Node iconMargin(Bitmap bitmap, @Px Integer padding, Object... nodes) {
    return new SpanNode(new IconMarginSpan(bitmap, padding), nodes);
}
项目:RoundedLayout    文件:RoundedLayout.java   
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override public void setElevation(@Px float elevation) {
    super.setElevation(elevation);
    mRoundingElevation = elevation;
}
项目:silly-android    文件:EasyFragment.java   
/**
 * Invokes {@link SillyAndroid#setPadding(View, int, int, int, int)} with the same arguments.
 */
protected final void setPadding(@NonNull final View view, @Px final int start, @Px final int top, @Px final int end, @Px final int bottom) {
    SillyAndroid.setPadding(view, start, top, end, bottom);
}
项目:silly-android    文件:EasyFragment.java   
/**
 * Invokes the {@link SillyAndroid#setPaddingVertical(View, int)} with the same arguments.
 */
protected final void setPaddingVertical(@NonNull final View view, @Px final int padding) {
    SillyAndroid.setPaddingVertical(view, padding);
}
项目:silly-android    文件:EasyFragment.java   
/**
 * Invokes the {@link SillyAndroid#setPaddingHorizontal(View, int)} with the same arguments.
 */
protected final void setPaddingHorizontal(@NonNull final View view, @Px final int padding) {
    SillyAndroid.setPaddingHorizontal(view, padding);
}
项目:silly-android    文件:EasyFragment.java   
/**
 * Invokes {@link SillyAndroid#setPadding(View, int)} with the same arguments.
 */
protected final void setPadding(@NonNull final View view, @Px final int padding) {
    SillyAndroid.setPadding(view, padding);
}
项目:silly-android    文件:EasyDialog.java   
/**
 * Invokes {@link SillyAndroid#setPadding(View, int, int, int, int)} with the same arguments.
 */
protected final void setPadding(@NonNull final View view, @Px final int start, @Px final int top, @Px final int end, @Px final int bottom) {
    SillyAndroid.setPadding(view, start, top, end, bottom);
}
项目:silly-android    文件:EasyDialog.java   
/**
 * Invokes the {@link SillyAndroid#setPaddingVertical(View, int)} with the same arguments.
 */
protected final void setPaddingVertical(@NonNull final View view, @Px final int padding) {
    SillyAndroid.setPaddingVertical(view, padding);
}
项目:silly-android    文件:EasyDialog.java   
/**
 * Invokes the {@link SillyAndroid#setPaddingHorizontal(View, int)} with the same arguments.
 */
protected final void setPaddingHorizontal(@NonNull final View view, @Px final int padding) {
    SillyAndroid.setPaddingHorizontal(view, padding);
}