Browse Source

Getting the details screen lay out properly.

pull/11/head
Eric Kok 12 years ago
parent
commit
34376e26e7
  1. 27
      lite/AndroidManifest.xml
  2. BIN
      lite/res/drawable-hdpi/ic_action_discard.png
  3. BIN
      lite/res/drawable-hdpi/ic_launcher.png
  4. BIN
      lite/res/drawable-mdpi/ic_action_discard.png
  5. BIN
      lite/res/drawable-mdpi/ic_launcher.png
  6. BIN
      lite/res/drawable-xhdpi/ic_action_discard.png
  7. BIN
      lite/res/drawable-xhdpi/ic_launcher.png
  8. BIN
      lite/res/drawable-xxhdpi/ic_launcher.png
  9. 2
      lite/res/layout/fragment_details.xml
  10. 12
      lite/res/layout/fragment_torrents.xml
  11. 9
      lite/res/layout/list_item_filter.xml
  12. 29
      lite/res/layout/list_item_torrent.xml
  13. 24
      lite/res/layout/list_item_torrentfile.xml
  14. 9
      lite/res/menu/activity_deleteableprefs.xml
  15. 14
      lite/res/menu/activity_torrents.xml
  16. 29
      lite/res/menu/fragment_torrents_cab.xml
  17. 13
      lite/res/values/strings.xml
  18. 1
      lite/res/values/styles.xml
  19. 2
      lite/res/xml/pref_main.xml
  20. 7
      lite/res/xml/pref_notifications.xml
  21. 8
      lite/res/xml/pref_server.xml
  22. 14
      lite/res/xml/pref_system.xml
  23. 2
      lite/res/xml/pref_websearch.xml
  24. 2
      lite/src/fr/marvinlabs/widget/CheckableRelativeLayout.java
  25. 21
      lite/src/org/transdroid/core/app/settings/ApplicationSettings.java
  26. 8
      lite/src/org/transdroid/core/app/settings/SystemSettings.java
  27. 26
      lite/src/org/transdroid/core/gui/DetailsActivity.java
  28. 8
      lite/src/org/transdroid/core/gui/DetailsFragment.java
  29. 69
      lite/src/org/transdroid/core/gui/TorrentsActivity.java
  30. 94
      lite/src/org/transdroid/core/gui/TorrentsFragment.java
  31. 103
      lite/src/org/transdroid/core/gui/lists/DetailsAdapter.java
  32. 6
      lite/src/org/transdroid/core/gui/lists/SimpleListItemAdapter.java
  33. 5
      lite/src/org/transdroid/core/gui/lists/TorrentProgressBar.java
  34. 2
      lite/src/org/transdroid/core/gui/lists/TorrentView.java
  35. 5
      lite/src/org/transdroid/core/gui/lists/TorrentsAdapter.java
  36. 7
      lite/src/org/transdroid/core/gui/settings/MainSettingsActivity.java
  37. 11
      lite/src/org/transdroid/core/gui/settings/NotificationSettingsActivity.java
  38. 2
      lite/src/org/transdroid/core/gui/settings/RssfeedSettingsActivity.java
  39. 9
      lite/src/org/transdroid/core/gui/settings/ServerSettingsActivity.java
  40. 71
      lite/src/org/transdroid/core/gui/settings/SystemSettingsActivity.java
  41. 2
      lite/src/org/transdroid/core/gui/settings/WebsearchSettingsActivity.java

27
lite/AndroidManifest.xml

@ -15,17 +15,25 @@ @@ -15,17 +15,25 @@
android:smallScreens="true"
android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_activity_torrents"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/TransdroidTheme" >
android:theme="@style/Theme.Sherlock" >
<!-- Main activities -->
<activity
android:name="org.transdroid.core.gui.TorrentsActivity_"
android:label="@string/app_name"
android:uiOptions="splitActionBarWhenNarrow" >
android:icon="@drawable/ic_activity_torrents"
android:uiOptions="splitActionBarWhenNarrow"
android:theme="@style/TransdroidTheme" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@ -41,7 +49,9 @@ @@ -41,7 +49,9 @@
</activity>
<activity
android:name="org.transdroid.core.gui.DetailsActivity_"
android:uiOptions="splitActionBarWhenNarrow" >
android:icon="@drawable/ic_activity_torrents"
android:uiOptions="splitActionBarWhenNarrow"
android:theme="@style/TransdroidTheme" >
</activity>
<!-- Settings screens -->
@ -49,12 +59,15 @@ @@ -49,12 +59,15 @@
<activity android:name="org.transdroid.core.gui.settings.ServerSettingsActivity_" />
<activity android:name="org.transdroid.core.gui.settings.WebsearchSettingsActivity_" />
<activity android:name="org.transdroid.core.gui.settings.RssfeedSettingsActivity_" />
<activity android:name="org.transdroid.core.gui.settings.OtherSettingsActivity_" />
<activity android:name="org.transdroid.core.gui.settings.NotificationSettingsActivity_" />
<activity android:name="org.transdroid.core.gui.settings.SystemSettingsActivity_" />
<!-- Search -->
<activity
android:name="org.transdroid.core.gui.SearchActivity"
android:label="@string/search_torrentsearch" >
android:label="@string/search_torrentsearch"
android:icon="@drawable/ic_activity_torrents"
android:theme="@style/TransdroidTheme" >
<intent-filter>
<action android:name="android.intent.action.SEARCH" />

BIN
lite/res/drawable-hdpi/ic_action_discard.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
lite/res/drawable-hdpi/ic_launcher.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 12 KiB

BIN
lite/res/drawable-mdpi/ic_action_discard.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
lite/res/drawable-mdpi/ic_launcher.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

BIN
lite/res/drawable-xhdpi/ic_action_discard.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
lite/res/drawable-xhdpi/ic_launcher.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

BIN
lite/res/drawable-xxhdpi/ic_launcher.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

2
lite/res/layout/fragment_details.xml

@ -9,6 +9,8 @@ @@ -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" />
<TextView

12
lite/res/layout/fragment_torrents.xml

@ -23,4 +23,16 @@ @@ -23,4 +23,16 @@
android:textIsSelectable="false"
android:visibility="gone" />
<TextView
android:id="@+id/nosettings_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawableTop="@drawable/ic_empty_details"
android:drawablePadding="8dip"
android:text="@string/navigation_nosettings"
android:gravity="center"
android:textIsSelectable="false"
android:visibility="gone" />
</FrameLayout>

9
lite/res/layout/list_item_filter.xml

@ -1,8 +1,11 @@ @@ -1,8 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
android:paddingTop="@dimen/margin_half"
android:paddingBottom="@dimen/margin_half"
android:paddingLeft="@dimen/margin_default"
android:paddingRight="@dimen/margin_default" >
<TextView
android:id="@+id/item_text"
@ -10,4 +13,4 @@ @@ -10,4 +13,4 @@
android:layout_height="wrap_content"
android:textIsSelectable="true" />
</LinearLayout>
</FrameLayout>

29
lite/res/layout/list_item_torrent.xml

@ -4,10 +4,9 @@ @@ -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">
<ImageView
android:id="@+id/priority_image"
@ -16,13 +15,16 @@ @@ -16,13 +15,16 @@
android:layout_marginLeft="@dimen/margin_half"
android:layout_marginTop="@dimen/margin_half"
android:src="@drawable/ic_priority_normal"
android:contentDescription="@string/status_priority_normal" />
android:contentDescription="@string/status_priority_normal"
android:focusable="false" />
<fr.marvinlabs.widget.InertCheckBox
android:id="@+id/torrent_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/priority_image" />
android:layout_below="@id/priority_image"
android:layout_marginRight="4dip"
android:focusable="false" />
<TextView
android:id="@+id/name_text"
@ -31,7 +33,8 @@ @@ -31,7 +33,8 @@
android:layout_toRightOf="@id/torrent_checkbox"
android:textColor="#fff"
android:textSize="15sp"
android:textIsSelectable="true" />
android:textIsSelectable="false"
android:focusable="false" />
<TextView
android:id="@+id/ratio_text"
@ -42,7 +45,8 @@ @@ -42,7 +45,8 @@
android:layout_marginLeft="@dimen/margin_half"
android:layout_marginTop="4dip"
android:textSize="12sp"
android:textIsSelectable="false" />
android:textIsSelectable="false"
android:focusable="false" />
<TextView
android:id="@+id/progress_text"
@ -52,7 +56,8 @@ @@ -52,7 +56,8 @@
android:layout_toLeftOf="@id/ratio_text"
android:layout_toRightOf="@id/torrent_checkbox"
android:textSize="12sp"
android:textIsSelectable="false" />
android:textIsSelectable="false"
android:focusable="false" />
<org.transdroid.core.gui.lists.TorrentProgressBar
android:id="@+id/torrent_progressbar"
@ -61,7 +66,8 @@ @@ -61,7 +66,8 @@
android:layout_toRightOf="@id/torrent_checkbox"
android:layout_below="@id/ratio_text"
android:layout_marginTop="@dimen/margin_half"
android:layout_marginBottom="@dimen/margin_half" />
android:layout_marginBottom="@dimen/margin_half"
android:focusable="false" />
<TextView
android:id="@+id/speed_text"
@ -71,7 +77,8 @@ @@ -71,7 +77,8 @@
android:layout_alignParentRight="true"
android:layout_marginLeft="@dimen/margin_half"
android:textSize="12sp"
android:textIsSelectable="false" />
android:textIsSelectable="false"
android:focusable="false" />
<TextView
android:id="@+id/peers_text"

24
lite/res/layout/list_item_torrentfile.xml

@ -4,15 +4,15 @@ @@ -4,15 +4,15 @@
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">
<fr.marvinlabs.widget.InertCheckBox
android:id="@+id/file_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:focusable="false" />
<TextView
android:id="@+id/name_text"
@ -21,8 +21,9 @@ @@ -21,8 +21,9 @@
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/file_checkbox"
android:textColor="#fff"
android:textIsSelectable="true"
android:textSize="15sp" />
android:textSize="15sp"
android:textIsSelectable="false"
android:focusable="false" />
<TextView
android:id="@+id/progress_text"
@ -33,7 +34,8 @@ @@ -33,7 +34,8 @@
android:layout_marginLeft="@dimen/margin_half"
android:layout_marginTop="4dip"
android:textSize="12sp"
android:textIsSelectable="false" />
android:textIsSelectable="false"
android:focusable="false" />
<TextView
android:id="@+id/sizes_text"
@ -43,7 +45,8 @@ @@ -43,7 +45,8 @@
android:layout_alignBottom="@+id/progress_text"
android:layout_toRightOf="@+id/priority_image"
android:textIsSelectable="false"
android:textSize="12sp" />
android:textSize="12sp"
android:focusable="false" />
<ImageView
android:id="@+id/priority_image"
@ -53,6 +56,7 @@ @@ -53,6 +56,7 @@
android:layout_below="@+id/name_text"
android:layout_marginTop="4dip"
android:layout_marginRight="@dimen/margin_half"
android:contentDescription="@string/status_priority_normal" />
android:contentDescription="@string/status_priority_normal"
android:focusable="false" />
</fr.marvinlabs.widget.CheckableRelativeLayout>

9
lite/res/menu/activity_deleteableprefs.xml

@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/action_remove"
android:icon="@drawable/ic_action_discard"
android:showAsAction="always"
android:title="@string/action_removesettings"/>
</menu>

14
lite/res/menu/activity_torrents.xml

@ -4,7 +4,13 @@ @@ -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">
<menu>
<item android:id="@+id/action_add_fromurl" android:title="@string/action_addfromurl" />
<item android:id="@+id/action_add_fromfile" android:title="@string/action_addfromfile" />
<item android:id="@+id/action_add_frombarcode" android:title="@string/action_scanbarcode" />
</menu>
</item>
<item
android:id="@+id/action_search"
android:icon="@drawable/ic_action_search"
@ -47,8 +53,12 @@ @@ -47,8 +53,12 @@
android:showAsAction="never"
android:title="@string/action_filter"/>
<item
android:id="@+id/action_settings"
android:id="@+id/action_help"
android:showAsAction="never"
android:title="@string/action_help"/>
<item
android:id="@+id/action_settings"
android:showAsAction="always"
android:title="@string/action_settings"/>
</menu>

29
lite/res/menu/fragment_torrents_cab.xml

@ -0,0 +1,29 @@ @@ -0,0 +1,29 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/action_resume"
android:icon="@drawable/ic_action_resume"
android:showAsAction="always"
android:title="@string/action_resume" />
<item
android:id="@+id/action_pause"
android:icon="@drawable/ic_action_pause"
android:showAsAction="always"
android:title="@string/action_pause" />
<item
android:id="@+id/action_remove"
android:icon="@drawable/ic_action_remove"
android:showAsAction="always"
android:title="@string/action_remove">
<menu>
<item android:id="@+id/action_remove_default" android:title="@string/action_remove_default" />
<item android:id="@+id/action_remove_withdata" android:title="@string/action_remove_withdata" />
</menu>
</item>
<item
android:id="@+id/action_setlabel"
android:icon="@drawable/ic_action_labels"
android:showAsAction="ifRoom"
android:title="@string/action_setlabel" />
</menu>

13
lite/res/values/strings.xml

@ -21,6 +21,7 @@ @@ -21,6 +21,7 @@
<string name="action_sort_ratio">Ratio</string>
<string name="action_filter">Filter list</string>
<string name="action_settings">Settings</string>
<string name="action_help">Help</string>
<string name="action_start">Start</string>
<string name="action_stop">Stop</string>
<string name="action_resume">Resume</string>
@ -36,6 +37,7 @@ @@ -36,6 +37,7 @@
<string name="action_priority_high">High</string>
<string name="action_remoteplay">Remote play in VLC</string>
<string name="action_download">Download using (S)FTP</string>
<string name="action_removesettings">Remove settings</string>
<string name="navigation_servers">SERVERS</string>
<string name="navigation_status">STATUS</string>
@ -47,6 +49,7 @@ @@ -47,6 +49,7 @@
<string name="navigation_status_onlyinactive">Inactive</string>
<string name="navigation_emptytorrents">Connected, but no torrent are active within the current filter</string>
<string name="navigation_emptydetails">Select a torrent to view its details</string>
<string name="navigation_nosettings">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!</string>
<string name="status_waiting">Waiting to check&#8230;</string>
<string name="status_checking">Verifying local data&#8230;</string>
@ -54,7 +57,7 @@ @@ -54,7 +57,7 @@
<string name="status_error">Error&#8230;</string>
<string name="status_size1">%1$s OF %2$s (%3$s)</string>
<string name="status_size2">%1$s, UPLOADED %2$s</string>
<string name="status_sincedate">SINCE $s</string>
<string name="status_sincedate">SINCE $1%s</string>
<string name="status_eta">~ %1$s</string>
<string name="status_etalong">ETA %1$s</string>
<string name="status_unknowneta">UNKNOWN ETA</string>
@ -145,16 +148,18 @@ @@ -145,16 +148,18 @@
<string name="pref_notifyvibrate">Vibrate</string>
<string name="pref_notifyled">LED colour</string>
<string name="pref_notifyled_info">If supported by your device</string>
<string name="pref_awdnotify">Support AWD notifications</string>
<string name="pref_awdnotify_info">Show torrent counter in ADW Launcher</string>
<string name="pref_adw">Support AWD notifications</string>
<string name="pref_adw_info">Show torrent counter in ADW Launcher</string>
<string name="pref_system">About Transdroid</string>
<string name="pref_system">System</string>
<string name="pref_checkupdates">Check for updates</string>
<string name="pref_checkupdates_info">Check transdroidorg for latest app version</string>
<string name="pref_import">Import settings</string>
<string name="pref_export">Export settings</string>
<string name="pref_sendlog">Send error log</string>
<string name="pref_sendlog_info">Get support or report a bug</string>
<string name="pref_installhelp">View install guides</string>
<string name="pref_changelog">Recent changes</string>
<string name="pref_about">About</string>
<string name="error_httperror">Error during communication; check your connection</string>

1
lite/res/values/styles.xml

@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
<style name="TransdroidTheme" parent="Theme.Transdroid">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
<item name="android:textViewStyle">@style/DefaultTextView</item>
<item name="android:windowBackground">@android:color/black</item>
</style>
<!-- Taken from http://stackoverflow.com/questions/10020466/android-4-0-sub-title-section-label-styling -->

2
lite/res/xml/pref_main.xml

@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@
<PreferenceCategory
android:key="header_searchsites"
android:title="@string/pref_servers"
android:title="@string/pref_searchsites"
android:order="100">
<ListPreference
android:key="header_setsearchsite"

7
lite/res/xml/pref_notifications.xml

@ -27,7 +27,8 @@ @@ -27,7 +27,8 @@
<CheckBoxPreference
android:key="notifications_vibrate"
android:title="@string/pref_notifyvibrate"
android:defaultValue="false" />
android:defaultValue="false"
android:dependency="notifications_enabled" />
<net.margaritov.preference.colorpicker.ColorPickerPreference
android:key="notifications_ledcolour"
@ -39,8 +40,8 @@ @@ -39,8 +40,8 @@
<CheckBoxPreference
android:key="notifications_adwnotify"
android:title="@string/pref_notifyled"
android:summary="@string/pref_notifyled_info"
android:title="@string/pref_adw"
android:summary="@string/pref_adw_info"
android:defaultValue="false"
android:dependency="notifications_enabled" />

8
lite/res/xml/pref_server.xml

@ -18,8 +18,7 @@ @@ -18,8 +18,7 @@
android:inputType="textUri" />
<EditTextPreference
android:key="server_port"
android:title="@string/pref_address"
android:summary="@string/pref_searchurl_info"
android:title="@string/pref_port"
android:inputType="numberSigned" />
<EditTextPreference
android:key="server_user"
@ -53,14 +52,15 @@ @@ -53,14 +52,15 @@
android:key="server_timeout"
android:title="@string/pref_timeout"
android:summary="@string/pref_timeout_info"
android:inputType="numberSigned" />
android:inputType="numberSigned"
android:defaultValue="8" />
<CheckBoxPreference
android:key="server_sslenabled"
android:title="@string/pref_sslenable"
android:summary="@string/pref_sslenable_info"
android:defaultValue="false" />
<CheckBoxPreference
android:key="server_trustall"
android:key="server_ssltrustall"
android:title="@string/pref_sslacceptall"
android:summary="@string/pref_sslacceptall_info"
android:defaultValue="false"

14
lite/res/xml/pref_about.xml → lite/res/xml/pref_system.xml

@ -2,19 +2,27 @@ @@ -2,19 +2,27 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
<CheckBoxPreference
android:key="about_checkupdates"
android:key="system_checkupdates"
android:title="@string/pref_checkupdates"
android:summary="@string/pref_checkupdates_info"
android:defaultValue="true" />
<Preference
android:key="about_sendlog"
android:key="system_sendlog"
android:title="@string/pref_sendlog"
android:summary="@string/pref_sendlog_info">
</Preference>
<Preference
android:key="about_about"
android:key="system_installhelp"
android:title="@string/pref_installhelp" />
<Preference
android:key="system_changelog"
android:title="@string/pref_changelog" />
<Preference
android:key="system_about"
android:title="@string/pref_about" />
</PreferenceScreen>

2
lite/res/xml/pref_websearch.xml

@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
android:inputType="textNoSuggestions" />
<EditTextPreference
android:key="websearch_url"
android:key="websearch_baseurl"
android:title="@string/pref_searchurl"
android:summary="@string/pref_searchurl_info"
android:inputType="textUri" />

2
lite/src/fr/marvinlabs/widget/CheckableRelativeLayout.java

@ -30,7 +30,7 @@ public class CheckableRelativeLayout extends RelativeLayout implements Checkable @@ -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);
}

21
lite/src/org/transdroid/core/app/settings/ApplicationSettings.java

@ -61,15 +61,16 @@ public class ApplicationSettings { @@ -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 { @@ -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);

8
lite/src/org/transdroid/core/app/settings/AboutSettings.java → lite/src/org/transdroid/core/app/settings/SystemSettings.java

@ -9,22 +9,22 @@ import android.content.SharedPreferences; @@ -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);
}
}

26
lite/src/org/transdroid/core/gui/DetailsActivity.java

@ -17,6 +17,7 @@ import org.transdroid.core.R; @@ -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; @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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());

8
lite/src/org/transdroid/core/gui/DetailsFagment.java → lite/src/org/transdroid/core/gui/DetailsFragment.java

@ -25,7 +25,7 @@ import com.actionbarsherlock.view.SherlockListView; @@ -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 { @@ -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 { @@ -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;

69
lite/src/org/transdroid/core/gui/TorrentsActivity.java

@ -25,6 +25,8 @@ import org.transdroid.core.gui.navigation.Label; @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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() {

94
lite/src/org/transdroid/core/gui/TorrentsFragment.java

@ -1,21 +1,28 @@ @@ -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 { @@ -23,21 +30,24 @@ public class TorrentsFragment extends SherlockFragment {
// Local data
@InstanceState
protected ArrayList<Torrent> 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 { @@ -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 { @@ -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<Torrent> checked = new ArrayList<Torrent>();
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<Torrent> torrents) {
// TODO: Implement action
}
}

103
lite/src/org/transdroid/core/gui/lists/DetailsAdapter.java

@ -1,10 +1,10 @@ @@ -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; @@ -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<SimpleListItem>());
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<SimpleListItem>());
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<TorrentFile>());
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<TorrentFile> 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<TorrentFile>());
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<? extends SimpleListItem> 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<SimpleListItemAdapter.SimpleStringItem>());
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<? extends SimpleListItem> 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<SimpleListItemAdapter.SimpleStringItem>());
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<TorrentFile> items;

6
lite/src/org/transdroid/core/gui/lists/SimpleListItemAdapter.java

@ -69,8 +69,10 @@ public class SimpleListItemAdapter extends BaseAdapter { @@ -69,8 +69,10 @@ public class SimpleListItemAdapter extends BaseAdapter {
*/
public static List<SimpleStringItem> wrapStringsList(List<String> errorStrings) {
ArrayList<SimpleStringItem> errors = new ArrayList<SimpleStringItem>();
for (String errorString : errorStrings) {
errors.add(new SimpleStringItem(errorString));
if (errorStrings != null) {
for (String errorString : errorStrings) {
errors.add(new SimpleStringItem(errorString));
}
}
return errors;
}

5
lite/src/org/transdroid/core/gui/lists/TorrentProgressBar.java

@ -18,8 +18,7 @@ import android.view.View; @@ -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 { @@ -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);
}

2
lite/src/org/transdroid/core/gui/lists/TorrentView.java

@ -27,7 +27,7 @@ public class TorrentView extends CheckableRelativeLayout { @@ -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) {

5
lite/src/org/transdroid/core/gui/lists/TorrentsAdapter.java

@ -33,6 +33,11 @@ public class TorrentsAdapter extends BaseAdapter { @@ -33,6 +33,11 @@ public class TorrentsAdapter extends BaseAdapter {
notifyDataSetChanged();
}
@Override
public boolean hasStableIds() {
return true;
}
@Override
public int getCount() {
if (torrents == null)

7
lite/src/org/transdroid/core/gui/settings/MainSettingsActivity.java

@ -45,7 +45,7 @@ public class MainSettingsActivity extends SherlockPreferenceActivity { @@ -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 { @@ -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 { @@ -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;
}
};

11
lite/src/org/transdroid/core/gui/settings/OtherSettingsActivity.java → lite/src/org/transdroid/core/gui/settings/NotificationSettingsActivity.java

@ -2,7 +2,7 @@ package org.transdroid.core.gui.settings; @@ -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; @@ -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 { @@ -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);
}

2
lite/src/org/transdroid/core/gui/settings/RssfeedSettingsActivity.java

@ -3,6 +3,7 @@ package org.transdroid.core.gui.settings; @@ -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; @@ -16,6 +17,7 @@ import com.actionbarsherlock.app.SherlockPreferenceActivity;
* @author Eric Kok
*/
@EActivity
@OptionsMenu(R.menu.activity_deleteableprefs)
public class RssfeedSettingsActivity extends SherlockPreferenceActivity {
@Extra

9
lite/src/org/transdroid/core/gui/settings/ServerSettingsActivity.java

@ -3,6 +3,7 @@ package org.transdroid.core.gui.settings; @@ -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; @@ -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 { @@ -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 { @@ -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;
}

71
lite/src/org/transdroid/core/gui/settings/SystemSettingsActivity.java

@ -0,0 +1,71 @@ @@ -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;
}
};
}

2
lite/src/org/transdroid/core/gui/settings/WebsearchSettingsActivity.java

@ -3,6 +3,7 @@ package org.transdroid.core.gui.settings; @@ -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; @@ -16,6 +17,7 @@ import com.actionbarsherlock.app.SherlockPreferenceActivity;
* @author Eric Kok
*/
@EActivity
@OptionsMenu(R.menu.activity_deleteableprefs)
public class WebsearchSettingsActivity extends SherlockPreferenceActivity {
@Extra

Loading…
Cancel
Save