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

项目:chromium-for-android-56-debug-video    文件:StatusCardViewHolder.java   
public void onBindViewHolder(final DataSource item) {
    super.onBindViewHolder();

    mTitleView.setText(item.getHeader());
    mBodyView.setText(item.getDescription());

    @IntegerRes
    int actionLabel = item.getActionLabel();
    if (actionLabel != 0) {
        mActionView.setText(actionLabel);
        mActionView.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                item.performAction(v.getContext());
            }
        });
        mActionView.setVisibility(View.VISIBLE);
    } else {
        mActionView.setVisibility(View.GONE);
    }
}
项目:AndroidChromium    文件:StatusCardViewHolder.java   
public void onBindViewHolder(final DataSource item) {
    super.onBindViewHolder();

    mTitleView.setText(item.getHeader());
    mBodyView.setText(item.getDescription());

    @IntegerRes
    int actionLabel = item.getActionLabel();
    if (actionLabel != 0) {
        mActionView.setText(actionLabel);
        mActionView.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                item.performAction(v.getContext());
            }
        });
        mActionView.setVisibility(View.VISIBLE);
    } else {
        mActionView.setVisibility(View.GONE);
    }
}
项目:external-resources    文件:ExternalResources.java   
/**
 * Return an integer associated with a particular resource key.
 * This resource can come from resources you provided via the URL or via default resources.
 *
 * @param key The desired resource key.
 * @return Returns the integer value contained in the resource.
 * @throws NotFoundException Throws NotFoundException if the given key does not exist.
 */
public int getInteger(@NonNull String key) throws NotFoundException {
  Resource resource = resources.get(key);
  if (null != resource && null != resource.getAsInt()) {
    return resource.getAsInt();
  }

  @IntegerRes int resId = getApplicationResourceIdentifier(key, "integer");

  if (0 != resId) {
    int value = context.getResources().getInteger(resId);
    resources.add(key, new Resource(value));

    return value;
  }

  throw new NotFoundException("Integer resource with key: " + key);
}
项目:365browser    文件:StatusCardViewHolder.java   
public void onBindViewHolder(final DataSource item) {
    super.onBindViewHolder();

    mTitleView.setText(item.getHeader());
    mBodyView.setText(item.getDescription());

    @IntegerRes
    int actionLabel = item.getActionLabel();
    if (actionLabel != 0) {
        mActionView.setText(actionLabel);
        mActionView.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                SuggestionsMetrics.recordCardActionTapped();
                item.performAction(v.getContext());
            }
        });
        mActionView.setVisibility(View.VISIBLE);
    } else {
        mActionView.setVisibility(View.GONE);
    }
}
项目:SkinFramework    文件:ComposedResources.java   
@Override
public int getInteger(@IntegerRes int id) throws NotFoundException {
    int realId = getCorrespondResId(id);
    if (realId > 0) {
        return mSkinResources.getInteger(realId);
    }
    return super.getInteger(id);
}
项目:CameraButton    文件:TypedArrayHelper.java   
static int getInteger(Context context,
                      TypedArray array,
                      @StyleableRes int attr,
                      @IntegerRes int defaultIntRes) {

    return array.getInteger(
            attr, context.getResources().getInteger(defaultIntRes));
}
项目:TimeSkyBackground    文件:SkyTimeBackgroundView.java   
public void setBackgroundGradient(@IntegerRes  int i, @IntegerRes int ii, @IntegerRes int iii) {
    mSkyTime = Time.CUSTOM;

    mDrawables[0] = i;
    mDrawables[1] = ii;
    mDrawables[2] = iii;
}
项目:TenguChat    文件:XmppConnectionService.java   
public long getLongPreference(String name, @IntegerRes int res) {
    long defaultValue = getResources().getInteger(res);
    try {
        return Long.parseLong(getPreferences().getString(name,String.valueOf(defaultValue)));
    } catch (NumberFormatException e) {
        return defaultValue;
    }
}
项目:PageIndicatorView    文件:PreferencesHelper.java   
/**
 * Get an integer from preferences
 *
 * @param context      application context
 * @param key          preference key
 * @param defaultValue default value
 * @return integer
 */
public static int getInteger(@NonNull Context context, @StringRes int key, @IntegerRes int defaultValue) {
    SharedPreferences sharedPreferences = context.getSharedPreferences(SHARED_PREFS_NAME, Context.MODE_PRIVATE);
    String integerAsString = sharedPreferences.getString(context.getString(key), null);

    if (integerAsString == null) {
        return context.getResources().getInteger(defaultValue);
    } else {
        return Integer.valueOf(integerAsString);
    }
}
项目:external-resources    文件:ExternalResources.java   
/**
 * Return an integer associated with a particular resource ID.
 * This resource can come from resources you provided via the URL or via default resources.
 *
 * @param resId The desired resource identifier, as generated by the aapt
 * tool. This integer encodes the package, type, and resource
 * entry. The value 0 is an invalid identifier.
 * @return Returns the integer value contained in the resource.
 * @throws NotFoundException Throws NotFoundException if the given ID does not exist.
 */
public int getInteger(@IntegerRes int resId) throws NotFoundException {
  String key = getApplicationResourceEntryName(resId);

  if (null != key) {
    Resource resource = resources.get(key);
    if (null != resource && null != resource.getAsInt()) {
      return resource.getAsInt();
    }
  }

  throw new NotFoundException("Integer resource with resId: " + resId);
}
项目:PracticeDemo    文件:BitmapUtils.java   
/**
 * 给bitmap着色
 * @param sourceBitmap
 * @param color  rgb
 * @return
 */
public static Bitmap changeBitmapColor(@NonNull Bitmap sourceBitmap, @IntegerRes int color) {

    Bitmap resultBitmap = Bitmap.createBitmap(sourceBitmap, 0, 0,
            sourceBitmap.getWidth() - 1, sourceBitmap.getHeight() - 1);
    Paint p = new Paint();
    ColorFilter filter = new LightingColorFilter(color, 1);
    p.setColorFilter(filter);

    Canvas canvas = new Canvas(resultBitmap);
    canvas.drawBitmap(resultBitmap, 0, 0, p);
    return resultBitmap;
}
项目:Pix-Art-Messenger    文件:XmppConnectionService.java   
public long getLongPreference(String name, @IntegerRes int res) {
    long defaultValue = getResources().getInteger(res);
    try {
        return Long.parseLong(getPreferences().getString(name,String.valueOf(defaultValue)));
    } catch (NumberFormatException e) {
        return defaultValue;
    }
}
项目:Conversations    文件:XmppConnectionService.java   
public long getLongPreference(String name, @IntegerRes int res) {
    long defaultValue = getResources().getInteger(res);
    try {
        return Long.parseLong(getPreferences().getString(name, String.valueOf(defaultValue)));
    } catch (NumberFormatException e) {
        return defaultValue;
    }
}
项目:Material-Motion    文件:BaseFragment.java   
protected int duration(@IntegerRes int resource){
    return getResources().getInteger(resource);
}
项目:disclosure-android-app    文件:AppIconLoader.java   
public Builder withPlaceholder(@IntegerRes Integer placeholderRes) {
  this.placeholderRes = placeholderRes;
  return this;
}
项目:RLibrary    文件:UIIViewImpl.java   
public int getInteger(@IntegerRes int id) {
    return getResources().getInteger(id);
}
项目:tribbble    文件:TribbbleApp.java   
public static int integer(@IntegerRes int resId) {
  return sContext.getResources().getInteger(resId);
}
项目:CanDialog    文件:CanDialog.java   
public Builder setIcon(@IntegerRes int resId) {
    mDialog.setIcon(resId);

    return this;
}
项目:CanDialog    文件:CanDialog.java   
public Builder setFullBackgroundResource(@IntegerRes int rid) {
    mDialog.setFullBackgroundResource(rid);

    return this;
}
项目:xowa_android    文件:ShareHandler.java   
private int getInteger(@IntegerRes int id) {
    return getResources().getInteger(id);
}
项目:RoseBase    文件:SPUtil.java   
@IntegerRes
public static int getInt(Context context, String key, int defaultInt) {
    return getSharedPreferences(context).getInt(key, defaultInt);
}
项目:aptoide-client-v8    文件:AptoideUtils.java   
public static int getInt(@IntegerRes int resId, Resources resources) {
  return resources.getInteger(resId);
}
项目:StraaS-android-sdk-sample    文件:Utils.java   
public static void fadeOutView(@NonNull final View view, @IntegerRes int durationRes, Animator.AnimatorListener listener) {
    fadeOutView(view, durationRes, listener, 0);
}
项目:StraaS-android-sdk-sample    文件:Utils.java   
public static void fadeOutView(@NonNull final View view, @IntegerRes int durationRes, Animator.AnimatorListener listener, long startDelay) {
    long duration = view.getResources().getInteger(durationRes);
    fadeOutView(view, duration, listener, startDelay);
}
项目:StraaS-android-sdk-sample    文件:Utils.java   
public static void fadeInView(@NonNull final View view, @IntegerRes int durationRes, Animator.AnimatorListener listener) {
    long duration = view.getResources().getInteger(durationRes);
    fadeInView(view, duration, listener);
}
项目:Images-to-PDF    文件:Home.java   
public int integer(@IntegerRes int resId) {
    return getResources().getInteger(resId);
}
项目:orz    文件:BaseUtils.java   
public static int getIntOfRes(Context context, @IntegerRes int res) {
    return context.getResources().getInteger(res);
}
项目:rose    文件:SPUtil.java   
@IntegerRes
public static int getInt(Context context, String key, int defaultInt) {
    return getSharedPreferences(context).getInt(key, defaultInt);
}
项目:Android-App-Template    文件:ResourcesUtil.java   
public static int getInteger(@IntegerRes int integerRes) {
    return ContextUtil.getResources().getInteger(integerRes);
}
项目:EnumResources    文件:EnumResources.java   
public EnumAssociation assocInteger(@IntegerRes final int integerRes) {
    _associations.put(INTEGER_FIELD_INDEX, integerRes);

    return this;
}
项目:EnumResources    文件:EnumResources.java   
public EnumAssociation assocInteger(@IntegerRes final int integerRes, final Enum<?> enumValue) {
    _enumAssociations.put(enumValue.ordinal(), integerRes);

    return this;
}
项目:EnumResources    文件:EnumResources.java   
@IntegerRes public int getIntegerRes() {
    return _associations.get(INTEGER_FIELD_INDEX);
}
项目:EnumResources    文件:EnumResources.java   
@IntegerRes public int getIntegerRes(final Enum<?> enumValue) {
    return _enumAssociations.get(enumValue.ordinal());
}
项目:DebugDrawer    文件:DebugDrawer.java   
/**
 * Set the background color for the Slider from a Resource.
 * This is the view containing the list.
 */
public Builder backgroundColorRes(@IntegerRes int sliderBackgroundColorRes) {
    this.sliderBackgroundColorRes = sliderBackgroundColorRes;
    return this;
}
项目:sprockets-android    文件:Animators.java   
private static ViewPropertyAnimator scale(View view, float size, TimeInterpolator interpolator,
                                          @IntegerRes int duration) {
    return view.animate().scaleX(size).scaleY(size).setInterpolator(interpolator)
            .setDuration(view.getResources().getInteger(duration));
}
项目:Print    文件:PrintView.java   
@Override
public void setIconCodeRes(@IntegerRes int resId) {
    getIcon().setIconCodeRes(resId);
}
项目:Print    文件:PrintDrawable.java   
@Override
public void setIconCodeRes(@IntegerRes int resId) {
    setIconCode(mContext.getResources().getInteger(resId));
}
项目:Print    文件:PrintDrawable.java   
public Builder iconCodeRes(@IntegerRes int resId) {
    return iconCode(mContext.getResources().getInteger(resId));
}
项目:Print    文件:PrintButton.java   
@Override
public void setIconCodeRes(@IntegerRes int resId) {
    getIcon().setIconCodeRes(resId);
}
项目:Qiitanium    文件:AppFragment.java   
protected int getInteger(@IntegerRes int resId) {
  return ResUtils.getInteger(getContext(), resId);
}