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

项目:external-resources    文件:ExternalResources.java   
/**
 * Return a boolean 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 boolean value contained in the resource.
 * @throws NotFoundException Throws NotFoundException if the given key does not exist.
 */
public boolean getBoolean(@NonNull String key) throws NotFoundException {
  Resource resource = resources.get(key);
  if (null != resource) {
    return resource.getAsBoolean();
  }

  @BoolRes int resId = getApplicationResourceIdentifier(key, "bool");

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

    return value;
  }

  throw new NotFoundException("Boolean resource with key: " + key);
}
项目:SkinFramework    文件:ComposedResources.java   
@Override
public boolean getBoolean(@BoolRes int id) throws NotFoundException {
    int realId = getCorrespondResId(id);
    if (realId > 0) {
        return mSkinResources.getBoolean(realId);
    }
    return super.getBoolean(id);
}
项目:BannerLayout    文件:BannerLayout.java   
/**
 * Initialize the dots control, do not initialize this method if you select custom hint bar
 *
 * @param isBackgroundColor Whether to display the background color
 * @param isVisibleDots     Whether to display small dots, the default display
 * @param isVisibleTitle    Whether to display title, the default is not displayed
 */
public BannerLayout initTips(@BoolRes boolean isBackgroundColor,
                             @BoolRes boolean isVisibleDots,
                             @BoolRes boolean isVisibleTitle) {
    this.isTipsBackground = isBackgroundColor;
    this.isVisibleDots = isVisibleDots;
    this.isVisibleTitle = isVisibleTitle;
    clearBannerTipLayout();
    bannerTipLayout = new BannerTipsLayout(getContext());
    return this;
}
项目:BannerLayout    文件:BannerLayout.java   
public BannerLayout switchBanner(@BoolRes boolean isStartRotation) {
    this.isStartRotation = isStartRotation;
    bannerHandlerUtils.removeCallbacksAndMessages(null);
    if (isStartRotation) {
        bannerHandlerUtils.setDelayTime(delayTime);
        bannerHandlerUtils.sendEmptyMessageDelayed(BannerHandlerUtils.MSG_UPDATE, delayTime);
    } else {
        bannerHandlerUtils.sendEmptyMessage(BannerHandlerUtils.MSG_KEEP);
        bannerHandlerUtils.removeCallbacksAndMessages(null);
    }
    return this;
}
项目:AppAuth-Demo    文件:IdentityProvider.java   
IdentityProvider(
        @NonNull String name,
        @BoolRes int enabledRes,
        @StringRes int discoveryEndpointRes,
        @StringRes int authEndpointRes,
        @StringRes int tokenEndpointRes,
        @StringRes int clientIdRes,
        @StringRes int clientSecretRes,
        @StringRes int redirectUriRes,
        @StringRes int scopeRes,
        @DrawableRes int buttonImageRes,
        @StringRes int buttonContentDescriptionRes) {
    if (!isSpecified(discoveryEndpointRes)
            && !isSpecified(authEndpointRes)
            && !isSpecified(tokenEndpointRes)) {
        throw new IllegalArgumentException(
                "the discovery endpoint or the auth and token endpoints must be specified");
    }

    this.name = name;
    this.mEnabledRes = checkSpecified(enabledRes, "enabledRes");
    this.mDiscoveryEndpointRes = discoveryEndpointRes;
    this.mAuthEndpointRes = authEndpointRes;
    this.mTokenEndpointRes = tokenEndpointRes;
    this.mClientIdRes = checkSpecified(clientIdRes, "clientIdRes");
    this.mClientSecretRes = clientSecretRes;
    this.mRedirectUriRes = checkSpecified(redirectUriRes, "redirectUriRes");
    this.mScopeRes = checkSpecified(scopeRes, "scopeRes");
    this.buttonImageRes = checkSpecified(buttonImageRes, "buttonImageRes");
    this.buttonContentDescriptionRes =
            checkSpecified(buttonContentDescriptionRes, "buttonContentDescriptionRes");
}
项目:jump.android    文件:OpenIDIdentityProvider.java   
protected OldProvider(
        @NonNull String name,
        @BoolRes int enabledRes,
        @StringRes int discoveryEndpointRes,
        @StringRes int authEndpointRes,
        @StringRes int tokenEndpointRes,
        @StringRes int registrationEndpointRes,
        @StringRes int clientIdRes,
        @StringRes int redirectUriRes,
        @StringRes int scopeRes,
        @DrawableRes int buttonImageRes,
        @StringRes int buttonContentDescriptionRes,
        @ColorRes int buttonTextColorRes) {
    super(null, buttonImageRes, buttonContentDescriptionRes, buttonTextColorRes, false);
    if (!isResSpecified(discoveryEndpointRes)
            && !isResSpecified(authEndpointRes)
            && !isResSpecified(tokenEndpointRes)) {
        throw new IllegalArgumentException(
                "the discovery endpoint or the auth and token endpoints must be specified");
    }

    this.name = name;
    this.mEnabledRes = checkResSpecified(enabledRes, "enabledRes");
    this.mDiscoveryEndpointRes = discoveryEndpointRes;
    this.mAuthEndpointRes = authEndpointRes;
    this.mTokenEndpointRes = tokenEndpointRes;
    this.mRegistrationEndpointRes = registrationEndpointRes;
    this.mClientIdRes = clientIdRes;
    this.mRedirectUriRes = checkResSpecified(redirectUriRes, "redirectUriRes");
    this.mScopeRes = checkResSpecified(scopeRes, "scopeRes");
}
项目:cafebar    文件:CafeBar.java   
public Builder showShadow(@BoolRes int res) {
    return showShadow(mContext.getResources().getBoolean(res));
}
项目:cafebar    文件:CafeBar.java   
public Builder autoDismiss(@BoolRes int res) {
    return autoDismiss(mContext.getResources().getBoolean(res));
}
项目:cafebar    文件:CafeBar.java   
public Builder swipeToDismiss(@BoolRes int res) {
    return swipeToDismiss(mContext.getResources().getBoolean(res));
}
项目:cafebar    文件:CafeBar.java   
public Builder floating(@BoolRes int res) {
    return floating(mContext.getResources().getBoolean(res));
}
项目:TenguChat    文件:XmppConnectionService.java   
public boolean getBooleanPreference(String name, @BoolRes int res) {
    return getPreferences().getBoolean(name,getResources().getBoolean(res));
}
项目:BannerLayout    文件:BannerLayout.java   
/**
 * sets whether the viewpager can be swiped, true to prevent sliding
 */
public BannerLayout setViewPagerTouchMode(@BoolRes boolean b) {
    this.viePagerTouchMode = b;
    return this;
}
项目:BannerLayout    文件:BannerLayout.java   
/**
 * Whether the vertical sliding ,The default is not
 */
public BannerLayout setVertical(@BoolRes boolean vertical) {
    this.isVertical = vertical;
    return this;
}
项目:BottomSheet    文件:BottomSheet.java   
public Builder(@NonNull Context context, @BoolRes int needFocus) {
    this.context = context;
    bottomSheet = new BottomSheet(context, context.getResources().getBoolean(needFocus));
}
项目:material-components-android    文件:ChipDrawable.java   
public void setChipIconEnabledResource(@BoolRes int id) {
  setChipIconEnabled(context.getResources().getBoolean(id));
}
项目:material-components-android    文件:ChipDrawable.java   
public void setCloseIconEnabledResource(@BoolRes int id) {
  setCloseIconEnabled(context.getResources().getBoolean(id));
}
项目:material-components-android    文件:ChipDrawable.java   
public void setCheckableResource(@BoolRes int id) {
  setCheckable(context.getResources().getBoolean(id));
}
项目:material-components-android    文件:ChipDrawable.java   
public void setCheckedIconEnabledResource(@BoolRes int id) {
  setCheckedIconEnabled(context.getResources().getBoolean(id));
}
项目:material-components-android    文件:ChipGroup.java   
/** Sets whether this chip group is single line, or reflowed multiline. */
public void setSingleLine(@BoolRes int id) {
  setSingleLine(getResources().getBoolean(id));
}
项目:material-components-android    文件:Chip.java   
public void setChipIconEnabledResource(@BoolRes int id) {
  if (chipDrawable != null) {
    chipDrawable.setChipIconEnabledResource(id);
  }
}
项目:material-components-android    文件:Chip.java   
public void setCloseIconEnabledResource(@BoolRes int id) {
  if (chipDrawable != null) {
    chipDrawable.setCloseIconEnabledResource(id);
  }
}
项目:material-components-android    文件:Chip.java   
public void setCheckableResource(@BoolRes int id) {
  if (chipDrawable != null) {
    chipDrawable.setCheckableResource(id);
  }
}
项目:material-components-android    文件:Chip.java   
public void setCheckedIconEnabledResource(@BoolRes int id) {
  if (chipDrawable != null) {
    chipDrawable.setCheckedIconEnabledResource(id);
  }
}
项目:Android-App-Template    文件:ResourcesUtil.java   
public static boolean getBoolean(@BoolRes int boolRes) {
    return ContextUtil.getResources().getBoolean(boolRes);
}
项目:EnumResources    文件:EnumResources.java   
public EnumAssociation assocBoolean(@BoolRes final int boolRes) {
    _associations.put(BOOL_FIELD_INDEX, boolRes);

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

    return this;
}
项目:EnumResources    文件:EnumResources.java   
@BoolRes public int getBooleanRes() {
    return _associations.get(BOOL_FIELD_INDEX);
}
项目:EnumResources    文件:EnumResources.java   
@BoolRes public int getBooleanRes(final Enum<?> enumValue) {
    return _enumAssociations.get(enumValue.ordinal());
}
项目:Pix-Art-Messenger    文件:XmppConnectionService.java   
public boolean getBooleanPreference(String name, @BoolRes int res) {
    return getPreferences().getBoolean(name, getResources().getBoolean(res));
}
项目:Conversations    文件:XmppConnectionService.java   
public boolean getBooleanPreference(String name, @BoolRes int res) {
    return getPreferences().getBoolean(name, getResources().getBoolean(res));
}
项目:ThemeEngine    文件:Theme.java   
/**
 * Gets boolean from theme apk
 */
public static Boolean getBoolean(Context context, @BoolRes int resId) {
    return getBoolean(context, Theme.get(context, resId));
}
项目:external-resources    文件:ExternalResources.java   
/**
 * Return a boolean 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 boolean value contained in the resource.
 * @throws NotFoundException Throws NotFoundException if the given ID does not exist.
 */
public boolean getBoolean(@BoolRes int resId) throws NotFoundException {
  String key = getApplicationResourceEntryName(resId);

  if (null == key) {
    throw new NotFoundException("Boolean resource with resId: " + resId);
  }

  return getBoolean(key);
}
项目:SimpleDialogFragments    文件:Check.java   
/**
 * Sets the initial state of the checkbox
 *
 * @param preset initial state as boolean resource
 */
public Check check(@BoolRes int preset){
    this.presetId = preset;
    return this;
}
项目:TwistyTimer    文件:DefaultPrefs.java   
/**
 * Returns the boolean value assigned to the resource key
 *
 * @param defaultResID
 *      The resource key ID
 *
 * @return
 *      The resource value
 */
public static boolean getBoolean(@BoolRes int defaultResID) {
    return getRes().getBoolean(defaultResID);
}
项目:SimpleDialogFragments    文件:Check.java   
/**
 * Sets the initial state of the checkbox
 *
 * @param preset initial state as boolean resource
 */
public Check check(@BoolRes int preset){
    this.presetId = preset;
    return this;
}
项目:material-components-android    文件:ChipGroup.java   
/**
 * Sets whether this chip group only allows a single chip to be checked.
 *
 * <p>Calling this method results in all the chips in this group to become unchecked.
 */
public void setSingleSelection(@BoolRes int id) {
  setSingleSelection(getResources().getBoolean(id));
}
项目:material-components-android    文件:BottomNavigationView.java   
/**
 * Sets whether the menu items horizontally translate when in shifting mode using a resource ID.
 *
 * @param itemHorizontalTranslation whether the items horizontally translate in shifting mode
 * @see #getItemHorizontalTranslation()
 */
public void setItemHorizontalTranslation(@BoolRes int itemHorizontalTranslation) {
  setItemHorizontalTranslation(getResources().getBoolean(itemHorizontalTranslation));
}
项目:material-components-android    文件:TabLayout.java   
/**
 * Set whether tab labels will be displayed inline with tab icons, or if they will be displayed
 * underneath tab icons.
 *
 * @param inlineResourceId Resource ID for boolean inline flag
 * @see #isInlineLabel()
 * @attr ref android.support.design.R.styleable#TabLayout_tabInlineLabel
 */
public void setInlineLabelResource(@BoolRes int inlineResourceId) {
  setInlineLabel(getResources().getBoolean(inlineResourceId));
}
项目:android-tao-core    文件:AppResources.java   
/**
 * Return a boolean associated with a particular resource ID.  This can be
 * used with any integral resource value, and will return true if it is
 * non-zero.
 *
 * @param id 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 boolean value contained in the resource.
 * @throws NotFoundException Throws NotFoundException if the given ID does not exist.
 */
public static boolean getBoolean(@BoolRes int id) throws NotFoundException {
   return resources.getBoolean(id);
}