/** * 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); }
@Override public boolean getBoolean(@BoolRes int id) throws NotFoundException { int realId = getCorrespondResId(id); if (realId > 0) { return mSkinResources.getBoolean(realId); } return super.getBoolean(id); }
/** * 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; }
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; }
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"); }
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"); }
public Builder showShadow(@BoolRes int res) { return showShadow(mContext.getResources().getBoolean(res)); }
public Builder autoDismiss(@BoolRes int res) { return autoDismiss(mContext.getResources().getBoolean(res)); }
public Builder swipeToDismiss(@BoolRes int res) { return swipeToDismiss(mContext.getResources().getBoolean(res)); }
public Builder floating(@BoolRes int res) { return floating(mContext.getResources().getBoolean(res)); }
public boolean getBooleanPreference(String name, @BoolRes int res) { return getPreferences().getBoolean(name,getResources().getBoolean(res)); }
/** * sets whether the viewpager can be swiped, true to prevent sliding */ public BannerLayout setViewPagerTouchMode(@BoolRes boolean b) { this.viePagerTouchMode = b; return this; }
/** * Whether the vertical sliding ,The default is not */ public BannerLayout setVertical(@BoolRes boolean vertical) { this.isVertical = vertical; return this; }
public Builder(@NonNull Context context, @BoolRes int needFocus) { this.context = context; bottomSheet = new BottomSheet(context, context.getResources().getBoolean(needFocus)); }
public void setChipIconEnabledResource(@BoolRes int id) { setChipIconEnabled(context.getResources().getBoolean(id)); }
public void setCloseIconEnabledResource(@BoolRes int id) { setCloseIconEnabled(context.getResources().getBoolean(id)); }
public void setCheckableResource(@BoolRes int id) { setCheckable(context.getResources().getBoolean(id)); }
public void setCheckedIconEnabledResource(@BoolRes int id) { setCheckedIconEnabled(context.getResources().getBoolean(id)); }
/** Sets whether this chip group is single line, or reflowed multiline. */ public void setSingleLine(@BoolRes int id) { setSingleLine(getResources().getBoolean(id)); }
public void setChipIconEnabledResource(@BoolRes int id) { if (chipDrawable != null) { chipDrawable.setChipIconEnabledResource(id); } }
public void setCloseIconEnabledResource(@BoolRes int id) { if (chipDrawable != null) { chipDrawable.setCloseIconEnabledResource(id); } }
public void setCheckableResource(@BoolRes int id) { if (chipDrawable != null) { chipDrawable.setCheckableResource(id); } }
public void setCheckedIconEnabledResource(@BoolRes int id) { if (chipDrawable != null) { chipDrawable.setCheckedIconEnabledResource(id); } }
public static boolean getBoolean(@BoolRes int boolRes) { return ContextUtil.getResources().getBoolean(boolRes); }
public EnumAssociation assocBoolean(@BoolRes final int boolRes) { _associations.put(BOOL_FIELD_INDEX, boolRes); return this; }
public EnumAssociation assocBoolean(@BoolRes final int boolRes, final Enum<?> enumValue) { _enumAssociations.put(enumValue.ordinal(), boolRes); return this; }
@BoolRes public int getBooleanRes() { return _associations.get(BOOL_FIELD_INDEX); }
@BoolRes public int getBooleanRes(final Enum<?> enumValue) { return _enumAssociations.get(enumValue.ordinal()); }
public boolean getBooleanPreference(String name, @BoolRes int res) { return getPreferences().getBoolean(name, getResources().getBoolean(res)); }
/** * Gets boolean from theme apk */ public static Boolean getBoolean(Context context, @BoolRes int resId) { return getBoolean(context, Theme.get(context, resId)); }
/** * 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); }
/** * 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; }
/** * 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); }
/** * 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)); }
/** * 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)); }
/** * 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)); }
/** * 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); }