List of usage examples for android.preference PreferenceFragment addPreferencesFromResource
public void addPreferencesFromResource(@XmlRes int preferencesResId)
From source file:net.forkk.autocron.data.action.OngoingNotificationAction.java
@Override public void addPreferencesToFragment(PreferenceFragment fragment) { super.addPreferencesToFragment(fragment); fragment.addPreferencesFromResource(R.xml.prefs_notification_action); }
From source file:com.almalence.opencam.PluginManager.java
private void loadCommonAdvancedSettings(PreferenceFragment pf) { pf.addPreferencesFromResource(R.xml.preferences_advanced_common); }
From source file:com.almalence.opencam.PluginManager.java
private void loadStandardSettingsBefore(PreferenceFragment pf, String settings) { if ("general_settings".equals(settings)) { pf.addPreferencesFromResource(R.xml.preferences); }//from w ww .j a v a 2s . c o m }
From source file:com.almalence.opencam.PluginManagerBase.java
protected void AddModeSettings(String modeName, PreferenceFragment pf) { if (modeName.equals("super") && CameraController.isUseCamera2()) { pf.addPreferencesFromResource(R.xml.preferences_processing_super); return;//from w ww. j av a 2 s . com } Mode mode = ConfigParser.getInstance().getMode(modeName); if (mode == null) return; for (int j = 0; j < listCapture.size(); j++) { Plugin pg = listCapture.get(j); if (mode.Capture.equals(pg.getID())) { addHeadersContent(pf, pg, false); } } for (int j = 0; j < listProcessing.size(); j++) { // all modes below use simple processing and we should avoid // duplicating DRO settings here. if (modeName.equals("video") || modeName.equals("burstmode") || modeName.equals("expobracketing") || modeName.equals("burstmode")) return; Plugin pg = listProcessing.get(j); if (mode.Processing.equals(pg.getID())) { addHeadersContent(pf, pg, false); } } }
From source file:com.almalence.opencam.PluginManager.java
@Override public void loadHeaderContent(String settings, PreferenceFragment pf) { List<Plugin> activePlugins = new ArrayList<Plugin>(); List<Plugin> inactivePlugins = new ArrayList<Plugin>(); boolean hasInactive = false; loadStandardSettingsBefore(pf, settings); if ("general_more".equals(settings)) { pf.addPreferencesFromResource(R.xml.preferences_general_more); ApplicationScreen.instance.onAdvancePreferenceCreate(pf); } else if ("general_image_size".equals(settings)) { pf.addPreferencesFromResource(R.xml.preferences_general_image_size); if (CameraController.isUseCamera2()) { Preference pref;//from w w w.jav a 2s. c o m if (null != (pref = pf.findPreference(ApplicationScreen.sImageSizeMultishotBackPref)) || null != (pref = pf.findPreference(ApplicationScreen.sImageSizeMultishotFrontPref))) { pref.setTitle(ApplicationScreen.getAppResources() .getString(R.string.Pref_Comon_SmartMultishot_And_Super_ImageSize_Title)); } } ApplicationScreen.instance.onPreferenceCreate(pf); } else if ("vf_settings".equals(settings)) { pf.addPreferencesFromResource(R.xml.preferences_vf_common); } else if ("vf_more".equals(settings)) { for (int i = 0; i < listVF.size(); i++) { Plugin pg = listVF.get(i); if (activeVF.contains(pg.getID())) activePlugins.add(pg); else inactivePlugins.add(pg); } addHeadersContent(pf, activePlugins, false); pf.addPreferencesFromResource(R.xml.preferences_vf_more); if (activePlugins.size() != listVF.size() && isPreferenecesAvailable(inactivePlugins, false)) pf.addPreferencesFromResource(R.xml.preferences_vf_inactive); ApplicationScreen.instance.onAdvancePreferenceCreate(pf); //Some vf advance preferences may be related to entire application instead of some special vf plugin } else if ("vf_inactive_settings".equals(settings)) { for (int i = 0; i < listVF.size(); i++) { Plugin pg = listVF.get(i); if (!activeVF.contains(pg.getID())) inactivePlugins.add(pg); } addHeadersContent(pf, inactivePlugins, false); } else if ("save_configuration".equals(settings)) { pf.addPreferencesFromResource(R.xml.preferences_general_saveconfiguration); } else if ("export_more".equals(settings)) { pf.addPreferencesFromResource(R.xml.preferences_export_common); } else if ("export_timestamp".equals(settings)) { pf.addPreferencesFromResource(R.xml.preferences_export_timestamp); } else if ("shooting_settings".equals(settings)) { pf.addPreferencesFromResource(R.xml.preferences_modes); } else if ("capture_expobracketing_more".equals(settings)) { pf.addPreferencesFromResource(R.xml.preferences_capture_expobracketing_more); } else if ("processing_expobracketing_more".equals(settings)) { pf.addPreferencesFromResource(R.xml.preferences_processing_hdr_more); } else if ("capture_night_more".equals(settings)) { pf.addPreferencesFromResource(R.xml.preferences_capture_night_more); } else if ("processing_night_more".equals(settings)) { pf.addPreferencesFromResource(R.xml.preferences_processing_night_more); if (CameraController.isUseCamera2()) { PreferenceScreen prefScr; if (null != (prefScr = (PreferenceScreen) pf.findPreference("nightProcessingMoreScreen"))) { Preference pref; if (null != (pref = pf.findPreference("keepcolorsPref"))) { prefScr.removePreference(pref); } } } } else if ("capture_preshot_more".equals(settings)) { pf.addPreferencesFromResource(R.xml.preferences_capture_preshot_more); } else if ("capture_panorama_more".equals(settings)) { pf.addPreferencesFromResource(R.xml.preferences_capture_panoramaaugmented_more); Plugin panoramaPlugin = pluginList.get(activeCapture); panoramaPlugin.onPreferenceCreate(pf); } else if ("dro".equals(settings)) { AddModeSettings("single", pf); } else if ("burst".equals(settings)) { AddModeSettings("burstmode", pf); } else if ("expobracketing".equals(settings)) { AddModeSettings("expobracketing", pf); } else if ("hdr".equals(settings)) { AddModeSettings("hdrmode", pf); } else if ("night".equals(settings)) { AddModeSettings("nightmode", pf); } else if ("super".equals(settings)) { AddModeSettings("super", pf); } else if ("video".equals(settings)) { AddModeSettings("video", pf); } else if ("preshot".equals(settings)) { AddModeSettings("pixfix", pf); } else if ("multishot".equals(settings)) { AddModeSettings("multishot", pf); } else if ("panorama_augmented".equals(settings)) { AddModeSettings("panorama_augmented", pf); } else if ("bestshotmode".equals(settings)) { AddModeSettings("bestshotmode", pf); } else if ("saving_settings".equals(settings)) { // for (int i = 0; i < listFilter.size(); i++) // { // Plugin pg = listFilter.get(i); // if (activeFilter.contains(pg.getID())) // activePlugins.add(pg); // else // inactivePlugins.add(pg); // } // if (activePlugins.size() != listFilter.size() && // isPreferenecesAvailable(inactivePlugins, false)) // hasInactive = true; addHeadersContent(pf, activePlugins, false); activePlugins.clear(); inactivePlugins.clear(); for (int i = 0; i < listExport.size(); i++) { Plugin pg = listExport.get(i); if (activeExport.contains(pg.getID())) activePlugins.add(pg); else inactivePlugins.add(pg); } if (activePlugins.size() != listExport.size() && isPreferenecesAvailable(inactivePlugins, false)) hasInactive = true; addHeadersContent(pf, activePlugins, false); if (hasInactive) pf.addPreferencesFromResource(R.xml.preferences_saving_inactive); } else if ("saving_inactive_settings".equals(settings)) { // for (int i = 0; i < listFilter.size(); i++) // { // Plugin pg = listFilter.get(i); // if (!activeFilter.contains(pg.getID())) // inactivePlugins.add(pg); // } addHeadersContent(pf, inactivePlugins, false); activePlugins.clear(); for (int i = 0; i < listExport.size(); i++) { Plugin pg = listExport.get(i); if (!activeExport.contains(pg.getID())) inactivePlugins.add(pg); } addHeadersContent(pf, inactivePlugins, false); } else if ("advanced".equals(settings)) { loadCommonAdvancedSettings(pf); for (int i = 0; i < listVF.size(); i++) { Plugin pg = listVF.get(i); if (activeVF.contains(pg.getID())) activePlugins.add(pg); else inactivePlugins.add(pg); } if (isPreferenecesAvailable(inactivePlugins, true)) hasInactive = true; addHeadersContent(pf, activePlugins, true); activePlugins.clear(); inactivePlugins.clear(); for (int i = 0; i < listCapture.size(); i++) { Plugin pg = listCapture.get(i); if (activeCapture.equals(pg.getID())) activePlugins.add(pg); else inactivePlugins.add(pg); } if (isPreferenecesAvailable(inactivePlugins, true)) hasInactive = true; addHeadersContent(pf, activePlugins, true); activePlugins.clear(); inactivePlugins.clear(); for (int i = 0; i < listProcessing.size(); i++) { Plugin pg = listProcessing.get(i); if (activeProcessing.equals(pg.getID())) activePlugins.add(pg); else inactivePlugins.add(pg); } if (isPreferenecesAvailable(inactivePlugins, true)) hasInactive = true; addHeadersContent(pf, activePlugins, true); activePlugins.clear(); inactivePlugins.clear(); // for (int i = 0; i < listFilter.size(); i++) // { // Plugin pg = listFilter.get(i); // if (activeFilter.contains(pg.getID())) // activePlugins.add(pg); // else // inactivePlugins.add(pg); // } if (isPreferenecesAvailable(inactivePlugins, true)) hasInactive = true; addHeadersContent(pf, activePlugins, true); activePlugins.clear(); inactivePlugins.clear(); for (int i = 0; i < listExport.size(); i++) { Plugin pg = listExport.get(i); if (activeExport.equals(pg.getID())) activePlugins.add(pg); else inactivePlugins.add(pg); } if (isPreferenecesAvailable(inactivePlugins, true)) hasInactive = true; addHeadersContent(pf, activePlugins, true); if (hasInactive) pf.addPreferencesFromResource(R.xml.preferences_advance_inactive); } else if ("advanced_inactive".equals(settings)) { for (int i = 0; i < listVF.size(); i++) { Plugin pg = listVF.get(i); if (!activeVF.contains(pg.getID())) inactivePlugins.add(pg); } addHeadersContent(pf, inactivePlugins, true); inactivePlugins.clear(); for (int i = 0; i < listCapture.size(); i++) { Plugin pg = listCapture.get(i); if (!activeCapture.equals(pg.getID())) inactivePlugins.add(pg); } addHeadersContent(pf, inactivePlugins, true); inactivePlugins.clear(); for (int i = 0; i < listProcessing.size(); i++) { Plugin pg = listProcessing.get(i); if (!activeProcessing.equals(pg.getID())) inactivePlugins.add(pg); } addHeadersContent(pf, inactivePlugins, true); inactivePlugins.clear(); // for (int i = 0; i < listFilter.size(); i++) // { // Plugin pg = listFilter.get(i); // if (!activeFilter.contains(pg.getID())) // inactivePlugins.add(pg); // } addHeadersContent(pf, inactivePlugins, true); inactivePlugins.clear(); for (int i = 0; i < listExport.size(); i++) { Plugin pg = listExport.get(i); if (!activeExport.equals(pg.getID())) inactivePlugins.add(pg); } addHeadersContent(pf, inactivePlugins, true); } else if ("plugins_settings".equals(settings)) { pf.getActivity().finish(); Preferences.closePrefs(); MainScreen.setShowStore(true); } }
From source file:com.almalence.opencam.PluginManagerBase.java
protected void addHeadersContent(PreferenceFragment pf, Plugin plugin, boolean isAdvanced) { if (null == plugin) return;//from ww w. ja v a2s. c o m if (!plugin.isShowPreferences) return; if (!isAdvanced) { if (plugin.getPreferenceName() == 0) return; pf.addPreferencesFromResource(plugin.getPreferenceName()); plugin.onPreferenceCreate(pf); } else { if (plugin.getAdvancedPreferenceName() == 0) return; pf.addPreferencesFromResource(plugin.getAdvancedPreferenceName()); } plugin.showInitialSummary(pf); }