當前位置: 首頁>>代碼示例>>Java>>正文


Java IntegerRes類代碼示例

本文整理匯總了Java中android.support.annotation.IntegerRes的典型用法代碼示例。如果您正苦於以下問題:Java IntegerRes類的具體用法?Java IntegerRes怎麽用?Java IntegerRes使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


IntegerRes類屬於android.support.annotation包,在下文中一共展示了IntegerRes類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onBindViewHolder

import android.support.annotation.IntegerRes; //導入依賴的package包/類
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);
    }
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:23,代碼來源:StatusCardViewHolder.java

示例2: getInteger

import android.support.annotation.IntegerRes; //導入依賴的package包/類
/**
 * 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);
}
 
開發者ID:prcaen,項目名稱:external-resources,代碼行數:26,代碼來源:ExternalResources.java

示例3: onBindViewHolder

import android.support.annotation.IntegerRes; //導入依賴的package包/類
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);
    }
}
 
開發者ID:mogoweb,項目名稱:365browser,代碼行數:24,代碼來源:StatusCardViewHolder.java

示例4: getInteger

import android.support.annotation.IntegerRes; //導入依賴的package包/類
@Override
public int getInteger(@IntegerRes int id) throws NotFoundException {
    int realId = getCorrespondResId(id);
    if (realId > 0) {
        return mSkinResources.getInteger(realId);
    }
    return super.getInteger(id);
}
 
開發者ID:Zeal27,項目名稱:SkinFramework,代碼行數:9,代碼來源:ComposedResources.java

示例5: getInteger

import android.support.annotation.IntegerRes; //導入依賴的package包/類
static int getInteger(Context context,
                      TypedArray array,
                      @StyleableRes int attr,
                      @IntegerRes int defaultIntRes) {

    return array.getInteger(
            attr, context.getResources().getInteger(defaultIntRes));
}
 
開發者ID:dewarder,項目名稱:CameraButton,代碼行數:9,代碼來源:TypedArrayHelper.java

示例6: setBackgroundGradient

import android.support.annotation.IntegerRes; //導入依賴的package包/類
public void setBackgroundGradient(@IntegerRes  int i, @IntegerRes int ii, @IntegerRes int iii) {
    mSkyTime = Time.CUSTOM;

    mDrawables[0] = i;
    mDrawables[1] = ii;
    mDrawables[2] = iii;
}
 
開發者ID:dsa28s,項目名稱:TimeSkyBackground,代碼行數:8,代碼來源:SkyTimeBackgroundView.java

示例7: getLongPreference

import android.support.annotation.IntegerRes; //導入依賴的package包/類
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;
	}
}
 
開發者ID:syntafin,項目名稱:TenguChat,代碼行數:9,代碼來源:XmppConnectionService.java

示例8: getInteger

import android.support.annotation.IntegerRes; //導入依賴的package包/類
/**
 * 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);
    }
}
 
開發者ID:markusressel,項目名稱:PageIndicatorView,代碼行數:19,代碼來源:PreferencesHelper.java

示例9: changeBitmapColor

import android.support.annotation.IntegerRes; //導入依賴的package包/類
/**
 * 給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;
}
 
開發者ID:AlanCheen,項目名稱:PracticeDemo,代碼行數:19,代碼來源:BitmapUtils.java

示例10: getLongPreference

import android.support.annotation.IntegerRes; //導入依賴的package包/類
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;
    }
}
 
開發者ID:kriztan,項目名稱:Pix-Art-Messenger,代碼行數:9,代碼來源:XmppConnectionService.java

示例11: getLongPreference

import android.support.annotation.IntegerRes; //導入依賴的package包/類
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;
	}
}
 
開發者ID:siacs,項目名稱:Conversations,代碼行數:9,代碼來源:XmppConnectionService.java

示例12: duration

import android.support.annotation.IntegerRes; //導入依賴的package包/類
protected int duration(@IntegerRes int resource){
    return getResources().getInteger(resource);
}
 
開發者ID:vpaliyX,項目名稱:Material-Motion,代碼行數:4,代碼來源:BaseFragment.java

示例13: withPlaceholder

import android.support.annotation.IntegerRes; //導入依賴的package包/類
public Builder withPlaceholder(@IntegerRes Integer placeholderRes) {
  this.placeholderRes = placeholderRes;
  return this;
}
 
開發者ID:philipphager,項目名稱:disclosure-android-app,代碼行數:5,代碼來源:AppIconLoader.java

示例14: getInteger

import android.support.annotation.IntegerRes; //導入依賴的package包/類
public int getInteger(@IntegerRes int id) {
    return getResources().getInteger(id);
}
 
開發者ID:angcyo,項目名稱:RLibrary,代碼行數:4,代碼來源:UIIViewImpl.java

示例15: integer

import android.support.annotation.IntegerRes; //導入依賴的package包/類
public static int integer(@IntegerRes int resId) {
  return sContext.getResources().getInteger(resId);
}
 
開發者ID:ItsSelina,項目名稱:tribbble,代碼行數:4,代碼來源:TribbbleApp.java


注:本文中的android.support.annotation.IntegerRes類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。