Java Code Examples for android.support.annotation.BoolRes

The following are top voted examples for showing how to use android.support.annotation.BoolRes. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: external-resources   File: ExternalResources.java   View source code 6 votes vote down vote up
/**
 * 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);
}
 
Example 2
Project: SkinFramework   File: ComposedResources.java   View source code 5 votes vote down vote up
@Override
public boolean getBoolean(@BoolRes int id) throws NotFoundException {
    int realId = getCorrespondResId(id);
    if (realId > 0) {
        return mSkinResources.getBoolean(realId);
    }
    return super.getBoolean(id);
}
 
Example 3
Project: BannerLayout   File: BannerLayout.java   View source code 5 votes vote down vote up
/**
 * 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;
}
 
Example 4
Project: BannerLayout   File: BannerLayout.java   View source code 5 votes vote down vote up
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;
}
 
Example 5
Project: AppAuth-Demo   File: IdentityProvider.java   View source code 5 votes vote down vote up
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");
}
 
Example 6
Project: jump.android   File: OpenIDIdentityProvider.java   View source code 5 votes vote down vote up
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");
}
 
Example 7
Project: cafebar   File: CafeBar.java   View source code 4 votes vote down vote up
public Builder showShadow(@BoolRes int res) {
    return showShadow(mContext.getResources().getBoolean(res));
}
 
Example 8
Project: cafebar   File: CafeBar.java   View source code 4 votes vote down vote up
public Builder autoDismiss(@BoolRes int res) {
    return autoDismiss(mContext.getResources().getBoolean(res));
}
 
Example 9
Project: cafebar   File: CafeBar.java   View source code 4 votes vote down vote up
public Builder swipeToDismiss(@BoolRes int res) {
    return swipeToDismiss(mContext.getResources().getBoolean(res));
}
 
Example 10
Project: cafebar   File: CafeBar.java   View source code 4 votes vote down vote up
public Builder floating(@BoolRes int res) {
    return floating(mContext.getResources().getBoolean(res));
}
 
Example 11
Project: TenguChat   File: XmppConnectionService.java   View source code 4 votes vote down vote up
public boolean getBooleanPreference(String name, @BoolRes int res) {
	return getPreferences().getBoolean(name,getResources().getBoolean(res));
}
 
Example 12
Project: BannerLayout   File: BannerLayout.java   View source code 4 votes vote down vote up
/**
 * sets whether the viewpager can be swiped, true to prevent sliding
 */
public BannerLayout setViewPagerTouchMode(@BoolRes boolean b) {
    this.viePagerTouchMode = b;
    return this;
}
 
Example 13
Project: BannerLayout   File: BannerLayout.java   View source code 4 votes vote down vote up
/**
 * Whether the vertical sliding ,The default is not
 */
public BannerLayout setVertical(@BoolRes boolean vertical) {
    this.isVertical = vertical;
    return this;
}
 
Example 14
Project: BottomSheet   File: BottomSheet.java   View source code 4 votes vote down vote up
public Builder(@NonNull Context context, @BoolRes int needFocus) {
    this.context = context;
    bottomSheet = new BottomSheet(context, context.getResources().getBoolean(needFocus));
}
 
Example 15
Project: material-components-android   File: ChipDrawable.java   View source code 4 votes vote down vote up
public void setChipIconEnabledResource(@BoolRes int id) {
  setChipIconEnabled(context.getResources().getBoolean(id));
}
 
Example 16
Project: material-components-android   File: ChipDrawable.java   View source code 4 votes vote down vote up
public void setCloseIconEnabledResource(@BoolRes int id) {
  setCloseIconEnabled(context.getResources().getBoolean(id));
}
 
Example 17
Project: material-components-android   File: ChipDrawable.java   View source code 4 votes vote down vote up
public void setCheckableResource(@BoolRes int id) {
  setCheckable(context.getResources().getBoolean(id));
}
 
Example 18
Project: material-components-android   File: ChipDrawable.java   View source code 4 votes vote down vote up
public void setCheckedIconEnabledResource(@BoolRes int id) {
  setCheckedIconEnabled(context.getResources().getBoolean(id));
}
 
Example 19
Project: material-components-android   File: ChipGroup.java   View source code 4 votes vote down vote up
/** Sets whether this chip group is single line, or reflowed multiline. */
public void setSingleLine(@BoolRes int id) {
  setSingleLine(getResources().getBoolean(id));
}
 
Example 20
Project: material-components-android   File: Chip.java   View source code 4 votes vote down vote up
public void setChipIconEnabledResource(@BoolRes int id) {
  if (chipDrawable != null) {
    chipDrawable.setChipIconEnabledResource(id);
  }
}
 
Example 21
Project: material-components-android   File: Chip.java   View source code 4 votes vote down vote up
public void setCloseIconEnabledResource(@BoolRes int id) {
  if (chipDrawable != null) {
    chipDrawable.setCloseIconEnabledResource(id);
  }
}
 
Example 22
Project: material-components-android   File: Chip.java   View source code 4 votes vote down vote up
public void setCheckableResource(@BoolRes int id) {
  if (chipDrawable != null) {
    chipDrawable.setCheckableResource(id);
  }
}
 
Example 23
Project: material-components-android   File: Chip.java   View source code 4 votes vote down vote up
public void setCheckedIconEnabledResource(@BoolRes int id) {
  if (chipDrawable != null) {
    chipDrawable.setCheckedIconEnabledResource(id);
  }
}
 
Example 24
Project: Android-App-Template   File: ResourcesUtil.java   View source code 4 votes vote down vote up
public static boolean getBoolean(@BoolRes int boolRes) {
    return ContextUtil.getResources().getBoolean(boolRes);
}
 
Example 25
Project: EnumResources   File: EnumResources.java   View source code 4 votes vote down vote up
public EnumAssociation assocBoolean(@BoolRes final int boolRes) {
	_associations.put(BOOL_FIELD_INDEX, boolRes);

	return this;
}
 
Example 26
Project: EnumResources   File: EnumResources.java   View source code 4 votes vote down vote up
public EnumAssociation assocBoolean(@BoolRes final int boolRes, final Enum<?> enumValue) {
	_enumAssociations.put(enumValue.ordinal(), boolRes);

	return this;
}
 
Example 27
Project: EnumResources   File: EnumResources.java   View source code 4 votes vote down vote up
@BoolRes public int getBooleanRes() {
	return _associations.get(BOOL_FIELD_INDEX);
}
 
Example 28
Project: EnumResources   File: EnumResources.java   View source code 4 votes vote down vote up
@BoolRes public int getBooleanRes(final Enum<?> enumValue) {
	return _enumAssociations.get(enumValue.ordinal());
}
 
Example 29
Project: Pix-Art-Messenger   File: XmppConnectionService.java   View source code 4 votes vote down vote up
public boolean getBooleanPreference(String name, @BoolRes int res) {
    return getPreferences().getBoolean(name, getResources().getBoolean(res));
}
 
Example 30
Project: Conversations   File: XmppConnectionService.java   View source code 4 votes vote down vote up
public boolean getBooleanPreference(String name, @BoolRes int res) {
	return getPreferences().getBoolean(name, getResources().getBoolean(res));
}
 
Example 31
Project: ThemeEngine   File: Theme.java   View source code 4 votes vote down vote up
/**
 * Gets boolean from theme apk
 */
public static Boolean getBoolean(Context context, @BoolRes int resId) {
    return getBoolean(context, Theme.get(context, resId));
}
 
Example 32
Project: external-resources   File: ExternalResources.java   View source code 3 votes vote down vote up
/**
 * 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);
}
 
Example 33
Project: SimpleDialogFragments   File: Check.java   View source code 2 votes vote down vote up
/**
 * 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;
}
 
Example 34
Project: TwistyTimer   File: DefaultPrefs.java   View source code 2 votes vote down vote up
/**
 * 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);
}
 
Example 35
Project: SimpleDialogFragments   File: Check.java   View source code 2 votes vote down vote up
/**
 * 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;
}
 
Example 36
Project: material-components-android   File: ChipGroup.java   View source code 2 votes vote down vote up
/**
 * 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));
}
 
Example 37
Project: material-components-android   File: BottomNavigationView.java   View source code 2 votes vote down vote up
/**
 * 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));
}
 
Example 38
Project: material-components-android   File: TabLayout.java   View source code 2 votes vote down vote up
/**
 * 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));
}
 
Example 39
Project: android-tao-core   File: AppResources.java   View source code 2 votes vote down vote up
/**
 * 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);
}