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 Project: external-resources   Author: prcaen   File: ExternalResources.java    License: 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 Project: Android-utils   Author: Shouheng88   File: ResUtils.java    License: Apache License 2.0 4 votes vote down vote up
public static boolean getBoolean(@BoolRes int id) {
    return UtilsApp.getApp().getResources().getBoolean(id);
}
 
Example #3
Source Project: PowerFileExplorer   Author: PowerExplorer   File: ResourcesUtil.java    License: 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 #4
Source Project: relight   Author: ittianyu   File: ChipGroupWidget.java    License: Apache License 2.0 4 votes vote down vote up
public ChipGroupWidget singleLine(@BoolRes int id) {
    view.setSingleLine(id);
    return self();
}
 
Example #5
Source Project: relight   Author: ittianyu   File: ChipGroupWidget.java    License: Apache License 2.0 4 votes vote down vote up
public ChipGroupWidget singleSelection(@BoolRes int id) {
    view.setSingleSelection(id);
    return self();
}
 
Example #6
Source Project: relight   Author: ittianyu   File: ChipWidget.java    License: Apache License 2.0 4 votes vote down vote up
public ChipWidget chipIconVisible(@BoolRes int id) {
    view.setChipIconVisible(id);
    return self();
}
 
Example #7
Source Project: relight   Author: ittianyu   File: ChipWidget.java    License: Apache License 2.0 4 votes vote down vote up
public ChipWidget closeIconVisible(@BoolRes int id) {
    view.setCloseIconVisible(id);
    return self();
}
 
Example #8
Source Project: relight   Author: ittianyu   File: ChipWidget.java    License: Apache License 2.0 4 votes vote down vote up
public ChipWidget checkableResource(@BoolRes int id) {
    view.setCheckableResource(id);
    return self();
}
 
Example #9
Source Project: relight   Author: ittianyu   File: ChipWidget.java    License: Apache License 2.0 4 votes vote down vote up
public ChipWidget checkedIconVisible(@BoolRes int id) {
    view.setCheckedIconVisible(id);
    return self();
}
 
Example #10
Source Project: cafebar   Author: danimahardhika   File: CafeBar.java    License: Apache License 2.0 4 votes vote down vote up
public Builder showShadow(@BoolRes int res) {
    return showShadow(mContext.getResources().getBoolean(res));
}
 
Example #11
Source Project: cafebar   Author: danimahardhika   File: CafeBar.java    License: Apache License 2.0 4 votes vote down vote up
public Builder autoDismiss(@BoolRes int res) {
    return autoDismiss(mContext.getResources().getBoolean(res));
}
 
Example #12
Source Project: cafebar   Author: danimahardhika   File: CafeBar.java    License: 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 Project: cafebar   Author: danimahardhika   File: CafeBar.java    License: Apache License 2.0 4 votes vote down vote up
public Builder floating(@BoolRes int res) {
    return floating(mContext.getResources().getBoolean(res));
}
 
Example #14
Source Project: BottomSheet   Author: michaelbel   File: BottomSheet.java    License: 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 #15
Source Project: BottomSheet   Author: michaelbel   File: BottomSheet.java    License: 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 #16
Source Project: BottomSheet   Author: michaelbel   File: BottomSheet.java    License: 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 #17
Source Project: BottomSheet   Author: michaelbel   File: BottomSheet.java    License: 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 #18
Source Project: BottomSheet   Author: michaelbel   File: BottomSheet.java    License: 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 #19
Source Project: Conversations   Author: iNPUTmice   File: Compatibility.java    License: 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 #20
Source Project: Conversations   Author: iNPUTmice   File: LocationActivity.java    License: 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 #21
Source Project: Conversations   Author: iNPUTmice   File: XmppActivity.java    License: 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 #22
Source Project: external-resources   Author: prcaen   File: ExternalResources.java    License: 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);
}