androidx.annotation.BoolRes Java Examples

The following examples show how to use androidx.annotation.BoolRes. 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 File: ResourceResolver.java    From litho with Apache License 2.0 5 votes vote down vote up
public boolean resolveBoolRes(@BoolRes int resId) {
  if (resId != 0) {
    Boolean cached = mResourceCache.get(resId);
    if (cached != null) {
      return cached;
    }

    boolean result = mResources.getBoolean(resId);
    mResourceCache.put(resId, result);

    return result;
  }

  return false;
}
 
Example #2
Source File: ResourceResolver.java    From litho with Apache License 2.0 5 votes vote down vote up
public boolean resolveBoolAttr(@AttrRes int attrResId, @BoolRes int defResId) {
  TypedArray a = mTheme.obtainStyledAttributes(new int[] {attrResId});

  try {
    return a.getBoolean(0, resolveBoolRes(defResId));
  } finally {
    a.recycle();
  }
}
 
Example #3
Source File: ResourceUtils.java    From DevUtils with Apache License 2.0 5 votes vote down vote up
/**
 * 获取 Boolean
 * @param id resource identifier
 * @return Boolean
 */
public static boolean getBoolean(@BoolRes final int id) {
    try {
        return DevUtils.getContext().getResources().getBoolean(id);
    } catch (Exception e) {
        LogPrintUtils.eTag(TAG, e, "getBoolean");
    }
    return false;
}
 
Example #4
Source File: XmppActivity.java    From Pix-Art-Messenger with GNU General Public License v3.0 4 votes vote down vote up
protected boolean getBooleanPreference(String name, @BoolRes int res) {
    return getPreferences().getBoolean(name, getResources().getBoolean(res));
}
 
Example #5
Source File: ActionBarActivity.java    From Pix-Art-Messenger with GNU General Public License v3.0 4 votes vote down vote up
protected boolean getBooleanPreference(String name, @BoolRes int res) {
    return getPreferences().getBoolean(name, getResources().getBoolean(res));
}
 
Example #6
Source File: Compatibility.java    From Pix-Art-Messenger with GNU General Public License v3.0 4 votes vote down vote up
private static boolean getBooleanPreference(Context context, String name, @BoolRes int res) {
    return getPreferences(context).getBoolean(name, context.getResources().getBoolean(res));
}
 
Example #7
Source File: Chip.java    From material-components-android with Apache License 2.0 4 votes vote down vote up
/** @deprecated Use {@link Chip#setCheckedIconVisible(int)} instead. */
@Deprecated
public void setCheckedIconEnabledResource(@BoolRes int id) {
  setCheckedIconVisible(id);
}
 
Example #8
Source File: Chip.java    From material-components-android with Apache License 2.0 4 votes vote down vote up
/** @deprecated Use {@link Chip#setCloseIconVisible(int)} instead. */
@Deprecated
public void setCloseIconEnabledResource(@BoolRes int id) {
  setCloseIconVisible(id);
}
 
Example #9
Source File: Chip.java    From material-components-android with Apache License 2.0 4 votes vote down vote up
/** @deprecated Use {@link Chip#setChipIconVisible(int)} instead. */
@Deprecated
public void setChipIconEnabledResource(@BoolRes int id) {
  setChipIconVisible(id);
}
 
Example #10
Source File: ChipGroup.java    From material-components-android with Apache License 2.0 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 #11
Source File: ChipDrawable.java    From material-components-android with Apache License 2.0 4 votes vote down vote up
/** @deprecated Use {@link ChipDrawable#setCheckedIconVisible(int)} instead. */
@Deprecated
public void setCheckedIconEnabledResource(@BoolRes int id) {
  setCheckedIconVisible(context.getResources().getBoolean(id));
}
 
Example #12
Source File: ChipDrawable.java    From material-components-android with Apache License 2.0 4 votes vote down vote up
public void setCheckedIconVisible(@BoolRes int id) {
  setCheckedIconVisible(context.getResources().getBoolean(id));
}
 
Example #13
Source File: ChipDrawable.java    From material-components-android with Apache License 2.0 4 votes vote down vote up
public void setCheckableResource(@BoolRes int id) {
  setCheckable(context.getResources().getBoolean(id));
}
 
Example #14
Source File: ChipDrawable.java    From material-components-android with Apache License 2.0 4 votes vote down vote up
/** @deprecated Use {@link ChipDrawable#setCloseIconVisible(int)} instead. */
@Deprecated
public void setCloseIconEnabledResource(@BoolRes int id) {
  setCloseIconVisible(id);
}
 
Example #15
Source File: ChipDrawable.java    From material-components-android with Apache License 2.0 4 votes vote down vote up
public void setCloseIconVisible(@BoolRes int id) {
  setCloseIconVisible(context.getResources().getBoolean(id));
}
 
Example #16
Source File: ChipDrawable.java    From material-components-android with Apache License 2.0 4 votes vote down vote up
/** @deprecated Use {@link ChipDrawable#setChipIconVisible(int)} instead. */
@Deprecated
public void setChipIconEnabledResource(@BoolRes int id) {
  setChipIconVisible(id);
}
 
Example #17
Source File: ChipDrawable.java    From material-components-android with Apache License 2.0 4 votes vote down vote up
public void setChipIconVisible(@BoolRes int id) {
  setChipIconVisible(context.getResources().getBoolean(id));
}
 
Example #18
Source File: BooleanPreferenceProvider.java    From TowerCollector with Mozilla Public License 2.0 4 votes vote down vote up
@Override
Boolean getPreferenceDefaultValue(@BoolRes int defaultValueKey) {
    Resources resources = context.getResources();
    return resources.getBoolean(defaultValueKey);
}
 
Example #19
Source File: TabLayout.java    From material-components-android with Apache License 2.0 2 votes vote down vote up
/**
 * Set whether this {@link TabLayout} will have an unbounded ripple effect or if ripple will be
 * bound to the tab item size. Defaults to false.
 *
 * @param unboundedRippleResourceId Resource ID for boolean unbounded ripple value
 * @see #hasUnboundedRipple()
 * @attr ref com.google.android.material.R.styleable#TabLayout_tabUnboundedRipple
 */
public void setUnboundedRippleResource(@BoolRes int unboundedRippleResourceId) {
  setUnboundedRipple(getResources().getBoolean(unboundedRippleResourceId));
}
 
Example #20
Source File: TabLayout.java    From material-components-android with Apache License 2.0 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 com.google.android.material.R.styleable#TabLayout_tabInlineLabel
 */
public void setInlineLabelResource(@BoolRes int inlineResourceId) {
  setInlineLabel(getResources().getBoolean(inlineResourceId));
}
 
Example #21
Source File: ChipGroup.java    From material-components-android with Apache License 2.0 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 #22
Source File: Chip.java    From material-components-android with Apache License 2.0 2 votes vote down vote up
/**
 * Sets the visibility of this chip's icon using a resource id.
 *
 * @param id The resource id for the visibility of this chip's icon.
 * @attr ref com.google.android.material.R.styleable#Chip_chipIconVisible
 */
public void setChipIconVisible(@BoolRes int id) {
  if (chipDrawable != null) {
    chipDrawable.setChipIconVisible(id);
  }
}
 
Example #23
Source File: MaterialButtonToggleGroup.java    From material-components-android with Apache License 2.0 2 votes vote down vote up
/**
 * Sets whether this group only allows a single button to be checked.
 *
 * <p>Calling this method results in all the buttons in this group to become unchecked.
 *
 * @param id boolean resource ID of whether this group only allows a single button to be checked
 * @attr ref R.styleable#MaterialButtonToggleGroup_singleSelection
 */
public void setSingleSelection(@BoolRes int id) {
  setSingleSelection(getResources().getBoolean(id));
}
 
Example #24
Source File: Chip.java    From material-components-android with Apache License 2.0 2 votes vote down vote up
/**
 * Sets whether this chip close icon is visible using a resource id.
 *
 * @param id The resource id of this chip's close icon visibility.
 * @attr ref com.google.android.material.R.styleable#Chip_closeIconVisible
 */
public void setCloseIconVisible(@BoolRes int id) {
  setCloseIconVisible(getResources().getBoolean(id));
}
 
Example #25
Source File: Check.java    From SimpleDialogFragments with Apache License 2.0 2 votes vote down vote up
/**
 * Sets the initial state of the checkbox
 *
 * @param preset initial state as boolean resource
 * @return this instance
 */
public Check check(@BoolRes int preset){
    this.presetId = preset;
    return this;
}
 
Example #26
Source File: Chip.java    From material-components-android with Apache License 2.0 2 votes vote down vote up
/**
 * Sets whether this chip is checkable using a resource id.
 *
 * @param id The resource id of this chip is checkable.
 * @attr ref com.google.android.material.R.styleable#Chip_android_checkable
 */
public void setCheckableResource(@BoolRes int id) {
  if (chipDrawable != null) {
    chipDrawable.setCheckableResource(id);
  }
}
 
Example #27
Source File: Chip.java    From material-components-android with Apache License 2.0 2 votes vote down vote up
/**
 * Sets whether this chip's checked icon is visible using a resource id.
 *
 * @param id The resource id of this chip's check icon visibility.
 * @attr ref com.google.android.material.R.styleable#Chip_checkedIconVisible
 */
public void setCheckedIconVisible(@BoolRes int id) {
  if (chipDrawable != null) {
    chipDrawable.setCheckedIconVisible(id);
  }
}
 
Example #28
Source File: Prefs.java    From TwistyTimer with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Returns a {@link Boolean} given a {@link BoolRes}
 * @param res an {@link BoolRes}
 * @return an {@link Boolean} associated with the given {@link BoolRes}
 */
public static boolean getDefaultBoolValue(@BoolRes int res) {
    return TwistyTimer.getAppContext().getResources().getBoolean(res);
}
 
Example #29
Source File: DefaultPrefs.java    From TwistyTimer with GNU General Public License v3.0 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 #30
Source File: Check.java    From SimpleDialogFragments with Apache License 2.0 2 votes vote down vote up
/**
 * Sets the initial state of the checkbox
 *
 * @param preset initial state as boolean resource
 * @return this instance
 */
public Check check(@BoolRes int preset){
    this.presetId = preset;
    return this;
}