android.support.annotation.XmlRes Java Examples
The following examples show how to use
android.support.annotation.XmlRes.
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: PickerSpinner.java From ReminderDatePicker with Apache License 2.0 | 6 votes |
/** * */ protected ArrayList<TwinTextItem> getItemsFromXml(@XmlRes int xmlResource) throws XmlPullParserException, IOException { final Resources res = getResources(); XmlResourceParser parser = res.getXml(xmlResource); ArrayList<TwinTextItem> items = new ArrayList<>(); int eventType; while((eventType = parser.next()) != XmlPullParser.END_DOCUMENT) { if(eventType == XmlPullParser.START_TAG) { // call our subclass to parse the correct item TwinTextItem item = parseItemFromXmlTag(parser); if(item != null) items.add(item); } } return items; }
Example #2
Source File: BottomBar.java From BottomBar with Apache License 2.0 | 5 votes |
/** * Set the item for the BottomBar from XML Resource with a default configuration * for each tab. */ public void setItems(@XmlRes int xmlRes, BottomBarTab.Config defaultTabConfig) { if (xmlRes == 0) { throw new RuntimeException("No items specified for the BottomBar!"); } if (defaultTabConfig == null) { defaultTabConfig = getTabConfig(); } TabParser parser = new TabParser(getContext(), defaultTabConfig, xmlRes); updateItems(parser.parseTabs()); }
Example #3
Source File: PreferenceUtils.java From 365browser with Apache License 2.0 | 5 votes |
/** * A helper that is used to load preferences from XML resources without causing a * StrictModeViolation. See http://crbug.com/692125. * * @param preferenceFragment A PreferenceFragment. * @param preferencesResId The id of the XML resource to add to the PreferenceFragment. */ public static void addPreferencesFromResource( PreferenceFragment preferenceFragment, @XmlRes int preferencesResId) { StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads(); try { preferenceFragment.addPreferencesFromResource(preferencesResId); } finally { StrictMode.setThreadPolicy(oldPolicy); } }
Example #4
Source File: XmlPreferenceParser.java From WearPreferenceActivity with Apache License 2.0 | 5 votes |
@NonNull WearPreferenceScreen parse(@NonNull final Context context, @XmlRes final int prefsResId) { try { final XmlResourceParser parser = context.getResources().getXml(prefsResId); return parseScreen(context, parser); } catch (XmlPullParserException | IOException e) { throw new RuntimeException("Error parsing preferences file", e); } }
Example #5
Source File: PreferenceFragment.java From ticdesign with Apache License 2.0 | 5 votes |
/** * Inflates the given XML resource and adds the preference hierarchy to the current * preference hierarchy. * * @param preferencesResId The XML resource ID to inflate. */ public void addPreferencesFromResource(@XmlRes int preferencesResId) { requirePreferenceManager(); setPreferenceScreen(mPreferenceManager.inflateFromResource(getActivity(), preferencesResId, getPreferenceScreen())); }
Example #6
Source File: PreferenceFragmentCompat.java From ticdesign with Apache License 2.0 | 5 votes |
/** * Inflates the given XML resource and adds the preference hierarchy to the current * preference hierarchy. * * @param preferencesResId The XML resource ID to inflate. */ public void addPreferencesFromResource(@XmlRes int preferencesResId) { requirePreferenceManager(); setPreferenceScreen(mPreferenceManager.inflateFromResource(getActivity(), preferencesResId, getPreferenceScreen())); }
Example #7
Source File: SettingsActivity.java From HeadsUp with GNU General Public License v2.0 | 4 votes |
@XmlRes protected int getDashboardResource() { return 0; }
Example #8
Source File: GsPreferenceFragmentCompat.java From kimai-android with MIT License | 4 votes |
@XmlRes public abstract int getPreferenceResourceForInflation();
Example #9
Source File: Settings2.java From AcDisplay with GNU General Public License v2.0 | 4 votes |
@XmlRes @Override public int getDashboardResource() { return R.xml.settings_dashboard; }
Example #10
Source File: SettingsActivity.java From AcDisplay with GNU General Public License v2.0 | 4 votes |
@XmlRes protected int getDashboardResource() { return 0; }
Example #11
Source File: SettingsActivity.java From island with Apache License 2.0 | 4 votes |
protected SubPreferenceFragment(final @XmlRes int preference_xml, final int... keys_to_bind_summary) { mPreferenceXml = preference_xml; mKeysToBindSummary = keys_to_bind_summary; }
Example #12
Source File: SwipeItemParser.java From SwipeSelector with Apache License 2.0 | 4 votes |
SwipeItemParser(Context context, @XmlRes int swipeItemsRes) { this.context = context; parser = context.getResources().getXml(swipeItemsRes); swipeItems = new ArrayList<>(); }
Example #13
Source File: GsPreferenceFragmentCompat.java From Stringlate with MIT License | 4 votes |
@XmlRes public abstract int getPreferenceResourceForInflation();
Example #14
Source File: GsPreferenceFragmentCompat.java From openlauncher with Apache License 2.0 | 4 votes |
@XmlRes public abstract int getPreferenceResourceForInflation();
Example #15
Source File: TabParser.java From BottomBar with Apache License 2.0 | 4 votes |
TabParser(@NonNull Context context, @NonNull BottomBarTab.Config defaultTabConfig, @XmlRes int tabsXmlResId) { this.context = context; this.defaultTabConfig = defaultTabConfig; this.parser = context.getResources().getXml(tabsXmlResId); }
Example #16
Source File: BottomBar.java From BottomBar with Apache License 2.0 | 4 votes |
/** * Set the items for the BottomBar from XML Resource. */ public void setItems(@XmlRes int xmlRes) { setItems(xmlRes, null); }
Example #17
Source File: GsPreferenceFragmentCompat.java From memetastic with GNU General Public License v3.0 | 4 votes |
@XmlRes public abstract int getPreferenceResourceForInflation();
Example #18
Source File: ResourcesUtil.java From PowerFileExplorer with GNU General Public License v3.0 | 4 votes |
public static XmlResourceParser getXml(@XmlRes int xmlRes) { return Base.getResources().getXml(xmlRes); }
Example #19
Source File: WearPreferenceActivity.java From WearPreferenceActivity with Apache License 2.0 | 2 votes |
/** * Inflates the preferences from the given resource and displays them on this page. * @param prefsResId The resource ID of the preferences xml file. */ protected void addPreferencesFromResource(@XmlRes int prefsResId) { addPreferencesFromResource(prefsResId, new XmlPreferenceParser()); }
Example #20
Source File: WearPreferenceActivity.java From WearPreferenceActivity with Apache License 2.0 | 2 votes |
/** * Inflates the preferences from the given resource and displays them on this page. * @param prefsResId The resource ID of the preferences xml file. * @param parser A parser used to parse custom preference types */ protected void addPreferencesFromResource(@XmlRes int prefsResId, @NonNull XmlPreferenceParser parser) { final WearPreferenceScreen prefsRoot = parser.parse(this, prefsResId); addPreferencesFromPreferenceScreen(prefsRoot); }
Example #21
Source File: BasePreferenceFragment.java From Android-VMLib with Apache License 2.0 | 2 votes |
/** * Get preferences resources id. * * @return preferences resources id */ @XmlRes protected abstract int getPreferencesResId();