Browse Source

Adjust codestyle to an .editorconfig

pull/559/head
TacoTheDank 4 years ago
parent
commit
8204bd56a7
  1. 9
      .editorconfig
  2. 21
      app/src/main/AndroidManifest.xml
  3. 3
      app/src/main/java/androidx/preference/PreferenceManagerBinder.java
  4. 6
      app/src/main/java/org/transdroid/core/app/search/SearchHelper.java
  5. 1
      app/src/main/java/org/transdroid/core/app/search/SearchResult.java
  6. 1
      app/src/main/java/org/transdroid/core/app/search/SearchSite.java
  7. 40
      app/src/main/java/org/transdroid/core/app/settings/ApplicationSettings.java
  8. 8
      app/src/main/java/org/transdroid/core/app/settings/NotificationSettings.java
  9. 4
      app/src/main/java/org/transdroid/core/app/settings/RssfeedSetting.java
  10. 6
      app/src/main/java/org/transdroid/core/app/settings/ServerSetting.java
  11. 5
      app/src/main/java/org/transdroid/core/app/settings/SettingsPersistence.java
  12. 3
      app/src/main/java/org/transdroid/core/app/settings/SettingsUtils.java
  13. 4
      app/src/main/java/org/transdroid/core/app/settings/SystemSettings.java
  14. 4
      app/src/main/java/org/transdroid/core/app/settings/WebsearchSetting.java
  15. 2
      app/src/main/java/org/transdroid/core/gui/DetailsActivity.java
  16. 10
      app/src/main/java/org/transdroid/core/gui/DetailsFragment.java
  17. 2
      app/src/main/java/org/transdroid/core/gui/ServerPickerDialog.java
  18. 2
      app/src/main/java/org/transdroid/core/gui/ServerSelectionView.java
  19. 1
      app/src/main/java/org/transdroid/core/gui/ServerStatusView.java
  20. 1
      app/src/main/java/org/transdroid/core/gui/TorrentTasksExecutor.java
  21. 7
      app/src/main/java/org/transdroid/core/gui/TorrentsActivity.java
  22. 12
      app/src/main/java/org/transdroid/core/gui/TorrentsFragment.java
  23. 3
      app/src/main/java/org/transdroid/core/gui/TransdroidApp.java
  24. 6
      app/src/main/java/org/transdroid/core/gui/lists/DetailsAdapter.java
  25. 9
      app/src/main/java/org/transdroid/core/gui/lists/LocalTorrent.java
  26. 8
      app/src/main/java/org/transdroid/core/gui/lists/MergeAdapter.java
  27. 9
      app/src/main/java/org/transdroid/core/gui/lists/PiecesMapView.java
  28. 1
      app/src/main/java/org/transdroid/core/gui/lists/SimpleListItem.java
  29. 3
      app/src/main/java/org/transdroid/core/gui/lists/SimpleListItemAdapter.java
  30. 2
      app/src/main/java/org/transdroid/core/gui/lists/SimpleListItemSpinnerAdapter.java
  31. 1
      app/src/main/java/org/transdroid/core/gui/lists/SimpleListItemView.java
  32. 3
      app/src/main/java/org/transdroid/core/gui/lists/SortByListItem.java
  33. 2
      app/src/main/java/org/transdroid/core/gui/lists/TorrentDetailsView.java
  34. 1
      app/src/main/java/org/transdroid/core/gui/lists/TorrentFilePriorityLayout.java
  35. 1
      app/src/main/java/org/transdroid/core/gui/lists/TorrentFileView.java
  36. 2
      app/src/main/java/org/transdroid/core/gui/lists/TorrentStatusLayout.java
  37. 1
      app/src/main/java/org/transdroid/core/gui/lists/TorrentView.java
  38. 2
      app/src/main/java/org/transdroid/core/gui/lists/TorrentsAdapter.java
  39. 4
      app/src/main/java/org/transdroid/core/gui/lists/ViewHolderAdapter.java
  40. 3
      app/src/main/java/org/transdroid/core/gui/log/DatabaseHelper.java
  41. 1
      app/src/main/java/org/transdroid/core/gui/log/ErrorLogEntry.java
  42. 2
      app/src/main/java/org/transdroid/core/gui/log/ErrorLogSender.java
  43. 1
      app/src/main/java/org/transdroid/core/gui/log/Log.java
  44. 4
      app/src/main/java/org/transdroid/core/gui/navigation/DialogHelper.java
  45. 4
      app/src/main/java/org/transdroid/core/gui/navigation/FilterListAdapter.java
  46. 1
      app/src/main/java/org/transdroid/core/gui/navigation/FilterListItemAdapter.java
  47. 1
      app/src/main/java/org/transdroid/core/gui/navigation/FilterListItemView.java
  48. 2
      app/src/main/java/org/transdroid/core/gui/navigation/FilterSeparatorView.java
  49. 3
      app/src/main/java/org/transdroid/core/gui/navigation/Label.java
  50. 4
      app/src/main/java/org/transdroid/core/gui/navigation/NavigationFilter.java
  51. 12
      app/src/main/java/org/transdroid/core/gui/navigation/NavigationHelper.java
  52. 1
      app/src/main/java/org/transdroid/core/gui/navigation/RefreshableActivity.java
  53. 3
      app/src/main/java/org/transdroid/core/gui/navigation/SelectionManagerMode.java
  54. 10
      app/src/main/java/org/transdroid/core/gui/navigation/SelectionModificationSpinner.java
  55. 1
      app/src/main/java/org/transdroid/core/gui/navigation/SetLabelDialog.java
  56. 1
      app/src/main/java/org/transdroid/core/gui/navigation/SetStorageLocationDialog.java
  57. 1
      app/src/main/java/org/transdroid/core/gui/navigation/SetTrackersDialog.java
  58. 1
      app/src/main/java/org/transdroid/core/gui/navigation/SetTransferRatesDialog.java
  59. 5
      app/src/main/java/org/transdroid/core/gui/navigation/StatusType.java
  60. 5
      app/src/main/java/org/transdroid/core/gui/remoterss/RemoteRssFragment.java
  61. 1
      app/src/main/java/org/transdroid/core/gui/remoterss/RemoteRssItemView.java
  62. 3
      app/src/main/java/org/transdroid/core/gui/remoterss/RemoteRssItemsAdapter.java
  63. 24
      app/src/main/java/org/transdroid/core/gui/rss/RssFeedsActivity.java
  64. 2
      app/src/main/java/org/transdroid/core/gui/rss/RssFeedsFragment.java
  65. 1
      app/src/main/java/org/transdroid/core/gui/rss/RssItemsActivity.java
  66. 4
      app/src/main/java/org/transdroid/core/gui/rss/RssItemsFragment.java
  67. 1
      app/src/main/java/org/transdroid/core/gui/rss/RssfeedLoader.java
  68. 1
      app/src/main/java/org/transdroid/core/gui/rss/RssfeedView.java
  69. 2
      app/src/main/java/org/transdroid/core/gui/rss/RssfeedsAdapter.java
  70. 1
      app/src/main/java/org/transdroid/core/gui/rss/RssitemStatusLayout.java
  71. 1
      app/src/main/java/org/transdroid/core/gui/rss/RssitemView.java
  72. 2
      app/src/main/java/org/transdroid/core/gui/rss/RssitemsAdapter.java
  73. 2
      app/src/main/java/org/transdroid/core/gui/search/BarcodeHelper.java
  74. 1
      app/src/main/java/org/transdroid/core/gui/search/FilePickerHelper.java
  75. 4
      app/src/main/java/org/transdroid/core/gui/search/SearchActivity.java
  76. 1
      app/src/main/java/org/transdroid/core/gui/search/SearchHistoryProvider.java
  77. 1
      app/src/main/java/org/transdroid/core/gui/search/SearchResultView.java
  78. 2
      app/src/main/java/org/transdroid/core/gui/search/SearchResultsAdapter.java
  79. 3
      app/src/main/java/org/transdroid/core/gui/search/SearchResultsFragment.java
  80. 2
      app/src/main/java/org/transdroid/core/gui/search/SearchSetting.java
  81. 1
      app/src/main/java/org/transdroid/core/gui/search/SearchSettingSelectionView.java
  82. 1
      app/src/main/java/org/transdroid/core/gui/search/SearchSettingsDropDownAdapter.java
  83. 1
      app/src/main/java/org/transdroid/core/gui/search/SearchSiteView.java
  84. 2
      app/src/main/java/org/transdroid/core/gui/search/SearchSitesAdapter.java
  85. 2
      app/src/main/java/org/transdroid/core/gui/search/SendIntentHelper.java
  86. 1
      app/src/main/java/org/transdroid/core/gui/search/UrlEntryDialog.java
  87. 1
      app/src/main/java/org/transdroid/core/gui/settings/AboutDialog.java
  88. 1
      app/src/main/java/org/transdroid/core/gui/settings/ChangelogDialog.java
  89. 10
      app/src/main/java/org/transdroid/core/gui/settings/KeyBoundPreferencesActivity.java
  90. 2
      app/src/main/java/org/transdroid/core/gui/settings/MainSettingsActivity.java
  91. 2
      app/src/main/java/org/transdroid/core/gui/settings/PreferenceCompatActivity.java
  92. 2
      app/src/main/java/org/transdroid/core/gui/settings/RingtonePreference.java
  93. 3
      app/src/main/java/org/transdroid/core/gui/settings/RssfeedPreference.java
  94. 1
      app/src/main/java/org/transdroid/core/gui/settings/RssfeedSettingsActivity.java
  95. 3
      app/src/main/java/org/transdroid/core/gui/settings/ServerPreference.java
  96. 1
      app/src/main/java/org/transdroid/core/gui/settings/ServerSettingsActivity.java
  97. 3
      app/src/main/java/org/transdroid/core/gui/settings/WebsearchPreference.java
  98. 1
      app/src/main/java/org/transdroid/core/gui/settings/WebsearchSettingsActivity.java
  99. 2
      app/src/main/java/org/transdroid/core/rssparser/Item.java
  100. 5
      app/src/main/java/org/transdroid/core/rssparser/RssParser.java
  101. Some files were not shown because too many files have changed in this diff Show More

9
.editorconfig

@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
# editorconfig.org
root = true
[*]
charset = utf-8
end_of_line = lf
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

21
app/src/main/AndroidManifest.xml

@ -1,5 +1,4 @@ @@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
Copyright 2010-2018 Eric Kok et al.
Transdroid is free software: you can redistribute it and/or modify
@ -17,7 +16,7 @@ @@ -17,7 +16,7 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.transdroid" >
package="org.transdroid">
<uses-sdk />
@ -69,7 +68,7 @@ @@ -69,7 +68,7 @@
android:label="@string/app_name"
android:launchMode="singleTop"
android:theme="@style/TransdroidTheme"
android:windowSoftInputMode="stateHidden" >
android:windowSoftInputMode="stateHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@ -193,8 +192,7 @@ @@ -193,8 +192,7 @@
<activity
android:name="org.transdroid.core.gui.DetailsActivity_"
android:theme="@style/TransdroidTheme"
android:uiOptions="splitActionBarWhenNarrow" >
</activity>
android:uiOptions="splitActionBarWhenNarrow"></activity>
<!-- Settings screens -->
<activity
@ -245,7 +243,7 @@ @@ -245,7 +243,7 @@
android:icon="@drawable/ic_launcher"
android:label="@string/search_torrentsearch"
android:launchMode="singleTask"
android:theme="@style/TransdroidTheme" >
android:theme="@style/TransdroidTheme">
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
@ -283,7 +281,7 @@ @@ -283,7 +281,7 @@
android:label="@string/rss_feeds"
android:theme="@style/TransdroidTheme" />
<receiver android:name="org.transdroid.core.service.BootReceiver_" >
<receiver android:name="org.transdroid.core.service.BootReceiver_">
<intent-filter>
<action
android:name="android.intent.action.BOOT_COMPLETED"
@ -294,7 +292,7 @@ @@ -294,7 +292,7 @@
<service
android:name="org.transdroid.core.service.ControlService_"
android:exported="true"
tools:ignore="ExportedService" >
tools:ignore="ExportedService">
<intent-filter>
<action android:name="org.transdroid.control.SET_TRANSFER_RATES" />
<action android:name="org.transdroid.control.PAUSE_ALL" />
@ -307,7 +305,7 @@ @@ -307,7 +305,7 @@
<!-- Home screen widget -->
<activity
android:name="org.transdroid.core.widget.ListWidgetConfigActivity_"
android:theme="@style/TransdroidTheme.WidgetConfig" >
android:theme="@style/TransdroidTheme.WidgetConfig">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
</intent-filter>
@ -318,8 +316,7 @@ @@ -318,8 +316,7 @@
android:exported="false"
android:permission="android.permission.BIND_REMOTEVIEWS" />
<receiver
android:name="org.transdroid.core.widget.ListWidgetProvider_">
<receiver android:name="org.transdroid.core.widget.ListWidgetProvider_">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>

3
app/src/main/java/androidx/preference/PreferenceManagerBinder.java

@ -5,7 +5,8 @@ package androidx.preference; @@ -5,7 +5,8 @@ package androidx.preference;
* around the protected visibility of {@link Preference#onAttachedToHierarchy(PreferenceManager)}.
*/
public class PreferenceManagerBinder {
private PreferenceManagerBinder() {}
private PreferenceManagerBinder() {
}
public static void bind(Preference pref, PreferenceManager manager) {
pref.onAttachedToHierarchy(manager);

6
app/src/main/java/org/transdroid/core/app/search/SearchHelper.java

@ -59,6 +59,7 @@ public class SearchHelper { @@ -59,6 +59,7 @@ public class SearchHelper {
/**
* Return whether the Torrent Search package is installed and available to query against
*
* @return True if the available sites can be retrieved from the content provider, false otherwise
*/
public boolean isTorrentSearchInstalled() {
@ -67,6 +68,7 @@ public class SearchHelper { @@ -67,6 +68,7 @@ public class SearchHelper {
/**
* Queries the Torrent Search package for all available in-app search sites. This method is synchronous.
*
* @return A list of available search sites as POJOs, or null if the Torrent Search package is not installed
*/
public List<SearchSite> getAvailableSites() {
@ -103,6 +105,7 @@ public class SearchHelper { @@ -103,6 +105,7 @@ public class SearchHelper {
/**
* Queries the Torrent Search module to search for torrents on the web. This method is synchronous and should always
* be called in a background thread.
*
* @param query The search query to pass to the torrent site
* @param site The site to search, as retrieved from the TorrentSitesProvider, or null if the Torrent Search package
* @param sortBy The sort order to request from the torrent site, if supported
@ -118,7 +121,7 @@ public class SearchHelper { @@ -118,7 +121,7 @@ public class SearchHelper {
// If no explicit site was supplied, rely on the Torrent Search package's default
cursor = context.getContentResolver().query(uri, null, null, null, sortBy.name());
} else {
cursor = context.getContentResolver().query(uri, null, "SITE = ?", new String[] { site.getKey() },
cursor = context.getContentResolver().query(uri, null, "SITE = ?", new String[]{site.getKey()},
sortBy.name());
}
if (cursor == null) {
@ -148,6 +151,7 @@ public class SearchHelper { @@ -148,6 +151,7 @@ public class SearchHelper {
* Asks the Torrent Search module to download a torrent file given the provided url, while using the specifics of
* the supplied torrent search site to do so. This way the Search Module can take care of user credentials, for
* example.
*
* @param site The unique key of the search site that this url belongs to, which is used to create a connection
* specific to this (private) site
* @param url The full url of the torrent to download

1
app/src/main/java/org/transdroid/core/app/search/SearchResult.java

@ -23,6 +23,7 @@ import android.os.Parcelable; @@ -23,6 +23,7 @@ import android.os.Parcelable;
/**
* Represents a search result as retrieved by querying the Torrent Search package.
*
* @author Eric Kok
*/
public class SearchResult implements Parcelable {

1
app/src/main/java/org/transdroid/core/app/search/SearchSite.java

@ -21,6 +21,7 @@ import org.transdroid.core.gui.search.SearchSetting; @@ -21,6 +21,7 @@ import org.transdroid.core.gui.search.SearchSetting;
/**
* Represents an available torrent site that can be searched using the Torrent Search package.
*
* @author Eric Kok
*/
public class SearchSite implements SimpleListItem, SearchSetting {

40
app/src/main/java/org/transdroid/core/app/settings/ApplicationSettings.java

@ -49,6 +49,7 @@ import java.util.List; @@ -49,6 +49,7 @@ import java.util.List;
/**
* Singleton object to access all application settings, including stored servers, web search sites and RSS feeds.
*
* @author Eric Kok
*/
@EBean(scope = Scope.Singleton)
@ -69,6 +70,7 @@ public class ApplicationSettings { @@ -69,6 +70,7 @@ public class ApplicationSettings {
/**
* Returns all available user-configured normal and seed servers
*
* @return A list of all stored server settings objects
*/
public List<ServerSetting> getAllServerSettings() {
@ -82,6 +84,7 @@ public class ApplicationSettings { @@ -82,6 +84,7 @@ public class ApplicationSettings {
/**
* Returns the order number/identifying key of the last server, normal or seedbox configured
*
* @return The zero-based order number (index) of the last stored server settings
*/
public int getMaxOfAllServers() {
@ -95,6 +98,7 @@ public class ApplicationSettings { @@ -95,6 +98,7 @@ public class ApplicationSettings {
/**
* Returns the server settings for either a normal or a seedbox server as the user configured. WARNING: This method
* does not check if the settings actually exist and may reply on empty default if called for a non-existing server.
*
* @param order The order number/identifying key of the server's settings to retrieve, where the normal servers are
* first and the seedboxes are numbers thereafter onwards
* @return The server settings object, loaded from shared preferences
@ -116,6 +120,7 @@ public class ApplicationSettings { @@ -116,6 +120,7 @@ public class ApplicationSettings {
/**
* Returns all available normal, user-configured servers (so no seedbox settings)
*
* @return A list of all stored server settings objects
*/
public List<ServerSetting> getNormalServerSettings() {
@ -128,6 +133,7 @@ public class ApplicationSettings { @@ -128,6 +133,7 @@ public class ApplicationSettings {
/**
* Returns the order number/identifying key of the last normal server
*
* @return The zero-based order number (index) of the last stored normal server settings
*/
public int getMaxNormalServer() {
@ -140,6 +146,7 @@ public class ApplicationSettings { @@ -140,6 +146,7 @@ public class ApplicationSettings {
/**
* Returns the user-specified server settings for a normal (non-seedbox) server. WARNING: This method does not check
* if the settings actually exist and may rely on empty defaults if called for a non-existing server.
*
* @param order The order number/identifying key of the normal server's settings to retrieve
* @return The server settings object, loaded from shared preferences
*/
@ -198,6 +205,7 @@ public class ApplicationSettings { @@ -198,6 +205,7 @@ public class ApplicationSettings {
/**
* Removes all settings related to a configured server. Since servers are ordered, the order of the remaining
* servers will be updated accordingly.
*
* @param order The identifying order number/key of the settings to remove
*/
public void removeNormalServerSettings(int order) {
@ -275,6 +283,7 @@ public class ApplicationSettings { @@ -275,6 +283,7 @@ public class ApplicationSettings {
* specific default server was selected, the last used server settings. As opposed to getDefaultServerKey(int), this
* method checks whether the particular server still exists (and returns the first server if not). If no servers are
* configured, null is returned.
*
* @return A server settings object of the server to use by default, or null if no server is yet configured
*/
public ServerSetting getDefaultServer() {
@ -302,6 +311,7 @@ public class ApplicationSettings { @@ -302,6 +311,7 @@ public class ApplicationSettings {
* Returns the unique key of the server setting that the user selected as their default server, or code indicating
* that the last used server should be selected by default; use with getDefaultServer directly. WARNING: the
* returned string may no longer refer to a known server setting key.
*
* @return An integer; if it is 0 or higher it represents the unique key of a configured server setting, -2 means
* the last used server should be selected as default instead and -1 means the last used server should be
* selected by default for viewing yet it should always ask when adding a new torrent
@ -320,6 +330,7 @@ public class ApplicationSettings { @@ -320,6 +330,7 @@ public class ApplicationSettings {
* Returns the settings of the server that was last used by the user. As opposed to getLastUsedServerKey(int), this
* method checks whether a server was already registered as being last used and check whether the server still
* exists. It returns the first server if that fails. If no servers are configured, null is returned.
*
* @return A server settings object of the last used server (or, if not known, the first server), or null if no
* servers exist
*/
@ -341,6 +352,7 @@ public class ApplicationSettings { @@ -341,6 +352,7 @@ public class ApplicationSettings {
* Returns the order number/unique key of the server that the used last used; use with getServerSettings(int) or
* call getLastUsedServer directly. WARNING: the returned integer may no longer refer to a known server settings
* object: check the bounds.
*
* @return An integer indicating the order number/key or the last used server, or -1 if it was not set
*/
public int getLastUsedServerKey() {
@ -349,6 +361,7 @@ public class ApplicationSettings { @@ -349,6 +361,7 @@ public class ApplicationSettings {
/**
* Registers some server as being the last used by the user
*
* @param server The settings of the server that the user last used
*/
public void setLastUsedServer(ServerSetting server) {
@ -357,6 +370,7 @@ public class ApplicationSettings { @@ -357,6 +370,7 @@ public class ApplicationSettings {
/**
* Registers the order number/unique key of some server as being last used by the user
*
* @param order The key identifying the specific server
*/
public void setLastUsedServerKey(int order) {
@ -366,6 +380,7 @@ public class ApplicationSettings { @@ -366,6 +380,7 @@ public class ApplicationSettings {
/**
* Returns the unique code that (should) uniquely identify a navigation filter, such as a label, in the list of all
* available filters
*
* @return A code that the last used navigation filter reported as uniquely identifying itself, or null if no last
* used filter is known
*/
@ -375,6 +390,7 @@ public class ApplicationSettings { @@ -375,6 +390,7 @@ public class ApplicationSettings {
/**
* Registers some navigation filter as being the last used by the user
*
* @param filter The navigation filter that the user last used in the interface
*/
public void setLastUsedNavigationFilter(NavigationFilter filter) {
@ -383,6 +399,7 @@ public class ApplicationSettings { @@ -383,6 +399,7 @@ public class ApplicationSettings {
/**
* Returns all available user-configured web-based (as opped to in-app) search sites
*
* @return A list of all stored web search site settings objects
*/
public List<WebsearchSetting> getWebsearchSettings() {
@ -395,6 +412,7 @@ public class ApplicationSettings { @@ -395,6 +412,7 @@ public class ApplicationSettings {
/**
* Returns the order number/identifying key of the last web search site
*
* @return The zero-based order number (index) of the last stored web search site
*/
public int getMaxWebsearch() {
@ -406,6 +424,7 @@ public class ApplicationSettings { @@ -406,6 +424,7 @@ public class ApplicationSettings {
/**
* Returns the user-specified web-based search site setting for a specific site
*
* @param order The order number/identifying key of the settings to retrieve
* @return The web search site settings object, loaded from shared preferences
*/
@ -421,6 +440,7 @@ public class ApplicationSettings { @@ -421,6 +440,7 @@ public class ApplicationSettings {
/**
* Removes all settings related to a configured web-based search site. Since sites are ordered, the order of the
* remaining sites will be updated accordingly.
*
* @param order The identifying order number/key of the settings to remove
*/
public void removeWebsearchSettings(int order) {
@ -446,6 +466,7 @@ public class ApplicationSettings { @@ -446,6 +466,7 @@ public class ApplicationSettings {
/**
* Returns all available user-configured RSS feeds
*
* @return A list of all stored RSS feed settings objects
*/
public List<RssfeedSetting> getRssfeedSettings() {
@ -458,6 +479,7 @@ public class ApplicationSettings { @@ -458,6 +479,7 @@ public class ApplicationSettings {
/**
* Returns the order number/identifying key of the last stored RSS feed
*
* @return The zero-based order number (index) of the last stored RSS feed
*/
public int getMaxRssfeed() {
@ -469,6 +491,7 @@ public class ApplicationSettings { @@ -469,6 +491,7 @@ public class ApplicationSettings {
/**
* Returns the user-specified RSS feed setting for a specific feed
*
* @param order The order number/identifying key of the settings to retrieve
* @return The RSS feed settings object, loaded from shared preferences
*/
@ -490,6 +513,7 @@ public class ApplicationSettings { @@ -490,6 +513,7 @@ public class ApplicationSettings {
/**
* Removes all settings related to a configured RSS feed. Since feeds are ordered, the order of the remaining feeds
* will be updated accordingly.
*
* @param order The identifying order number/key of the settings to remove
*/
public void removeRssfeedSettings(int order) {
@ -528,6 +552,7 @@ public class ApplicationSettings { @@ -528,6 +552,7 @@ public class ApplicationSettings {
* the user. This is used to determine which items in an RSS feed are 'new'. Warning: any previously retrieved
* {@link RssfeedSetting} object is now no longer in sync, as this will not automatically be updated in the object.
* Use {@link #getRssfeedSetting(int)} to get fresh data.
*
* @param order The identifying order number/key of the settings of te RSS feed that was viewed
* @param lastViewed The date and time that the feed was last viewed; typically now
* @param lastViewedItemUrl The url of the last item the last time that the feed was viewed
@ -543,6 +568,7 @@ public class ApplicationSettings { @@ -543,6 +568,7 @@ public class ApplicationSettings {
/**
* Registers the torrents list sort order as being last used by the user
*
* @param currentSortOrder The sort order property the user selected last
* @param currentSortAscending The sort order direction that was last used
*/
@ -556,6 +582,7 @@ public class ApplicationSettings { @@ -556,6 +582,7 @@ public class ApplicationSettings {
/**
* Returns the sort order property that the user last used. Use together with {@link #getLastUsedSortDescending()}
* to get the full last used sort settings.
*
* @return The last used sort order enumeration value
*/
public TorrentsSortBy getLastUsedSortOrder() {
@ -565,6 +592,7 @@ public class ApplicationSettings { @@ -565,6 +592,7 @@ public class ApplicationSettings {
/**
* Registers the search list sort order as being last used by the user
*
* @param currentSortOrder The sort order property the user selected last
*/
public void setLastUsedSearchSortOrder(SearchSortOrder currentSortOrder) {
@ -575,6 +603,7 @@ public class ApplicationSettings { @@ -575,6 +603,7 @@ public class ApplicationSettings {
/**
* Returns the search sort order property that the user last used.
*
* @return The last used sort order enumeration value
*/
public SearchSortOrder getLastUsedSearchSortOrder() {
@ -584,6 +613,7 @@ public class ApplicationSettings { @@ -584,6 +613,7 @@ public class ApplicationSettings {
/**
* Returns the sort order direction that the user last used. Use together with {@link #getLastUsedSortOrder()} to
* get the full last used sort settings.
*
* @return True if the last used sort direction was descending, false otherwise (i.e. the default ascending
* direction)
*/
@ -593,6 +623,7 @@ public class ApplicationSettings { @@ -593,6 +623,7 @@ public class ApplicationSettings {
/**
* Returns the list of all available in-app search sites as well as all web searches that the user configured.
*
* @return A list of search settings, all of which are either a {@link SearchSite} or {@link WebsearchSetting}
*/
public List<SearchSetting> getSearchSettings() {
@ -607,6 +638,7 @@ public class ApplicationSettings { @@ -607,6 +638,7 @@ public class ApplicationSettings {
* site in the main settings. As opposed to getLastUsedSearchSiteKey(int), this method checks whether a site was
* already registered as being last used (or set as default) and checks whether the site still exists. It returns
* the first in-app search site if that fails.
*
* @return A site settings object of the last used server (or, if not known, the first server), or null if no
* servers exist
*/
@ -658,6 +690,7 @@ public class ApplicationSettings { @@ -658,6 +690,7 @@ public class ApplicationSettings {
* Returns the unique key of the site that the used last used or selected as default form the main settings; use
* with getLastUsedSearchSite directly. WARNING: the returned string may no longer refer to a known web search site
* or in-app search settings object.
*
* @return A string indicating the key of the last used search site, or null if no site was yet used or set as
* default
*/
@ -667,6 +700,7 @@ public class ApplicationSettings { @@ -667,6 +700,7 @@ public class ApplicationSettings {
/**
* Registers the unique key of some web search or in-app search site as being last used by the user
*
* @param site The site settings to register as being last used
*/
public void setLastUsedSearchSite(SearchSetting site) {
@ -675,6 +709,7 @@ public class ApplicationSettings { @@ -675,6 +709,7 @@ public class ApplicationSettings {
/**
* Returns the statistics of this server as it was last seen by the background server checker service.
*
* @param server The server for which to retrieved the statistics from the stored preferences
* @return A JSON array of JSON objects, each which represent a since torrent
*/
@ -692,6 +727,7 @@ public class ApplicationSettings { @@ -692,6 +727,7 @@ public class ApplicationSettings {
/**
* Stores the now-last seen statistics of the supplied server by the background server checker service to the
* internal stored preferences.
*
* @param server The server to which the statistics apply to
* @param lastStats A JSON array of JSON objects that each represent a single seen torrent
*/
@ -701,6 +737,7 @@ public class ApplicationSettings { @@ -701,6 +737,7 @@ public class ApplicationSettings {
/**
* Returns the user configuration for some specific app widget, if the widget is known at all.
*
* @param appWidgetId The unique ID of the app widget to retrieve settings for, as supplied by the AppWidgetManager
* @return A widget configuration object, or null if no settings were stored for the widget ID
*/
@ -720,6 +757,7 @@ public class ApplicationSettings { @@ -720,6 +757,7 @@ public class ApplicationSettings {
/**
* Stores the user settings for some specific app widget. Existing settings for the supplied app widget ID will be
* overridden.
*
* @param appWidgetId The unique ID of the app widget to store settings for, as supplied by the AppWidgetManager
* @param settings A widget configuration object, which may not be null
*/
@ -738,6 +776,7 @@ public class ApplicationSettings { @@ -738,6 +776,7 @@ public class ApplicationSettings {
/**
* Remove the setting for some specific app widget.
*
* @param appWidgetId The unique ID of the app widget to store settings for, as supplied by the AppWidgetManager
*/
public void removeWidgetConfig(int appWidgetId) {
@ -753,6 +792,7 @@ public class ApplicationSettings { @@ -753,6 +792,7 @@ public class ApplicationSettings {
/**
* Trims away whitespace around a string, or returns null if str is null
*
* @param str The string to trim, or null
* @return The trimmed string, or null if str is null
*/

8
app/src/main/java/org/transdroid/core/app/settings/NotificationSettings.java

@ -30,6 +30,7 @@ import org.transdroid.R; @@ -30,6 +30,7 @@ import org.transdroid.R;
/**
* Allows instantiation of the settings specified in R.xml.pref_notifications.
*
* @author Eric Kok
*/
@EBean(scope = Scope.Singleton)
@ -47,6 +48,7 @@ public class NotificationSettings { @@ -47,6 +48,7 @@ public class NotificationSettings {
/**
* Whether the background service is enabled and the user wants to receive RSS-related notifications
*
* @return True if the server should be checked for RSS feed updates
*/
public boolean isEnabledForRss() {
@ -55,6 +57,7 @@ public class NotificationSettings { @@ -55,6 +57,7 @@ public class NotificationSettings {
/**
* Whether the background service is enabled and the user wants to receive torrent-related notifications
*
* @return True if the server should be checked for torrent status updates
*/
public boolean isEnabledForTorrents() {
@ -67,6 +70,7 @@ public class NotificationSettings { @@ -67,6 +70,7 @@ public class NotificationSettings {
/**
* Returns the interval between two server checks
*
* @return The interval, in milliseconds
*/
public Long getInvervalInMilliseconds() {
@ -79,6 +83,7 @@ public class NotificationSettings { @@ -79,6 +83,7 @@ public class NotificationSettings {
/**
* Returns the sound (ring tone) to play on a new notification, or null if it should not play any
*
* @return Either the user-specified sound, null if the user specified 'Silent' or the system default notification sound
*/
public Uri getSound() {
@ -100,6 +105,7 @@ public class NotificationSettings { @@ -100,6 +105,7 @@ public class NotificationSettings {
/**
* Returns the default vibrate pattern to use if the user enabled notification vibrations; check
* {@link #shouldVibrate()},
*
* @return A unique pattern for vibrations in Transdroid
*/
public long[] getDefaultVibratePattern() {
@ -112,6 +118,7 @@ public class NotificationSettings { @@ -112,6 +118,7 @@ public class NotificationSettings {
/**
* Returns the LED colour to use on a new notification
*
* @return The integer value of the user-specified or default colour
*/
public int getDesiredLedColour() {
@ -123,6 +130,7 @@ public class NotificationSettings { @@ -123,6 +130,7 @@ public class NotificationSettings {
/**
* Whether the background service should report to ADW Launcher
*
* @return True if the user want Transdroid to report to ADW Launcher
*/
public boolean shouldReportToAdwLauncher() {

4
app/src/main/java/org/transdroid/core/app/settings/RssfeedSetting.java

@ -25,6 +25,7 @@ import android.text.TextUtils; @@ -25,6 +25,7 @@ import android.text.TextUtils;
/**
* Represents a user-specified RSS feed.
*
* @author Eric Kok
*/
public class RssfeedSetting implements SimpleListItem {
@ -93,6 +94,7 @@ public class RssfeedSetting implements SimpleListItem { @@ -93,6 +94,7 @@ public class RssfeedSetting implements SimpleListItem {
* Returns the date on which we last checked this feed. Note that this is NOT updated automatically after the
* settings were loaded from {@link ApplicationSettings}; instead the settings have to be manually loaded again
* using {@link ApplicationSettings#getRssfeedSetting(int)}.
*
* @return The last new item's URL as URL-encoded string
*/
public Date getLastViewed() {
@ -103,6 +105,7 @@ public class RssfeedSetting implements SimpleListItem { @@ -103,6 +105,7 @@ public class RssfeedSetting implements SimpleListItem {
* Returns the URL of the item that was the newest last time we checked this feed. Note that this is NOT updated
* automatically after the settings were loaded from {@link ApplicationSettings}; instead the settings have to be
* manually loaded again using {@link ApplicationSettings#getRssfeedSetting(int)}.
*
* @return The last new item's URL as URL-encoded string
*/
public String getLastViewedItemUrl() {
@ -111,6 +114,7 @@ public class RssfeedSetting implements SimpleListItem { @@ -111,6 +114,7 @@ public class RssfeedSetting implements SimpleListItem {
/**
* Returns a nicely formatted identifier containing (a portion of) the feed URL
*
* @return A string to identify this feed's URL
*/
public String getHumanReadableIdentifier() {

6
app/src/main/java/org/transdroid/core/app/settings/ServerSetting.java

@ -29,6 +29,7 @@ import org.transdroid.daemon.OS; @@ -29,6 +29,7 @@ import org.transdroid.daemon.OS;
/**
* Represents a user-configured remote server.
*
* @author Eric Kok
*/
public class ServerSetting implements SimpleListItem {
@ -65,6 +66,7 @@ public class ServerSetting implements SimpleListItem { @@ -65,6 +66,7 @@ public class ServerSetting implements SimpleListItem {
/**
* Creates a daemon settings instance, providing full connection details
*
* @param name A name used to identify this server to the user
* @param type The server daemon type
* @param address The server domain name or IP address
@ -235,6 +237,7 @@ public class ServerSetting implements SimpleListItem { @@ -235,6 +237,7 @@ public class ServerSetting implements SimpleListItem {
/**
* Returns a string that the user can use to identify the server by internal settings (rather than the name).
*
* @return A human-readable identifier in the form [https://]username@address:port/folder
*/
public String getHumanReadableIdentifier() {
@ -253,6 +256,7 @@ public class ServerSetting implements SimpleListItem { @@ -253,6 +256,7 @@ public class ServerSetting implements SimpleListItem {
* Returns a string that acts as a unique identifier for this server, non-depending on the internal storage
* order/index. THis may be used to store additional details about this server elsewhere. It may change if the user
* changes server settings, but not with name or notification settings.
*
* @return A unique identifying string, based primarily on the configured address, port number, SSL settings and
* user name; returns null if the server is not yet fully identifiable (during configuration, for example)
*/
@ -284,6 +288,7 @@ public class ServerSetting implements SimpleListItem { @@ -284,6 +288,7 @@ public class ServerSetting implements SimpleListItem {
/**
* Returns the appropriate daemon adapter to which tasks can be executed, in accordance with this server's settings
*
* @param connectedToNetwork The name of the (wifi) network we are currently connected to, or null if this could not
* be determined
* @param context A context to access the logger
@ -295,6 +300,7 @@ public class ServerSetting implements SimpleListItem { @@ -295,6 +300,7 @@ public class ServerSetting implements SimpleListItem {
/**
* Converts local server settings into an old-style {@link DaemonSettings} object.
*
* @param connectedToNetwork The name of the (wifi) network we are currently connected to, or null if this could not
* be determined
* @param caller A context to access the logger

5
app/src/main/java/org/transdroid/core/app/settings/SettingsPersistence.java

@ -56,6 +56,7 @@ public class SettingsPersistence { @@ -56,6 +56,7 @@ public class SettingsPersistence {
/**
* Reads the server, web searches, RSS feed, background service and system settings from a JSON-encoded String, such as when read via a QR code.
*
* @param prefs The application-global preferences object to write settings to
* @param contents The JSON-encoded settings as raw String
* @throws JSONException Thrown when the file did not contain valid JSON content
@ -67,6 +68,7 @@ public class SettingsPersistence { @@ -67,6 +68,7 @@ public class SettingsPersistence {
/**
* Synchronously reads the server, web searches, RSS feed, background service and system settings from a file in
* JSON format.
*
* @param prefs The application-global preferences object to write settings to
* @param settingsFile The local file to read the settings from
* @throws FileNotFoundException Thrown when the settings file doesn't exist or couldn't be read
@ -79,6 +81,7 @@ public class SettingsPersistence { @@ -79,6 +81,7 @@ public class SettingsPersistence {
/**
* Synchronously reads the server, web searches, RSS feed, background service and system settings from a stream (file) in
* JSON format.
*
* @param prefs The application-global preferences object to write settings to
* @param settingsStream The stream to read the settings from
* @throws JSONException Thrown when the file did not contain valid JSON content
@ -229,6 +232,7 @@ public class SettingsPersistence { @@ -229,6 +232,7 @@ public class SettingsPersistence {
/**
* Returns encoded server, web searches, RSS feed, background service and system settings as a JSON data object structure, serialized to a String.
*
* @param prefs The application-global preferences object to read settings from
* @throws JSONException Thrown when the JSON content could not be constructed properly
*/
@ -239,6 +243,7 @@ public class SettingsPersistence { @@ -239,6 +243,7 @@ public class SettingsPersistence {
/**
* Synchronously writes the server, web searches, RSS feed, background service and system settings to a file in JSON
* format.
*
* @param prefs The application-global preferences object to read settings from
* @param settingsFile The local file to read the settings from
* @throws JSONException Thrown when the JSON content could not be constructed properly

3
app/src/main/java/org/transdroid/core/app/settings/SettingsUtils.java

@ -2,6 +2,7 @@ package org.transdroid.core.app.settings; @@ -2,6 +2,7 @@ package org.transdroid.core.app.settings;
import android.content.Context;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
@ -33,6 +34,6 @@ public class SettingsUtils { @@ -33,6 +34,6 @@ public class SettingsUtils {
return builder;
}
return builder.theme(settings.useDarkTheme() ? Theme.DARK: Theme.LIGHT);
return builder.theme(settings.useDarkTheme() ? Theme.DARK : Theme.LIGHT);
}
}

4
app/src/main/java/org/transdroid/core/app/settings/SystemSettings.java

@ -29,6 +29,7 @@ import java.util.Date; @@ -29,6 +29,7 @@ import java.util.Date;
/**
* Allows instantiation of the settings specified in R.xml.pref_system.
*
* @author Eric Kok
*/
@EBean(scope = Scope.Singleton)
@ -48,6 +49,7 @@ public class SystemSettings { @@ -48,6 +49,7 @@ public class SystemSettings {
/**
* Returns the interval in which automatic screen refreshes should be scheduled.
*
* @return The selected refresh interval in milliseconds or 0 if automatic refreshes should be disabled
*/
public long getRefreshIntervalMilliseconds() {
@ -68,6 +70,7 @@ public class SystemSettings { @@ -68,6 +70,7 @@ public class SystemSettings {
/**
* Returns the date when we last checked transdroid.org for the latest app version.
*
* @return The date/time when the {@link org.transdroid.core.service.AppUpdateJob} checked on the server for updates
*/
public Date getLastCheckedForAppUpdates() {
@ -77,6 +80,7 @@ public class SystemSettings { @@ -77,6 +80,7 @@ public class SystemSettings {
/**
* Stores the date at which was last successfully, fully checked for new updates to the app.
*
* @param lastChecked The date/time at which the {@link org.transdroid.core.service.AppUpdateJob} last checked the server for updates
*/
public void setLastCheckedForAppUpdates(Date lastChecked) {

4
app/src/main/java/org/transdroid/core/app/settings/WebsearchSetting.java

@ -24,6 +24,7 @@ import android.text.TextUtils; @@ -24,6 +24,7 @@ import android.text.TextUtils;
/**
* Represents a user-specified website that can be searched (by starting the browser, rather than in-app)
*
* @author Eric Kok
*/
public class WebsearchSetting implements SimpleListItem, SearchSetting {
@ -53,7 +54,7 @@ public class WebsearchSetting implements SimpleListItem, SearchSetting { @@ -53,7 +54,7 @@ public class WebsearchSetting implements SimpleListItem, SearchSetting {
return name;
if (!TextUtils.isEmpty(baseUrl)) {
String host = Uri.parse(baseUrl).getHost();
return host == null? DEFAULT_NAME: host;
return host == null ? DEFAULT_NAME : host;
}
return DEFAULT_NAME;
}
@ -72,6 +73,7 @@ public class WebsearchSetting implements SimpleListItem, SearchSetting { @@ -72,6 +73,7 @@ public class WebsearchSetting implements SimpleListItem, SearchSetting {
/**
* Returns a nicely formatted identifier containing (a portion of) the search base URL
*
* @return A string to identify this site's search URL
*/
public String getHumanReadableIdentifier() {

2
app/src/main/java/org/transdroid/core/gui/DetailsActivity.java

@ -20,6 +20,7 @@ import android.annotation.TargetApi; @@ -20,6 +20,7 @@ import android.annotation.TargetApi;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
@ -82,6 +83,7 @@ import java.util.List; @@ -82,6 +83,7 @@ import java.util.List;
* An activity that holds a single torrents details fragment. It is used on devices (i.e. phones) where there is no room to show details in the {@link
* TorrentsActivity} directly. Task execution, such as loading of more details and updating file priorities, is performed in this activity via
* background methods.
*
* @author Eric Kok
*/
@EActivity(R.layout.activity_details)

10
app/src/main/java/org/transdroid/core/gui/DetailsFragment.java

@ -23,9 +23,11 @@ import android.content.ClipboardManager; @@ -23,9 +23,11 @@ import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.ActionMenuView;
import android.view.ActionMode;
import android.view.Menu;
import android.view.MenuItem;
@ -75,6 +77,7 @@ import java.util.List; @@ -75,6 +77,7 @@ import java.util.List;
* Fragment that shows detailed statistics about some torrent. These come from some already fetched {@link Torrent} object, but it also retrieves
* further detailed statistics. The actual execution of tasks is performed by the activity that contains this fragment, as per the {@link
* TorrentTasksExecutor} interface.
*
* @author Eric Kok
*/
@EFragment(R.layout.fragment_details)
@ -161,6 +164,7 @@ public class DetailsFragment extends Fragment implements OnTrackersUpdatedListen @@ -161,6 +164,7 @@ public class DetailsFragment extends Fragment implements OnTrackersUpdatedListen
/**
* Updates the details adapter header to show the new torrent data.
*
* @param newTorrent The new, non-null torrent object
*/
public void updateTorrent(Torrent newTorrent) {
@ -186,6 +190,7 @@ public class DetailsFragment extends Fragment implements OnTrackersUpdatedListen @@ -186,6 +190,7 @@ public class DetailsFragment extends Fragment implements OnTrackersUpdatedListen
/**
* Updates the details adapter to show the list of trackers and tracker errors.
*
* @param checkTorrent The torrent for which the details were retrieved
* @param newTorrentDetails The new fine details object of some torrent
*/
@ -205,6 +210,7 @@ public class DetailsFragment extends Fragment implements OnTrackersUpdatedListen @@ -205,6 +210,7 @@ public class DetailsFragment extends Fragment implements OnTrackersUpdatedListen
/**
* Updates the list adapter to show a new list of torrent files, replacing the old files list.
*
* @param checkTorrent The torrent for which the details were retrieved
* @param newTorrentFiles The new, updated list of torrent file objects
*/
@ -220,6 +226,7 @@ public class DetailsFragment extends Fragment implements OnTrackersUpdatedListen @@ -220,6 +226,7 @@ public class DetailsFragment extends Fragment implements OnTrackersUpdatedListen
/**
* Can be called if some outside activity returned new torrents, so we can perhaps piggyback on this by update our data as well.
*
* @param torrents The last of retrieved torrents
*/
public void perhapsUpdateTorrent(List<Torrent> torrents) {
@ -239,6 +246,7 @@ public class DetailsFragment extends Fragment implements OnTrackersUpdatedListen @@ -239,6 +246,7 @@ public class DetailsFragment extends Fragment implements OnTrackersUpdatedListen
/**
* Updates the locally maintained list of labels that are active on the server. Used in the label picking dialog and should be updated every time
* after the list of torrents was retrieved to keep it updated.
*
* @param currentLabels The list of known server labels
*/
public void updateLabels(ArrayList<Label> currentLabels) {
@ -261,6 +269,7 @@ public class DetailsFragment extends Fragment implements OnTrackersUpdatedListen @@ -261,6 +269,7 @@ public class DetailsFragment extends Fragment implements OnTrackersUpdatedListen
/**
* Updates the shown screen depending on whether the torrent is loading
*
* @param isLoading True if the torrent is (re)loading, false otherwise
* @param connectionErrorMessage The error message text to show to the user, or null if there was no error
*/
@ -680,6 +689,7 @@ public class DetailsFragment extends Fragment implements OnTrackersUpdatedListen @@ -680,6 +689,7 @@ public class DetailsFragment extends Fragment implements OnTrackersUpdatedListen
/**
* Returns the object responsible for executing torrent tasks against a connected server
*
* @return The executor for tasks on some torrent
*/
private TorrentTasksExecutor getTasksExecutor() {

2
app/src/main/java/org/transdroid/core/gui/ServerPickerDialog.java

@ -21,6 +21,7 @@ import java.util.List; @@ -21,6 +21,7 @@ import java.util.List;
import android.app.Dialog;
import android.app.DialogFragment;
import android.os.Bundle;
import org.transdroid.R;
import org.transdroid.core.app.settings.ServerSetting;
@ -46,6 +47,7 @@ public class ServerPickerDialog extends DialogFragment { @@ -46,6 +47,7 @@ public class ServerPickerDialog extends DialogFragment {
/**
* Opens a dialog that allows the selection of a configured server (manual or seedbox). The calling activity will
* receive a callback on its switchServerAndAddFromIntent(int) method.
*
* @param activity The torrents activity from which the picker is started (and which received the callback)
* @param serverSettings The list of all available servers, of which their names will be offered to the user to pick
* from (and its position in the list is returned to the activity)

2
app/src/main/java/org/transdroid/core/gui/ServerSelectionView.java

@ -42,6 +42,7 @@ public class ServerSelectionView extends RelativeLayout { @@ -42,6 +42,7 @@ public class ServerSelectionView extends RelativeLayout {
/**
* Updates the name of the current connected server.
*
* @param currentServer The server currently connected to
*/
public void updateCurrentServer(IDaemonAdapter currentServer) {
@ -50,6 +51,7 @@ public class ServerSelectionView extends RelativeLayout { @@ -50,6 +51,7 @@ public class ServerSelectionView extends RelativeLayout {
/**
* Updates the name of the selected filter.
*
* @param currentFilter The filter that is currently selected
*/
public void updateCurrentFilter(NavigationFilter currentFilter) {

1
app/src/main/java/org/transdroid/core/gui/ServerStatusView.java

@ -54,6 +54,7 @@ public class ServerStatusView extends RelativeLayout implements OnRatesPickedLis @@ -54,6 +54,7 @@ public class ServerStatusView extends RelativeLayout implements OnRatesPickedLis
/**
* Updates the statistics as shown in the action bar through this server status view.
*
* @param torrents The most recently received list of torrents
* @param dormantAsInactive Whether to treat dormant (0KB/s) torrent as inactive state torrents
* @param supportsSetTransferRates Whether the connected torrent client supports setting of max transfer speeds

1
app/src/main/java/org/transdroid/core/gui/TorrentTasksExecutor.java

@ -27,6 +27,7 @@ import java.util.List; @@ -27,6 +27,7 @@ import java.util.List;
/**
* Interface to be implemented by any activity that wants containing fragments to be able to load data and execute commands against a torrent server.
*
* @author Eric Kok
*/
public interface TorrentTasksExecutor {

7
app/src/main/java/org/transdroid/core/gui/TorrentsActivity.java

@ -24,6 +24,7 @@ import android.net.Uri; @@ -24,6 +24,7 @@ import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.core.view.MenuItemCompat;
import androidx.drawerlayout.widget.DrawerLayout;
@ -32,6 +33,7 @@ import androidx.appcompat.app.AppCompatActivity; @@ -32,6 +33,7 @@ import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.ActionMenuView;
import androidx.appcompat.widget.SearchView;
import androidx.appcompat.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
@ -142,6 +144,7 @@ import java.util.Map.Entry; @@ -142,6 +144,7 @@ import java.util.Map.Entry;
* Main activity that holds the fragment that shows the torrents list, presents a way to filter the list (via an action bar spinner or list side list)
* and potentially shows a torrent details fragment too, if there is room. Task execution such as loading of and adding torrents is performs in this
* activity, using background methods. Finally, the activity offers navigation elements such as access to settings and showing connection issues.
*
* @author Eric Kok
*/
@EActivity(R.layout.activity_torrents)
@ -537,6 +540,7 @@ public class TorrentsActivity extends AppCompatActivity implements TorrentTasksE @@ -537,6 +540,7 @@ public class TorrentsActivity extends AppCompatActivity implements TorrentTasksE
/**
* A new filter was selected; update the view over the current data
*
* @param item The touched filter item
* @param forceNewConnection Whether a new connection should be initialised regardless of the old server selection
*/
@ -596,6 +600,7 @@ public class TorrentsActivity extends AppCompatActivity implements TorrentTasksE @@ -596,6 +600,7 @@ public class TorrentsActivity extends AppCompatActivity implements TorrentTasksE
/**
* Hides the filter list and details fragment's full view if there is no configured connection
*
* @param hasServerSettings Whether there are server settings available, so we can continue to connect
*/
private void updateFragmentVisibility(boolean hasServerSettings) {
@ -885,6 +890,7 @@ public class TorrentsActivity extends AppCompatActivity implements TorrentTasksE @@ -885,6 +890,7 @@ public class TorrentsActivity extends AppCompatActivity implements TorrentTasksE
/**
* Redirect the newly entered list filter to the torrents fragment.
*
* @param newFilterText The newly entered filter (or empty to clear the current filter).
*/
public void filterTorrents(String newFilterText) {
@ -894,6 +900,7 @@ public class TorrentsActivity extends AppCompatActivity implements TorrentTasksE @@ -894,6 +900,7 @@ public class TorrentsActivity extends AppCompatActivity implements TorrentTasksE
/**
* Shows the a details fragment for the given torrent, either in the dedicated details fragment pane, in the same pane as the torrent list was
* displayed or by starting a details activity.
*
* @param torrent The torrent to show detailed statistics for
*/
public void openDetails(Torrent torrent) {

12
app/src/main/java/org/transdroid/core/gui/TorrentsFragment.java

@ -18,10 +18,12 @@ package org.transdroid.core.gui; @@ -18,10 +18,12 @@ package org.transdroid.core.gui;
import android.app.Fragment;
import android.content.Context;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.ActionMenuView;
import androidx.appcompat.widget.Toolbar;
import android.view.ActionMode;
import android.view.Menu;
import android.view.MenuItem;
@ -64,6 +66,7 @@ import java.util.Locale; @@ -64,6 +66,7 @@ import java.util.Locale;
/**
* Fragment that shows a list of torrents that are active on the server. It supports sorting and filtering and can show connection progress and
* issues. However, actual task starting and execution and overall navigation elements are part of the containing activity, not this fragment.
*
* @author Eric Kok
*/
@EFragment(R.layout.fragment_torrents)
@ -141,6 +144,7 @@ public class TorrentsFragment extends Fragment implements OnLabelPickedListener @@ -141,6 +144,7 @@ public class TorrentsFragment extends Fragment implements OnLabelPickedListener
/**
* 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
*/
public void updateTorrents(ArrayList<Torrent> newTorrents, ArrayList<Label> currentLabels) {
@ -155,6 +159,7 @@ public class TorrentsFragment extends Fragment implements OnLabelPickedListener @@ -155,6 +159,7 @@ public class TorrentsFragment extends Fragment implements OnLabelPickedListener
/**
* Just look for a specific torrent in the currently shown list (by its unique id) and update only this
*
* @param affected The affected torrent to update
* @param wasRemoved Whether the affected torrent was indeed removed; otherwise it was updated somehow
*/
@ -182,6 +187,7 @@ public class TorrentsFragment extends Fragment implements OnLabelPickedListener @@ -182,6 +187,7 @@ public class TorrentsFragment extends Fragment implements OnLabelPickedListener
/**
* Clears the currently visible list of torrents.
*
* @param clearError Also clear any error message
* @param clearFilter Also clear any selected filter
*/
@ -200,6 +206,7 @@ public class TorrentsFragment extends Fragment implements OnLabelPickedListener @@ -200,6 +206,7 @@ public class TorrentsFragment extends Fragment implements OnLabelPickedListener
/**
* Stores the new sort order (for future refreshes) and sorts the current visible list. If the given new sort property equals the existing
* property, the list sort order is reversed instead.
*
* @param newSortOrder The sort order that the user selected.
*/
public void sortBy(TorrentsSortBy newSortOrder) {
@ -222,6 +229,7 @@ public class TorrentsFragment extends Fragment implements OnLabelPickedListener @@ -222,6 +229,7 @@ public class TorrentsFragment extends Fragment implements OnLabelPickedListener
/**
* Apply a filter on the current list of all torrents, showing the appropriate sublist of torrents only
*
* @param newFilter The new filter to apply to the local list of torrents
*/
public void applyNavigationFilter(NavigationFilter newFilter) {
@ -425,6 +433,7 @@ public class TorrentsFragment extends Fragment implements OnLabelPickedListener @@ -425,6 +433,7 @@ public class TorrentsFragment extends Fragment implements OnLabelPickedListener
/**
* 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). This should only ever be called on the UI thread.
*
* @param hasAConnection True if the user has servers configured and therefore has a connection that can be used
*/
public void updateConnectionStatus(boolean hasAConnection, Daemon daemonType) {
@ -446,6 +455,7 @@ public class TorrentsFragment extends Fragment implements OnLabelPickedListener @@ -446,6 +455,7 @@ public class TorrentsFragment extends Fragment implements OnLabelPickedListener
/**
* Updates the shown screen depending on whether the torrents are loading. This should only ever be called on the UI thread.
*
* @param isLoading True if the list of torrents is (re)loading, false otherwise
*/
public void updateIsLoading(boolean isLoading) {
@ -460,6 +470,7 @@ public class TorrentsFragment extends Fragment implements OnLabelPickedListener @@ -460,6 +470,7 @@ public class TorrentsFragment extends Fragment implements OnLabelPickedListener
/**
* Updates the shown screen depending on whether a connection error occurred. This should only ever be called on the UI thread.
*
* @param connectionErrorMessage The error message from the last failed connection attempt, or null to clear the visible error text
*/
public void updateError(String connectionErrorMessage) {
@ -489,6 +500,7 @@ public class TorrentsFragment extends Fragment implements OnLabelPickedListener @@ -489,6 +500,7 @@ public class TorrentsFragment extends Fragment implements OnLabelPickedListener
/**
* Returns the object responsible for executing torrent tasks against a connected server
*
* @return The executor for tasks on some torrent
*/
private TorrentTasksExecutor getTasksExecutor() {

3
app/src/main/java/org/transdroid/core/gui/TransdroidApp.java

@ -17,11 +17,14 @@ @@ -17,11 +17,14 @@
package org.transdroid.core.gui;
import android.app.Application;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.evernote.android.job.JobConfig;
import com.evernote.android.job.JobManager;
import com.evernote.android.job.util.JobLogger;
import org.androidannotations.annotations.Bean;
import org.androidannotations.annotations.EApplication;
import org.transdroid.core.gui.log.Log;

6
app/src/main/java/org/transdroid/core/gui/lists/DetailsAdapter.java

@ -33,6 +33,7 @@ import android.widget.BaseAdapter; @@ -33,6 +33,7 @@ import android.widget.BaseAdapter;
/**
* List adapter that holds a header view showing torrent details and show the list list contained by the torrent.
*
* @author Eric Kok
*/
public class DetailsAdapter extends MergeAdapter {
@ -104,6 +105,7 @@ public class DetailsAdapter extends MergeAdapter { @@ -104,6 +105,7 @@ public class DetailsAdapter extends MergeAdapter {
/**
* 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) {
@ -113,6 +115,7 @@ public class DetailsAdapter extends MergeAdapter { @@ -113,6 +115,7 @@ public class DetailsAdapter extends MergeAdapter {
/**
* Update the list of files contained in this torrent
*
* @param torrentFiles The new list of files, or null if the list and header should be hidden
*/
public void updateTorrentFiles(List<TorrentFile> torrentFiles) {
@ -127,6 +130,7 @@ public class DetailsAdapter extends MergeAdapter { @@ -127,6 +130,7 @@ public class DetailsAdapter extends MergeAdapter {
/**
* Update the list of trackers
*
* @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) {
@ -141,6 +145,7 @@ public class DetailsAdapter extends MergeAdapter { @@ -141,6 +145,7 @@ public class DetailsAdapter extends MergeAdapter {
/**
* Update the list of errors
*
* @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) {
@ -191,6 +196,7 @@ public class DetailsAdapter extends MergeAdapter { @@ -191,6 +196,7 @@ public class DetailsAdapter extends MergeAdapter {
/**
* Allows updating of the full data list underlying this adapter, replacing all items
*
* @param newItems The new list of files to display
*/
public void update(List<TorrentFile> newItems) {

9
app/src/main/java/org/transdroid/core/gui/lists/LocalTorrent.java

@ -30,12 +30,14 @@ import android.content.res.Resources; @@ -30,12 +30,14 @@ import android.content.res.Resources;
/**
* Wrapper around Torrent to provide some addition getters that give translatable or otherwise formatted Strings of
* torrent statistics.
*
* @author Eric Kok
*/
public class LocalTorrent {
/**
* Creates the LocalTorrent object so that the translatable/formattable version of a Torrent can be used.
*
* @param torrent The Torrent object
* @return The torrent wrapped as LocalTorrent object
*/
@ -56,6 +58,7 @@ public class LocalTorrent { @@ -56,6 +58,7 @@ public class LocalTorrent {
* Builds a string showing the upload/download seed ratio. If not downloading, it will base the ratio on the total
* size; so if you created the torrent yourself you will have downloaded 0 bytes, but the ratio will pretend you
* have 100%.
*
* @return A nicely formatted string containing the upload/download seed ratio
*/
public String getRatioString() {
@ -74,6 +77,7 @@ public class LocalTorrent { @@ -74,6 +77,7 @@ public class LocalTorrent {
/**
* Returns a formatted string indicating the current progress in terms of transferred bytes
*
* @param r The context resources, to access translations
* @param withAvailability Whether to show file availability in-line
* @return A nicely formatted string indicating torrent status and, if applicable, progress in bytes
@ -111,6 +115,7 @@ public class LocalTorrent { @@ -111,6 +115,7 @@ public class LocalTorrent {
/**
* Returns a formatted string indicating either the expected time to download (ETA) or, when seeding, the ratio
*
* @param r The context resources, to access translations
* @return A string like '~ 34 seconds', or 'RATIO 8.2' or an empty string
*/
@ -134,6 +139,7 @@ public class LocalTorrent { @@ -134,6 +139,7 @@ public class LocalTorrent {
/**
* Returns a formatted string indicating the torrent status and connected peers
*
* @param r The context resources, to access translations
* @return A string like 'Queued' or, when seeding or leeching, '2 OF 28 PEERS'
*/
@ -162,6 +168,7 @@ public class LocalTorrent { @@ -162,6 +168,7 @@ public class LocalTorrent {
/**
* Returns a formatted string indicating current transfer speeds for the torrent
*
* @param r The context resources, to access translations
* @return A string like ' 28KB/s 1.8MB/s', or an empty string when not transferrring
*/
@ -210,6 +217,7 @@ public class LocalTorrent { @@ -210,6 +217,7 @@ public class LocalTorrent {
/**
* Returns a formatted string indicating the remaining download time
*
* @param r The context resources, to access translations
* @param inDays Whether to show days or use hours for > 24 hours left instead
* @return A string like '4d 8h 34m 5s' or '2m 3s'
@ -224,6 +232,7 @@ public class LocalTorrent { @@ -224,6 +232,7 @@ public class LocalTorrent {
/**
* Convert a DaemonException to a translatable human-readable error message
*
* @param e The exception that was thrown by the server
* @return A string resource ID to show to the user
*/

8
app/src/main/java/org/transdroid/core/gui/lists/MergeAdapter.java

@ -31,6 +31,7 @@ import android.widget.TextView; @@ -31,6 +31,7 @@ import android.widget.TextView;
* An adapter that can contain many other adapters and shows them in sequence. Taken from
* http://stackoverflow.com/questions/7964259/android-attaching-multiple-adapters-to-one-adapter and based on the Apache
* 2-licensed CommonsWare MergeAdapter.
*
* @author Eric Kok
* @author Alex Amiryan
* @author Mark Murphy
@ -49,6 +50,7 @@ public class MergeAdapter extends BaseAdapter implements SectionIndexer { @@ -49,6 +50,7 @@ public class MergeAdapter extends BaseAdapter implements SectionIndexer {
/**
* Adds a new adapter to the roster of things to appear in the aggregate list.
*
* @param adapter Source for row views for this section
*/
public void addAdapter(ListAdapter adapter) {
@ -58,6 +60,7 @@ public class MergeAdapter extends BaseAdapter implements SectionIndexer { @@ -58,6 +60,7 @@ public class MergeAdapter extends BaseAdapter implements SectionIndexer {
/**
* Get the data item associated with the specified position in the data set.
*
* @param position Position of the item whose data we want
*/
public Object getItem(int position) {
@ -80,6 +83,7 @@ public class MergeAdapter extends BaseAdapter implements SectionIndexer { @@ -80,6 +83,7 @@ public class MergeAdapter extends BaseAdapter implements SectionIndexer {
/**
* Get the adapter associated with the specified position in the data set.
*
* @param position Position of the item whose adapter we want
*/
public ListAdapter getAdapter(int position) {
@ -130,6 +134,7 @@ public class MergeAdapter extends BaseAdapter implements SectionIndexer { @@ -130,6 +134,7 @@ public class MergeAdapter extends BaseAdapter implements SectionIndexer {
/**
* Get the type of {@link View} that will be created by {@link #getView(int, View, ViewGroup)} for the specified item.
*
* @param position Position of the item whose data we want
*/
@Override
@ -162,6 +167,7 @@ public class MergeAdapter extends BaseAdapter implements SectionIndexer { @@ -162,6 +167,7 @@ public class MergeAdapter extends BaseAdapter implements SectionIndexer {
/**
* Returns true if the item at the specified position is not a separator.
*
* @param position Position of the item whose data we want
*/
@Override
@ -181,6 +187,7 @@ public class MergeAdapter extends BaseAdapter implements SectionIndexer { @@ -181,6 +187,7 @@ public class MergeAdapter extends BaseAdapter implements SectionIndexer {
/**
* Get a {@link View} that displays the data at the specified position in the data set.
*
* @param position Position of the item whose data we want
* @param convertView View to recycle, if not null
* @param parent ViewGroup containing the returned View
@ -208,6 +215,7 @@ public class MergeAdapter extends BaseAdapter implements SectionIndexer { @@ -208,6 +215,7 @@ public class MergeAdapter extends BaseAdapter implements SectionIndexer {
/**
* Get the row id associated with the specified position in the list.
*
* @param position Position of the item whose data we want
*/
public long getItemId(int position) {

9
app/src/main/java/org/transdroid/core/gui/lists/PiecesMapView.java

@ -65,7 +65,7 @@ class PiecesMapView extends View { @@ -65,7 +65,7 @@ class PiecesMapView extends View {
piecesScaled = new ArrayList<Integer>();
int bucketCount = (int) Math.ceil((double) width / (double) pieceWidth);
int bucketSize = (int) Math.floor((double)this.pieces.size() / (double) bucketCount);
int bucketSize = (int) Math.floor((double) this.pieces.size() / (double) bucketCount);
// loop buckets
for (int i = 0; i < bucketCount; i++) {
@ -74,7 +74,7 @@ class PiecesMapView extends View { @@ -74,7 +74,7 @@ class PiecesMapView extends View {
int start = i * bucketSize;
// If this is the last bucket, throw the remainder of the pieces array into it
int end = (i == bucketCount-1) ? this.pieces.size() : (i+1) * bucketSize;
int end = (i == bucketCount - 1) ? this.pieces.size() : (i + 1) * bucketSize;
ArrayList<Integer> bucket = new ArrayList<Integer>(this.pieces.subList(start, end));
@ -82,7 +82,7 @@ class PiecesMapView extends View { @@ -82,7 +82,7 @@ class PiecesMapView extends View {
int downloadingCount = 0;
// loop pieces in bucket
for(int j = 0; j < bucket.size(); j++) {
for (int j = 0; j < bucket.size(); j++) {
// Count downloading pieces
if (bucket.get(j) == 1) {
downloadingCount++;
@ -115,8 +115,7 @@ class PiecesMapView extends View { @@ -115,8 +115,7 @@ class PiecesMapView extends View {
}
String scaledPiecesString = "";
for (int s : piecesScaled)
{
for (int s : piecesScaled) {
scaledPiecesString += s;
}

1
app/src/main/java/org/transdroid/core/gui/lists/SimpleListItem.java

@ -19,6 +19,7 @@ package org.transdroid.core.gui.lists; @@ -19,6 +19,7 @@ package org.transdroid.core.gui.lists;
/**
* Represents a filter item as shown in the navigation list or spinner.
*
* @author Eric Kok
*/
public interface SimpleListItem {

3
app/src/main/java/org/transdroid/core/gui/lists/SimpleListItemAdapter.java

@ -37,6 +37,7 @@ public class SimpleListItemAdapter extends BaseAdapter { @@ -37,6 +37,7 @@ public class SimpleListItemAdapter extends BaseAdapter {
/**
* Allows updating of the full data list underlying this adapter, replacing all items
*
* @param newItems The new list of simple list items to display
*/
public void update(List<? extends SimpleListItem> newItems) {
@ -78,6 +79,7 @@ public class SimpleListItemAdapter extends BaseAdapter { @@ -78,6 +79,7 @@ public class SimpleListItemAdapter extends BaseAdapter {
/**
* Represents a very simple list item that only contains a single string to show in the list. Use wrapStringsList to
* wrap an existing list of strings into a list of {@link SimpleListItem}s.
*
* @author Eric Kok
*/
public static class SimpleStringItem implements SimpleListItem {
@ -85,6 +87,7 @@ public class SimpleListItemAdapter extends BaseAdapter { @@ -85,6 +87,7 @@ public class SimpleListItemAdapter extends BaseAdapter {
/**
* Wraps a simple string of strings into a list of SimpleStringItem to add as data to a
* {@link SimpleListItemAdapter}
*
* @param strings A list of string
* @return A list of SimpleStringItem objects representing the input strings
*/

2
app/src/main/java/org/transdroid/core/gui/lists/SimpleListItemSpinnerAdapter.java

@ -27,6 +27,7 @@ import android.widget.TextView; @@ -27,6 +27,7 @@ import android.widget.TextView;
/**
* A wrapper around {@link ArrayAdapter} that contains {@link SimpleListItem}s which simply show their name in the
* Spinner. The standard Android spinner resources are used for the layout.
*
* @author Eric Kok
*/
public class SimpleListItemSpinnerAdapter<T extends SimpleListItem> extends ArrayAdapter<T> {
@ -34,6 +35,7 @@ public class SimpleListItemSpinnerAdapter<T extends SimpleListItem> extends Arra @@ -34,6 +35,7 @@ public class SimpleListItemSpinnerAdapter<T extends SimpleListItem> extends Arra
/**
* Constructs the adapter, supplying the {@link SimpleListItem}s to show in the spinner. The given resource will be
* ignored as the standard Android Spinner layout is used instead.
*
* @param context The UI context to inflate the layout in
* @param resource This is ignored; android.R.layout.simple_spinner_item is always used instead
* @param objects The items to show in the spinner, which can simply display some name

1
app/src/main/java/org/transdroid/core/gui/lists/SimpleListItemView.java

@ -26,6 +26,7 @@ import org.transdroid.R; @@ -26,6 +26,7 @@ import org.transdroid.R;
/**
* View that represents some {@link SimpleListItem} object and simple prints out the text (in proper style)
*
* @author Eric Kok
*/
@EViewGroup(R.layout.list_item_simple)

3
app/src/main/java/org/transdroid/core/gui/lists/SortByListItem.java

@ -17,11 +17,13 @@ @@ -17,11 +17,13 @@
package org.transdroid.core.gui.lists;
import android.content.Context;
import org.transdroid.R;
import org.transdroid.daemon.TorrentsSortBy;
/**
* Represents a way in which a torrents list can be sorted.
*
* @author Eric Kok
*/
public class SortByListItem implements SimpleListItem {
@ -64,6 +66,7 @@ public class SortByListItem implements SimpleListItem { @@ -64,6 +66,7 @@ public class SortByListItem implements SimpleListItem {
/**
* Returns the contained represented sort order.
*
* @return The sort by order as its enumeration value
*/
public TorrentsSortBy getSortBy() {

2
app/src/main/java/org/transdroid/core/gui/lists/TorrentDetailsView.java

@ -32,6 +32,7 @@ import org.transdroid.daemon.util.FileSizeConverter; @@ -32,6 +32,7 @@ import org.transdroid.daemon.util.FileSizeConverter;
/**
* Represents a group of views that show torrent status, sizes, speeds and other details.
*
* @author Eric Kok
*/
@EViewGroup(R.layout.fragment_details_header)
@ -49,6 +50,7 @@ public class TorrentDetailsView extends RelativeLayout { @@ -49,6 +50,7 @@ public class TorrentDetailsView extends RelativeLayout {
/**
* Update the text fields with new/updated torrent details
*
* @param torrent The torrent for which to show details
*/
public void update(Torrent torrent) {

1
app/src/main/java/org/transdroid/core/gui/lists/TorrentFilePriorityLayout.java

@ -30,6 +30,7 @@ import android.widget.RelativeLayout; @@ -30,6 +30,7 @@ import android.widget.RelativeLayout;
* A relative layout that that is checkable (to be used in a contextual action bar) and shows a coloured bar in the far
* left indicating the priority of the represented file. The darker the green, the higher the priority, while grey means
* the file isn't downloaded at all.
*
* @author Eric Kok
*/
public class TorrentFilePriorityLayout extends RelativeLayout {

1
app/src/main/java/org/transdroid/core/gui/lists/TorrentFileView.java

@ -26,6 +26,7 @@ import org.transdroid.daemon.TorrentFile; @@ -26,6 +26,7 @@ import org.transdroid.daemon.TorrentFile;
/**
* View that represents some {@link TorrentFile} object and show the file's name, status and priority
*
* @author Eric Kok
*/
@EViewGroup(R.layout.list_item_torrentfile)

2
app/src/main/java/org/transdroid/core/gui/lists/TorrentStatusLayout.java

@ -30,6 +30,7 @@ import android.widget.RelativeLayout; @@ -30,6 +30,7 @@ import android.widget.RelativeLayout;
* A relative layout that is checkable (to be used in a contextual action bar) and shows a coloured bar in the far left
* indicating the status of the represented torrent. Active downloads are blue, seeding torrents are green, errors are
* red, etc.
*
* @author Eric Kok
*/
public class TorrentStatusLayout extends RelativeLayout {
@ -68,6 +69,7 @@ public class TorrentStatusLayout extends RelativeLayout { @@ -68,6 +69,7 @@ public class TorrentStatusLayout extends RelativeLayout {
/**
* Registers the status of the represented torrent and invalidates the view so the status colour will be updated
* accordingly.
*
* @param status The updated torrent status to show
*/
public void setStatus(TorrentStatus status) {

1
app/src/main/java/org/transdroid/core/gui/lists/TorrentView.java

@ -29,6 +29,7 @@ import org.transdroid.daemon.TorrentStatus; @@ -29,6 +29,7 @@ import org.transdroid.daemon.TorrentStatus;
/**
* View that represents some {@link Torrent} object and displays progress, status, speeds, etc.
*
* @author Eric Kok
*/
@EViewGroup(R.layout.list_item_torrent)

2
app/src/main/java/org/transdroid/core/gui/lists/TorrentsAdapter.java

@ -29,6 +29,7 @@ import java.util.ArrayList; @@ -29,6 +29,7 @@ import java.util.ArrayList;
/**
* Adapter that contains a list of torrent objects to show.
*
* @author Eric Kok
*/
@EBean
@ -41,6 +42,7 @@ public class TorrentsAdapter extends BaseAdapter { @@ -41,6 +42,7 @@ public class TorrentsAdapter extends BaseAdapter {
/**
* Allows updating the full internal list of torrents at once, replacing the old list
*
* @param newTorrents The new list of torrent objects
*/
public void update(ArrayList<Torrent> newTorrents) {

4
app/src/main/java/org/transdroid/core/gui/lists/ViewHolderAdapter.java

@ -28,6 +28,7 @@ import android.widget.ListView; @@ -28,6 +28,7 @@ import android.widget.ListView;
* the view object. This is required since otherwise the adapter's consumer (i.e. a {@link ListView}) does not update
* the list row accordingly. Use {@link #setViewEnabled(boolean)} to enable or disable this contained view for user
* interaction.
*
* @author Eric Kok
*/
public class ViewHolderAdapter extends BaseAdapter {
@ -38,6 +39,7 @@ public class ViewHolderAdapter extends BaseAdapter { @@ -38,6 +39,7 @@ public class ViewHolderAdapter extends BaseAdapter {
* Instantiates this wrapper adapter with the one and only view to show. It can not be updated and view visibility
* should be set directly on this adapter using {@link #setViewVisibility(int)}. Use
* {@link #setViewEnabled(boolean)} to enable or disable this contained view for user interaction.
*
* @param view The view that will be wrapper in an adapter to show in a list view
*/
public ViewHolderAdapter(View view) {
@ -47,6 +49,7 @@ public class ViewHolderAdapter extends BaseAdapter { @@ -47,6 +49,7 @@ public class ViewHolderAdapter extends BaseAdapter {
/**
* Sets the visibility on the contained view and notifies consumers of this adapter (i.e. a {@link ListView})
* accordingly. Use {@link View#GONE} to hide this adapter's view altogether.
*
* @param visibility The visibility to set on the contained view
*/
public void setViewVisibility(int visibility) {
@ -57,6 +60,7 @@ public class ViewHolderAdapter extends BaseAdapter { @@ -57,6 +60,7 @@ public class ViewHolderAdapter extends BaseAdapter {
/**
* Sets whether the contained view should be enabled and notifies consumers of this adapter (i.e. a {@link ListView}
* ) accordingly. A contained enabled view allows user interaction (clicks, focus), while a disabled view does not.
*
* @param enabled Whether the contained view should be enabled
*/
public void setViewEnabled(boolean enabled) {

3
app/src/main/java/org/transdroid/core/gui/log/DatabaseHelper.java

@ -20,7 +20,9 @@ import java.sql.SQLException; @@ -20,7 +20,9 @@ import java.sql.SQLException;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import androidx.annotation.Keep;
import android.util.Log;
import com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper;
@ -29,6 +31,7 @@ import com.j256.ormlite.table.TableUtils; @@ -29,6 +31,7 @@ import com.j256.ormlite.table.TableUtils;
/**
* Helper to access the database to access persisting objects.
*
* @author Eric Kok
*/
public class DatabaseHelper extends OrmLiteSqliteOpenHelper {

1
app/src/main/java/org/transdroid/core/gui/log/ErrorLogEntry.java

@ -26,6 +26,7 @@ import com.j256.ormlite.table.DatabaseTable; @@ -26,6 +26,7 @@ import com.j256.ormlite.table.DatabaseTable;
/**
* Represents an error log entry to be registered in the database.
*
* @author Eric Kok
*/
@DatabaseTable(tableName = "ErrorLogEntry")

2
app/src/main/java/org/transdroid/core/gui/log/ErrorLogSender.java

@ -76,7 +76,7 @@ public class ErrorLogSender { @@ -76,7 +76,7 @@ public class ErrorLogSender {
Intent target = new Intent(Intent.ACTION_SEND);
target.setType("message/rfc822");
target.putExtra(Intent.EXTRA_EMAIL, new String[] { "transdroid@2312.nl" });
target.putExtra(Intent.EXTRA_EMAIL, new String[]{"transdroid@2312.nl"});
target.putExtra(Intent.EXTRA_SUBJECT, "Transdroid error report");
target.putExtra(Intent.EXTRA_TEXT, body.toString());
try {

1
app/src/main/java/org/transdroid/core/gui/log/Log.java

@ -28,6 +28,7 @@ import java.util.Date; @@ -28,6 +28,7 @@ import java.util.Date;
/**
* Application-wide logging class that registers entries in the database (for a certain time).
*
* @author Eric Kok
*/
@EBean(scope = Scope.Singleton)

4
app/src/main/java/org/transdroid/core/gui/navigation/DialogHelper.java

@ -36,6 +36,7 @@ import android.view.Window; @@ -36,6 +36,7 @@ import android.view.Window;
* Helper class that show a dialog either as pop-up or as full screen activity. Should be used by calling
* {@link #showDialog(Context, DialogSpecification)} with in instance of the dialog specification that should be shown,
* from the calling activity's {@link Activity#onCreateDialog(int)}.
*
* @author Eric Kok
*/
@EActivity
@ -71,6 +72,7 @@ public class DialogHelper extends Activity { @@ -71,6 +72,7 @@ public class DialogHelper extends Activity {
/**
* Call this from {@link Activity#onCreateDialog(int)}, supplying an instance of the {@link DialogSpecification}
* that should be shown to the user.
*
* @param context The activity that calls this method and which will own the constructed dialog
* @param dialog An instance of the specification for the dialog that needs to be shown
* @return Either an instance of a {@link Dialog} that the activity should further control or null if the dialog
@ -106,7 +108,9 @@ public class DialogHelper extends Activity { @@ -106,7 +108,9 @@ public class DialogHelper extends Activity {
*/
public interface DialogSpecification extends Serializable {
int getDialogLayoutId();
int getDialogMenuId();
boolean onMenuItemSelected(Activity ownerActivity, int selectedItemId);
}

4
app/src/main/java/org/transdroid/core/gui/navigation/FilterListAdapter.java

@ -33,6 +33,7 @@ import java.util.List; @@ -33,6 +33,7 @@ import java.util.List;
/**
* List adapter that holds filter items, that is, servers, view types and labels. A header item is inserted where appropriate.
*
* @author Eric Kok
*/
@EBean
@ -49,6 +50,7 @@ public class FilterListAdapter extends MergeAdapter { @@ -49,6 +50,7 @@ public class FilterListAdapter extends MergeAdapter {
/**
* Update the list of available servers
*
* @param servers The new list of available servers
*/
public void updateServers(List<ServerSetting> servers) {
@ -70,6 +72,7 @@ public class FilterListAdapter extends MergeAdapter { @@ -70,6 +72,7 @@ public class FilterListAdapter extends MergeAdapter {
/**
* Update the list of available status types
*
* @param statusTypes The new list of available status types
*/
public void updateStatusTypes(List<StatusTypeFilter> statusTypes) {
@ -91,6 +94,7 @@ public class FilterListAdapter extends MergeAdapter { @@ -91,6 +94,7 @@ public class FilterListAdapter extends MergeAdapter {
/**
* Update the list of available labels
*
* @param labels The new list of available labels
*/
public void updateLabels(List<Label> labels) {

1
app/src/main/java/org/transdroid/core/gui/navigation/FilterListItemAdapter.java

@ -38,6 +38,7 @@ public class FilterListItemAdapter extends BaseAdapter { @@ -38,6 +38,7 @@ public class FilterListItemAdapter extends BaseAdapter {
/**
* Allows updating of the full data list underlying this adapter, replacing all items
*
* @param newItems The new list of filter items to display
*/
public void update(List<? extends SimpleListItem> newItems) {

1
app/src/main/java/org/transdroid/core/gui/navigation/FilterListItemView.java

@ -27,6 +27,7 @@ import org.transdroid.core.gui.lists.SimpleListItem; @@ -27,6 +27,7 @@ import org.transdroid.core.gui.lists.SimpleListItem;
/**
* View that represents some {@link SimpleListItem} object specifically used to represent a navigation filter item.
*
* @author Eric Kok
*/
@EViewGroup(R.layout.list_item_filter)

2
app/src/main/java/org/transdroid/core/gui/navigation/FilterSeparatorView.java

@ -27,6 +27,7 @@ import org.transdroid.R; @@ -27,6 +27,7 @@ import org.transdroid.R;
/**
* A list item that shows a sub header or separator (in underlined Holo style).
*
* @author Eric Kok
*/
@EViewGroup(R.layout.list_item_separator)
@ -43,6 +44,7 @@ public class FilterSeparatorView extends FrameLayout { @@ -43,6 +44,7 @@ public class FilterSeparatorView extends FrameLayout {
/**
* Sets the text that will be shown in this separator (sub header)
*
* @param text The new text to show
* @return Itself, for convenience of method chaining
*/

3
app/src/main/java/org/transdroid/core/gui/navigation/Label.java

@ -29,6 +29,7 @@ import java.util.List; @@ -29,6 +29,7 @@ import java.util.List;
/**
* Represents some label that is active or available on the server.
*
* @author Eric Kok
*/
public class Label implements SimpleListItem, NavigationFilter, Comparable<Label> {
@ -73,6 +74,7 @@ public class Label implements SimpleListItem, NavigationFilter, Comparable<Label @@ -73,6 +74,7 @@ public class Label implements SimpleListItem, NavigationFilter, Comparable<Label
/**
* Returns true if the torrent label's name matches this (selected) label's name, false otherwise
*
* @param torrent The torrent to match against this label
* @param dormantAsInactive This property is ignored for label comparisons
*/
@ -91,6 +93,7 @@ public class Label implements SimpleListItem, NavigationFilter, Comparable<Label @@ -91,6 +93,7 @@ public class Label implements SimpleListItem, NavigationFilter, Comparable<Label
/**
* Converts a list of labels as retrieved from a server daemon into a list of labels that can be used in the UI as navigation filters.
*
* @param daemonLabels The raw list of labels as received from the server daemon adapter
* @param unnamedLabel The text to show for the empty label (i.e. the unnamed label)
* @return A label items that can be used in a filter list such as the action bar spinner

4
app/src/main/java/org/transdroid/core/gui/navigation/NavigationFilter.java

@ -22,6 +22,7 @@ import org.transdroid.daemon.Torrent; @@ -22,6 +22,7 @@ import org.transdroid.daemon.Torrent;
/**
* Represents a filter, used in the app navigation, that can check if some torrent matches the user-set filter
*
* @author Eric Kok
*/
public interface NavigationFilter extends Parcelable {
@ -29,6 +30,7 @@ public interface NavigationFilter extends Parcelable { @@ -29,6 +30,7 @@ public interface NavigationFilter extends Parcelable {
/**
* Implementations should check if the supplied torrent matches the filter; for example a label filter should return true if the torrent's label
* equals this items label name.
*
* @param torrent The torrent to check for matches
* @param dormantAsInactive If true, dormant (0KB/s, so no data transfer) torrents are never actively downloading or seeding
* @return True if the torrent matches the filter and should be shown in the current screen, false otherwise
@ -37,12 +39,14 @@ public interface NavigationFilter extends Parcelable { @@ -37,12 +39,14 @@ public interface NavigationFilter extends Parcelable {
/**
* Implementations should return a name that can be shown to indicate the active filter
*
* @return The name of the filter item as string
*/
String getName();
/**
* Implementations should return a code that (within reasonable expectations) uniquely identifies it in the list of navigation filters
*
* @return The code to uniquely identify this specific navigation filter, such as the name with a class name prefix
*/
String getCode();

12
app/src/main/java/org/transdroid/core/gui/navigation/NavigationHelper.java

@ -26,9 +26,11 @@ import android.content.pm.PackageManager; @@ -26,9 +26,11 @@ import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Build;
import androidx.annotation.NonNull;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.style.TypefaceSpan;
@ -54,6 +56,7 @@ import java.util.List; @@ -54,6 +56,7 @@ import java.util.List;
/**
* Helper for activities to make navigation-related decisions, such as when a device can display a larger, tablet style layout or how to display
* errors.
*
* @author Eric Kok
*/
@SuppressLint("ResourceAsColor")
@ -140,6 +143,7 @@ public class NavigationHelper { @@ -140,6 +143,7 @@ public class NavigationHelper {
/**
* Converts a string into a {@link Spannable} that displays the string in the Roboto Condensed font
*
* @param string A plain text {@link String}
* @return A {@link Spannable} that can be applied to supporting views (such as the action bar title) so that the input string will be displayed
* using the Roboto Condensed font (if the OS has this)
@ -155,6 +159,7 @@ public class NavigationHelper { @@ -155,6 +159,7 @@ public class NavigationHelper {
/**
* Analyses a torrent http or magnet URI and tries to come up with a reasonable human-readable name.
*
* @param rawTorrentUri The raw http:// or magnet: link to the torrent
* @return A best-guess, reasonably long name for the linked torrent
*/
@ -204,6 +209,7 @@ public class NavigationHelper { @@ -204,6 +209,7 @@ public class NavigationHelper {
/**
* Returns (and initialises, if needed) an image cache that uses memory and (1MB) local storage.
*
* @return An image cache that loads web images synchronously and transparently
*/
public ImageLoader getImageCache() {
@ -250,6 +256,7 @@ public class NavigationHelper { @@ -250,6 +256,7 @@ public class NavigationHelper {
/**
* Returns the application name (like Transdroid) and version name (like 1.5.0), appended by the version code (like 180).
*
* @return The app name and version, such as 'Transdroid 1.5.0 (180)'
*/
public String getAppNameAndVersion() {
@ -259,6 +266,7 @@ public class NavigationHelper { @@ -259,6 +266,7 @@ public class NavigationHelper {
/**
* Returns whether the device is considered small (i.e. a phone) rather than large (i.e. a tablet). Can, for example, be used to determine if a
* dialog should be shown full screen. Currently is true if the device's smallest dimension is 500 dip.
*
* @return True if the app runs on a small device, false otherwise
*/
public boolean isSmallScreen() {
@ -268,6 +276,7 @@ public class NavigationHelper { @@ -268,6 +276,7 @@ public class NavigationHelper {
/**
* Whether any search-related UI components should be shown in the interface. At the moment returns false only if we run as Transdroid Lite
* version.
*
* @return True if search is enabled, false otherwise
*/
public boolean enableSearchUi() {
@ -276,6 +285,7 @@ public class NavigationHelper { @@ -276,6 +285,7 @@ public class NavigationHelper {
/**
* Whether any RSS-related UI components should be shown in the interface. At the moment returns false only if we run as Transdroid Lite version.
*
* @return True if search is enabled, false otherwise
*/
public boolean enableRssUi() {
@ -285,6 +295,7 @@ public class NavigationHelper { @@ -285,6 +295,7 @@ public class NavigationHelper {
/**
* Returns whether any seedbox-related components should be shown in the interface; specifically the option to add server settings via easy
* seedbox-specific screens.
*
* @return True if seedbox settings should be shown, false otherwise
*/
public boolean enableSeedboxes() {
@ -293,6 +304,7 @@ public class NavigationHelper { @@ -293,6 +304,7 @@ public class NavigationHelper {
/**
* Whether the custom app update checker should be used to check for new app and search module versions.
*
* @return True if it should be checked against transdroid.org if there are app updates (as opposed to using the Play Store for updates, for
* example), false otherwise
*/

1
app/src/main/java/org/transdroid/core/gui/navigation/RefreshableActivity.java

@ -18,6 +18,7 @@ package org.transdroid.core.gui.navigation; @@ -18,6 +18,7 @@ package org.transdroid.core.gui.navigation;
/**
* Interface to be implemented by any activity that allows its content to be refreshed; fragments can ask for user-initiated refreshes.
*
* @author Eric Kok
*/
public interface RefreshableActivity {

3
app/src/main/java/org/transdroid/core/gui/navigation/SelectionManagerMode.java

@ -32,6 +32,7 @@ import android.widget.ListView; @@ -32,6 +32,7 @@ import android.widget.ListView;
* A helper to implement {@link ListView} selection modification behaviour with the {@link SelectionModificationSpinner}
* by implementing the specific actions and providing a title based on the number of currently selected items. It is
* important that the provided list was instantiated already.
*
* @author Eric Kok
*/
public class SelectionManagerMode implements MultiChoiceModeListener, OnModificationActionSelectedListener {
@ -44,6 +45,7 @@ public class SelectionManagerMode implements MultiChoiceModeListener, OnModifica @@ -44,6 +45,7 @@ public class SelectionManagerMode implements MultiChoiceModeListener, OnModifica
/**
* Instantiates the helper by binding it to a specific {@link ListView} and providing the text resource to display
* as title in the spinner.
*
* @param themedContext The context which is associated with the correct theme to apply when inflating views, i.e. the toolbar context
* @param managedList The list to manage the selection for and execute selection action to
* @param titleTemplateResource The string resource id to show as the spinners title; the number of selected items
@ -58,6 +60,7 @@ public class SelectionManagerMode implements MultiChoiceModeListener, OnModifica @@ -58,6 +60,7 @@ public class SelectionManagerMode implements MultiChoiceModeListener, OnModifica
/**
* Set the class type of items that are allowed to be checked in the {@link ListView}. Defaults to null, which means
* every list view row can be checked.
*
* @param onlyCheckClass The {@link Class} instance to use to check list item types against
*/
public void setOnlyCheckClass(Class<?> onlyCheckClass) {

10
app/src/main/java/org/transdroid/core/gui/navigation/SelectionModificationSpinner.java

@ -28,6 +28,7 @@ import android.widget.TextView; @@ -28,6 +28,7 @@ import android.widget.TextView;
/**
* Spinner that holds actions that can be performed on list selections. The spinner itself has some title, which can for
* example be used to show the number of selected items.
*
* @author Eric Kok
*/
public class SelectionModificationSpinner extends Spinner {
@ -37,6 +38,7 @@ public class SelectionModificationSpinner extends Spinner { @@ -37,6 +38,7 @@ public class SelectionModificationSpinner extends Spinner {
/**
* Instantiates a spinner that contains some fixed actions for a user to modify selections.
*
* @param context The interface context where the spinner will be shown in
*/
public SelectionModificationSpinner(Context context) {
@ -47,6 +49,7 @@ public class SelectionModificationSpinner extends Spinner { @@ -47,6 +49,7 @@ public class SelectionModificationSpinner extends Spinner {
/**
* Updates the fixed title text shown in the spinner, regardless of spinner item action selection.
*
* @param title The new static string to show, such as the number of selected items
*/
public void updateTitle(String title) {
@ -56,6 +59,7 @@ public class SelectionModificationSpinner extends Spinner { @@ -56,6 +59,7 @@ public class SelectionModificationSpinner extends Spinner {
/**
* Sets the listener for action selection events.
*
* @param onModificationActionSelected The listener that handles performing of the actions as selected in this
* spinner by the user
*/
@ -84,10 +88,10 @@ public class SelectionModificationSpinner extends Spinner { @@ -84,10 +88,10 @@ public class SelectionModificationSpinner extends Spinner {
protected TextView titleView = null;
public SelectionDropDownAdapter(Context context) {
super(context, android.R.layout.simple_list_item_1, new String[] {
super(context, android.R.layout.simple_list_item_1, new String[]{
context.getString(R.string.navigation_selectall),
context.getString(R.string.navigation_selectfinished),
context.getString(R.string.navigation_invertselection) });
context.getString(R.string.navigation_invertselection)});
titleView = new TextView(getContext());
}
@ -110,7 +114,9 @@ public class SelectionModificationSpinner extends Spinner { @@ -110,7 +114,9 @@ public class SelectionModificationSpinner extends Spinner {
*/
public interface OnModificationActionSelectedListener {
public void selectAll();
public void selectFinished();
public void invertSelection();
}

1
app/src/main/java/org/transdroid/core/gui/navigation/SetLabelDialog.java

@ -39,6 +39,7 @@ public class SetLabelDialog { @@ -39,6 +39,7 @@ public class SetLabelDialog {
/**
* A dialog fragment that allows picking a label or entering a new label to set this new label to the torrent.
*
* @param context The activity context that opens (and owns) this dialog
* @param onLabelPickedListener The callback when a new label has been entered or picked by the user
* @param currentLabels The list of labels as currently exist on the server, to present as list for easy selection

1
app/src/main/java/org/transdroid/core/gui/navigation/SetStorageLocationDialog.java

@ -30,6 +30,7 @@ public class SetStorageLocationDialog { @@ -30,6 +30,7 @@ public class SetStorageLocationDialog {
/**
* A dialog fragment that allows changing of the storage location by editing the path text directly.
*
* @param context The activity context that opens (and owns) this dialog
* @param onStorageLocationUpdatedListener The callback for when the user is done updating the storage location
* @param currentLocation The current storage location that will be available to the user to edit

1
app/src/main/java/org/transdroid/core/gui/navigation/SetTrackersDialog.java

@ -34,6 +34,7 @@ public class SetTrackersDialog extends DialogFragment { @@ -34,6 +34,7 @@ public class SetTrackersDialog extends DialogFragment {
/**
* A dialog fragment that allows changing the trackers of a torrent by editing the text directly.
*
* @param context The activity context that opens (and owns) this dialog
* @param onTrackersUpdatedListener The callback for when the user is done updating the trackers list
* @param currentTrackers The current trackers text/list that will be available to the user to edit

1
app/src/main/java/org/transdroid/core/gui/navigation/SetTransferRatesDialog.java

@ -32,6 +32,7 @@ public class SetTransferRatesDialog { @@ -32,6 +32,7 @@ public class SetTransferRatesDialog {
/**
* A dialog fragment that allow picking of maximum download and upload transfer rates as well as the resetting of these values.
*
* @param context The activity context that opens (and owns) this dialog
* @param onRatesPickedListener The callback for results in this dialog (with newly selected values or a reset)
*/

5
app/src/main/java/org/transdroid/core/gui/navigation/StatusType.java

@ -29,6 +29,7 @@ import android.os.Parcelable; @@ -29,6 +29,7 @@ import android.os.Parcelable;
/**
* Enumeration of all status types, which filter the list of shown torrents based on transfer activity.
*
* @author Eric Kok
*/
public enum StatusType {
@ -61,6 +62,7 @@ public enum StatusType { @@ -61,6 +62,7 @@ public enum StatusType {
/**
* Returns the status type to show all torrents, represented as filter item to show in the navigation list.
*
* @param context The Android UI context, to access translations
* @return The show ShowAll status type filter item
*/
@ -70,6 +72,7 @@ public enum StatusType { @@ -70,6 +72,7 @@ public enum StatusType {
/**
* Returns a list with all status types, represented as filter item that can be shown in the GUI.
*
* @param context The Android UI context, to access translations
* @return A list of filter items for all available status types
*/
@ -81,6 +84,7 @@ public enum StatusType { @@ -81,6 +84,7 @@ public enum StatusType {
/**
* Every status type can return a filter item that represents it in the navigation
*
* @param context The Android UI context, to access translations
* @return A filter item object to show in the GUI
*/
@ -113,6 +117,7 @@ public enum StatusType { @@ -113,6 +117,7 @@ public enum StatusType {
/**
* Returns true if the torrent status matches this (selected) status type, false otherwise
*
* @param torrent The torrent to match against this status type
* @param dormantAsInactive If true, dormant (0KB/s, so no data transfer) torrents are never actively
* downloading or seeding

5
app/src/main/java/org/transdroid/core/gui/remoterss/RemoteRssFragment.java

@ -18,6 +18,7 @@ package org.transdroid.core.gui.remoterss; @@ -18,6 +18,7 @@ package org.transdroid.core.gui.remoterss;
import androidx.fragment.app.Fragment;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
@ -44,6 +45,7 @@ import java.util.List; @@ -44,6 +45,7 @@ import java.util.List;
/**
* Fragment that shows a list of RSS items from the server and allows the user
* to download remotely, without having to set up RSS feeds on the Android device.
*
* @author Twig
*/
@EFragment(R.layout.fragment_remoterss)
@ -108,8 +110,7 @@ public class RemoteRssFragment extends Fragment { @@ -108,8 +110,7 @@ public class RemoteRssFragment extends Fragment {
// Show/hide a nice message if there are no items to show
if (remoteRssItems.size() > 0) {
remoteRssStatusMessage.setVisibility(View.GONE);
}
else {
} else {
remoteRssStatusMessage.setVisibility(View.VISIBLE);
remoteRssStatusMessage.setText(R.string.remoterss_no_files);
}

1
app/src/main/java/org/transdroid/core/gui/remoterss/RemoteRssItemView.java

@ -28,6 +28,7 @@ import org.transdroid.core.gui.remoterss.data.RemoteRssItem; @@ -28,6 +28,7 @@ import org.transdroid.core.gui.remoterss.data.RemoteRssItem;
/**
* View that represents some {@link RemoteRssItem} object.
*
* @author Twig
*/
@EViewGroup(R.layout.list_item_remoterssitem)

3
app/src/main/java/org/transdroid/core/gui/remoterss/RemoteRssItemsAdapter.java

@ -40,8 +40,7 @@ public class RemoteRssItemsAdapter extends BaseAdapter { @@ -40,8 +40,7 @@ public class RemoteRssItemsAdapter extends BaseAdapter {
if (convertView == null) {
itemView = RemoteRssItemView_.build(context);
}
else {
} else {
itemView = (RemoteRssItemView) convertView;
}

24
app/src/main/java/org/transdroid/core/gui/rss/RssFeedsActivity.java

@ -22,13 +22,17 @@ import android.net.Uri; @@ -22,13 +22,17 @@ import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Parcel;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.material.tabs.TabLayout;
import androidx.viewpager.widget.PagerAdapter;
import androidx.viewpager.widget.ViewPager;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
@ -130,8 +134,7 @@ public class RssFeedsActivity extends AppCompatActivity { @@ -130,8 +134,7 @@ public class RssFeedsActivity extends AppCompatActivity {
if (position == RSS_FEEDS_LOCAL) {
resId = R.id.layout_rssfeeds_local;
}
else if (position == RSS_FEEDS_REMOTE) {
} else if (position == RSS_FEEDS_REMOTE) {
resId = R.id.layout_rss_feeds_remote;
}
@ -196,7 +199,8 @@ public class RssFeedsActivity extends AppCompatActivity { @@ -196,7 +199,8 @@ public class RssFeedsActivity extends AppCompatActivity {
try {
hasRemoteFeeds = remoteConnection.getRemoteRssChannels(log).size() > 0;
} catch (DaemonException e) {}
} catch (DaemonException e) {
}
if (hasRemoteFeeds) {
defaultTab = RSS_FEEDS_REMOTE;
@ -234,6 +238,7 @@ public class RssFeedsActivity extends AppCompatActivity { @@ -234,6 +238,7 @@ public class RssFeedsActivity extends AppCompatActivity {
/**
* Performs the loading of the RSS feed content and parsing of items, in a background thread.
*
* @param loader The RSS feed loader for which to retrieve the contents
*/
@Background
@ -253,6 +258,7 @@ public class RssFeedsActivity extends AppCompatActivity { @@ -253,6 +258,7 @@ public class RssFeedsActivity extends AppCompatActivity {
/**
* Stores the retrieved RSS feed content channel into the loader and updates the RSS feed in the feeds list fragment.
*
* @param loader The RSS feed loader that was executed
* @param channel The data that was retrieved, or null if it could not be parsed
* @param hasError True if a connection error occurred in the loading of the feed; false otherwise
@ -267,6 +273,7 @@ public class RssFeedsActivity extends AppCompatActivity { @@ -267,6 +273,7 @@ public class RssFeedsActivity extends AppCompatActivity {
/**
* Opens an RSS feed in the dedicated fragment (if there was space in the UI) or a new {@link RssItemsActivity}. Optionally this also registers in
* the user preferences that the feed was now viewed, so that in the future the new items can be properly marked.
*
* @param loader The RSS feed loader (with settings and the loaded content channel) to show
* @param markAsViewedNow True if the user settings should be updated to reflect this feed's last viewed date; false otherwise
*/
@ -367,8 +374,8 @@ public class RssFeedsActivity extends AppCompatActivity { @@ -367,8 +374,8 @@ public class RssFeedsActivity extends AppCompatActivity {
// @UIThread
fragmentRemoteFeeds.updateRemoteItems(
selectedFilter == 0 ? recentItems : feeds.get(selectedFilter -1).getItems(),
false /* allow android to restore scroll position */ );
selectedFilter == 0 ? recentItems : feeds.get(selectedFilter - 1).getItems(),
false /* allow android to restore scroll position */);
showRemoteChannelFilters();
}
@ -386,9 +393,8 @@ public class RssFeedsActivity extends AppCompatActivity { @@ -386,9 +393,8 @@ public class RssFeedsActivity extends AppCompatActivity {
if (position == 0) {
fragmentRemoteFeeds.updateRemoteItems(recentItems, true);
}
else {
RemoteRssChannel channel = feeds.get(selectedFilter -1);
} else {
RemoteRssChannel channel = feeds.get(selectedFilter - 1);
fragmentRemoteFeeds.updateRemoteItems(channel.getItems(), true);
}
}
@ -424,7 +430,7 @@ public class RssFeedsActivity extends AppCompatActivity { @@ -424,7 +430,7 @@ public class RssFeedsActivity extends AppCompatActivity {
}
private void showRemoteChannelFilters() {
List<RemoteRssChannel> feedLabels = new ArrayList<>(feeds.size() +1);
List<RemoteRssChannel> feedLabels = new ArrayList<>(feeds.size() + 1);
feedLabels.add(new RemoteRssChannel() {
@Override
public String getName() {

2
app/src/main/java/org/transdroid/core/gui/rss/RssFeedsFragment.java

@ -17,6 +17,7 @@ @@ -17,6 +17,7 @@
package org.transdroid.core.gui.rss;
import androidx.fragment.app.Fragment;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
@ -37,6 +38,7 @@ import java.util.List; @@ -37,6 +38,7 @@ import java.util.List;
/**
* Fragment lists the RSS feeds the user wants to monitor and, if room, the list of items in a feed in a right pane.
*
* @author Eric Kok
*/
@EFragment(R.layout.fragment_rssfeeds)

1
app/src/main/java/org/transdroid/core/gui/rss/RssItemsActivity.java

@ -20,6 +20,7 @@ import android.annotation.TargetApi; @@ -20,6 +20,7 @@ import android.annotation.TargetApi;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;

4
app/src/main/java/org/transdroid/core/gui/rss/RssItemsFragment.java

@ -23,8 +23,10 @@ import android.content.ClipboardManager; @@ -23,8 +23,10 @@ import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import androidx.fragment.app.Fragment;
import androidx.appcompat.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.ActionMode;
import android.view.Menu;
@ -57,6 +59,7 @@ import java.util.List; @@ -57,6 +59,7 @@ import java.util.List;
/**
* Fragment that lists the items in a specific RSS feed
*
* @author Eric Kok
*/
@EFragment(R.layout.fragment_rssitems)
@ -197,6 +200,7 @@ public class RssItemsFragment extends Fragment { @@ -197,6 +200,7 @@ public class RssItemsFragment extends Fragment {
/**
* Update the shown RSS items in the list.
*
* @param channel The loaded RSS content channel object
* @param hasError True if there were errors in loading the channel, in which case an error text is shown; false otherwise
* @param requiresExternalAuthentication Whether this RSS feed requires external authentication and should thus be redirected to a browser

1
app/src/main/java/org/transdroid/core/gui/rss/RssfeedLoader.java

@ -28,6 +28,7 @@ import java.util.List; @@ -28,6 +28,7 @@ import java.util.List;
/**
* A container class that holds RSS feed settings and, after they have been retrieved, the contents as {@link Channel}, the number of new items and an
* indication of a connection error.
*
* @author Eric Kok
*/
public class RssfeedLoader {

1
app/src/main/java/org/transdroid/core/gui/rss/RssfeedView.java

@ -33,6 +33,7 @@ import org.transdroid.core.gui.navigation.NavigationHelper; @@ -33,6 +33,7 @@ import org.transdroid.core.gui.navigation.NavigationHelper;
/**
* View that represents some {@link RssfeedSetting} object and displays name as well as loads a favicon for the feed's site and can load how many new
* items are available.
*
* @author Eric Kok
*/
@EViewGroup(R.layout.list_item_rssfeed)

2
app/src/main/java/org/transdroid/core/gui/rss/RssfeedsAdapter.java

@ -29,6 +29,7 @@ import java.util.List; @@ -29,6 +29,7 @@ import java.util.List;
/**
* Adapter that contains a list of {@link RssfeedSetting}s, each with associated loaded RSS feed {@link org.transdroid.core.rssparser.Channel}.
*
* @author Eric Kok
*/
@EBean
@ -41,6 +42,7 @@ public class RssfeedsAdapter extends BaseAdapter { @@ -41,6 +42,7 @@ public class RssfeedsAdapter extends BaseAdapter {
/**
* Allows updating the full internal list of feed loaders at once, replacing the old list
*
* @param loaders The new list of RSS feed loader objects, which pair settings and a loaded channel
*/
public void update(List<RssfeedLoader> loaders) {

1
app/src/main/java/org/transdroid/core/gui/rss/RssitemStatusLayout.java

@ -28,6 +28,7 @@ import org.transdroid.R; @@ -28,6 +28,7 @@ import org.transdroid.R;
/**
* A relative layout that that is checkable (to be used in a contextual action bar) and shows a coloured bar in the far left indicating the view
* status, that is, if the item is new to the user or was viewed earlier.
*
* @author Eric Kok
*/
public class RssitemStatusLayout extends RelativeLayout {

1
app/src/main/java/org/transdroid/core/gui/rss/RssitemView.java

@ -27,6 +27,7 @@ import org.transdroid.core.rssparser.Item; @@ -27,6 +27,7 @@ import org.transdroid.core.rssparser.Item;
/**
* View that represents some {@link Item} object, which is a single item in some RSS feed.
*
* @author Eric Kok
*/
@EViewGroup(R.layout.list_item_rssitem)

2
app/src/main/java/org/transdroid/core/gui/rss/RssitemsAdapter.java

@ -28,6 +28,7 @@ import org.transdroid.core.rssparser.Item; @@ -28,6 +28,7 @@ import org.transdroid.core.rssparser.Item;
/**
* Adapter that contains a list of {@link Item}s in an RSS feed.
*
* @author Eric Kok
*/
@EBean
@ -40,6 +41,7 @@ public class RssitemsAdapter extends BaseAdapter { @@ -40,6 +41,7 @@ public class RssitemsAdapter extends BaseAdapter {
/**
* Allows updating the full RSS feed (channel and contained items), replacing the old data
*
* @param rssfeed The new RSS feed contents
*/
public void update(Channel rssfeed) {

2
app/src/main/java/org/transdroid/core/gui/search/BarcodeHelper.java

@ -38,6 +38,7 @@ public class BarcodeHelper { @@ -38,6 +38,7 @@ public class BarcodeHelper {
/**
* Call this to start a bar code scanner intent. The calling activity will receive an Intent result with the given
* request code.
*
* @param activity The calling activity, to which the result is returned or a dialog is bound that asks to install
* the bar code scanner
* @param requestCode {@link #ACTIVITY_BARCODE_QRSETTINGS}
@ -51,6 +52,7 @@ public class BarcodeHelper { @@ -51,6 +52,7 @@ public class BarcodeHelper {
* Call this to share content encoded in a QR code, specially used to share settings. The calling activity will
* receive an Intent result with ID {@link #ACTIVITY_BARCODE_QRSETTINGS}. From there the returned intent will
* contain the data as SCAN_RESULT String extra.
*
* @param activity The calling activity, to which the result is returned or a dialog is bound that asks to install
* the bar code scanner
* @param content The content to share, that is, the raw data (Transdroid settings encoded as JSON data structure)

1
app/src/main/java/org/transdroid/core/gui/search/FilePickerHelper.java

@ -37,6 +37,7 @@ public class FilePickerHelper { @@ -37,6 +37,7 @@ public class FilePickerHelper {
/**
* Call this to start a file picker intent. The calling activity will receive an Intent result with ID
* {@link #ACTIVITY_FILEPICKER} with an Intent that contains the selected local file as data Intent.
*
* @param activity The calling activity, to which the result is returned or a dialog is bound that asks to install
* the file picker
*/

4
app/src/main/java/org/transdroid/core/gui/search/SearchActivity.java

@ -23,9 +23,11 @@ import android.net.Uri; @@ -23,9 +23,11 @@ import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.SearchRecentSuggestions;
import androidx.core.view.MenuItemCompat;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
@ -58,6 +60,7 @@ import java.util.List; @@ -58,6 +60,7 @@ import java.util.List;
/**
* An activity that shows search results to the user (after a query was supplied by the standard Android search manager) and either shows the list of
* search sites on the left (e.g. on tablets) or allows switching between search sites via the action bar spinner.
*
* @author Eric Kok
*/
@EActivity(R.layout.activity_search)
@ -258,6 +261,7 @@ public class SearchActivity extends AppCompatActivity { @@ -258,6 +261,7 @@ public class SearchActivity extends AppCompatActivity {
/**
* Extracts the query string from the search {@link Intent}
*
* @return The query string that was entered by the user
*/
private String parseQuery(Intent intent) {

1
app/src/main/java/org/transdroid/core/gui/search/SearchHistoryProvider.java

@ -24,6 +24,7 @@ import org.transdroid.BuildConfig; @@ -24,6 +24,7 @@ import org.transdroid.BuildConfig;
/**
* Provides search suggestions by simply returning previous user entries.
*
* @author Eric Kok
*/
public class SearchHistoryProvider extends SearchRecentSuggestionsProvider {

1
app/src/main/java/org/transdroid/core/gui/search/SearchResultView.java

@ -28,6 +28,7 @@ import android.widget.TextView; @@ -28,6 +28,7 @@ import android.widget.TextView;
/**
* View that represents a {@link SearchResult} object from an in-app search
*
* @author Eric Kok
*/
@EViewGroup(resName = "list_item_searchresult")

2
app/src/main/java/org/transdroid/core/gui/search/SearchResultsAdapter.java

@ -29,6 +29,7 @@ import java.util.List; @@ -29,6 +29,7 @@ import java.util.List;
/**
* Adapter that contains a list of {@link SearchResult}s.
*
* @author Eric Kok
*/
@EBean
@ -41,6 +42,7 @@ public class SearchResultsAdapter extends BaseAdapter { @@ -41,6 +42,7 @@ public class SearchResultsAdapter extends BaseAdapter {
/**
* Allows updating the search results, replacing the old data
*
* @param results The new list of search results
*/
public void update(List<SearchResult> results) {

3
app/src/main/java/org/transdroid/core/gui/search/SearchResultsFragment.java

@ -20,7 +20,9 @@ import android.app.Fragment; @@ -20,7 +20,9 @@ import android.app.Fragment;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import androidx.appcompat.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.ActionMode;
import android.view.Menu;
@ -58,6 +60,7 @@ import java.util.List; @@ -58,6 +60,7 @@ import java.util.List;
/**
* Fragment that lists the items in a specific RSS feed
*
* @author Eric Kok
*/
@EFragment(R.layout.fragment_searchresults)

2
app/src/main/java/org/transdroid/core/gui/search/SearchSetting.java

@ -22,12 +22,14 @@ public interface SearchSetting extends SimpleListItem { @@ -22,12 +22,14 @@ public interface SearchSetting extends SimpleListItem {
/**
* Should return a unique key for this search setting, so that it can be compared (using equals()) to other settings.
*
* @return A unique string identifying this search setting
*/
public String getKey();
/**
* Should return an URL (which may still be abstract and not the actual search URL) specific to the search site
*
* @return A clean URL directing to the search site, to, for example, get the favicon of the site
*/
public String getBaseUrl();

1
app/src/main/java/org/transdroid/core/gui/search/SearchSettingSelectionView.java

@ -26,6 +26,7 @@ import org.transdroid.R; @@ -26,6 +26,7 @@ import org.transdroid.R;
/**
* View that shows, as part of the action bar spinner, which {@link SearchSetting} is currently chosen.
*
* @author Eric Kok
*/
@EViewGroup(R.layout.actionbar_searchsite)

1
app/src/main/java/org/transdroid/core/gui/search/SearchSettingsDropDownAdapter.java

@ -27,6 +27,7 @@ import java.util.List; @@ -27,6 +27,7 @@ import java.util.List;
/**
* List adapter that holds search settings, that is, web searches and in-app search sites, displayed as content to a Spinner instead of a ListView.
*
* @author Eric Kok
*/
public class SearchSettingsDropDownAdapter extends FilterListItemAdapter {

1
app/src/main/java/org/transdroid/core/gui/search/SearchSiteView.java

@ -31,6 +31,7 @@ import org.transdroid.core.gui.navigation.NavigationHelper; @@ -31,6 +31,7 @@ import org.transdroid.core.gui.navigation.NavigationHelper;
/**
* View that represents some {@link RssfeedSetting} object and displays name as well as loads a favicon for the feed's site and can load how many new
* items are available.
*
* @author Eric Kok
*/
@EViewGroup(R.layout.list_item_searchsite)

2
app/src/main/java/org/transdroid/core/gui/search/SearchSitesAdapter.java

@ -30,6 +30,7 @@ import java.util.List; @@ -30,6 +30,7 @@ import java.util.List;
/**
* Adapter that contains a list of {@link SearchSetting}s, either {@link SearchSite} or {@link WebsearchSetting}.
*
* @author Eric Kok
*/
@EBean
@ -42,6 +43,7 @@ public class SearchSitesAdapter extends BaseAdapter { @@ -42,6 +43,7 @@ public class SearchSitesAdapter extends BaseAdapter {
/**
* Allows updating the full internal list of sites at once, replacing the old list
*
* @param sites The new list of search sites, either in-app or web search settings
*/
public void update(List<SearchSetting> sites) {

2
app/src/main/java/org/transdroid/core/gui/search/SendIntentHelper.java

@ -21,6 +21,7 @@ import android.content.Intent; @@ -21,6 +21,7 @@ import android.content.Intent;
/**
* Used to clean up text as received from a generic ACTION_SEND intent. This class is highly custom-based for known
* applications, i.e. the EXTRA_TEXT send by some known applications.
*
* @author Eric Kok
*/
public class SendIntentHelper {
@ -36,6 +37,7 @@ public class SendIntentHelper { @@ -36,6 +37,7 @@ public class SendIntentHelper {
/**
* Cleans a SEND intent text string by removing irrelevant parts, so that the remaining text can be used as search
* string. Typically deals with specific known applications such as Shazam and YouTube's SEND intents.
*
* @param intent The original SEND intent that was received
* @return A cleaned string to be used as search query
*/

1
app/src/main/java/org/transdroid/core/gui/search/UrlEntryDialog.java

@ -36,6 +36,7 @@ public class UrlEntryDialog { @@ -36,6 +36,7 @@ public class UrlEntryDialog {
/**
* Opens a dialog that allows entry of a single URL string, which (on confirmation) will be supplied to the calling activity's {@link
* TorrentsActivity#addTorrentByUrl(String, String) method}.
*
* @param activity The activity that opens (and owns) this dialog
*/
public static void show(final TorrentsActivity activity) {

1
app/src/main/java/org/transdroid/core/gui/settings/AboutDialog.java

@ -25,6 +25,7 @@ import android.net.Uri; @@ -25,6 +25,7 @@ import android.net.Uri;
/**
* Fragment that shows info about the application developer and used open source libraries.
*
* @author Eric Kok
*/
public class AboutDialog implements DialogHelper.DialogSpecification {

1
app/src/main/java/org/transdroid/core/gui/settings/ChangelogDialog.java

@ -25,6 +25,7 @@ import android.net.Uri; @@ -25,6 +25,7 @@ import android.net.Uri;
/**
* Fragment that shows recent app changes.
*
* @author Eric Kok
*/
public class ChangelogDialog implements DialogHelper.DialogSpecification {

10
app/src/main/java/org/transdroid/core/gui/settings/KeyBoundPreferencesActivity.java

@ -40,6 +40,7 @@ import java.util.Map; @@ -40,6 +40,7 @@ import java.util.Map;
* and then call initXPreference for each contained preference. {@link #onPreferencesChanged()} can be overridden to
* react to preference changes, e.g. when field availability should be updated (and where preference dependency isn't
* enough).
*
* @author Eric Kok
*/
@EActivity
@ -54,6 +55,7 @@ public abstract class KeyBoundPreferencesActivity extends PreferenceCompatActivi @@ -54,6 +55,7 @@ public abstract class KeyBoundPreferencesActivity extends PreferenceCompatActivi
/**
* Should be called during the activity {@link #onCreate(android.os.Bundle)} (but after super.onCreate(Bundle)) to
* load the preferences for this screen from an XML resource.
*
* @param preferencesResId The XML resource to read preferences from, which may contain embedded
* {@link PreferenceScreen} objects
* @param currentMaxKey The value of what is currently the last defined settings object, or -1 of no settings were
@ -103,6 +105,7 @@ public abstract class KeyBoundPreferencesActivity extends PreferenceCompatActivi @@ -103,6 +105,7 @@ public abstract class KeyBoundPreferencesActivity extends PreferenceCompatActivi
/**
* Updates a preference that allows for text entry via a dialog. This is used for both string and integer values. No
* default value will be shown.
*
* @param baseName The base name of the stored preference, e.g. item_name, which will then actually be stored under
* item_name_[key]
* @return The concrete {@link EditTextPreference} that is bound to this preference
@ -113,6 +116,7 @@ public abstract class KeyBoundPreferencesActivity extends PreferenceCompatActivi @@ -113,6 +116,7 @@ public abstract class KeyBoundPreferencesActivity extends PreferenceCompatActivi
/**
* Updates a preference that allows for text entry via a dialog. This is used for both string and integer values.
*
* @param baseName The base name of the stored preference, e.g. item_name, which will then actually be stored under
* item_name_[key]
* @param defValue The default value for this preference, as shown when no value was yet stored
@ -125,6 +129,7 @@ public abstract class KeyBoundPreferencesActivity extends PreferenceCompatActivi @@ -125,6 +129,7 @@ public abstract class KeyBoundPreferencesActivity extends PreferenceCompatActivi
/**
* Updates a preference (including dependency) that allows for text entry via a dialog. This is used for both string
* and integer values.
*
* @param baseName The base name of the stored preference, e.g. item_name, which will then actually be stored under
* item_name_[key]
* @param defValue The default value for this preference, as shown when no value was yet stored
@ -146,6 +151,7 @@ public abstract class KeyBoundPreferencesActivity extends PreferenceCompatActivi @@ -146,6 +151,7 @@ public abstract class KeyBoundPreferencesActivity extends PreferenceCompatActivi
/**
* Updates a preference that simply shows a check box. No default value will be shown.
*
* @param baseName The base name of the stored preference, e.g. item_name, which will then actually be stored under
* item_name_[key]
* @return The concrete {@link CheckBoxPreference} that is bound to this preference
@ -156,6 +162,7 @@ public abstract class KeyBoundPreferencesActivity extends PreferenceCompatActivi @@ -156,6 +162,7 @@ public abstract class KeyBoundPreferencesActivity extends PreferenceCompatActivi
/**
* Updates a preference that simply shows a check box.
*
* @param baseName The base name of the stored preference, e.g. item_name, which will then actually be stored under
* item_name_[key]
* @param defValue The default value for this preference, as shown when no value was yet stored
@ -167,6 +174,7 @@ public abstract class KeyBoundPreferencesActivity extends PreferenceCompatActivi @@ -167,6 +174,7 @@ public abstract class KeyBoundPreferencesActivity extends PreferenceCompatActivi
/**
* Updates a preference (including dependency) that simply shows a check box.
*
* @param baseName The base name of the stored preference, e.g. item_name, which will then actually be stored under
* item_name_[key]
* @param defValue The default value for this preference, as shown when no value was yet stored
@ -185,6 +193,7 @@ public abstract class KeyBoundPreferencesActivity extends PreferenceCompatActivi @@ -185,6 +193,7 @@ public abstract class KeyBoundPreferencesActivity extends PreferenceCompatActivi
/**
* Updates a preference that allows picking an item from a list. No default value will be shown.
*
* @param baseName The base name of the stored preference, e.g. item_name, which will then actually be stored under
* item_name_[key]
* @return The concrete {@link ListPreference} that is bound to this preference
@ -195,6 +204,7 @@ public abstract class KeyBoundPreferencesActivity extends PreferenceCompatActivi @@ -195,6 +204,7 @@ public abstract class KeyBoundPreferencesActivity extends PreferenceCompatActivi
/**
* Updates a preference that allows picking an item from a list.
*
* @param baseName The base name of the stored preference, e.g. item_name, which will then actually be stored under
* item_name_[key]
* @param defValue The default value for this preference, as shown when no value was yet stored

2
app/src/main/java/org/transdroid/core/gui/settings/MainSettingsActivity.java

@ -26,6 +26,7 @@ import android.content.SharedPreferences; @@ -26,6 +26,7 @@ import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import androidx.preference.ListPreference;
import androidx.preference.Preference;
import androidx.preference.Preference.OnPreferenceClickListener;
@ -55,6 +56,7 @@ import java.util.List; @@ -55,6 +56,7 @@ import java.util.List;
/**
* The main activity that provides access to all application settings. It shows the configured serves, web search sites and RSS feeds along with other
* general settings.
*
* @author Eric Kok
*/
@EActivity

2
app/src/main/java/org/transdroid/core/gui/settings/PreferenceCompatActivity.java

@ -76,4 +76,4 @@ public class PreferenceCompatActivity extends AppCompatActivity implements AppCo @@ -76,4 +76,4 @@ public class PreferenceCompatActivity extends AppCompatActivity implements AppCo
}
}
}
}
}

2
app/src/main/java/org/transdroid/core/gui/settings/RingtonePreference.java

@ -62,7 +62,7 @@ public class RingtonePreference extends Preference { @@ -62,7 +62,7 @@ public class RingtonePreference extends Preference {
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_RINGTONE && resultCode == Activity.RESULT_OK && data != null && data.getExtras() != null) {
Uri ringtone = (Uri) data.getExtras().get(RingtoneManager.EXTRA_RINGTONE_PICKED_URI);
getSharedPreferences().edit().putString(getKey(), ringtone == null? "": ringtone.toString()).apply();
getSharedPreferences().edit().putString(getKey(), ringtone == null ? "" : ringtone.toString()).apply();
}
}
}

3
app/src/main/java/org/transdroid/core/gui/settings/RssfeedPreference.java

@ -24,6 +24,7 @@ import org.transdroid.core.app.settings.RssfeedSetting; @@ -24,6 +24,7 @@ import org.transdroid.core.app.settings.RssfeedSetting;
/**
* Represents a {@link RssfeedSetting} in a preferences screen.
*
* @author Eric Kok
*/
public class RssfeedPreference extends Preference {
@ -41,6 +42,7 @@ public class RssfeedPreference extends Preference { @@ -41,6 +42,7 @@ public class RssfeedPreference extends Preference {
/**
* Set the RSS feed settings object that is bound to this preference item
*
* @param rssfeedSetting The RSS feed settings
* @return Itself, for method chaining
*/
@ -54,6 +56,7 @@ public class RssfeedPreference extends Preference { @@ -54,6 +56,7 @@ public class RssfeedPreference extends Preference {
/**
* Set a listener that will be notified of click events on this preference
*
* @param onRssfeedClickedListener The click listener to register
* @return Itself, for method chaining
*/

1
app/src/main/java/org/transdroid/core/gui/settings/RssfeedSettingsActivity.java

@ -34,6 +34,7 @@ import org.transdroid.core.app.settings.ApplicationSettings_; @@ -34,6 +34,7 @@ import org.transdroid.core.app.settings.ApplicationSettings_;
/**
* Activity that allows for a configuration of some RSS feed. The key can be supplied to update an existing RSS feed setting instead of creating a new
* one.
*
* @author Eric Kok
*/
@EActivity

3
app/src/main/java/org/transdroid/core/gui/settings/ServerPreference.java

@ -24,6 +24,7 @@ import org.transdroid.core.app.settings.ServerSetting; @@ -24,6 +24,7 @@ import org.transdroid.core.app.settings.ServerSetting;
/**
* Represents a {@link ServerSetting} in a preferences screen.
*
* @author Eric Kok
*/
public class ServerPreference extends Preference {
@ -41,6 +42,7 @@ public class ServerPreference extends Preference { @@ -41,6 +42,7 @@ public class ServerPreference extends Preference {
/**
* Set the server settings object that is bound to this preference item
*
* @param serverSetting The server settings
* @return Itself, for method chaining
*/
@ -54,6 +56,7 @@ public class ServerPreference extends Preference { @@ -54,6 +56,7 @@ public class ServerPreference extends Preference {
/**
* Set a listener that will be notified of click events on this preference
*
* @param onServerClickedListener The click listener to register
* @return Itself, for method chaining
*/

1
app/src/main/java/org/transdroid/core/gui/settings/ServerSettingsActivity.java

@ -42,6 +42,7 @@ import org.transdroid.daemon.Daemon; @@ -42,6 +42,7 @@ import org.transdroid.daemon.Daemon;
/**
* Activity that allows for a configuration of a server. The key can be supplied to update an existing server setting instead of creating a new one.
*
* @author Eric Kok
*/
@EActivity

3
app/src/main/java/org/transdroid/core/gui/settings/WebsearchPreference.java

@ -24,6 +24,7 @@ import org.transdroid.core.app.settings.WebsearchSetting; @@ -24,6 +24,7 @@ import org.transdroid.core.app.settings.WebsearchSetting;
/**
* Represents a {@link WebsearchSetting} in a preferences screen.
*
* @author Eric Kok
*/
public class WebsearchPreference extends Preference {
@ -41,6 +42,7 @@ public class WebsearchPreference extends Preference { @@ -41,6 +42,7 @@ public class WebsearchPreference extends Preference {
/**
* Set the websearch settings object that is bound to this preference item
*
* @param websearchSetting The websearch settings
* @return Itself, for method chaining
*/
@ -54,6 +56,7 @@ public class WebsearchPreference extends Preference { @@ -54,6 +56,7 @@ public class WebsearchPreference extends Preference {
/**
* Set a listener that will be notified of click events on this preference
*
* @param onWebsearchClickedListener The click listener to register
* @return Itself, for method chaining
*/

1
app/src/main/java/org/transdroid/core/gui/settings/WebsearchSettingsActivity.java

@ -34,6 +34,7 @@ import android.os.Bundle; @@ -34,6 +34,7 @@ import android.os.Bundle;
/**
* Activity that allows for a configuration of a web search site. The key can be supplied to update an existing web
* search site setting instead of creating a new one.
*
* @author Eric Kok
*/
@EActivity

2
app/src/main/java/org/transdroid/core/rssparser/Item.java

@ -101,6 +101,7 @@ public class Item implements Parcelable { @@ -101,6 +101,7 @@ public class Item implements Parcelable {
/**
* Returns 'the' item link as string, which preferably is the enclosure URL, but otherwise the link (or null if that
* is empty too).
*
* @return A single link URL string to be used
*/
public String getTheLink() {
@ -114,6 +115,7 @@ public class Item implements Parcelable { @@ -114,6 +115,7 @@ public class Item implements Parcelable {
/**
* Returns 'the' item link as URI, which preferably is the enclosure URL, but otherwise the link (or null if that is
* empty too).
*
* @return A single link URI to be used
*/
public Uri getTheLinkUri() {

5
app/src/main/java/org/transdroid/core/rssparser/RssParser.java

@ -47,6 +47,7 @@ public class RssParser extends DefaultHandler { @@ -47,6 +47,7 @@ public class RssParser extends DefaultHandler {
/**
* The constructor for the RSS parser; call {@link #parse()} to synchronously create an HTTP connection and parse
* the RSS feed contents. The results can be retrieved with {@link #getChannel()}.
*
* @param url The url of the feed to retrieve
* @param excludeFilter A |-separated list of words that may not be included in the item title or they are excluded
* @param includeFilter A |-separated list of words that need to be included in the item title or they are excluded
@ -74,6 +75,7 @@ public class RssParser extends DefaultHandler { @@ -74,6 +75,7 @@ public class RssParser extends DefaultHandler {
/**
* Returns the loaded RSS feed as channel which contains the individual {@link Item}s
*
* @return A channel object that contains the feed details and individual items
*/
public Channel getChannel() {
@ -82,6 +84,7 @@ public class RssParser extends DefaultHandler { @@ -82,6 +84,7 @@ public class RssParser extends DefaultHandler {
/**
* Initialises an HTTP connection, retrieves the content and parses the RSS feed as standard XML.
*
* @throws ParserConfigurationException Thrown if the SX parser is not working corectly
* @throws SAXException Thrown if the SAX parser can encounters non-standard XML content
* @throws IOException Thrown if the RSS feed content can not be retrieved, such as when no connection is available
@ -152,6 +155,7 @@ public class RssParser extends DefaultHandler { @@ -152,6 +155,7 @@ public class RssParser extends DefaultHandler {
/**
* By default creates a standard Item (with title, description and links), which may to overridden to add more data
* (i.e. custom tags that a feed may supply).
*
* @return A possibly decorated Item instance
*/
protected Item createNewItem() {
@ -282,6 +286,7 @@ public class RssParser extends DefaultHandler { @@ -282,6 +286,7 @@ public class RssParser extends DefaultHandler {
/**
* May be overridden to add additional data from tags that are not standard in RSS. Not used by this default RSS
* style parser. Usually used in conjunction with {@link #createNewItem()}.
*
* @param localName The tag name
* @param item The Item we are currently parsing
* @param text The new text content

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save