diff --git a/lite/AndroidManifest.xml b/lite/AndroidManifest.xml index 90b10a33..6b16a6ad 100644 --- a/lite/AndroidManifest.xml +++ b/lite/AndroidManifest.xml @@ -15,17 +15,25 @@ android:smallScreens="true" android:xlargeScreens="true" /> + + + + + + + android:theme="@style/Theme.Sherlock" > + android:icon="@drawable/ic_activity_torrents" + android:uiOptions="splitActionBarWhenNarrow" + android:theme="@style/TransdroidTheme" > @@ -41,7 +49,9 @@ + android:icon="@drawable/ic_activity_torrents" + android:uiOptions="splitActionBarWhenNarrow" + android:theme="@style/TransdroidTheme" > @@ -49,12 +59,15 @@ - - + + + + android:label="@string/search_torrentsearch" + android:icon="@drawable/ic_activity_torrents" + android:theme="@style/TransdroidTheme" > diff --git a/lite/res/drawable-hdpi/ic_action_discard.png b/lite/res/drawable-hdpi/ic_action_discard.png new file mode 100644 index 00000000..ffd19d9e Binary files /dev/null and b/lite/res/drawable-hdpi/ic_action_discard.png differ diff --git a/lite/res/drawable-hdpi/ic_launcher.png b/lite/res/drawable-hdpi/ic_launcher.png index 96a442e5..bb8449f4 100644 Binary files a/lite/res/drawable-hdpi/ic_launcher.png and b/lite/res/drawable-hdpi/ic_launcher.png differ diff --git a/lite/res/drawable-mdpi/ic_action_discard.png b/lite/res/drawable-mdpi/ic_action_discard.png new file mode 100644 index 00000000..a8ee5f25 Binary files /dev/null and b/lite/res/drawable-mdpi/ic_action_discard.png differ diff --git a/lite/res/drawable-mdpi/ic_launcher.png b/lite/res/drawable-mdpi/ic_launcher.png index 359047df..88fb5bd7 100644 Binary files a/lite/res/drawable-mdpi/ic_launcher.png and b/lite/res/drawable-mdpi/ic_launcher.png differ diff --git a/lite/res/drawable-xhdpi/ic_action_discard.png b/lite/res/drawable-xhdpi/ic_action_discard.png new file mode 100644 index 00000000..412b3335 Binary files /dev/null and b/lite/res/drawable-xhdpi/ic_action_discard.png differ diff --git a/lite/res/drawable-xhdpi/ic_launcher.png b/lite/res/drawable-xhdpi/ic_launcher.png index 71c6d760..e2a94658 100644 Binary files a/lite/res/drawable-xhdpi/ic_launcher.png and b/lite/res/drawable-xhdpi/ic_launcher.png differ diff --git a/lite/res/drawable-xxhdpi/ic_launcher.png b/lite/res/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 00000000..91ea69c2 Binary files /dev/null and b/lite/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/lite/res/layout/fragment_details.xml b/lite/res/layout/fragment_details.xml index 245e60fc..6c17e9e2 100644 --- a/lite/res/layout/fragment_details.xml +++ b/lite/res/layout/fragment_details.xml @@ -9,6 +9,8 @@ android:layout_height="match_parent" android:choiceMode="multipleChoiceModal" android:listSelector="@drawable/selectable_background_transdroid" + android:divider="@null" + android:dividerHeight="0dip" android:visibility="gone" /> + + \ No newline at end of file diff --git a/lite/res/layout/list_item_filter.xml b/lite/res/layout/list_item_filter.xml index 92114e79..5dff7d2f 100644 --- a/lite/res/layout/list_item_filter.xml +++ b/lite/res/layout/list_item_filter.xml @@ -1,8 +1,11 @@ - + android:paddingTop="@dimen/margin_half" + android:paddingBottom="@dimen/margin_half" + android:paddingLeft="@dimen/margin_default" + android:paddingRight="@dimen/margin_default" > - \ No newline at end of file + \ No newline at end of file diff --git a/lite/res/layout/list_item_torrent.xml b/lite/res/layout/list_item_torrent.xml index 7f4d8a0f..c87f9742 100644 --- a/lite/res/layout/list_item_torrent.xml +++ b/lite/res/layout/list_item_torrent.xml @@ -4,10 +4,9 @@ android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" - android:layout_marginTop="@dimen/margin_half" - android:layout_marginBottom="@dimen/margin_half" - android:layout_marginLeft="@dimen/margin_half" - android:layout_marginRight="@dimen/margin_default"> + android:paddingTop="@dimen/margin_half" + android:paddingBottom="@dimen/margin_half" + android:paddingRight="@dimen/margin_default"> + android:contentDescription="@string/status_priority_normal" + android:focusable="false" /> + android:layout_below="@id/priority_image" + android:layout_marginRight="4dip" + android:focusable="false" /> + android:textIsSelectable="false" + android:focusable="false" /> + android:textIsSelectable="false" + android:focusable="false" /> + android:textIsSelectable="false" + android:focusable="false" /> + android:layout_marginBottom="@dimen/margin_half" + android:focusable="false" /> + android:textIsSelectable="false" + android:focusable="false" /> + android:paddingTop="@dimen/margin_half" + android:paddingBottom="@dimen/margin_half" + android:paddingRight="@dimen/margin_default"> + android:layout_height="wrap_content" + android:focusable="false" /> + android:textSize="15sp" + android:textIsSelectable="false" + android:focusable="false" /> + android:textIsSelectable="false" + android:focusable="false" /> + android:textSize="12sp" + android:focusable="false" /> + android:contentDescription="@string/status_priority_normal" + android:focusable="false" /> diff --git a/lite/res/menu/activity_deleteableprefs.xml b/lite/res/menu/activity_deleteableprefs.xml new file mode 100644 index 00000000..ad353807 --- /dev/null +++ b/lite/res/menu/activity_deleteableprefs.xml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/lite/res/menu/activity_torrents.xml b/lite/res/menu/activity_torrents.xml index 1832ea34..0d086f85 100644 --- a/lite/res/menu/activity_torrents.xml +++ b/lite/res/menu/activity_torrents.xml @@ -4,7 +4,13 @@ android:id="@+id/action_add" android:icon="@drawable/ic_action_new" android:showAsAction="always" - android:title="@string/action_add"/> + android:title="@string/action_add"> + + + + + + + \ No newline at end of file diff --git a/lite/res/menu/fragment_torrents_cab.xml b/lite/res/menu/fragment_torrents_cab.xml new file mode 100644 index 00000000..ae62819e --- /dev/null +++ b/lite/res/menu/fragment_torrents_cab.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/lite/res/values/strings.xml b/lite/res/values/strings.xml index 22fba165..ccd9f810 100644 --- a/lite/res/values/strings.xml +++ b/lite/res/values/strings.xml @@ -21,6 +21,7 @@ Ratio Filter list Settings + Help Start Stop Resume @@ -36,6 +37,7 @@ High Remote play in VLC Download using (S)FTP + Remove settings SERVERS STATUS @@ -47,6 +49,7 @@ Inactive Connected, but no torrent are active within the current filter Select a torrent to view its details + Transdroid allows you to monitor and manage the torrent client you run at home or on your seedbox. Setting things up can be a bit tricky, but we offer step-by-step guides and promise it\'ll be worth it! Waiting to check… Verifying local data… @@ -54,7 +57,7 @@ Error… %1$s OF %2$s (%3$s) %1$s, UPLOADED %2$s - SINCE $s + SINCE $1%s ~ %1$s ETA %1$s UNKNOWN ETA @@ -145,16 +148,18 @@ Vibrate LED colour If supported by your device - Support AWD notifications - Show torrent counter in ADW Launcher + Support AWD notifications + Show torrent counter in ADW Launcher - About Transdroid + System Check for updates Check transdroidorg for latest app version Import settings Export settings Send error log Get support or report a bug + View install guides + Recent changes About Error during communication; check your connection diff --git a/lite/res/values/styles.xml b/lite/res/values/styles.xml index ae796309..9daedc4b 100644 --- a/lite/res/values/styles.xml +++ b/lite/res/values/styles.xml @@ -3,6 +3,7 @@ diff --git a/lite/res/xml/pref_main.xml b/lite/res/xml/pref_main.xml index 19f3bf36..09c61a50 100644 --- a/lite/res/xml/pref_main.xml +++ b/lite/res/xml/pref_main.xml @@ -13,7 +13,7 @@ + android:defaultValue="false" + android:dependency="notifications_enabled" /> diff --git a/lite/res/xml/pref_server.xml b/lite/res/xml/pref_server.xml index 9512a302..c34556f7 100644 --- a/lite/res/xml/pref_server.xml +++ b/lite/res/xml/pref_server.xml @@ -18,8 +18,7 @@ android:inputType="textUri" /> + android:inputType="numberSigned" + android:defaultValue="8" /> + + + + \ No newline at end of file diff --git a/lite/res/xml/pref_websearch.xml b/lite/res/xml/pref_websearch.xml index 09674685..f2efdec1 100644 --- a/lite/res/xml/pref_websearch.xml +++ b/lite/res/xml/pref_websearch.xml @@ -8,7 +8,7 @@ android:inputType="textNoSuggestions" /> diff --git a/lite/src/fr/marvinlabs/widget/CheckableRelativeLayout.java b/lite/src/fr/marvinlabs/widget/CheckableRelativeLayout.java index e8e92e9a..91932561 100644 --- a/lite/src/fr/marvinlabs/widget/CheckableRelativeLayout.java +++ b/lite/src/fr/marvinlabs/widget/CheckableRelativeLayout.java @@ -30,7 +30,7 @@ public class CheckableRelativeLayout extends RelativeLayout implements Checkable initialise(attrs); } - public CheckableRelativeLayout(Context context, int checkableId) { + public CheckableRelativeLayout(Context context) { super(context); initialise(null); } diff --git a/lite/src/org/transdroid/core/app/settings/ApplicationSettings.java b/lite/src/org/transdroid/core/app/settings/ApplicationSettings.java index 7f6393d5..9bd6d723 100644 --- a/lite/src/org/transdroid/core/app/settings/ApplicationSettings.java +++ b/lite/src/org/transdroid/core/app/settings/ApplicationSettings.java @@ -61,15 +61,16 @@ public class ApplicationSettings { return new ServerSetting(order, prefs.getString("server_name_" + order, null), Daemon.fromCode(prefs.getString( "server_type_" + order, null)), prefs.getString("server_address_" + order, null), prefs.getString( "server_localaddress_" + order, null), prefs.getString("server_localnetwork_" + order, null), - prefs.getInt("server_port_" + order, -1), prefs.getBoolean("server_sslenabled_" + order, false), - prefs.getBoolean("server_ssltrustall_" + order, false), prefs.getString("server_ssltrustkey_" + order, - null), prefs.getString("server_folder_" + order, null), prefs.getBoolean("server_useauth_" - + order, true), prefs.getString("server_user_" + order, null), prefs.getString("server_pass_" - + order, null), prefs.getString("server_extrapass_" + order, null), OS.fromCode(prefs - .getString("server_os_" + order, null)), prefs.getString("server_downloaddir_" + order, null), - prefs.getString("server_ftpurl_" + order, null), prefs.getString("server_ftppass_" + order, null), - prefs.getInt("server_timeout_" + order, -1), prefs.getBoolean("server_alarmfinished_" + order, true), - prefs.getBoolean("server_alarmnew_" + order, false), false); + Integer.parseInt(prefs.getString("server_port_" + order, "-1")), prefs.getBoolean("server_sslenabled_" + + order, false), prefs.getBoolean("server_ssltrustall_" + order, false), prefs.getString( + "server_ssltrustkey_" + order, null), prefs.getString("server_folder_" + order, null), + prefs.getBoolean("server_useauth_" + order, true), prefs.getString("server_user_" + order, null), + prefs.getString("server_pass_" + order, null), prefs.getString("server_extrapass_" + order, null), + OS.fromCode(prefs.getString("server_os_" + order, null)), prefs.getString( + "server_downloaddir_" + order, null), prefs.getString("server_ftpurl_" + order, null), + prefs.getString("server_ftppass_" + order, null), prefs.getInt("server_timeout_" + order, 8), + prefs.getBoolean("server_alarmfinished_" + order, true), prefs.getBoolean("server_alarmnew_" + order, + false), false); } /** @@ -87,7 +88,7 @@ public class ApplicationSettings { } int last = getLastUsedServerKey(); if (last < 0 || last > max) { - // Last server was never set or no longer exists + // Last server was never set or no longer exists return getServerSetting(0); } return getServerSetting(last); diff --git a/lite/src/org/transdroid/core/app/settings/AboutSettings.java b/lite/src/org/transdroid/core/app/settings/SystemSettings.java similarity index 82% rename from lite/src/org/transdroid/core/app/settings/AboutSettings.java rename to lite/src/org/transdroid/core/app/settings/SystemSettings.java index 577f9fc9..3030af70 100644 --- a/lite/src/org/transdroid/core/app/settings/AboutSettings.java +++ b/lite/src/org/transdroid/core/app/settings/SystemSettings.java @@ -9,22 +9,22 @@ import android.content.SharedPreferences; import android.preference.PreferenceManager; /** - * Allows instantiation of the settings specified in R.xml.pref_about. + * Allows instantiation of the settings specified in R.xml.pref_system. * @author Eric Kok */ @EBean(scope = Scope.Singleton) -public class AboutSettings { +public class SystemSettings { @RootContext protected Context context; private SharedPreferences prefs; - protected AboutSettings(Context context) { + protected SystemSettings(Context context) { prefs = PreferenceManager.getDefaultSharedPreferences(context); } public boolean checkForUpdates() { - return prefs.getBoolean("about_checkupdates", true); + return prefs.getBoolean("system_checkupdates", true); } } diff --git a/lite/src/org/transdroid/core/gui/DetailsActivity.java b/lite/src/org/transdroid/core/gui/DetailsActivity.java index 5e57cfa3..68076526 100644 --- a/lite/src/org/transdroid/core/gui/DetailsActivity.java +++ b/lite/src/org/transdroid/core/gui/DetailsActivity.java @@ -17,6 +17,7 @@ import org.transdroid.core.R; import org.transdroid.core.app.settings.ApplicationSettings; import org.transdroid.core.app.settings.ServerSetting; import org.transdroid.core.gui.lists.LocalTorrent; +import org.transdroid.daemon.Daemon; import org.transdroid.daemon.IDaemonAdapter; import org.transdroid.daemon.Torrent; import org.transdroid.daemon.TorrentDetails; @@ -30,6 +31,9 @@ import org.transdroid.daemon.task.GetTorrentDetailsTaskSuccessResult; import org.transdroid.daemon.task.RetrieveTask; import org.transdroid.daemon.task.RetrieveTaskSuccessResult; +import android.annotation.TargetApi; +import android.content.Intent; +import android.os.Build; import android.widget.Toast; import com.actionbarsherlock.app.SherlockFragmentActivity; @@ -49,11 +53,17 @@ public class DetailsActivity extends SherlockFragmentActivity { // Details view components @FragmentById(R.id.torrent_details) - protected DetailsFagment fragmentDetails; + protected DetailsFragment fragmentDetails; @AfterViews protected void init() { + // We require a torrent to be specified; otherwise close the activity + if (torrent == null) { + finish(); + return; + } + // Simple action bar with up, torrent name as title and refresh button getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setTitle(torrent.getName()); @@ -62,11 +72,19 @@ public class DetailsActivity extends SherlockFragmentActivity { ServerSetting lastUsed = applicationSettings.getLastUsedServer(); currentConnection = lastUsed.createServerAdapter(); - // Load fine details and torrent files + // Show details and load fine stats and torrent files + fragmentDetails.updateTorrent(torrent); refreshTorrentDetails(); + refreshTorrentFiles(); } + @TargetApi(Build.VERSION_CODES.HONEYCOMB) + @OptionsItem(android.R.id.home) + protected void navigateUp() { + TorrentsActivity_.intent(this).flags(Intent.FLAG_ACTIVITY_CLEAR_TOP).start(); + } + @OptionsItem(R.id.action_refresh) protected void refreshScreen() { refreshTorrent(); @@ -92,6 +110,8 @@ public class DetailsActivity extends SherlockFragmentActivity { @Background protected void refreshTorrentDetails() { + if (!Daemon.supportsFineDetails(torrent.getDaemon())) + return; DaemonTaskResult result = GetTorrentDetailsTask.create(currentConnection, torrent).execute(); if (result instanceof GetTorrentDetailsTaskSuccessResult) { onTorrentDetailsRetrieved(((GetTorrentDetailsTaskSuccessResult) result).getTorrentDetails()); @@ -108,6 +128,8 @@ public class DetailsActivity extends SherlockFragmentActivity { @Background protected void refreshTorrentFiles() { + if (!Daemon.supportsFileListing(torrent.getDaemon())) + return; DaemonTaskResult result = GetFileListTask.create(currentConnection, torrent).execute(); if (result instanceof GetFileListTaskSuccessResult) { onTorrentFilesRetrieved(((GetFileListTaskSuccessResult) result).getFiles()); diff --git a/lite/src/org/transdroid/core/gui/DetailsFagment.java b/lite/src/org/transdroid/core/gui/DetailsFragment.java similarity index 93% rename from lite/src/org/transdroid/core/gui/DetailsFagment.java rename to lite/src/org/transdroid/core/gui/DetailsFragment.java index f05a8a3b..f1d85081 100644 --- a/lite/src/org/transdroid/core/gui/DetailsFagment.java +++ b/lite/src/org/transdroid/core/gui/DetailsFragment.java @@ -25,7 +25,7 @@ import com.actionbarsherlock.view.SherlockListView; * @author Eric Kok */ @EFragment(R.layout.fragment_details) -public class DetailsFagment extends SherlockFragment { +public class DetailsFragment extends SherlockFragment { // Local data @InstanceState @@ -44,8 +44,8 @@ public class DetailsFagment extends SherlockFragment { @AfterViews protected void init() { - detailsList.setAdapter(new DetailsAdapter()); - detailsList.setEmptyView(emptyText); // Shows a text that no torrent was selected yet + detailsList.setAdapter(new DetailsAdapter(getActivity())); + detailsList.setEmptyView(emptyText); if (torrent != null) updateTorrent(torrent); if (torrentDetails != null) @@ -104,7 +104,7 @@ public class DetailsFagment extends SherlockFragment { * Clear the screen by fully clearing the internal merge list (with header and other lists) */ public void clear() { - detailsList.setAdapter(new DetailsAdapter()); + ((DetailsAdapter)detailsList.getAdapter()).clear(); torrent = null; torrentDetails = null; torrentFiles = null; diff --git a/lite/src/org/transdroid/core/gui/TorrentsActivity.java b/lite/src/org/transdroid/core/gui/TorrentsActivity.java index cfd82a53..f4242fd5 100644 --- a/lite/src/org/transdroid/core/gui/TorrentsActivity.java +++ b/lite/src/org/transdroid/core/gui/TorrentsActivity.java @@ -25,6 +25,8 @@ import org.transdroid.core.gui.navigation.Label; import org.transdroid.core.gui.navigation.NavigationHelper; import org.transdroid.core.gui.navigation.StatusType; import org.transdroid.core.gui.navigation.StatusType.StatusTypeFilter; +import org.transdroid.core.gui.settings.MainSettingsActivity_; +import org.transdroid.daemon.Daemon; import org.transdroid.daemon.IDaemonAdapter; import org.transdroid.daemon.Torrent; import org.transdroid.daemon.task.DaemonTaskFailureResult; @@ -68,6 +70,8 @@ public class TorrentsActivity extends SherlockFragmentActivity implements OnNavi @InstanceState boolean firstStart = true; private IDaemonAdapter currentConnection = null; + @InstanceState + protected boolean turleModeEnabled = false; // Torrents list components @FragmentById(R.id.torrent_list) @@ -75,7 +79,7 @@ public class TorrentsActivity extends SherlockFragmentActivity implements OnNavi // Details view components @FragmentById(R.id.torrent_details) - protected DetailsFagment fragmentDetails; + protected DetailsFragment fragmentDetails; @AfterViews protected void init() { @@ -105,14 +109,12 @@ public class TorrentsActivity extends SherlockFragmentActivity implements OnNavi return; } // Set this as selection in the action bar spinner; we can use the server setting key since we have stable ids - // TODO: Does this call the action bar item selection callback? + // TODO: Does this call the action bar item selection callback? And refreshes? getSupportActionBar().setSelectedNavigationItem(lastUsed.getOrder()); - // Handle any start up intents or instead just refresh the torrents list + // Handle any start up intents if (firstStart) { handleStartIntent(); - } else { - refreshTorrents(); } } @@ -120,7 +122,16 @@ public class TorrentsActivity extends SherlockFragmentActivity implements OnNavi @Override protected void onResume() { super.onResume(); - refreshTorrents(); + + // Refresh server settings + navigationSpinnerAdapter.updateServers(applicationSettings.getServerSettings()); + ServerSetting lastUsed = applicationSettings.getLastUsedServer(); + if (lastUsed == null) { + // Still no settings + return; + } + // There is a server now: select it to establish a connection + filterSelected(lastUsed); } @TargetApi(Build.VERSION_CODES.FROYO) @@ -138,6 +149,45 @@ public class TorrentsActivity extends SherlockFragmentActivity implements OnNavi return true; } + @Override + public boolean onPrepareOptionsMenu(Menu menu) { + super.onPrepareOptionsMenu(menu); + + // No connection yet; hide all menu options except settings + if (currentConnection == null) { + menu.findItem(R.id.action_add).setVisible(false); + menu.findItem(R.id.action_search).setVisible(false); + menu.findItem(R.id.action_rss).setVisible(false); + menu.findItem(R.id.action_enableturtle).setVisible(false); + menu.findItem(R.id.action_disableturtle).setVisible(false); + menu.findItem(R.id.action_refresh).setVisible(false); + menu.findItem(R.id.action_sort).setVisible(false); + menu.findItem(R.id.action_filter).setVisible(false); + menu.findItem(R.id.action_settings).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); + menu.findItem(R.id.action_help).setVisible(true); + fragmentTorrents.updateConnectionStatus(false); + getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); + return true; + } + + // There is a connection (read: settings to some server known) + menu.findItem(R.id.action_add).setVisible(true); + menu.findItem(R.id.action_search).setVisible(true); + menu.findItem(R.id.action_rss).setVisible(true); + boolean hasAltMode = Daemon.supportsSetAlternativeMode(currentConnection.getType()); + menu.findItem(R.id.action_enableturtle).setVisible(hasAltMode && !turleModeEnabled); + menu.findItem(R.id.action_disableturtle).setVisible(hasAltMode && turleModeEnabled); + menu.findItem(R.id.action_refresh).setVisible(true); + menu.findItem(R.id.action_sort).setVisible(true); + menu.findItem(R.id.action_filter).setVisible(true); + menu.findItem(R.id.action_settings).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); + menu.findItem(R.id.action_help).setVisible(false); + fragmentTorrents.updateConnectionStatus(true); + getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); + + return true; + } + /** * Called when an item in the action bar navigation spinner was selected */ @@ -211,7 +261,12 @@ public class TorrentsActivity extends SherlockFragmentActivity implements OnNavi @OptionsItem(R.id.action_refresh) protected void refreshScreen() { refreshTorrents(); - // TODO: Refresh TorentDetails and TorrentFiles as well + // TODO: Retrieve turtle mode status + } + + @OptionsItem(R.id.action_settings) + protected void openSettings() { + MainSettingsActivity_.intent(this).start(); } private void clearScreens() { diff --git a/lite/src/org/transdroid/core/gui/TorrentsFragment.java b/lite/src/org/transdroid/core/gui/TorrentsFragment.java index a62dd8d2..25ef7d28 100644 --- a/lite/src/org/transdroid/core/gui/TorrentsFragment.java +++ b/lite/src/org/transdroid/core/gui/TorrentsFragment.java @@ -1,21 +1,28 @@ package org.transdroid.core.gui; import java.util.ArrayList; +import java.util.List; import org.androidannotations.annotations.AfterViews; +import org.androidannotations.annotations.Background; import org.androidannotations.annotations.EFragment; import org.androidannotations.annotations.InstanceState; import org.androidannotations.annotations.ItemClick; import org.androidannotations.annotations.ViewById; import org.transdroid.core.R; import org.transdroid.core.gui.lists.TorrentsAdapter; +import org.transdroid.core.gui.lists.TorrentsAdapter_; import org.transdroid.daemon.Torrent; import android.view.View; import android.widget.TextView; import com.actionbarsherlock.app.SherlockFragment; +import com.actionbarsherlock.view.ActionMode; +import com.actionbarsherlock.view.Menu; +import com.actionbarsherlock.view.MenuItem; import com.actionbarsherlock.view.SherlockListView; +import com.actionbarsherlock.view.SherlockListView.MultiChoiceModeListenerCompat; @EFragment(R.layout.fragment_torrents) public class TorrentsFragment extends SherlockFragment { @@ -23,21 +30,24 @@ public class TorrentsFragment extends SherlockFragment { // Local data @InstanceState protected ArrayList torrents = null; - + // Views @ViewById(R.id.torrent_list) protected SherlockListView torrentsList; @ViewById protected TextView emptyText; - + @ViewById + protected TextView nosettingsText; + @AfterViews protected void init() { - torrentsList.setAdapter(new TorrentsAdapter()); + torrentsList.setAdapter(TorrentsAdapter_.getInstance_(getActivity())); torrentsList.setEmptyView(emptyText); + torrentsList.setMultiChoiceModeListener(onTorrentsSelected); if (torrents != null) updateTorrents(torrents); } - + /** * Updates the list adapter to show a new list of torrent objects, replacing the old torrents completely * @param newTorrents The new, updated list of torrents @@ -49,7 +59,7 @@ public class TorrentsFragment extends SherlockFragment { torrentsList.setVisibility(View.GONE); emptyText.setVisibility(View.GONE); } else { - ((TorrentsAdapter)torrentsList.getAdapter()).update(newTorrents); + ((TorrentsAdapter) torrentsList.getAdapter()).update(newTorrents); // NOTE: This will also make visible again the list or empty view } } @@ -61,9 +71,79 @@ public class TorrentsFragment extends SherlockFragment { updateTorrents(null); } + private MultiChoiceModeListenerCompat onTorrentsSelected = new MultiChoiceModeListenerCompat() { + + @Override + public boolean onCreateActionMode(ActionMode mode, Menu menu) { + // Show contextual action bar to start/stop/remove/etc. torrents in batch mode + mode.getMenuInflater().inflate(R.menu.fragment_torrents_cab, menu); + return true; + } + + @Override + public boolean onActionItemClicked(ActionMode mode, MenuItem item) { + + // Get checked torrents + List checked = new ArrayList(); + for (int i = 0; i < torrentsList.getCheckedItemPositions().size(); i++) { + if (torrentsList.getCheckedItemPositions().get(i)) + checked.add((Torrent) torrentsList.getAdapter().getItem(i)); + } + + // Execute the requested action + // TODO: Add the other actions + switch (item.getItemId()) { + case R.id.action_start: + startTorrents(checked); + mode.finish(); + return true; + default: + return false; + } + } + + @Override + public void onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) { + // TODO: Update title or otherwise show number of selected torrents? + } + + @Override + public boolean onPrepareActionMode(ActionMode mode, Menu menu) { + return false; + } + + @Override + public void onDestroyActionMode(ActionMode mode) { + } + + }; + @ItemClick(R.id.torrent_list) protected void torrentsListClicked(Torrent torrent) { - + DetailsActivity_.intent(getActivity()).torrent(torrent).start(); + } + + /** + * Updates the shown screen depending on whether we have a connection (so torrents can be shown) or not (in case we + * need to show a message suggesting help) + * @param hasAConnection True if the user has servers configured and therefor has a conenction that can be used + */ + public void updateConnectionStatus(boolean hasAConnection) { + if (!hasAConnection) { + clear(); + torrentsList.setVisibility(View.GONE); + emptyText.setVisibility(View.GONE); + nosettingsText.setVisibility(View.VISIBLE); + } else { + nosettingsText.setVisibility(View.GONE); + torrentsList.setVisibility(torrentsList.getAdapter().isEmpty()? View.GONE: View.VISIBLE); + emptyText.setVisibility(torrentsList.getAdapter().isEmpty()? View.VISIBLE: View.GONE); + } } - + + @Background + protected void startTorrents(List torrents) { + // TODO: Implement action + } + } diff --git a/lite/src/org/transdroid/core/gui/lists/DetailsAdapter.java b/lite/src/org/transdroid/core/gui/lists/DetailsAdapter.java index adb3b573..11f8e986 100644 --- a/lite/src/org/transdroid/core/gui/lists/DetailsAdapter.java +++ b/lite/src/org/transdroid/core/gui/lists/DetailsAdapter.java @@ -1,10 +1,10 @@ package org.transdroid.core.gui.lists; +import java.util.ArrayList; import java.util.List; -import org.androidannotations.annotations.EBean; -import org.androidannotations.annotations.RootContext; import org.transdroid.core.R; +import org.transdroid.core.gui.navigation.FilterSeparatorView; import org.transdroid.core.gui.navigation.FilterSeparatorView_; import org.transdroid.daemon.Torrent; import org.transdroid.daemon.TorrentFile; @@ -20,77 +20,110 @@ import com.commonsware.cwac.merge.MergeAdapter; * List adapter that holds a header view showing torrent details and show the list list contained by the torrent. * @author Eric Kok */ -@EBean public class DetailsAdapter extends MergeAdapter { - @RootContext - protected Context context; private TorrentDetailsView torrentDetailsView = null; - private TorrentFilesAdapter torrentFilesAdapter = null; + private FilterSeparatorView trackersSeparatorView = null; private SimpleListItemAdapter trackersAdapter = null; + private FilterSeparatorView errorsSeparatorView = null; private SimpleListItemAdapter errorsAdapter = null; + private FilterSeparatorView torrentFilesSeparatorView = null; + private TorrentFilesAdapter torrentFilesAdapter = null; + public DetailsAdapter(Context context) { + // Immediately bind the adapters, or the MergeAdapter will not be able to determine the view types and instead + // display nothing at all + + // Torrent details header + torrentDetailsView = TorrentDetailsView_.build(context); + torrentDetailsView.setVisibility(View.GONE); + addView(torrentDetailsView, true); + + // Trackers + trackersSeparatorView = FilterSeparatorView_.build(context).setText(context.getString(R.string.status_trackers)); + trackersSeparatorView.setVisibility(View.GONE); + addView(trackersSeparatorView, true); + this.trackersAdapter = new SimpleListItemAdapter(context, new ArrayList()); + addAdapter(trackersAdapter); + + // Tracker errors + errorsSeparatorView = FilterSeparatorView_.build(context).setText(context.getString(R.string.status_errors)); + errorsSeparatorView.setVisibility(View.GONE); + addView(errorsSeparatorView, true); + this.errorsAdapter = new SimpleListItemAdapter(context, new ArrayList()); + addAdapter(errorsAdapter); + + // Torrent files + torrentFilesSeparatorView = FilterSeparatorView_.build(context).setText(context.getString(R.string.status_files)); + torrentFilesSeparatorView.setVisibility(View.GONE); + addView(torrentFilesSeparatorView, true); + this.torrentFilesAdapter = new TorrentFilesAdapter(context, new ArrayList()); + addAdapter(torrentFilesAdapter); + + } + /** * Update the torrent data in the details header of this merge adapter * @param torrent The torrent for which detailed data is shown */ public void updateTorrent(Torrent torrent) { - if (this.torrentDetailsView == null) { - torrentDetailsView = TorrentDetailsView_.build(context); - addView(torrentDetailsView, false); - } torrentDetailsView.update(torrent); + torrentDetailsView.setVisibility(torrent == null? View.GONE: View.VISIBLE); } /** * Update the list of files contained in this torrent - * @param torrentFiles The new list of files + * @param torrentFiles The new list of files, or null if the list and header should be hidden */ public void updateTorrentFiles(List torrentFiles) { - if (this.torrentFilesAdapter == null && torrentFiles != null) { - addView(FilterSeparatorView_.build(context).setText(context.getString(R.string.status_files)), false); - this.torrentFilesAdapter = new TorrentFilesAdapter(context, torrentFiles); - addAdapter(torrentFilesAdapter); - } else if (this.torrentFilesAdapter != null && torrentFiles != null) { - this.torrentFilesAdapter.update(torrentFiles); + if (torrentFiles == null) { + torrentFilesAdapter.update(new ArrayList()); + torrentFilesSeparatorView.setVisibility(View.GONE); } else { - this.torrentFilesAdapter = null; + torrentFilesAdapter.update(torrentFiles); + torrentFilesSeparatorView.setVisibility(View.GONE); } } /** * Update the list of trackers - * @param trackers The new list of trackers known for this torrent + * @param trackers The new list of trackers known for this torrent, or null if the list and header should be hidden */ public void updateTrackers(List trackers) { - if (this.trackersAdapter == null && trackers != null) { - addView(FilterSeparatorView_.build(context).setText(context.getString(R.string.status_trackers)), false); - this.trackersAdapter = new SimpleListItemAdapter(context, trackers); - addAdapter(trackersAdapter); - } else if (this.trackersAdapter != null && trackers != null) { - this.trackersAdapter.update(trackers); + if (trackers == null) { + trackersAdapter.update(new ArrayList()); + trackersSeparatorView.setVisibility(View.GONE); } else { - this.trackersAdapter = null; + trackersAdapter.update(trackers); + trackersSeparatorView.setVisibility(View.GONE); } } /** * Update the list of errors - * @param errors The new list of errors known for this torrent + * @param errors The new list of errors known for this torrent, or null if the list and header should be hidden */ public void updateErrors(List errors) { - if (this.errorsAdapter == null && errors != null) { - addView(FilterSeparatorView_.build(context).setText(context.getString(R.string.status_errors)), false); - this.errorsAdapter = new SimpleListItemAdapter(context, errors); - addAdapter(errorsAdapter); - } else if (this.errorsAdapter != null && errors != null) { - this.errorsAdapter.update(errors); + if (errors == null) { + errorsAdapter.update(new ArrayList()); + errorsSeparatorView.setVisibility(View.GONE); } else { - this.errorsAdapter = null; + errorsAdapter.update(errors); + errorsSeparatorView.setVisibility(View.GONE); } } - protected class TorrentFilesAdapter extends BaseAdapter { + /** + * Clear currently visible torrent, including header and shown lists + */ + public void clear() { + updateTorrent(null); + updateTorrentFiles(null); + updateErrors(null); + updateTrackers(null); + } + + protected static class TorrentFilesAdapter extends BaseAdapter { private final Context context; private List items; diff --git a/lite/src/org/transdroid/core/gui/lists/SimpleListItemAdapter.java b/lite/src/org/transdroid/core/gui/lists/SimpleListItemAdapter.java index f44c86f5..43c92426 100644 --- a/lite/src/org/transdroid/core/gui/lists/SimpleListItemAdapter.java +++ b/lite/src/org/transdroid/core/gui/lists/SimpleListItemAdapter.java @@ -69,8 +69,10 @@ public class SimpleListItemAdapter extends BaseAdapter { */ public static List wrapStringsList(List errorStrings) { ArrayList errors = new ArrayList(); - for (String errorString : errorStrings) { - errors.add(new SimpleStringItem(errorString)); + if (errorStrings != null) { + for (String errorString : errorStrings) { + errors.add(new SimpleStringItem(errorString)); + } } return errors; } diff --git a/lite/src/org/transdroid/core/gui/lists/TorrentProgressBar.java b/lite/src/org/transdroid/core/gui/lists/TorrentProgressBar.java index 34123a99..c6347cee 100644 --- a/lite/src/org/transdroid/core/gui/lists/TorrentProgressBar.java +++ b/lite/src/org/transdroid/core/gui/lists/TorrentProgressBar.java @@ -18,8 +18,7 @@ import android.view.View; public class TorrentProgressBar extends View { private final float scale = getContext().getResources().getDisplayMetrics().density; - private final int MINIMUM_HEIGHT = (int) (2 * scale + 0.5f); - // private final int RIGHT_MARGIN = (int)(3 * scale + 0.5f); + private final int MINIMUM_HEIGHT = (int) (3 * scale + 0.5f); private int progress; private boolean isActive; @@ -77,7 +76,7 @@ public class TorrentProgressBar extends View { @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { - int ws = MeasureSpec.getSize(widthMeasureSpec);// - RIGHT_MARGIN; + int ws = MeasureSpec.getSize(widthMeasureSpec); int hs = Math.max(getHeight(), MINIMUM_HEIGHT); setMeasuredDimension(ws, hs); } diff --git a/lite/src/org/transdroid/core/gui/lists/TorrentView.java b/lite/src/org/transdroid/core/gui/lists/TorrentView.java index bf8ff662..897a6b0e 100644 --- a/lite/src/org/transdroid/core/gui/lists/TorrentView.java +++ b/lite/src/org/transdroid/core/gui/lists/TorrentView.java @@ -27,7 +27,7 @@ public class TorrentView extends CheckableRelativeLayout { protected TorrentProgressBar torrentProgressbar; public TorrentView(Context context) { - super(context, null); + super(context); } public void bind(Torrent torrent) { diff --git a/lite/src/org/transdroid/core/gui/lists/TorrentsAdapter.java b/lite/src/org/transdroid/core/gui/lists/TorrentsAdapter.java index 1ebf2390..eeb17774 100644 --- a/lite/src/org/transdroid/core/gui/lists/TorrentsAdapter.java +++ b/lite/src/org/transdroid/core/gui/lists/TorrentsAdapter.java @@ -33,6 +33,11 @@ public class TorrentsAdapter extends BaseAdapter { notifyDataSetChanged(); } + @Override + public boolean hasStableIds() { + return true; + } + @Override public int getCount() { if (torrents == null) diff --git a/lite/src/org/transdroid/core/gui/settings/MainSettingsActivity.java b/lite/src/org/transdroid/core/gui/settings/MainSettingsActivity.java index dce00a47..0c7b97d1 100644 --- a/lite/src/org/transdroid/core/gui/settings/MainSettingsActivity.java +++ b/lite/src/org/transdroid/core/gui/settings/MainSettingsActivity.java @@ -45,7 +45,7 @@ public class MainSettingsActivity extends SherlockPreferenceActivity { addPreferencesFromResource(R.xml.pref_main); findPreference("header_addserver").setOnPreferenceClickListener(onAddServer); findPreference("header_addwebsearch").setOnPreferenceClickListener(onAddWebsearch); - findPreference("header_rssfeed").setOnPreferenceClickListener(onAddRssfeed); + findPreference("header_addrssfeed").setOnPreferenceClickListener(onAddRssfeed); findPreference("header_background").setOnPreferenceClickListener(onBackgroundSettings); findPreference("header_system").setOnPreferenceClickListener(onSystemSettings); @@ -126,8 +126,7 @@ public class MainSettingsActivity extends SherlockPreferenceActivity { private OnPreferenceClickListener onBackgroundSettings = new OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { - OtherSettingsActivity_.intent(MainSettingsActivity.this).preferencesResourceID(R.xml.pref_notifications) - .start(); + NotificationSettingsActivity_.intent(MainSettingsActivity.this).start(); return true; } }; @@ -135,7 +134,7 @@ public class MainSettingsActivity extends SherlockPreferenceActivity { private OnPreferenceClickListener onSystemSettings = new OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { - OtherSettingsActivity_.intent(MainSettingsActivity.this).preferencesResourceID(R.xml.pref_about).start(); + SystemSettingsActivity_.intent(MainSettingsActivity.this).start(); return true; } }; diff --git a/lite/src/org/transdroid/core/gui/settings/OtherSettingsActivity.java b/lite/src/org/transdroid/core/gui/settings/NotificationSettingsActivity.java similarity index 63% rename from lite/src/org/transdroid/core/gui/settings/OtherSettingsActivity.java rename to lite/src/org/transdroid/core/gui/settings/NotificationSettingsActivity.java index fdd62df7..29f9bdec 100644 --- a/lite/src/org/transdroid/core/gui/settings/OtherSettingsActivity.java +++ b/lite/src/org/transdroid/core/gui/settings/NotificationSettingsActivity.java @@ -2,7 +2,7 @@ package org.transdroid.core.gui.settings; import org.androidannotations.annotations.Bean; import org.androidannotations.annotations.EActivity; -import org.androidannotations.annotations.Extra; +import org.transdroid.core.R; import org.transdroid.core.app.settings.ApplicationSettings; import android.os.Bundle; @@ -10,11 +10,8 @@ import android.os.Bundle; import com.actionbarsherlock.app.SherlockPreferenceActivity; @EActivity -public class OtherSettingsActivity extends SherlockPreferenceActivity { +public class NotificationSettingsActivity extends SherlockPreferenceActivity { - @Extra - protected int preferencesResourceID; - @Bean protected ApplicationSettings applicationSettings; @@ -23,8 +20,8 @@ public class OtherSettingsActivity extends SherlockPreferenceActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - // Just load the preferences from XML, of which the ID is supplied as extra - addPreferencesFromResource(preferencesResourceID); + // Just load the notification-related preferences from XML + addPreferencesFromResource(R.xml.pref_notifications); } diff --git a/lite/src/org/transdroid/core/gui/settings/RssfeedSettingsActivity.java b/lite/src/org/transdroid/core/gui/settings/RssfeedSettingsActivity.java index e0e8e44c..b32b9e91 100644 --- a/lite/src/org/transdroid/core/gui/settings/RssfeedSettingsActivity.java +++ b/lite/src/org/transdroid/core/gui/settings/RssfeedSettingsActivity.java @@ -3,6 +3,7 @@ package org.transdroid.core.gui.settings; import org.androidannotations.annotations.Bean; import org.androidannotations.annotations.EActivity; import org.androidannotations.annotations.Extra; +import org.androidannotations.annotations.OptionsMenu; import org.transdroid.core.R; import org.transdroid.core.app.settings.ApplicationSettings; @@ -16,6 +17,7 @@ import com.actionbarsherlock.app.SherlockPreferenceActivity; * @author Eric Kok */ @EActivity +@OptionsMenu(R.menu.activity_deleteableprefs) public class RssfeedSettingsActivity extends SherlockPreferenceActivity { @Extra diff --git a/lite/src/org/transdroid/core/gui/settings/ServerSettingsActivity.java b/lite/src/org/transdroid/core/gui/settings/ServerSettingsActivity.java index 6398d547..98551451 100644 --- a/lite/src/org/transdroid/core/gui/settings/ServerSettingsActivity.java +++ b/lite/src/org/transdroid/core/gui/settings/ServerSettingsActivity.java @@ -3,6 +3,7 @@ package org.transdroid.core.gui.settings; import org.androidannotations.annotations.Bean; import org.androidannotations.annotations.EActivity; import org.androidannotations.annotations.Extra; +import org.androidannotations.annotations.OptionsMenu; import org.transdroid.daemon.Daemon; import org.transdroid.core.R; import org.transdroid.core.app.settings.ApplicationSettings; @@ -21,6 +22,7 @@ import com.actionbarsherlock.app.SherlockPreferenceActivity; * @author Eric Kok */ @EActivity +@OptionsMenu(R.menu.activity_deleteableprefs) public class ServerSettingsActivity extends SherlockPreferenceActivity { @Extra @@ -53,15 +55,17 @@ public class ServerSettingsActivity extends SherlockPreferenceActivity { findPreference("server_localnetwork").setKey("server_localnetwork_" + key); findPreference("server_folder").setKey("server_folder_" + key); findPreference("server_timeout").setKey("server_timeout_" + key); - findPreference("server_alamrfinished").setKey("server_alamrfinished_" + key); - findPreference("server_alarnew").setKey("server_alarnew_" + key); + findPreference("server_alarmfinished").setKey("server_alarmfinished_" + key); + findPreference("server_alarmnew").setKey("server_alarmnew_" + key); findPreference("server_os").setKey("server_os_" + key); findPreference("server_downloaddir").setKey("server_downloaddir_" + key); findPreference("server_ftpurl").setKey("server_ftpurl_" + key); findPreference("server_ftppass").setKey("server_ftppass_" + key); findPreference("server_sslenabled").setKey("server_sslenabled_" + key); findPreference("server_ssltrustall").setKey("server_ssltrustall_" + key); + findPreference("server_ssltrustall_" + key).setDependency("server_sslenabled_" + key); findPreference("server_ssltrustkey").setKey("server_ssltrustkey_" + key); + findPreference("server_ssltrustkey_" + key).setDependency("server_sslenabled_" + key); // Monitor preference changes getPreferenceScreen().setOnPreferenceChangeListener(onPreferenceChangeListener); @@ -70,6 +74,7 @@ public class ServerSettingsActivity extends SherlockPreferenceActivity { private OnPreferenceChangeListener onPreferenceChangeListener = new OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { + // TODO: This doesn't get called updatePreferenceAvailability(); return true; } diff --git a/lite/src/org/transdroid/core/gui/settings/SystemSettingsActivity.java b/lite/src/org/transdroid/core/gui/settings/SystemSettingsActivity.java new file mode 100644 index 00000000..20a9d611 --- /dev/null +++ b/lite/src/org/transdroid/core/gui/settings/SystemSettingsActivity.java @@ -0,0 +1,71 @@ +package org.transdroid.core.gui.settings; + +import org.androidannotations.annotations.Bean; +import org.androidannotations.annotations.EActivity; +import org.transdroid.core.R; +import org.transdroid.core.app.settings.ApplicationSettings; + +import android.content.Intent; +import android.net.Uri; +import android.os.Bundle; +import android.preference.Preference; +import android.preference.Preference.OnPreferenceClickListener; + +import com.actionbarsherlock.app.SherlockPreferenceActivity; + +@EActivity +public class SystemSettingsActivity extends SherlockPreferenceActivity { + + protected static final String INSTALLHELP_URI = "http://www.transdroid.org/download/"; + + @Bean + protected ApplicationSettings applicationSettings; + + @SuppressWarnings("deprecation") + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + // Just load the system-related preferences from XML + addPreferencesFromResource(R.xml.pref_notifications); + + // Handle outgoing links + findPreference("system_sendlog").setOnPreferenceClickListener(onSendLogClick); + findPreference("system_installhelp").setOnPreferenceClickListener(onInstallHelpClick); + findPreference("system_changelog").setOnPreferenceClickListener(onChangeLogClick); + findPreference("system_about").setOnPreferenceClickListener(onAboutClick); + } + + private OnPreferenceClickListener onSendLogClick = new OnPreferenceClickListener() { + @Override + public boolean onPreferenceClick(Preference preference) { + // TODO: Implement error log collection and sending + return true; + } + }; + + private OnPreferenceClickListener onInstallHelpClick = new OnPreferenceClickListener() { + @Override + public boolean onPreferenceClick(Preference preference) { + startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(INSTALLHELP_URI))); + return true; + } + }; + + private OnPreferenceClickListener onChangeLogClick = new OnPreferenceClickListener() { + @Override + public boolean onPreferenceClick(Preference preference) { + // TODO: Implement about change log screen + return true; + } + }; + + private OnPreferenceClickListener onAboutClick = new OnPreferenceClickListener() { + @Override + public boolean onPreferenceClick(Preference preference) { + // TODO: Implement about screen with app version, developer name and used open source libraries + return true; + } + }; + +} diff --git a/lite/src/org/transdroid/core/gui/settings/WebsearchSettingsActivity.java b/lite/src/org/transdroid/core/gui/settings/WebsearchSettingsActivity.java index 53194bcc..ae2e6fe9 100644 --- a/lite/src/org/transdroid/core/gui/settings/WebsearchSettingsActivity.java +++ b/lite/src/org/transdroid/core/gui/settings/WebsearchSettingsActivity.java @@ -3,6 +3,7 @@ package org.transdroid.core.gui.settings; import org.androidannotations.annotations.Bean; import org.androidannotations.annotations.EActivity; import org.androidannotations.annotations.Extra; +import org.androidannotations.annotations.OptionsMenu; import org.transdroid.core.R; import org.transdroid.core.app.settings.ApplicationSettings; @@ -16,6 +17,7 @@ import com.actionbarsherlock.app.SherlockPreferenceActivity; * @author Eric Kok */ @EActivity +@OptionsMenu(R.menu.activity_deleteableprefs) public class WebsearchSettingsActivity extends SherlockPreferenceActivity { @Extra