android.support.annotation.IntegerRes Java Examples

The following examples show how to use android.support.annotation.IntegerRes. 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: AndroidChromium   Author: JackyAndroid   File: StatusCardViewHolder.java    License: Apache License 2.0 6 votes vote down vote up
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);
    }
}
 
Example #2
Source Project: external-resources   Author: prcaen   File: ExternalResources.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example #3
Source Project: 365browser   Author: mogoweb   File: StatusCardViewHolder.java    License: Apache License 2.0 6 votes vote down vote up
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);
    }
}
 
Example #4
Source Project: CameraButton   Author: hluhovskyi   File: TypedArrayHelper.java    License: Apache License 2.0 5 votes vote down vote up
static int getInteger(Context context,
                      TypedArray array,
                      @StyleableRes int attr,
                      @IntegerRes int defaultIntRes) {

    return array.getInteger(
            attr, context.getResources().getInteger(defaultIntRes));
}
 
Example #5
Source Project: external-resources   Author: prcaen   File: ExternalResources.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #6
Source Project: PracticeDemo   Author: AlanCheen   File: BitmapUtils.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 给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;
}
 
Example #7
Source Project: Android-utils   Author: Shouheng88   File: ResUtils.java    License: Apache License 2.0 4 votes vote down vote up
public static int getInteger(@IntegerRes int id) {
    return UtilsApp.getApp().getResources().getInteger(id);
}
 
Example #8
Source Project: PowerFileExplorer   Author: PowerExplorer   File: ResourcesUtil.java    License: GNU General Public License v3.0 4 votes vote down vote up
public static int getInteger(@IntegerRes int integerRes) {
    return Base.getResources().getInteger(integerRes);
}
 
Example #9
Source Project: Dual-color-Polyline-Animation   Author: tintinscorpion   File: MapAnimator.java    License: MIT License 4 votes vote down vote up
public void setPercentCompletion(@IntegerRes int time) {
    PERCENT_COMPLETION = time;
}
 
Example #10
Source Project: Dual-color-Polyline-Animation   Author: tintinscorpion   File: MapAnimator.java    License: MIT License 4 votes vote down vote up
public void setColorFillCompletion(@IntegerRes int time) {
    COLOR_FILL_ANIMATION = time;
}
 
Example #11
Source Project: Dual-color-Polyline-Animation   Author: tintinscorpion   File: MapAnimator.java    License: MIT License 4 votes vote down vote up
public void setPrimaryLineCompletion(@IntegerRes int time) {
    FOREGROUND_TIME = time;
}
 
Example #12
Source Project: Dual-color-Polyline-Animation   Author: tintinscorpion   File: MapAnimator.java    License: MIT License 4 votes vote down vote up
public void setDelayTime(@IntegerRes int time) {
    DELAY_TIME = time;
}
 
Example #13
Source Project: android-material-motion   Author: vpaliy   File: BaseFragment.java    License: Apache License 2.0 4 votes vote down vote up
protected int duration(@IntegerRes int resource) {
  return getResources().getInteger(resource);
}
 
Example #14
Source Project: mirror   Author: jreyes   File: AppManagerImpl.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public int getInteger(@IntegerRes int intResId) {
    return mApplication.getResources().getInteger(intResId);
}
 
Example #15
Source Project: tribbble   Author: ItsSelina   File: TribbbleApp.java    License: Apache License 2.0 4 votes vote down vote up
public static int integer(@IntegerRes int resId) {
  return sContext.getResources().getInteger(resId);
}
 
Example #16
Source Project: CanDialog   Author: canyinghao   File: CanDialog.java    License: Apache License 2.0 4 votes vote down vote up
public Builder setIcon(@IntegerRes int resId) {
    mDialog.setIcon(resId);

    return this;
}
 
Example #17
Source Project: CanDialog   Author: canyinghao   File: CanDialog.java    License: Apache License 2.0 4 votes vote down vote up
public Builder setFullBackgroundResource(@IntegerRes int rid) {
    mDialog.setFullBackgroundResource(rid);

    return this;
}
 
Example #18
Source Project: orz   Author: vsona   File: BaseUtils.java    License: Apache License 2.0 4 votes vote down vote up
public static int getIntOfRes(Context context, @IntegerRes int res) {
    return context.getResources().getInteger(res);
}
 
Example #19
Source Project: DebugDrawer   Author: palaima   File: DebugDrawer.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * 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;
}
 
Example #20
Source Project: Print   Author: johnkil   File: PrintView.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void setIconCodeRes(@IntegerRes int resId) {
    getIcon().setIconCodeRes(resId);
}
 
Example #21
Source Project: Print   Author: johnkil   File: PrintDrawable.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void setIconCodeRes(@IntegerRes int resId) {
    setIconCode(mContext.getResources().getInteger(resId));
}
 
Example #22
Source Project: Print   Author: johnkil   File: PrintDrawable.java    License: Apache License 2.0 4 votes vote down vote up
public Builder iconCodeRes(@IntegerRes int resId) {
    return iconCode(mContext.getResources().getInteger(resId));
}
 
Example #23
Source Project: Print   Author: johnkil   File: PrintButton.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void setIconCodeRes(@IntegerRes int resId) {
    getIcon().setIconCodeRes(resId);
}
 
Example #24
Source Project: Qiitanium   Author: ogaclejapan   File: AppFragment.java    License: MIT License 4 votes vote down vote up
protected int getInteger(@IntegerRes int resId) {
  return ResUtils.getInteger(getContext(), resId);
}
 
Example #25
Source Project: Qiitanium   Author: ogaclejapan   File: AppActivity.java    License: MIT License 4 votes vote down vote up
protected int getInteger(@IntegerRes int resId) {
  return ResUtils.getInteger(this, resId);
}
 
Example #26
Source Project: Qiitanium   Author: ogaclejapan   File: ResUtils.java    License: MIT License 4 votes vote down vote up
public static int getInteger(Context ctx, @IntegerRes int integerResId) {
  return ctx.getResources().getInteger(integerResId);
}
 
Example #27
Source Project: SimpleProject   Author: Liberuman   File: ResourceUtil.java    License: MIT License 2 votes vote down vote up
/**
 * 获取整型值
 * @param resId
 * @return
 */
public int getInteger(@IntegerRes int resId) {
	return BaseContentProvider.context.getResources().getInteger(resId);
}
 
Example #28
Source Project: mirror   Author: jreyes   File: AppManager.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Gets the specified integer ressource.
 *
 * @param intResId The resource id of the integer.
 * @return An {@code int} value.
 */
int getInteger(@IntegerRes int intResId);
 
Example #29
Source Project: DebugDrawer   Author: palaima   File: DebugDrawer.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Set the background color for the Slider from a Resource.
 * This is the view containing the list.
 */
public Builder backgroundColorRes(@IntegerRes int sliderBackgroundColorRes) {
    return this;
}
 
Example #30
Source Project: Print   Author: johnkil   File: IPrint.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Sets the icon text based on char code from integer resources. Fixed issue of support
 * UTF-16 chars (see <a href="https://github.com/johnkil/Print/issues/11">issue #11</a>)
 *
 * @see #setIconCode(int)
 * @see #getIconText()
 */
void setIconCodeRes(@IntegerRes int resId);