类androidx.annotation.BoolRes源码实例Demo

下面列出了怎么用androidx.annotation.BoolRes的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: DevUtils   文件: ResourceUtils.java
/**
 * 获取 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;
}
 
源代码2 项目: litho   文件: ResourceResolver.java
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;
}
 
源代码3 项目: litho   文件: ResourceResolver.java
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();
  }
}
 
@Override
Boolean getPreferenceDefaultValue(@BoolRes int defaultValueKey) {
    Resources resources = context.getResources();
    return resources.getBoolean(defaultValueKey);
}
 
public void setChipIconVisible(@BoolRes int id) {
  setChipIconVisible(context.getResources().getBoolean(id));
}
 
/** @deprecated Use {@link ChipDrawable#setChipIconVisible(int)} instead. */
@Deprecated
public void setChipIconEnabledResource(@BoolRes int id) {
  setChipIconVisible(id);
}
 
public void setCloseIconVisible(@BoolRes int id) {
  setCloseIconVisible(context.getResources().getBoolean(id));
}
 
/** @deprecated Use {@link ChipDrawable#setCloseIconVisible(int)} instead. */
@Deprecated
public void setCloseIconEnabledResource(@BoolRes int id) {
  setCloseIconVisible(id);
}
 
public void setCheckableResource(@BoolRes int id) {
  setCheckable(context.getResources().getBoolean(id));
}
 
源代码10 项目: material-components-android   文件: ChipDrawable.java
public void setCheckedIconVisible(@BoolRes int id) {
  setCheckedIconVisible(context.getResources().getBoolean(id));
}
 
源代码11 项目: material-components-android   文件: ChipDrawable.java
/** @deprecated Use {@link ChipDrawable#setCheckedIconVisible(int)} instead. */
@Deprecated
public void setCheckedIconEnabledResource(@BoolRes int id) {
  setCheckedIconVisible(context.getResources().getBoolean(id));
}
 
源代码12 项目: 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));
}
 
源代码13 项目: material-components-android   文件: Chip.java
/** @deprecated Use {@link Chip#setChipIconVisible(int)} instead. */
@Deprecated
public void setChipIconEnabledResource(@BoolRes int id) {
  setChipIconVisible(id);
}
 
源代码14 项目: material-components-android   文件: Chip.java
/** @deprecated Use {@link Chip#setCloseIconVisible(int)} instead. */
@Deprecated
public void setCloseIconEnabledResource(@BoolRes int id) {
  setCloseIconVisible(id);
}
 
源代码15 项目: material-components-android   文件: Chip.java
/** @deprecated Use {@link Chip#setCheckedIconVisible(int)} instead. */
@Deprecated
public void setCheckedIconEnabledResource(@BoolRes int id) {
  setCheckedIconVisible(id);
}
 
源代码16 项目: Pix-Art-Messenger   文件: Compatibility.java
private static boolean getBooleanPreference(Context context, String name, @BoolRes int res) {
    return getPreferences(context).getBoolean(name, context.getResources().getBoolean(res));
}
 
源代码17 项目: Pix-Art-Messenger   文件: ActionBarActivity.java
protected boolean getBooleanPreference(String name, @BoolRes int res) {
    return getPreferences().getBoolean(name, getResources().getBoolean(res));
}
 
源代码18 项目: Pix-Art-Messenger   文件: XmppActivity.java
protected boolean getBooleanPreference(String name, @BoolRes int res) {
    return getPreferences().getBoolean(name, getResources().getBoolean(res));
}
 
源代码19 项目: SimpleDialogFragments   文件: Check.java
/**
 * 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;
}
 
源代码20 项目: 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);
}
 
源代码21 项目: TwistyTimer   文件: Prefs.java
/**
 * 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);
}
 
源代码22 项目: SimpleDialogFragments   文件: Check.java
/**
 * 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;
}
 
/**
 * 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));
}
 
源代码24 项目: 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 com.google.android.material.R.styleable#TabLayout_tabInlineLabel
 */
public void setInlineLabelResource(@BoolRes int inlineResourceId) {
  setInlineLabel(getResources().getBoolean(inlineResourceId));
}
 
源代码25 项目: material-components-android   文件: TabLayout.java
/**
 * 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));
}
 
源代码26 项目: 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));
}
 
源代码27 项目: material-components-android   文件: Chip.java
/**
 * 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);
  }
}
 
源代码28 项目: material-components-android   文件: Chip.java
/**
 * 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));
}
 
源代码29 项目: material-components-android   文件: Chip.java
/**
 * 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);
  }
}
 
源代码30 项目: material-components-android   文件: Chip.java
/**
 * 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);
  }
}