android.support.annotation.BoolRes Java Examples

The following examples show how to use android.support.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: ExternalResources.java    From external-resources with Apache License 2.0 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
Source File: CafeBar.java    From cafebar with Apache License 2.0 4 votes vote down vote up
public Builder floating(@BoolRes int res) {
    return floating(mContext.getResources().getBoolean(res));
}
 
Example #3
Source File: XmppActivity.java    From Conversations 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 #4
Source File: LocationActivity.java    From Conversations 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: Compatibility.java    From Conversations 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 #6
Source File: BottomSheet.java    From BottomSheet with Apache License 2.0 4 votes vote down vote up
public Builder setTitleMultiline(@BoolRes int titleMultiline) {
    bottomSheet.titleTextMultiline = context.getResources().getBoolean(titleMultiline);
    return this;
}
 
Example #7
Source File: BottomSheet.java    From BottomSheet with Apache License 2.0 4 votes vote down vote up
public Builder setDividers(@BoolRes int dividers) {
    bottomSheet.dividers = context.getResources().getBoolean(dividers);
    return this;
}
 
Example #8
Source File: BottomSheet.java    From BottomSheet with Apache License 2.0 4 votes vote down vote up
public Builder setFullWidth(@BoolRes int fullWidth) {
    bottomSheet.fullWidth = context.getResources().getBoolean(fullWidth);
    return this;
}
 
Example #9
Source File: BottomSheet.java    From BottomSheet with Apache License 2.0 4 votes vote down vote up
public Builder setDarkTheme(@BoolRes int theme) {
    bottomSheet.darkTheme = context.getResources().getBoolean(theme);
    return this;
}
 
Example #10
Source File: BottomSheet.java    From BottomSheet with Apache License 2.0 4 votes vote down vote up
public Builder(@NonNull Context context, @BoolRes int focus) {
    this.context = context;
    bottomSheet = new BottomSheet(context, context.getResources().getBoolean(focus));
}
 
Example #11
Source File: ResUtils.java    From Android-utils with Apache License 2.0 4 votes vote down vote up
public static boolean getBoolean(@BoolRes int id) {
    return UtilsApp.getApp().getResources().getBoolean(id);
}
 
Example #12
Source File: CafeBar.java    From cafebar with Apache License 2.0 4 votes vote down vote up
public Builder swipeToDismiss(@BoolRes int res) {
    return swipeToDismiss(mContext.getResources().getBoolean(res));
}
 
Example #13
Source File: CafeBar.java    From cafebar with Apache License 2.0 4 votes vote down vote up
public Builder autoDismiss(@BoolRes int res) {
    return autoDismiss(mContext.getResources().getBoolean(res));
}
 
Example #14
Source File: CafeBar.java    From cafebar with Apache License 2.0 4 votes vote down vote up
public Builder showShadow(@BoolRes int res) {
    return showShadow(mContext.getResources().getBoolean(res));
}
 
Example #15
Source File: ChipWidget.java    From relight with Apache License 2.0 4 votes vote down vote up
public ChipWidget checkedIconVisible(@BoolRes int id) {
    view.setCheckedIconVisible(id);
    return self();
}
 
Example #16
Source File: ChipWidget.java    From relight with Apache License 2.0 4 votes vote down vote up
public ChipWidget checkableResource(@BoolRes int id) {
    view.setCheckableResource(id);
    return self();
}
 
Example #17
Source File: ChipWidget.java    From relight with Apache License 2.0 4 votes vote down vote up
public ChipWidget closeIconVisible(@BoolRes int id) {
    view.setCloseIconVisible(id);
    return self();
}
 
Example #18
Source File: ChipWidget.java    From relight with Apache License 2.0 4 votes vote down vote up
public ChipWidget chipIconVisible(@BoolRes int id) {
    view.setChipIconVisible(id);
    return self();
}
 
Example #19
Source File: ChipGroupWidget.java    From relight with Apache License 2.0 4 votes vote down vote up
public ChipGroupWidget singleSelection(@BoolRes int id) {
    view.setSingleSelection(id);
    return self();
}
 
Example #20
Source File: ChipGroupWidget.java    From relight with Apache License 2.0 4 votes vote down vote up
public ChipGroupWidget singleLine(@BoolRes int id) {
    view.setSingleLine(id);
    return self();
}
 
Example #21
Source File: ResourcesUtil.java    From PowerFileExplorer with GNU General Public License v3.0 4 votes vote down vote up
public static boolean getBoolean(@BoolRes int boolRes) {
    return Base.getResources().getBoolean(boolRes);
}
 
Example #22
Source File: ExternalResources.java    From external-resources with Apache License 2.0 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);
}