/* (non-Javadoc) * @see android.widget.CompoundButton.OnCheckedChangeListener#onCheckedChanged(android.widget.CompoundButton, boolean) */ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { configuration.setEnabled(isChecked); final Intent intent = new Intent(NewsConstants.CONFIGURATION_UPDATE); intent.putExtra(Configuration.class.getName(), configuration); parentActivity.sendBroadcast(intent); }
/** @param configuration the {@link Configuration} to be added as gui content. */ public void addConfiguration(final Configuration configuration) { final String tabTitle = configuration.getClass().getSimpleName(); if (configuration instanceof TwitterPluginConfiguration) { // Twitter Plugin final TwitterPluginConfiguration castedConfiguration = (TwitterPluginConfiguration) configuration; if (configurations.containsKey(configuration)) { ((TwitterPluginConfigurationPanel) configurations.get(configuration)) .updateConfiguration(castedConfiguration); } else { final TwitterPluginConfigurationPanel castedConfigurationPanel = new TwitterPluginConfigurationPanel(castedConfiguration, this); configurations.put(castedConfiguration, castedConfigurationPanel); tabbedPane.addTab(tabTitle, castedConfigurationPanel); } } else if (configuration instanceof RSSPluginConfiguration) { // RSS Plugin final RSSPluginConfiguration castedConfiguration = (RSSPluginConfiguration) configuration; if (configurations.containsKey(configuration)) { ((RSSPluginConfigurationPanel) configurations.get(configuration)) .updateConfiguration(castedConfiguration); } else { final RSSPluginConfigurationPanel castedConfigurationPanel = new RSSPluginConfigurationPanel(castedConfiguration, this); configurations.put(castedConfiguration, castedConfigurationPanel); tabbedPane.addTab(tabTitle, castedConfigurationPanel); } } else if (configuration instanceof RawURLProcessorConfiguration) { // RSS Plugin final RawURLProcessorConfiguration castedConfiguration = (RawURLProcessorConfiguration) configuration; if (configurations.containsKey(configuration)) { ((RawURLProcessorConfigurationPanel) configurations.get(configuration)) .updateConfiguration(castedConfiguration); } else { final RawURLProcessorConfigurationPanel castedConfigurationPanel = new RawURLProcessorConfigurationPanel(castedConfiguration, this); configurations.put(castedConfiguration, castedConfigurationPanel); tabbedPane.addTab(tabTitle, castedConfigurationPanel); } } else if (configuration instanceof PlainURLProcessorConfiguration) { // Plain URLProcessor Plugin final PlainURLProcessorConfiguration castedConfiguration = (PlainURLProcessorConfiguration) configuration; if (configurations.containsKey(configuration)) { ((PlainURLProcessorConfigurationPanel) configurations.get(configuration)) .updateConfiguration(castedConfiguration); } else { final PlainURLProcessorConfigurationPanel castedConfigurationPanel = new PlainURLProcessorConfigurationPanel(castedConfiguration, this); configurations.put(castedConfiguration, castedConfigurationPanel); tabbedPane.addTab(tabTitle, castedConfigurationPanel); } } else if (configuration instanceof TestURLProcessorConfiguration) { // Test URLProcessor Plugin final TestURLProcessorConfiguration castedConfiguration = (TestURLProcessorConfiguration) configuration; if (configurations.containsKey(configuration)) { ((TestURLProcessorConfigurationPanel) configurations.get(configuration)) .updateConfiguration(castedConfiguration); } else { final TestURLProcessorConfigurationPanel castedConfigurationPanel = new TestURLProcessorConfigurationPanel(castedConfiguration, this); configurations.put(castedConfiguration, castedConfigurationPanel); tabbedPane.addTab(tabTitle, castedConfigurationPanel); } } else if (configuration instanceof TestPluginConfiguration) { // Test Plugin final TestPluginConfiguration googleReaderConfiguration = (TestPluginConfiguration) configuration; if (configurations.containsKey(configuration)) { ((TestPluginConfigurationPanel) configurations.get(configuration)) .updateConfiguration(googleReaderConfiguration); } else { final TestPluginConfigurationPanel castedConfigurationPanel = new TestPluginConfigurationPanel(googleReaderConfiguration, this); configurations.put(googleReaderConfiguration, castedConfigurationPanel); tabbedPane.addTab(tabTitle, castedConfigurationPanel); } } else if (configuration instanceof GoogleReaderPluginConfiguration) { // Google Reader Plugin final GoogleReaderPluginConfiguration castedConfiguration = (GoogleReaderPluginConfiguration) configuration; if (configurations.containsKey(configuration)) { ((GoogleReaderPluginConfigurationPanel) configurations.get(configuration)) .updateConfiguration(castedConfiguration); } else { final GoogleReaderPluginConfigurationPanel castedConfigurationPanel = new GoogleReaderPluginConfigurationPanel(castedConfiguration, this); configurations.put(castedConfiguration, castedConfigurationPanel); tabbedPane.addTab(tabTitle, castedConfigurationPanel); } } }