Browse Source

.editorconfig part 3: Entry rearrangement

pull/559/head
TacoTheDank 4 years ago
parent
commit
6dc1b85b2a
  1. 2
      app/src/main/AndroidManifest.xml
  2. 8
      app/src/main/java/org/transdroid/core/app/search/SearchHelper.java
  3. 43
      app/src/main/java/org/transdroid/core/app/search/SearchResult.java
  4. 56
      app/src/main/java/org/transdroid/core/app/settings/ApplicationSettings.java
  5. 2
      app/src/main/java/org/transdroid/core/app/settings/RssfeedSetting.java
  6. 9
      app/src/main/java/org/transdroid/core/app/settings/SettingsPersistence.java
  7. 3
      app/src/main/java/org/transdroid/core/app/settings/WebsearchSetting.java
  8. 3
      app/src/main/java/org/transdroid/core/gui/DetailsActivity.java
  9. 340
      app/src/main/java/org/transdroid/core/gui/DetailsFragment.java
  10. 26
      app/src/main/java/org/transdroid/core/gui/ServerPickerDialog.java
  11. 11
      app/src/main/java/org/transdroid/core/gui/ServerStatusView.java
  12. 69
      app/src/main/java/org/transdroid/core/gui/TorrentsActivity.java
  13. 259
      app/src/main/java/org/transdroid/core/gui/TorrentsFragment.java
  14. 67
      app/src/main/java/org/transdroid/core/gui/lists/LocalTorrent.java
  15. 4
      app/src/main/java/org/transdroid/core/gui/lists/PiecesMapView.java
  16. 12
      app/src/main/java/org/transdroid/core/gui/lists/SimpleListItemAdapter.java
  17. 3
      app/src/main/java/org/transdroid/core/gui/lists/TorrentFilePriorityLayout.java
  18. 37
      app/src/main/java/org/transdroid/core/gui/lists/TorrentProgressBar.java
  19. 3
      app/src/main/java/org/transdroid/core/gui/lists/TorrentStatusLayout.java
  20. 3
      app/src/main/java/org/transdroid/core/gui/lists/TorrentsAdapter.java
  21. 34
      app/src/main/java/org/transdroid/core/gui/log/ErrorLogEntry.java
  22. 56
      app/src/main/java/org/transdroid/core/gui/navigation/DialogHelper.java
  23. 6
      app/src/main/java/org/transdroid/core/gui/navigation/FilterListAdapter.java
  24. 86
      app/src/main/java/org/transdroid/core/gui/navigation/Label.java
  25. 132
      app/src/main/java/org/transdroid/core/gui/navigation/NavigationHelper.java
  26. 22
      app/src/main/java/org/transdroid/core/gui/navigation/SelectionModificationSpinner.java
  27. 26
      app/src/main/java/org/transdroid/core/gui/navigation/SetTransferRatesDialog.java
  28. 29
      app/src/main/java/org/transdroid/core/gui/navigation/StatusType.java
  29. 116
      app/src/main/java/org/transdroid/core/gui/rss/RssFeedsActivity.java
  30. 8
      app/src/main/java/org/transdroid/core/gui/rss/RssItemsFragment.java
  31. 3
      app/src/main/java/org/transdroid/core/gui/rss/RssfeedsAdapter.java
  32. 3
      app/src/main/java/org/transdroid/core/gui/rss/RssitemsAdapter.java
  33. 39
      app/src/main/java/org/transdroid/core/gui/search/SearchActivity.java
  34. 3
      app/src/main/java/org/transdroid/core/gui/search/SearchResultsAdapter.java
  35. 135
      app/src/main/java/org/transdroid/core/gui/search/SearchResultsFragment.java
  36. 3
      app/src/main/java/org/transdroid/core/gui/search/SearchSitesAdapter.java
  37. 50
      app/src/main/java/org/transdroid/core/gui/settings/HelpSettingsActivity.java
  38. 15
      app/src/main/java/org/transdroid/core/gui/settings/KeyBoundPreferencesActivity.java
  39. 17
      app/src/main/java/org/transdroid/core/gui/settings/RssfeedPreference.java
  40. 17
      app/src/main/java/org/transdroid/core/gui/settings/ServerPreference.java
  41. 4
      app/src/main/java/org/transdroid/core/gui/settings/ServerSettingsActivity.java
  42. 24
      app/src/main/java/org/transdroid/core/gui/settings/SystemSettingsActivity.java
  43. 17
      app/src/main/java/org/transdroid/core/gui/settings/WebsearchPreference.java
  44. 85
      app/src/main/java/org/transdroid/core/rssparser/Channel.java
  45. 92
      app/src/main/java/org/transdroid/core/rssparser/Item.java
  46. 17
      app/src/main/java/org/transdroid/core/seedbox/SeedboxPreference.java
  47. 3
      app/src/main/java/org/transdroid/core/seedbox/XirvikSharedSettingsActivity.java
  48. 12
      app/src/main/java/org/transdroid/core/widget/ListWidgetConfigActivity.java
  49. 4
      app/src/main/java/org/transdroid/daemon/Daemon.java
  50. 20
      app/src/main/java/org/transdroid/daemon/DaemonException.java
  51. 11
      app/src/main/java/org/transdroid/daemon/DaemonMethod.java
  52. 19
      app/src/main/java/org/transdroid/daemon/Deluge/DelugeRemoteRssChannel.java
  53. 20
      app/src/main/java/org/transdroid/daemon/Deluge/DelugeRemoteRssItem.java
  54. 5
      app/src/main/java/org/transdroid/daemon/Deluge/DelugeRpcClient.java
  55. 33
      app/src/main/java/org/transdroid/daemon/Label.java
  56. 11
      app/src/main/java/org/transdroid/daemon/Priority.java
  57. 38
      app/src/main/java/org/transdroid/daemon/Tfb4rt/Tfb4rtAdapter.java
  58. 32
      app/src/main/java/org/transdroid/daemon/Torrent.java
  59. 19
      app/src/main/java/org/transdroid/daemon/TorrentDetails.java
  60. 80
      app/src/main/java/org/transdroid/daemon/TorrentFile.java
  61. 11
      app/src/main/java/org/transdroid/daemon/TorrentFilesSortBy.java
  62. 11
      app/src/main/java/org/transdroid/daemon/TorrentStatus.java
  63. 11
      app/src/main/java/org/transdroid/daemon/TorrentsSortBy.java
  64. 3
      app/src/main/java/org/transdroid/daemon/Utorrent/UtorrentAdapter.java
  65. 20
      app/src/main/java/org/transdroid/daemon/Utorrent/data/UTorrentRemoteRssChannel.java
  66. 22
      app/src/main/java/org/transdroid/daemon/Utorrent/data/UTorrentRemoteRssItem.java
  67. 74
      app/src/main/java/org/transdroid/daemon/Vuze/VuzeXmlOverHttpClient.java
  68. 19
      app/src/main/java/org/transdroid/daemon/util/FileSizeConverter.java
  69. 8
      app/src/main/res/drawable-night/details_list_background.xml
  70. 8
      app/src/main/res/drawable/activatable_background.xml
  71. 8
      app/src/main/res/drawable/details_list_background.xml
  72. 8
      app/src/main/res/layout-land/dialog_color_picker.xml
  73. 2
      app/src/main/res/layout-w600dp/activity_search.xml
  74. 22
      app/src/main/res/layout-w600dp/activity_torrents.xml
  75. 30
      app/src/main/res/layout-w900dp/activity_torrents.xml
  76. 4
      app/src/main/res/layout/actionbar_addbutton.xml
  77. 4
      app/src/main/res/layout/actionbar_donebutton.xml
  78. 4
      app/src/main/res/layout/actionbar_serverselection.xml
  79. 18
      app/src/main/res/layout/actionbar_serverstatus.xml
  80. 2
      app/src/main/res/layout/activity_search.xml
  81. 14
      app/src/main/res/layout/activity_torrents.xml
  82. 2
      app/src/main/res/layout/activity_widgetconfig.xml
  83. 8
      app/src/main/res/layout/dialog_about.xml
  84. 8
      app/src/main/res/layout/dialog_changelog.xml
  85. 6
      app/src/main/res/layout/dialog_color_picker.xml
  86. 16
      app/src/main/res/layout/dialog_setlabel.xml
  87. 4
      app/src/main/res/layout/dialog_trackers.xml
  88. 8
      app/src/main/res/layout/fragment_details.xml
  89. 22
      app/src/main/res/layout/fragment_details_header.xml
  90. 4
      app/src/main/res/layout/fragment_remoterss.xml
  91. 2
      app/src/main/res/layout/fragment_rssfeeds.xml
  92. 2
      app/src/main/res/layout/fragment_rssitems.xml
  93. 2
      app/src/main/res/layout/fragment_searchresults.xml
  94. 8
      app/src/main/res/layout/fragment_torrents.xml
  95. 4
      app/src/main/res/layout/list_item_filter.xml
  96. 8
      app/src/main/res/layout/list_item_remoterssitem.xml
  97. 6
      app/src/main/res/layout/list_item_rssfeed.xml
  98. 4
      app/src/main/res/layout/list_item_rssitem.xml
  99. 10
      app/src/main/res/layout/list_item_searchresult.xml
  100. 4
      app/src/main/res/layout/list_item_searchsite.xml
  101. Some files were not shown because too many files have changed in this diff Show More

2
app/src/main/AndroidManifest.xml

@ -50,9 +50,9 @@ @@ -50,9 +50,9 @@
<application
android:name=".core.gui.TransdroidApp_"
android:allowBackup="true"
android:banner="@drawable/banner"
android:hardwareAccelerated="true"
android:icon="@drawable/ic_launcher"
android:banner="@drawable/banner"
android:label="@string/app_name"
android:theme="@style/Theme.AppCompat"
android:usesCleartextTraffic="true">

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

@ -53,10 +53,6 @@ public class SearchHelper { @@ -53,10 +53,6 @@ public class SearchHelper {
@RootContext
protected Context context;
public enum SearchSortOrder {
Combined, BySeeders
}
/**
* Return whether the Torrent Search package is installed and available to query against
*
@ -169,4 +165,8 @@ public class SearchHelper { @@ -169,4 +165,8 @@ public class SearchHelper {
}
}
public enum SearchSortOrder {
Combined, BySeeders
}
}

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

@ -28,6 +28,15 @@ import java.util.Date; @@ -28,6 +28,15 @@ import java.util.Date;
*/
public class SearchResult implements Parcelable {
public static final Parcelable.Creator<SearchResult> CREATOR = new Parcelable.Creator<SearchResult>() {
public SearchResult createFromParcel(Parcel in) {
return new SearchResult(in);
}
public SearchResult[] newArray(int size) {
return new SearchResult[size];
}
};
private final int id;
private final String name;
private final String torrentUrl;
@ -49,6 +58,18 @@ public class SearchResult implements Parcelable { @@ -49,6 +58,18 @@ public class SearchResult implements Parcelable {
this.leechers = leechers;
}
public SearchResult(Parcel in) {
id = in.readInt();
name = in.readString();
torrentUrl = in.readString();
detailsUrl = in.readString();
size = in.readString();
long addedOnIn = in.readLong();
addedOn = addedOnIn == -1 ? null : new Date(addedOnIn);
seeders = in.readString();
leechers = in.readString();
}
public int getId() {
return id;
}
@ -98,26 +119,4 @@ public class SearchResult implements Parcelable { @@ -98,26 +119,4 @@ public class SearchResult implements Parcelable {
out.writeString(leechers);
}
public static final Parcelable.Creator<SearchResult> CREATOR = new Parcelable.Creator<SearchResult>() {
public SearchResult createFromParcel(Parcel in) {
return new SearchResult(in);
}
public SearchResult[] newArray(int size) {
return new SearchResult[size];
}
};
public SearchResult(Parcel in) {
id = in.readInt();
name = in.readString();
torrentUrl = in.readString();
detailsUrl = in.readString();
size = in.readString();
long addedOnIn = in.readLong();
addedOn = addedOnIn == -1 ? null : new Date(addedOnIn);
seeders = in.readString();
leechers = in.readString();
}
}

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

@ -60,9 +60,9 @@ public class ApplicationSettings { @@ -60,9 +60,9 @@ public class ApplicationSettings {
@RootContext
protected Context context;
private SharedPreferences prefs;
@Bean
protected SearchHelper searchHelper;
private SharedPreferences prefs;
protected ApplicationSettings(Context context) {
prefs = PreferenceManager.getDefaultSharedPreferences(context);
@ -348,6 +348,15 @@ public class ApplicationSettings { @@ -348,6 +348,15 @@ public class ApplicationSettings {
return getServerSetting(last);
}
/**
* 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) {
setLastUsedServerKey(server.getOrder());
}
/**
* 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
@ -359,15 +368,6 @@ public class ApplicationSettings { @@ -359,15 +368,6 @@ public class ApplicationSettings {
return prefs.getInt("system_lastusedserver", -1);
}
/**
* 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) {
setLastUsedServerKey(server.getOrder());
}
/**
* Registers the order number/unique key of some server as being last used by the user
*
@ -590,6 +590,15 @@ public class ApplicationSettings { @@ -590,6 +590,15 @@ public class ApplicationSettings {
.getStatus(prefs.getInt("system_lastusedsortorder", TorrentsSortBy.Alphanumeric.getCode()));
}
/**
* Returns the search sort order property that the user last used.
*
* @return The last used sort order enumeration value
*/
public SearchSortOrder getLastUsedSearchSortOrder() {
return SearchSortOrder.values()[(prefs.getInt("system_lastusedsearchsortorder", SearchSortOrder.BySeeders.ordinal()))];
}
/**
* Registers the search list sort order as being last used by the user
*
@ -601,15 +610,6 @@ public class ApplicationSettings { @@ -601,15 +610,6 @@ public class ApplicationSettings {
edit.apply();
}
/**
* Returns the search sort order property that the user last used.
*
* @return The last used sort order enumeration value
*/
public SearchSortOrder getLastUsedSearchSortOrder() {
return SearchSortOrder.values()[(prefs.getInt("system_lastusedsearchsortorder", SearchSortOrder.BySeeders.ordinal()))];
}
/**
* Returns the sort order direction that the user last used. Use together with {@link #getLastUsedSortOrder()} to
* get the full last used sort settings.
@ -686,6 +686,15 @@ public class ApplicationSettings { @@ -686,6 +686,15 @@ public class ApplicationSettings {
return null;
}
/**
* 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) {
prefs.edit().putString("header_setsearchsite", site.getKey()).apply();
}
/**
* 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
@ -698,15 +707,6 @@ public class ApplicationSettings { @@ -698,15 +707,6 @@ public class ApplicationSettings {
return prefs.getString("header_setsearchsite", null);
}
/**
* 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) {
prefs.edit().putString("header_setsearchsite", site.getKey()).apply();
}
/**
* Returns the statistics of this server as it was last seen by the background server checker service.
*

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

@ -39,8 +39,8 @@ public class RssfeedSetting implements SimpleListItem { @@ -39,8 +39,8 @@ public class RssfeedSetting implements SimpleListItem {
private final boolean alarm;
private final String excludeFilter;
private final String includeFilter;
private Date lastViewed;
private final String lastViewedItemUrl;
private Date lastViewed;
public RssfeedSetting(int order, String name, String baseUrl, boolean needsAuth, boolean alarm, String excludeFilter, String includeFilter, Date lastViewed,
String lastViewedItemUrl) {

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

@ -44,15 +44,14 @@ import java.io.OutputStream; @@ -44,15 +44,14 @@ import java.io.OutputStream;
@EBean(scope = Scope.Singleton)
public class SettingsPersistence {
@Bean
protected ApplicationSettings applicationSettings;
@Bean
protected SystemSettings systemSettings;
public static final String DEFAULT_SETTINGS_DIR = Environment.getExternalStorageDirectory().toString()
+ "/Transdroid/";
public static final String DEFAULT_SETTINGS_FILENAME = "settings.json";
public static final File DEFAULT_SETTINGS_FILE = new File(DEFAULT_SETTINGS_DIR + DEFAULT_SETTINGS_FILENAME);
@Bean
protected ApplicationSettings applicationSettings;
@Bean
protected SystemSettings systemSettings;
/**
* 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.

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

@ -29,9 +29,8 @@ import org.transdroid.core.gui.search.SearchSetting; @@ -29,9 +29,8 @@ import org.transdroid.core.gui.search.SearchSetting;
*/
public class WebsearchSetting implements SimpleListItem, SearchSetting {
private static final String DEFAULT_NAME = "Default";
public static final String KEY_PREFIX = "websearch_";
private static final String DEFAULT_NAME = "Default";
private final int order;
private final String name;
private final String baseUrl;

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

@ -106,13 +106,12 @@ public class DetailsActivity extends AppCompatActivity implements TorrentTasksEx @@ -106,13 +106,12 @@ public class DetailsActivity extends AppCompatActivity implements TorrentTasksEx
protected ConnectivityHelper connectivityHelper;
@Bean
protected ApplicationSettings applicationSettings;
private IDaemonAdapter currentConnection = null;
// Details view components
@ViewById
protected Toolbar selectionToolbar;
@FragmentById(R.id.torrentdetails_fragment)
protected DetailsFragment fragmentDetails;
private IDaemonAdapter currentConnection = null;
@Override
public void onCreate(Bundle savedInstanceState) {

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

@ -96,8 +96,6 @@ public class DetailsFragment extends Fragment implements OnTrackersUpdatedListen @@ -96,8 +96,6 @@ public class DetailsFragment extends Fragment implements OnTrackersUpdatedListen
protected boolean isLoadingTorrent = false;
@InstanceState
protected boolean hasCriticalError = false;
private ServerSetting currentServerSettings = null;
// Views
@ViewById
protected View detailsContainer;
@ -113,6 +111,175 @@ public class DetailsFragment extends Fragment implements OnTrackersUpdatedListen @@ -113,6 +111,175 @@ public class DetailsFragment extends Fragment implements OnTrackersUpdatedListen
protected TextView emptyText, errorText;
@ViewById
protected ProgressBar loadingProgress;
private ServerSetting currentServerSettings = null;
private MultiChoiceModeListener onDetailsSelected = new MultiChoiceModeListener() {
SelectionManagerMode selectionManagerMode;
@Override
public boolean onCreateActionMode(final ActionMode mode, Menu menu) {
// Show contextual action bar to start/stop/remove/etc. torrents in batch mode
detailsMenu.setEnabled(false);
contextualMenu.setVisibility(View.VISIBLE);
contextualMenu.setOnMenuItemClickListener(new ActionMenuView.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem menuItem) {
return onActionItemClicked(mode, menuItem);
}
});
contextualMenu.getMenu().clear();
getActivity().getMenuInflater().inflate(R.menu.fragment_details_cab_main, contextualMenu.getMenu());
Context themedContext = ((AppCompatActivity) getActivity()).getSupportActionBar().getThemedContext();
mode.getMenuInflater().inflate(R.menu.fragment_details_cab_secondary, menu);
selectionManagerMode = new SelectionManagerMode(themedContext, detailsList, R.plurals.navigation_filesselected);
selectionManagerMode.setOnlyCheckClass(TorrentFile.class);
selectionManagerMode.onCreateActionMode(mode, menu);
return true;
}
@Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
selectionManagerMode.onPrepareActionMode(mode, menu);
// Pause autorefresh
if (getActivity() != null && getActivity() instanceof TorrentsActivity) {
((TorrentsActivity) getActivity()).stopRefresh = true;
((TorrentsActivity) getActivity()).stopAutoRefresh();
}
boolean filePaths = currentServerSettings != null && Daemon.supportsFilePaths(currentServerSettings.getType());
contextualMenu.getMenu().findItem(R.id.action_download).setVisible(filePaths);
boolean filePriorities = currentServerSettings != null && Daemon.supportsFilePrioritySetting(currentServerSettings.getType());
contextualMenu.getMenu().findItem(R.id.action_priority_off).setVisible(filePriorities);
contextualMenu.getMenu().findItem(R.id.action_priority_low).setVisible(filePriorities);
contextualMenu.getMenu().findItem(R.id.action_priority_normal).setVisible(filePriorities);
contextualMenu.getMenu().findItem(R.id.action_priority_high).setVisible(filePriorities);
return true;
}
@SuppressLint("SdCardPath")
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
// Get checked torrents
List<TorrentFile> checked = new ArrayList<>();
for (int i = 0; i < detailsList.getCheckedItemPositions().size(); i++) {
if (detailsList.getCheckedItemPositions().valueAt(i) && i < detailsList.getAdapter().getCount() &&
detailsList.getAdapter().getItem(detailsList.getCheckedItemPositions().keyAt(i)) instanceof TorrentFile) {
checked.add((TorrentFile) detailsList.getAdapter().getItem(detailsList.getCheckedItemPositions().keyAt(i)));
}
}
int itemId = item.getItemId();
if (itemId == R.id.action_download) {
if (checked.size() < 1 || currentServerSettings == null) {
return true;
}
String urlBase = currentServerSettings.getFtpUrl();
if (urlBase == null || urlBase.equals("")) {
urlBase = "ftp://" + currentServerSettings.getAddress() + "/";
}
// Try using AndFTP intents
Intent andftpStart = new Intent(Intent.ACTION_PICK);
andftpStart.setDataAndType(Uri.parse(urlBase), "vnd.android.cursor.dir/lysesoft.andftp.uri");
andftpStart.putExtra("command_type", "download");
andftpStart.putExtra("ftp_pasv", "true");
if (Uri.parse(urlBase).getUserInfo() != null) {
andftpStart.putExtra("ftp_username", Uri.parse(urlBase).getUserInfo());
} else {
andftpStart.putExtra("ftp_username", currentServerSettings.getUsername());
}
if (currentServerSettings.getFtpPassword() != null && !currentServerSettings.getFtpPassword().equals("")) {
andftpStart.putExtra("ftp_password", currentServerSettings.getFtpPassword());
} else {
andftpStart.putExtra("ftp_password", currentServerSettings.getPassword());
}
// Note: AndFTP doesn't understand the directory that Environment.getExternalStoragePublicDirectory()
// uses :(
andftpStart.putExtra("local_folder", "/sdcard/Download");
for (int f = 0; f < checked.size(); f++) {
String file = checked.get(f).getRelativePath();
if (file != null) {
// If the file is directly in the root, AndFTP fails if we supply the proper path (like
// /file.pdf)
// Work around this bug by removing the leading / if no further directories are used in the path
if (file.startsWith("/") && file.indexOf("/", 1) < 0) {
file = file.substring(1);
}
andftpStart.putExtra("remote_file" + (f + 1), file);
}
}
if (andftpStart.resolveActivity(getActivity().getPackageManager()) != null) {
startActivity(andftpStart);
mode.finish();
return true;
}
// Try using a VIEW intent given an ftp:// scheme URI
String url = urlBase + checked.get(0).getRelativePath();
Intent simpleStart = new Intent(Intent.ACTION_VIEW, Uri.parse(url)).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if (simpleStart.resolveActivity(getActivity().getPackageManager()) != null) {
startActivity(simpleStart);
mode.finish();
return true;
}
// No app is available that can handle FTP downloads
SnackbarManager.show(Snackbar.with(getActivity()).text(getString(R.string.error_noftpapp, url)).type(SnackbarType.MULTI_LINE)
.colorResource(R.color.red));
mode.finish();
return true;
} else if (itemId == R.id.action_copytoclipboard) {
StringBuilder names = new StringBuilder();
for (int f = 0; f < checked.size(); f++) {
if (f != 0) {
names.append("\n");
}
names.append(checked.get(f).getName());
}
ClipboardManager clipboardManager = (ClipboardManager) getActivity().getSystemService(Context.CLIPBOARD_SERVICE);
clipboardManager.setPrimaryClip(ClipData.newPlainText("Transdroid", names.toString()));
mode.finish();
return true;
} else {
Priority priority = Priority.Off;
if (itemId == R.id.action_priority_low) {
priority = Priority.Low;
}
if (itemId == R.id.action_priority_normal) {
priority = Priority.Normal;
}
if (itemId == R.id.action_priority_high) {
priority = Priority.High;
}
if (getTasksExecutor() != null)
getTasksExecutor().updatePriority(torrent, checked, priority);
mode.finish();
return true;
}
}
@Override
public void onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) {
selectionManagerMode.onItemCheckedStateChanged(mode, position, id, checked);
}
@Override
public void onDestroyActionMode(ActionMode mode) {
// Resume autorefresh
if (getActivity() != null && getActivity() instanceof TorrentsActivity) {
((TorrentsActivity) getActivity()).stopRefresh = false;
((TorrentsActivity) getActivity()).startAutoRefresh();
}
selectionManagerMode.onDestroyActionMode(mode);
contextualMenu.setVisibility(View.GONE);
detailsMenu.setEnabled(true);
}
};
@AfterViews
protected void init() {
@ -516,175 +683,6 @@ public class DetailsFragment extends Fragment implements OnTrackersUpdatedListen @@ -516,175 +683,6 @@ public class DetailsFragment extends Fragment implements OnTrackersUpdatedListen
}
}
private MultiChoiceModeListener onDetailsSelected = new MultiChoiceModeListener() {
SelectionManagerMode selectionManagerMode;
@Override
public boolean onCreateActionMode(final ActionMode mode, Menu menu) {
// Show contextual action bar to start/stop/remove/etc. torrents in batch mode
detailsMenu.setEnabled(false);
contextualMenu.setVisibility(View.VISIBLE);
contextualMenu.setOnMenuItemClickListener(new ActionMenuView.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem menuItem) {
return onActionItemClicked(mode, menuItem);
}
});
contextualMenu.getMenu().clear();
getActivity().getMenuInflater().inflate(R.menu.fragment_details_cab_main, contextualMenu.getMenu());
Context themedContext = ((AppCompatActivity) getActivity()).getSupportActionBar().getThemedContext();
mode.getMenuInflater().inflate(R.menu.fragment_details_cab_secondary, menu);
selectionManagerMode = new SelectionManagerMode(themedContext, detailsList, R.plurals.navigation_filesselected);
selectionManagerMode.setOnlyCheckClass(TorrentFile.class);
selectionManagerMode.onCreateActionMode(mode, menu);
return true;
}
@Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
selectionManagerMode.onPrepareActionMode(mode, menu);
// Pause autorefresh
if (getActivity() != null && getActivity() instanceof TorrentsActivity) {
((TorrentsActivity) getActivity()).stopRefresh = true;
((TorrentsActivity) getActivity()).stopAutoRefresh();
}
boolean filePaths = currentServerSettings != null && Daemon.supportsFilePaths(currentServerSettings.getType());
contextualMenu.getMenu().findItem(R.id.action_download).setVisible(filePaths);
boolean filePriorities = currentServerSettings != null && Daemon.supportsFilePrioritySetting(currentServerSettings.getType());
contextualMenu.getMenu().findItem(R.id.action_priority_off).setVisible(filePriorities);
contextualMenu.getMenu().findItem(R.id.action_priority_low).setVisible(filePriorities);
contextualMenu.getMenu().findItem(R.id.action_priority_normal).setVisible(filePriorities);
contextualMenu.getMenu().findItem(R.id.action_priority_high).setVisible(filePriorities);
return true;
}
@SuppressLint("SdCardPath")
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
// Get checked torrents
List<TorrentFile> checked = new ArrayList<>();
for (int i = 0; i < detailsList.getCheckedItemPositions().size(); i++) {
if (detailsList.getCheckedItemPositions().valueAt(i) && i < detailsList.getAdapter().getCount() &&
detailsList.getAdapter().getItem(detailsList.getCheckedItemPositions().keyAt(i)) instanceof TorrentFile) {
checked.add((TorrentFile) detailsList.getAdapter().getItem(detailsList.getCheckedItemPositions().keyAt(i)));
}
}
int itemId = item.getItemId();
if (itemId == R.id.action_download) {
if (checked.size() < 1 || currentServerSettings == null) {
return true;
}
String urlBase = currentServerSettings.getFtpUrl();
if (urlBase == null || urlBase.equals("")) {
urlBase = "ftp://" + currentServerSettings.getAddress() + "/";
}
// Try using AndFTP intents
Intent andftpStart = new Intent(Intent.ACTION_PICK);
andftpStart.setDataAndType(Uri.parse(urlBase), "vnd.android.cursor.dir/lysesoft.andftp.uri");
andftpStart.putExtra("command_type", "download");
andftpStart.putExtra("ftp_pasv", "true");
if (Uri.parse(urlBase).getUserInfo() != null) {
andftpStart.putExtra("ftp_username", Uri.parse(urlBase).getUserInfo());
} else {
andftpStart.putExtra("ftp_username", currentServerSettings.getUsername());
}
if (currentServerSettings.getFtpPassword() != null && !currentServerSettings.getFtpPassword().equals("")) {
andftpStart.putExtra("ftp_password", currentServerSettings.getFtpPassword());
} else {
andftpStart.putExtra("ftp_password", currentServerSettings.getPassword());
}
// Note: AndFTP doesn't understand the directory that Environment.getExternalStoragePublicDirectory()
// uses :(
andftpStart.putExtra("local_folder", "/sdcard/Download");
for (int f = 0; f < checked.size(); f++) {
String file = checked.get(f).getRelativePath();
if (file != null) {
// If the file is directly in the root, AndFTP fails if we supply the proper path (like
// /file.pdf)
// Work around this bug by removing the leading / if no further directories are used in the path
if (file.startsWith("/") && file.indexOf("/", 1) < 0) {
file = file.substring(1);
}
andftpStart.putExtra("remote_file" + (f + 1), file);
}
}
if (andftpStart.resolveActivity(getActivity().getPackageManager()) != null) {
startActivity(andftpStart);
mode.finish();
return true;
}
// Try using a VIEW intent given an ftp:// scheme URI
String url = urlBase + checked.get(0).getRelativePath();
Intent simpleStart = new Intent(Intent.ACTION_VIEW, Uri.parse(url)).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if (simpleStart.resolveActivity(getActivity().getPackageManager()) != null) {
startActivity(simpleStart);
mode.finish();
return true;
}
// No app is available that can handle FTP downloads
SnackbarManager.show(Snackbar.with(getActivity()).text(getString(R.string.error_noftpapp, url)).type(SnackbarType.MULTI_LINE)
.colorResource(R.color.red));
mode.finish();
return true;
} else if (itemId == R.id.action_copytoclipboard) {
StringBuilder names = new StringBuilder();
for (int f = 0; f < checked.size(); f++) {
if (f != 0) {
names.append("\n");
}
names.append(checked.get(f).getName());
}
ClipboardManager clipboardManager = (ClipboardManager) getActivity().getSystemService(Context.CLIPBOARD_SERVICE);
clipboardManager.setPrimaryClip(ClipData.newPlainText("Transdroid", names.toString()));
mode.finish();
return true;
} else {
Priority priority = Priority.Off;
if (itemId == R.id.action_priority_low) {
priority = Priority.Low;
}
if (itemId == R.id.action_priority_normal) {
priority = Priority.Normal;
}
if (itemId == R.id.action_priority_high) {
priority = Priority.High;
}
if (getTasksExecutor() != null)
getTasksExecutor().updatePriority(torrent, checked, priority);
mode.finish();
return true;
}
}
@Override
public void onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) {
selectionManagerMode.onItemCheckedStateChanged(mode, position, id, checked);
}
@Override
public void onDestroyActionMode(ActionMode mode) {
// Resume autorefresh
if (getActivity() != null && getActivity() instanceof TorrentsActivity) {
((TorrentsActivity) getActivity()).stopRefresh = false;
((TorrentsActivity) getActivity()).startAutoRefresh();
}
selectionManagerMode.onDestroyActionMode(mode);
contextualMenu.setVisibility(View.GONE);
detailsMenu.setEnabled(true);
}
};
/**
* Returns the object responsible for executing torrent tasks against a connected server
*

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

@ -30,19 +30,6 @@ import java.util.List; @@ -30,19 +30,6 @@ import java.util.List;
public class ServerPickerDialog extends DialogFragment {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
String[] serverNames = getArguments().getStringArray("serverNames");
return new AlertDialog.Builder(getActivity()).setTitle(R.string.navigation_pickserver)
.setItems(serverNames, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (getActivity() != null && getActivity() instanceof TorrentsActivity)
((TorrentsActivity) getActivity()).switchServerAndAddFromIntent(which);
}
}).create();
}
/**
* 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.
@ -63,4 +50,17 @@ public class ServerPickerDialog extends DialogFragment { @@ -63,4 +50,17 @@ public class ServerPickerDialog extends DialogFragment {
dialog.show(activity.getFragmentManager(), "serverpicker");
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
String[] serverNames = getArguments().getStringArray("serverNames");
return new AlertDialog.Builder(getActivity()).setTitle(R.string.navigation_pickserver)
.setItems(serverNames, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (getActivity() != null && getActivity() instanceof TorrentsActivity)
((TorrentsActivity) getActivity()).switchServerAndAddFromIntent(which);
}
}).create();
}
}

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

@ -42,6 +42,11 @@ public class ServerStatusView extends RelativeLayout implements OnRatesPickedLis @@ -42,6 +42,11 @@ public class ServerStatusView extends RelativeLayout implements OnRatesPickedLis
@ViewById
protected View speedswrapperLayout;
private TorrentsActivity activity;
private OnClickListener onStartDownPickerClicked = new OnClickListener() {
public void onClick(View v) {
SetTransferRatesDialog.show(getContext(), ServerStatusView.this);
}
};
public ServerStatusView(Context context) {
super(context);
@ -100,12 +105,6 @@ public class ServerStatusView extends RelativeLayout implements OnRatesPickedLis @@ -100,12 +105,6 @@ public class ServerStatusView extends RelativeLayout implements OnRatesPickedLis
}
private OnClickListener onStartDownPickerClicked = new OnClickListener() {
public void onClick(View v) {
SetTransferRatesDialog.show(getContext(), ServerStatusView.this);
}
};
@Override
public void onRatesPicked(int maxDownloadSpeed, int maxUploadSpeed) {
activity.updateMaxSpeeds(maxDownloadSpeed, maxUploadSpeed);

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

@ -188,12 +188,6 @@ public class TorrentsActivity extends AppCompatActivity implements TorrentTasksE @@ -188,12 +188,6 @@ public class TorrentsActivity extends AppCompatActivity implements TorrentTasksE
protected ListView filtersList;
@ViewById
protected SearchView filterSearch;
private ListView navigationList;
private FilterListAdapter navigationListAdapter;
private ServerSelectionView serverSelectionView;
private ServerStatusView serverStatusView;
private ActionBarDrawerToggle drawerToggle;
// Settings
@Bean
protected ApplicationSettings applicationSettings;
@ -214,6 +208,11 @@ public class TorrentsActivity extends AppCompatActivity implements TorrentTasksE @@ -214,6 +208,11 @@ public class TorrentsActivity extends AppCompatActivity implements TorrentTasksE
protected DetailsFragment fragmentDetails;
@InstanceState
boolean firstStart = true;
private ListView navigationList;
private FilterListAdapter navigationListAdapter;
private ServerSelectionView serverSelectionView;
private ServerStatusView serverStatusView;
private ActionBarDrawerToggle drawerToggle;
private MenuItem searchMenu = null;
private IDaemonAdapter currentConnection = null;
@ -222,6 +221,34 @@ public class TorrentsActivity extends AppCompatActivity implements TorrentTasksE @@ -222,6 +221,34 @@ public class TorrentsActivity extends AppCompatActivity implements TorrentTasksE
private String awaitingAddLocalFile;
private String awaitingAddTitle;
/**
* Handles item selections on the dedicated list of filter items
*/
private OnItemClickListener onFilterListItemClicked = new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
navigationList.setItemChecked(position, true);
Object item = navigationList.getAdapter().getItem(position);
if (item instanceof SimpleListItem) {
filterSelected((SimpleListItem) item, false);
}
if (drawerLayout != null)
drawerLayout.closeDrawer(drawerContainer);
}
};
private SearchView.OnQueryTextListener filterQueryTextChanged = new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
return false;
}
@Override
public boolean onQueryTextChange(String newText) {
// Redirect to filter method which will directly apply it
filterTorrents(newText);
return true;
}
};
@Override
public void onCreate(Bundle savedInstanceState) {
@ -524,22 +551,6 @@ public class TorrentsActivity extends AppCompatActivity implements TorrentTasksE @@ -524,22 +551,6 @@ public class TorrentsActivity extends AppCompatActivity implements TorrentTasksE
return drawerToggle != null && drawerToggle.onOptionsItemSelected(item);
}
/**
* Handles item selections on the dedicated list of filter items
*/
private OnItemClickListener onFilterListItemClicked = new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
navigationList.setItemChecked(position, true);
Object item = navigationList.getAdapter().getItem(position);
if (item instanceof SimpleListItem) {
filterSelected((SimpleListItem) item, false);
}
if (drawerLayout != null)
drawerLayout.closeDrawer(drawerContainer);
}
};
/**
* A new filter was selected; update the view over the current data
*
@ -876,20 +887,6 @@ public class TorrentsActivity extends AppCompatActivity implements TorrentTasksE @@ -876,20 +887,6 @@ public class TorrentsActivity extends AppCompatActivity implements TorrentTasksE
fragmentTorrents.sortBy(TorrentsSortBy.Size);
}
private SearchView.OnQueryTextListener filterQueryTextChanged = new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
return false;
}
@Override
public boolean onQueryTextChange(String newText) {
// Redirect to filter method which will directly apply it
filterTorrents(newText);
return true;
}
};
/**
* Redirect the newly entered list filter to the torrents fragment.
*

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

@ -71,13 +71,13 @@ import java.util.Locale; @@ -71,13 +71,13 @@ import java.util.Locale;
@EFragment(R.layout.fragment_torrents)
public class TorrentsFragment extends Fragment implements OnLabelPickedListener {
// HACK Working around #391 while hopefully we rework the UI in the future to persist the list in db or something
protected static ArrayList<Torrent> torrents = null;
// Local data
@Bean
protected ApplicationSettings applicationSettings;
@Bean
protected SystemSettings systemSettings;
// HACK Working around #391 while hopefully we rework the UI in the future to persist the list in db or something
protected static ArrayList<Torrent> torrents = null;
@InstanceState
protected ArrayList<Torrent> lastMultiSelectedTorrents;
@InstanceState
@ -112,6 +112,133 @@ public class TorrentsFragment extends Fragment implements OnLabelPickedListener @@ -112,6 +112,133 @@ public class TorrentsFragment extends Fragment implements OnLabelPickedListener
protected TextView errorText;
@ViewById
protected ProgressBar loadingProgress;
private MultiChoiceModeListener onTorrentsSelected = new MultiChoiceModeListener() {
private SelectionManagerMode selectionManagerMode;
private ActionMenuView actionsMenu;
private Toolbar actionsToolbar;
private FloatingActionsMenu addmenuButton;
@Override
public boolean onCreateActionMode(final ActionMode mode, Menu menu) {
// Show contextual action bars to start/stop/remove/etc. torrents in batch mode
if (actionsMenu == null) {
actionsMenu = ((TorrentsActivity) getActivity()).contextualMenu;
actionsToolbar = ((TorrentsActivity) getActivity()).actionsToolbar;
addmenuButton = ((TorrentsActivity) getActivity()).addmenuButton;
}
actionsToolbar.setEnabled(false);
actionsMenu.setVisibility(View.VISIBLE);
addmenuButton.setVisibility(View.GONE);
actionsMenu.setOnMenuItemClickListener(new ActionMenuView.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem menuItem) {
return onActionItemClicked(mode, menuItem);
}
});
actionsMenu.getMenu().clear();
getActivity().getMenuInflater().inflate(R.menu.fragment_torrents_cab, actionsMenu.getMenu());
Context themedContext = ((AppCompatActivity) getActivity()).getSupportActionBar().getThemedContext();
selectionManagerMode = new SelectionManagerMode(themedContext, torrentsList, R.plurals.navigation_torrentsselected);
selectionManagerMode.onCreateActionMode(mode, menu);
return true;
}
@Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
selectionManagerMode.onPrepareActionMode(mode, menu);
// Hide/show options depending on the type of server we are connected to
if (daemonType != null) {
actionsMenu.getMenu().findItem(R.id.action_start).setVisible(Daemon.supportsStoppingStarting(daemonType));
actionsMenu.getMenu().findItem(R.id.action_stop).setVisible(Daemon.supportsStoppingStarting(daemonType));
actionsMenu.getMenu().findItem(R.id.action_setlabel).setVisible(Daemon.supportsSetLabel(daemonType));
}
// Pause autorefresh
if (getActivity() != null && getActivity() instanceof TorrentsActivity) {
((TorrentsActivity) getActivity()).stopRefresh = true;
((TorrentsActivity) getActivity()).stopAutoRefresh();
}
return true;
}
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
// Get checked torrents
ArrayList<Torrent> checked = new ArrayList<>();
for (int i = 0; i < torrentsList.getCheckedItemPositions().size(); i++) {
if (torrentsList.getCheckedItemPositions().valueAt(i) && i < torrentsList.getAdapter().getCount()) {
checked.add((Torrent) torrentsList.getAdapter().getItem(torrentsList.getCheckedItemPositions().keyAt(i)));
}
}
int itemId = item.getItemId();
if (itemId == R.id.action_resume) {
for (Torrent torrent : checked) {
getTasksExecutor().resumeTorrent(torrent);
}
mode.finish();
return true;
} else if (itemId == R.id.action_pause) {
for (Torrent torrent : checked) {
getTasksExecutor().pauseTorrent(torrent);
}
mode.finish();
return true;
} else if (itemId == R.id.action_start) {
for (Torrent torrent : checked) {
getTasksExecutor().startTorrent(torrent, false);
}
mode.finish();
return true;
} else if (itemId == R.id.action_stop) {
for (Torrent torrent : checked) {
getTasksExecutor().stopTorrent(torrent);
}
mode.finish();
return true;
} else if (itemId == R.id.action_remove_default) {
for (Torrent torrent : checked) {
getTasksExecutor().removeTorrent(torrent, false);
}
mode.finish();
return true;
} else if (itemId == R.id.action_remove_withdata) {
for (Torrent torrent : checked) {
getTasksExecutor().removeTorrent(torrent, true);
}
mode.finish();
return true;
} else if (itemId == R.id.action_setlabel) {
lastMultiSelectedTorrents = checked;
if (currentLabels != null) {
SetLabelDialog.show(getActivity(), TorrentsFragment.this, currentLabels);
}
mode.finish();
return true;
} else {
return false;
}
}
@Override
public void onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) {
selectionManagerMode.onItemCheckedStateChanged(mode, position, id, checked);
}
@Override
public void onDestroyActionMode(ActionMode mode) {
// Resume autorefresh
if (getActivity() != null && getActivity() instanceof TorrentsActivity) {
((TorrentsActivity) getActivity()).stopRefresh = false;
((TorrentsActivity) getActivity()).startAutoRefresh();
}
selectionManagerMode.onDestroyActionMode(mode);
actionsMenu.setVisibility(View.GONE);
actionsToolbar.setEnabled(true);
addmenuButton.setVisibility(View.VISIBLE);
}
};
@AfterViews
protected void init() {
@ -272,134 +399,6 @@ public class TorrentsFragment extends Fragment implements OnLabelPickedListener @@ -272,134 +399,6 @@ public class TorrentsFragment extends Fragment implements OnLabelPickedListener
updateViewVisibility();
}
private MultiChoiceModeListener onTorrentsSelected = new MultiChoiceModeListener() {
private SelectionManagerMode selectionManagerMode;
private ActionMenuView actionsMenu;
private Toolbar actionsToolbar;
private FloatingActionsMenu addmenuButton;
@Override
public boolean onCreateActionMode(final ActionMode mode, Menu menu) {
// Show contextual action bars to start/stop/remove/etc. torrents in batch mode
if (actionsMenu == null) {
actionsMenu = ((TorrentsActivity) getActivity()).contextualMenu;
actionsToolbar = ((TorrentsActivity) getActivity()).actionsToolbar;
addmenuButton = ((TorrentsActivity) getActivity()).addmenuButton;
}
actionsToolbar.setEnabled(false);
actionsMenu.setVisibility(View.VISIBLE);
addmenuButton.setVisibility(View.GONE);
actionsMenu.setOnMenuItemClickListener(new ActionMenuView.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem menuItem) {
return onActionItemClicked(mode, menuItem);
}
});
actionsMenu.getMenu().clear();
getActivity().getMenuInflater().inflate(R.menu.fragment_torrents_cab, actionsMenu.getMenu());
Context themedContext = ((AppCompatActivity) getActivity()).getSupportActionBar().getThemedContext();
selectionManagerMode = new SelectionManagerMode(themedContext, torrentsList, R.plurals.navigation_torrentsselected);
selectionManagerMode.onCreateActionMode(mode, menu);
return true;
}
@Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
selectionManagerMode.onPrepareActionMode(mode, menu);
// Hide/show options depending on the type of server we are connected to
if (daemonType != null) {
actionsMenu.getMenu().findItem(R.id.action_start).setVisible(Daemon.supportsStoppingStarting(daemonType));
actionsMenu.getMenu().findItem(R.id.action_stop).setVisible(Daemon.supportsStoppingStarting(daemonType));
actionsMenu.getMenu().findItem(R.id.action_setlabel).setVisible(Daemon.supportsSetLabel(daemonType));
}
// Pause autorefresh
if (getActivity() != null && getActivity() instanceof TorrentsActivity) {
((TorrentsActivity) getActivity()).stopRefresh = true;
((TorrentsActivity) getActivity()).stopAutoRefresh();
}
return true;
}
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
// Get checked torrents
ArrayList<Torrent> checked = new ArrayList<>();
for (int i = 0; i < torrentsList.getCheckedItemPositions().size(); i++) {
if (torrentsList.getCheckedItemPositions().valueAt(i) && i < torrentsList.getAdapter().getCount()) {
checked.add((Torrent) torrentsList.getAdapter().getItem(torrentsList.getCheckedItemPositions().keyAt(i)));
}
}
int itemId = item.getItemId();
if (itemId == R.id.action_resume) {
for (Torrent torrent : checked) {
getTasksExecutor().resumeTorrent(torrent);
}
mode.finish();
return true;
} else if (itemId == R.id.action_pause) {
for (Torrent torrent : checked) {
getTasksExecutor().pauseTorrent(torrent);
}
mode.finish();
return true;
} else if (itemId == R.id.action_start) {
for (Torrent torrent : checked) {
getTasksExecutor().startTorrent(torrent, false);
}
mode.finish();
return true;
} else if (itemId == R.id.action_stop) {
for (Torrent torrent : checked) {
getTasksExecutor().stopTorrent(torrent);
}
mode.finish();
return true;
} else if (itemId == R.id.action_remove_default) {
for (Torrent torrent : checked) {
getTasksExecutor().removeTorrent(torrent, false);
}
mode.finish();
return true;
} else if (itemId == R.id.action_remove_withdata) {
for (Torrent torrent : checked) {
getTasksExecutor().removeTorrent(torrent, true);
}
mode.finish();
return true;
} else if (itemId == R.id.action_setlabel) {
lastMultiSelectedTorrents = checked;
if (currentLabels != null) {
SetLabelDialog.show(getActivity(), TorrentsFragment.this, currentLabels);
}
mode.finish();
return true;
} else {
return false;
}
}
@Override
public void onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) {
selectionManagerMode.onItemCheckedStateChanged(mode, position, id, checked);
}
@Override
public void onDestroyActionMode(ActionMode mode) {
// Resume autorefresh
if (getActivity() != null && getActivity() instanceof TorrentsActivity) {
((TorrentsActivity) getActivity()).stopRefresh = false;
((TorrentsActivity) getActivity()).startAutoRefresh();
}
selectionManagerMode.onDestroyActionMode(mode);
actionsMenu.setVisibility(View.GONE);
actionsToolbar.setEnabled(true);
addmenuButton.setVisibility(View.VISIBLE);
}
};
@Click
protected void emptyTextClicked() {
// Refresh the activity (that contains this fragment) when the empty view gear is clicked

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

@ -35,6 +35,14 @@ import java.util.Locale; @@ -35,6 +35,14 @@ import java.util.Locale;
*/
public class LocalTorrent {
private static final String DECIMAL_FORMATTER = "%.1f";
private static final String DECIMAL_FORMATTER_2 = "%.2f";
private final Torrent t;
private LocalTorrent(Torrent torrent) {
this.t = torrent;
}
/**
* Creates the LocalTorrent object so that the translatable/formattable version of a Torrent can be used.
*
@ -45,14 +53,32 @@ public class LocalTorrent { @@ -45,14 +53,32 @@ public class LocalTorrent {
return new LocalTorrent(torrent);
}
private final Torrent t;
private LocalTorrent(Torrent torrent) {
this.t = torrent;
/**
* 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
*/
public static int getResourceForDaemonException(DaemonException e) {
switch (e.getType()) {
case MethodUnsupported:
return R.string.error_unsupported;
case ConnectionError:
return R.string.error_httperror;
case UnexpectedResponse:
return R.string.error_jsonresponseerror;
case ParsingFailed:
return R.string.error_jsonrequesterror;
case NotConnected:
return R.string.error_daemonnotconnected;
case AuthenticationFailure:
return R.string.error_401;
case FileAccessError:
return R.string.error_torrentfile;
default:
return R.string.error_httperror;
}
}
private static final String DECIMAL_FORMATTER = "%.1f";
private static final String DECIMAL_FORMATTER_2 = "%.2f";
/**
* Builds a string showing the upload/download seed ratio. If not downloading, it will base the ratio on the total
@ -230,31 +256,4 @@ public class LocalTorrent { @@ -230,31 +256,4 @@ public class LocalTorrent {
TimespanConverter.getTime(t.getEta(), inDays));
}
/**
* 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
*/
public static int getResourceForDaemonException(DaemonException e) {
switch (e.getType()) {
case MethodUnsupported:
return R.string.error_unsupported;
case ConnectionError:
return R.string.error_httperror;
case UnexpectedResponse:
return R.string.error_jsonresponseerror;
case ParsingFailed:
return R.string.error_jsonrequesterror;
case NotConnected:
return R.string.error_daemonnotconnected;
case AuthenticationFailure:
return R.string.error_401;
case FileAccessError:
return R.string.error_torrentfile;
default:
return R.string.error_httperror;
}
}
}

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

@ -15,12 +15,10 @@ class PiecesMapView extends View { @@ -15,12 +15,10 @@ class PiecesMapView extends View {
private final float scale = getContext().getResources().getDisplayMetrics().density;
private final int MINIMUM_HEIGHT = (int) (25 * scale);
private final int MINIMUM_PIECE_WIDTH = (int) (2 * scale);
private ArrayList<Integer> pieces = null;
private final Paint downloadingPaint = new Paint();
private final Paint donePaint = new Paint();
private final Paint partialDonePaint = new Paint();
private ArrayList<Integer> pieces = null;
public PiecesMapView(Context context) {
super(context);

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

@ -84,6 +84,12 @@ public class SimpleListItemAdapter extends BaseAdapter { @@ -84,6 +84,12 @@ public class SimpleListItemAdapter extends BaseAdapter {
*/
public static class SimpleStringItem implements SimpleListItem {
private final String string;
public SimpleStringItem(String string) {
this.string = string;
}
/**
* Wraps a simple string of strings into a list of SimpleStringItem to add as data to a
* {@link SimpleListItemAdapter}
@ -101,12 +107,6 @@ public class SimpleListItemAdapter extends BaseAdapter { @@ -101,12 +107,6 @@ public class SimpleListItemAdapter extends BaseAdapter {
return errors;
}
private final String string;
public SimpleStringItem(String string) {
this.string = string;
}
@Override
public String getName() {
return this.string;

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

@ -37,13 +37,12 @@ public class TorrentFilePriorityLayout extends RelativeLayout { @@ -37,13 +37,12 @@ public class TorrentFilePriorityLayout extends RelativeLayout {
private final float scale = getContext().getResources().getDisplayMetrics().density;
private final int WIDTH = (int) (6 * scale + 0.5f);
private Priority priority = null;
private final Paint offPaint = new Paint();
private final Paint lowPaint = new Paint();
private final Paint highPaint = new Paint();
private final Paint normalPaint = new Paint();
private final RectF fullRect = new RectF();
private Priority priority = null;
public TorrentFilePriorityLayout(Context context) {
super(context);

37
app/src/main/java/org/transdroid/core/gui/lists/TorrentProgressBar.java

@ -35,10 +35,6 @@ public class TorrentProgressBar extends View { @@ -35,10 +35,6 @@ public class TorrentProgressBar extends View {
private final float scale = getContext().getResources().getDisplayMetrics().density;
private final int MINIMUM_HEIGHT = (int) (3 * scale + 0.5f);
private int progress;
private boolean isActive;
private boolean isError;
private final Paint notdonePaint = new Paint();
private final Paint inactiveDonePaint = new Paint();
private final Paint inactivePaint = new Paint();
@ -47,21 +43,9 @@ public class TorrentProgressBar extends View { @@ -47,21 +43,9 @@ public class TorrentProgressBar extends View {
private final Paint errorPaint = new Paint();
private final RectF fullRect = new RectF();
private final RectF progressRect = new RectF();
public void setProgress(int progress) {
this.progress = progress;
this.invalidate();
}
public void setActive(boolean isActive) {
this.isActive = isActive;
this.invalidate();
}
public void setError(boolean isError) {
this.isError = isError;
this.invalidate();
}
private int progress;
private boolean isActive;
private boolean isError;
public TorrentProgressBar(Context context) {
super(context);
@ -81,6 +65,21 @@ public class TorrentProgressBar extends View { @@ -81,6 +65,21 @@ public class TorrentProgressBar extends View {
a.recycle();
}
public void setProgress(int progress) {
this.progress = progress;
this.invalidate();
}
public void setActive(boolean isActive) {
this.isActive = isActive;
this.invalidate();
}
public void setError(boolean isError) {
this.isError = isError;
this.invalidate();
}
private void initPaints() {
notdonePaint.setColor(getResources().getColor(R.color.torrent_background));
inactiveDonePaint.setColor(getResources().getColor(R.color.torrent_paused));

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

@ -37,14 +37,13 @@ public class TorrentStatusLayout extends RelativeLayout { @@ -37,14 +37,13 @@ public class TorrentStatusLayout extends RelativeLayout {
private final float scale = getContext().getResources().getDisplayMetrics().density;
private final int WIDTH = (int) (6 * scale + 0.5f);
private TorrentStatus status = null;
private final Paint pausedPaint = new Paint();
private final Paint otherPaint = new Paint();
private final Paint downloadingPaint = new Paint();
private final Paint seedingPaint = new Paint();
private final Paint errorPaint = new Paint();
private final RectF fullRect = new RectF();
private TorrentStatus status = null;
public TorrentStatusLayout(Context context) {
super(context);

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

@ -35,10 +35,9 @@ import java.util.ArrayList; @@ -35,10 +35,9 @@ import java.util.ArrayList;
@EBean
public class TorrentsAdapter extends BaseAdapter {
private ArrayList<Torrent> torrents = null;
@RootContext
protected Context context;
private ArrayList<Torrent> torrents = null;
/**
* Allows updating the full internal list of torrents at once, replacing the old list

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

@ -34,7 +34,15 @@ public class ErrorLogEntry implements Parcelable { @@ -34,7 +34,15 @@ public class ErrorLogEntry implements Parcelable {
public static final String ID = "logId";
public static final String DATEANDTIME = "dateAndTime";
public static final Parcelable.Creator<ErrorLogEntry> CREATOR = new Parcelable.Creator<ErrorLogEntry>() {
public ErrorLogEntry createFromParcel(Parcel in) {
return new ErrorLogEntry(in);
}
public ErrorLogEntry[] newArray(int size) {
return new ErrorLogEntry[size];
}
};
@DatabaseField(id = true, columnName = ID)
private Integer logId;
@DatabaseField(columnName = DATEANDTIME)
@ -56,6 +64,14 @@ public class ErrorLogEntry implements Parcelable { @@ -56,6 +64,14 @@ public class ErrorLogEntry implements Parcelable {
this.message = message;
}
private ErrorLogEntry(Parcel in) {
logId = in.readInt();
dateAndTime = new Date(in.readLong());
priority = in.readInt();
tag = in.readString();
message = in.readString();
}
public Integer getLogId() {
return logId;
}
@ -88,22 +104,4 @@ public class ErrorLogEntry implements Parcelable { @@ -88,22 +104,4 @@ public class ErrorLogEntry implements Parcelable {
out.writeString(message);
}
public static final Parcelable.Creator<ErrorLogEntry> CREATOR = new Parcelable.Creator<ErrorLogEntry>() {
public ErrorLogEntry createFromParcel(Parcel in) {
return new ErrorLogEntry(in);
}
public ErrorLogEntry[] newArray(int size) {
return new ErrorLogEntry[size];
}
};
private ErrorLogEntry(Parcel in) {
logId = in.readInt();
dateAndTime = new Date(in.readLong());
priority = in.readInt();
tag = in.readString();
message = in.readString();
}
}

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

@ -45,6 +45,27 @@ public class DialogHelper extends Activity { @@ -45,6 +45,27 @@ public class DialogHelper extends Activity {
@Extra
protected DialogSpecification dialog;
/**
* 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
* will instead be opened as a full screen activity
*/
public static Dialog showDialog(Context context, DialogSpecification dialog) {
// If the device is large (i.e. a tablet) then return a dialog to show
if (!NavigationHelper_.getInstance_(context).isSmallScreen())
return new PopupDialog(context, dialog);
// This is a small device; create a full screen dialog (which is just an activity)
DialogHelper_.intent(context).dialog(dialog).start();
return null;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -70,24 +91,16 @@ public class DialogHelper extends Activity { @@ -70,24 +91,16 @@ 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
* will instead be opened as a full screen activity
* Specification for some dialog that can be show to the user, consisting of a custom layout and possibly an action
* bar menu. Warning: the action bar, and thus the menu options, is only shown when the dialog is presented as full
* screen activity. Use only for unimportant actions.
*/
public static Dialog showDialog(Context context, DialogSpecification dialog) {
// If the device is large (i.e. a tablet) then return a dialog to show
if (!NavigationHelper_.getInstance_(context).isSmallScreen())
return new PopupDialog(context, dialog);
public interface DialogSpecification extends Serializable {
int getDialogLayoutId();
// This is a small device; create a full screen dialog (which is just an activity)
DialogHelper_.intent(context).dialog(dialog).start();
return null;
int getDialogMenuId();
boolean onMenuItemSelected(Activity ownerActivity, int selectedItemId);
}
/**
@ -101,17 +114,4 @@ public class DialogHelper extends Activity { @@ -101,17 +114,4 @@ public class DialogHelper extends Activity {
}
}
/**
* Specification for some dialog that can be show to the user, consisting of a custom layout and possibly an action
* bar menu. Warning: the action bar, and thus the menu options, is only shown when the dialog is presented as full
* screen activity. Use only for unimportant actions.
*/
public interface DialogSpecification extends Serializable {
int getDialogLayoutId();
int getDialogMenuId();
boolean onMenuItemSelected(Activity ownerActivity, int selectedItemId);
}
}

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

@ -41,12 +41,12 @@ public class FilterListAdapter extends MergeAdapter { @@ -41,12 +41,12 @@ public class FilterListAdapter extends MergeAdapter {
@RootContext
protected Context context;
private FilterListItemAdapter serverItems = null;
private FilterListItemAdapter statusTypeItems = null;
private FilterListItemAdapter labelItems = null;
protected ViewHolderAdapter statusTypeSeparator;
protected ViewHolderAdapter labelSeperator;
protected ViewHolderAdapter serverSeparator;
private FilterListItemAdapter serverItems = null;
private FilterListItemAdapter statusTypeItems = null;
private FilterListItemAdapter labelItems = null;
/**
* Update the list of available servers

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

@ -34,8 +34,16 @@ import java.util.List; @@ -34,8 +34,16 @@ import java.util.List;
*/
public class Label implements SimpleListItem, NavigationFilter, Comparable<Label> {
private static String unnamedLabelText = null;
public static final Parcelable.Creator<Label> CREATOR = new Parcelable.Creator<Label>() {
public Label createFromParcel(Parcel in) {
return new Label(in);
}
public Label[] newArray(int size) {
return new Label[size];
}
};
private static String unnamedLabelText = null;
private final boolean isEmptyLabel;
private final String name;
private final int count;
@ -50,6 +58,39 @@ public class Label implements SimpleListItem, NavigationFilter, Comparable<Label @@ -50,6 +58,39 @@ public class Label implements SimpleListItem, NavigationFilter, Comparable<Label
this(daemonLabel.getName(), daemonLabel.getCount(), false);
}
private Label(Parcel in) {
this.name = in.readString();
this.count = in.readInt();
this.isEmptyLabel = in.readInt() == 1;
}
/**
* 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
*/
public static ArrayList<Label> convertToNavigationLabels(List<org.transdroid.daemon.Label> daemonLabels, String unnamedLabel) {
if (daemonLabels == null) {
return null;
}
ArrayList<Label> localLabels = new ArrayList<>();
unnamedLabelText = unnamedLabel;
for (org.transdroid.daemon.Label label : daemonLabels) {
if (label != null && !TextUtils.isEmpty(label.getName())) {
localLabels.add(new Label(label));
}
}
Collections.sort(localLabels);
// force unlabelled to be at the top
localLabels.add(0, new Label(unnamedLabel, -1, true));
return localLabels;
}
@Override
public String getName() {
if (TextUtils.isEmpty(this.name)) {
@ -91,49 +132,6 @@ public class Label implements SimpleListItem, NavigationFilter, Comparable<Label @@ -91,49 +132,6 @@ public class Label implements SimpleListItem, NavigationFilter, Comparable<Label
return this.name.compareTo(another.getName());
}
/**
* 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
*/
public static ArrayList<Label> convertToNavigationLabels(List<org.transdroid.daemon.Label> daemonLabels, String unnamedLabel) {
if (daemonLabels == null) {
return null;
}
ArrayList<Label> localLabels = new ArrayList<>();
unnamedLabelText = unnamedLabel;
for (org.transdroid.daemon.Label label : daemonLabels) {
if (label != null && !TextUtils.isEmpty(label.getName())) {
localLabels.add(new Label(label));
}
}
Collections.sort(localLabels);
// force unlabelled to be at the top
localLabels.add(0, new Label(unnamedLabel, -1, true));
return localLabels;
}
private Label(Parcel in) {
this.name = in.readString();
this.count = in.readInt();
this.isEmptyLabel = in.readInt() == 1;
}
public static final Parcelable.Creator<Label> CREATOR = new Parcelable.Creator<Label>() {
public Label createFromParcel(Parcel in) {
return new Label(in);
}
public Label[] newArray(int size) {
return new Label[size];
}
};
@Override
public int describeContents() {
return 0;

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

@ -70,6 +70,72 @@ public class NavigationHelper { @@ -70,6 +70,72 @@ public class NavigationHelper {
@RootContext
protected Context context;
/**
* 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)
*/
public static SpannableString buildCondensedFontString(String string) {
if (string == null) {
return null;
}
SpannableString s = new SpannableString(string);
s.setSpan(new TypefaceSpan("sans-serif-condensed"), 0, s.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
return s;
}
/**
* 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
*/
public static String extractNameFromUri(Uri rawTorrentUri) {
if (rawTorrentUri.getScheme() == null) {
// Probably an incorrect URI; just return the whole thing
return rawTorrentUri.toString();
}
if (rawTorrentUri.getScheme().equals("magnet")) {
// Magnet links might have a dn (display name) parameter
String dn = getQueryParameter(rawTorrentUri, "dn");
if (dn != null && !dn.equals("")) {
return dn;
}
// If not, try to return the hash that is specified as xt (exact topci)
String xt = getQueryParameter(rawTorrentUri, "xt");
if (xt != null && !xt.equals("")) {
return xt;
}
}
if (rawTorrentUri.isHierarchical()) {
String path = rawTorrentUri.getPath();
if (path != null) {
if (path.contains("/")) {
path = path.substring(path.lastIndexOf("/"));
}
return path;
}
}
// No idea what to do with this; return as is
return rawTorrentUri.toString();
}
private static String getQueryParameter(Uri uri, String parameter) {
int start = uri.toString().indexOf(parameter + "=");
if (start >= 0) {
int begin = start + (parameter + "=").length();
int end = uri.toString().indexOf("&", begin);
return uri.toString().substring(begin, end >= 0 ? end : uri.toString().length());
}
return null;
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public boolean checkTorrentReadPermission(final Activity activity) {
return Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT ||
@ -140,72 +206,6 @@ public class NavigationHelper { @@ -140,72 +206,6 @@ public class NavigationHelper {
return null;
}
/**
* 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)
*/
public static SpannableString buildCondensedFontString(String string) {
if (string == null) {
return null;
}
SpannableString s = new SpannableString(string);
s.setSpan(new TypefaceSpan("sans-serif-condensed"), 0, s.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
return s;
}
/**
* 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
*/
public static String extractNameFromUri(Uri rawTorrentUri) {
if (rawTorrentUri.getScheme() == null) {
// Probably an incorrect URI; just return the whole thing
return rawTorrentUri.toString();
}
if (rawTorrentUri.getScheme().equals("magnet")) {
// Magnet links might have a dn (display name) parameter
String dn = getQueryParameter(rawTorrentUri, "dn");
if (dn != null && !dn.equals("")) {
return dn;
}
// If not, try to return the hash that is specified as xt (exact topci)
String xt = getQueryParameter(rawTorrentUri, "xt");
if (xt != null && !xt.equals("")) {
return xt;
}
}
if (rawTorrentUri.isHierarchical()) {
String path = rawTorrentUri.getPath();
if (path != null) {
if (path.contains("/")) {
path = path.substring(path.lastIndexOf("/"));
}
return path;
}
}
// No idea what to do with this; return as is
return rawTorrentUri.toString();
}
private static String getQueryParameter(Uri uri, String parameter) {
int start = uri.toString().indexOf(parameter + "=");
if (start >= 0) {
int begin = start + (parameter + "=").length();
int end = uri.toString().indexOf("&", begin);
return uri.toString().substring(begin, end >= 0 ? end : uri.toString().length());
}
return null;
}
/**
* Returns (and initialises, if needed) an image cache that uses memory and (1MB) local storage.
*

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

@ -79,6 +79,17 @@ public class SelectionModificationSpinner extends Spinner { @@ -79,6 +79,17 @@ public class SelectionModificationSpinner extends Spinner {
super.setSelection(position);
}
/**
* Interface to implement if an interface want to respond to selection modification actions.
*/
public interface OnModificationActionSelectedListener {
public void selectAll();
public void selectFinished();
public void invertSelection();
}
/**
* Local adapter that holds the actions which can be performed and a title text view that always shows instead of a
* list item as in a normal spinner.
@ -109,15 +120,4 @@ public class SelectionModificationSpinner extends Spinner { @@ -109,15 +120,4 @@ public class SelectionModificationSpinner extends Spinner {
}
/**
* Interface to implement if an interface want to respond to selection modification actions.
*/
public interface OnModificationActionSelectedListener {
public void selectAll();
public void selectFinished();
public void invertSelection();
}
}

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

@ -30,6 +30,19 @@ import org.transdroid.core.app.settings.SettingsUtils; @@ -30,6 +30,19 @@ import org.transdroid.core.app.settings.SettingsUtils;
public class SetTransferRatesDialog {
private static OnClickListener onNumberClicked = new OnClickListener() {
@Override
public void onClick(View v) {
// Append the text contents of the button itself as text to the current number (as reference in the view's
// tag)
TextView numberView = (TextView) v.getTag();
if (numberView.getText().toString().equals(v.getContext().getString(R.string.status_maxspeed_novalue))) {
numberView.setText("");
}
numberView.setText(numberView.getText().toString() + ((Button) v).getText().toString());
}
};
/**
* A dialog fragment that allow picking of maximum download and upload transfer rates as well as the resetting of these values.
*
@ -88,19 +101,6 @@ public class SetTransferRatesDialog { @@ -88,19 +101,6 @@ public class SetTransferRatesDialog {
}
}
private static OnClickListener onNumberClicked = new OnClickListener() {
@Override
public void onClick(View v) {
// Append the text contents of the button itself as text to the current number (as reference in the view's
// tag)
TextView numberView = (TextView) v.getTag();
if (numberView.getText().toString().equals(v.getContext().getString(R.string.status_maxspeed_novalue))) {
numberView.setText("");
}
numberView.setText(numberView.getText().toString() + ((Button) v).getText().toString());
}
};
/**
* Listener interface to the user having picked or wanting to resets the current maximum transfer speeds;
*/

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

@ -92,6 +92,15 @@ public enum StatusType { @@ -92,6 +92,15 @@ public enum StatusType {
public static class StatusTypeFilter implements SimpleListItem, NavigationFilter {
public static final Parcelable.Creator<StatusTypeFilter> CREATOR = new Parcelable.Creator<StatusTypeFilter>() {
public StatusTypeFilter createFromParcel(Parcel in) {
return new StatusTypeFilter(in);
}
public StatusTypeFilter[] newArray(int size) {
return new StatusTypeFilter[size];
}
};
private final StatusType statusType;
private final String name;
@ -100,6 +109,11 @@ public enum StatusType { @@ -100,6 +109,11 @@ public enum StatusType {
this.name = name;
}
private StatusTypeFilter(Parcel in) {
this.statusType = StatusType.valueOf(in.readString());
this.name = in.readString();
}
public StatusType getStatusType() {
return statusType;
}
@ -139,21 +153,6 @@ public enum StatusType { @@ -139,21 +153,6 @@ public enum StatusType {
}
}
private StatusTypeFilter(Parcel in) {
this.statusType = StatusType.valueOf(in.readString());
this.name = in.readString();
}
public static final Parcelable.Creator<StatusTypeFilter> CREATOR = new Parcelable.Creator<StatusTypeFilter>() {
public StatusTypeFilter createFromParcel(Parcel in) {
return new StatusTypeFilter(in);
}
public StatusTypeFilter[] newArray(int size) {
return new StatusTypeFilter[size];
}
};
@Override
public int describeContents() {
return 0;

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

@ -79,15 +79,13 @@ import java.util.List; @@ -79,15 +79,13 @@ import java.util.List;
@EActivity(R.layout.activity_rssfeeds)
public class RssFeedsActivity extends AppCompatActivity {
protected static final int RSS_FEEDS_LOCAL = 0;
protected static final int RSS_FEEDS_REMOTE = 1;
// Settings and local data
@Bean
protected Log log;
@Bean
protected ApplicationSettings applicationSettings;
protected static final int RSS_FEEDS_LOCAL = 0;
protected static final int RSS_FEEDS_REMOTE = 1;
@FragmentById(R.id.rssfeeds_fragment)
protected RssFeedsFragment fragmentLocalFeeds;
@FragmentById(R.id.rssitems_fragment)
@ -112,61 +110,6 @@ public class RssFeedsActivity extends AppCompatActivity { @@ -112,61 +110,6 @@ public class RssFeedsActivity extends AppCompatActivity {
@Bean
protected ConnectivityHelper connectivityHelper;
protected class LayoutPagerAdapter extends PagerAdapter {
boolean hasRemoteRss;
String serverName;
public LayoutPagerAdapter(boolean hasRemoteRss, String name) {
super();
this.hasRemoteRss = hasRemoteRss;
this.serverName = (name.length() > 0 ? name : getString(R.string.navigation_rss_tabs_remote));
}
@NonNull
@Override
public Object instantiateItem(@NonNull ViewGroup container, int position) {
int resId = 0;
if (position == RSS_FEEDS_LOCAL) {
resId = R.id.layout_rssfeeds_local;
} else if (position == RSS_FEEDS_REMOTE) {
resId = R.id.layout_rss_feeds_remote;
}
return findViewById(resId);
}
@Override
public int getCount() {
return (this.hasRemoteRss ? 2 : 1);
}
@Override
public boolean isViewFromObject(@NonNull View view, @NonNull Object o) {
return (view == o);
}
@Override
public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
container.removeView((View) object);
}
@Nullable
@Override
public CharSequence getPageTitle(int position) {
switch (position) {
case RSS_FEEDS_LOCAL:
return getString(R.string.navigation_rss_tabs_local);
case RSS_FEEDS_REMOTE:
return this.serverName;
}
return super.getPageTitle(position);
}
}
@Override
public void onCreate(Bundle savedInstanceState) {
SettingsUtils.applyDayNightTheme(this);
@ -384,7 +327,6 @@ public class RssFeedsActivity extends AppCompatActivity { @@ -384,7 +327,6 @@ public class RssFeedsActivity extends AppCompatActivity {
SnackbarManager.show(Snackbar.with(this).text(error).colorResource(R.color.red).type(SnackbarType.MULTI_LINE));
}
public void onFeedSelected(int position) {
selectedFilter = position;
@ -442,4 +384,58 @@ public class RssFeedsActivity extends AppCompatActivity { @@ -442,4 +384,58 @@ public class RssFeedsActivity extends AppCompatActivity {
fragmentRemoteFeeds.updateChannelFilters(feedLabels);
}
protected class LayoutPagerAdapter extends PagerAdapter {
boolean hasRemoteRss;
String serverName;
public LayoutPagerAdapter(boolean hasRemoteRss, String name) {
super();
this.hasRemoteRss = hasRemoteRss;
this.serverName = (name.length() > 0 ? name : getString(R.string.navigation_rss_tabs_remote));
}
@NonNull
@Override
public Object instantiateItem(@NonNull ViewGroup container, int position) {
int resId = 0;
if (position == RSS_FEEDS_LOCAL) {
resId = R.id.layout_rssfeeds_local;
} else if (position == RSS_FEEDS_REMOTE) {
resId = R.id.layout_rss_feeds_remote;
}
return findViewById(resId);
}
@Override
public int getCount() {
return (this.hasRemoteRss ? 2 : 1);
}
@Override
public boolean isViewFromObject(@NonNull View view, @NonNull Object o) {
return (view == o);
}
@Override
public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
container.removeView((View) object);
}
@Nullable
@Override
public CharSequence getPageTitle(int position) {
switch (position) {
case RSS_FEEDS_LOCAL:
return getString(R.string.navigation_rss_tabs_local);
case RSS_FEEDS_REMOTE:
return this.serverName;
}
return super.getPageTitle(position);
}
}
}

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

@ -77,6 +77,10 @@ public class RssItemsFragment extends Fragment { @@ -77,6 +77,10 @@ public class RssItemsFragment extends Fragment {
// Views
@ViewById(R.id.rssitems_list)
protected ListView rssItemsList;
@Bean
protected RssitemsAdapter rssitemsAdapter;
@ViewById
protected TextView emptyText;
private MultiChoiceModeListener onItemsSelected = new MultiChoiceModeListener() {
SelectionManagerMode selectionManagerMode;
@ -182,10 +186,6 @@ public class RssItemsFragment extends Fragment { @@ -182,10 +186,6 @@ public class RssItemsFragment extends Fragment {
}
};
@Bean
protected RssitemsAdapter rssitemsAdapter;
@ViewById
protected TextView emptyText;
@AfterViews
protected void init() {

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

@ -35,10 +35,9 @@ import java.util.List; @@ -35,10 +35,9 @@ import java.util.List;
@EBean
public class RssfeedsAdapter extends BaseAdapter {
private List<RssfeedLoader> loaders = null;
@RootContext
protected Context context;
private List<RssfeedLoader> loaders = null;
/**
* Allows updating the full internal list of feed loaders at once, replacing the old list

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

@ -34,10 +34,9 @@ import org.transdroid.core.rssparser.Item; @@ -34,10 +34,9 @@ import org.transdroid.core.rssparser.Item;
@EBean
public class RssitemsAdapter extends BaseAdapter {
private Channel rssfeed = null;
@RootContext
protected Context context;
private Channel rssfeed = null;
/**
* Allows updating the full RSS feed (channel and contained items), replacing the old data

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

@ -87,6 +87,25 @@ public class SearchActivity extends AppCompatActivity { @@ -87,6 +87,25 @@ public class SearchActivity extends AppCompatActivity {
private List<SearchSetting> searchSites;
private SearchSetting lastUsedSite;
private String lastUsedQuery;
private OnItemClickListener onSearchSiteClicked = new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
lastUsedSite = searchSites.get(position);
refreshSearch();
}
};
private AdapterView.OnItemSelectedListener onSearchSiteSelected = new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
lastUsedSite = searchSites.get(position);
refreshSearch();
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
};
@Override
public void onCreate(Bundle savedInstanceState) {
@ -238,26 +257,6 @@ public class SearchActivity extends AppCompatActivity { @@ -238,26 +257,6 @@ public class SearchActivity extends AppCompatActivity {
return true;
}
private OnItemClickListener onSearchSiteClicked = new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
lastUsedSite = searchSites.get(position);
refreshSearch();
}
};
private AdapterView.OnItemSelectedListener onSearchSiteSelected = new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
lastUsedSite = searchSites.get(position);
refreshSearch();
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
};
/**
* Extracts the query string from the search {@link Intent}
*

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

@ -35,10 +35,9 @@ import java.util.List; @@ -35,10 +35,9 @@ import java.util.List;
@EBean
public class SearchResultsAdapter extends BaseAdapter {
private List<SearchResult> results = null;
@RootContext
protected Context context;
private List<SearchResult> results = null;
/**
* Allows updating the search results, replacing the old data

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

@ -80,74 +80,6 @@ public class SearchResultsFragment extends Fragment { @@ -80,74 +80,6 @@ public class SearchResultsFragment extends Fragment {
protected TextView emptyText;
@ViewById
protected ProgressBar loadingProgress;
@AfterViews
protected void init() {
// On large screens where this fragment is shown next to the sites list; we show a continues grey vertical line
// to separate the lists visually
if (!NavigationHelper_.getInstance_(getActivity()).isSmallScreen()) {
resultsList.setBackgroundResource(R.drawable.details_list_background);
}
// Set up the list adapter, which allows multi-select
resultsList.setAdapter(resultsAdapter);
resultsList.setMultiChoiceModeListener(onItemsSelected);
if (results != null) {
showResults();
}
}
public void startSearch(String query, SearchSite site, SearchSortOrder sortBy) {
loadingProgress.setVisibility(View.VISIBLE);
resultsList.setVisibility(View.GONE);
emptyText.setVisibility(View.GONE);
performSearch(query, site, sortBy);
}
@Background
protected void performSearch(String query, SearchSite site, SearchSortOrder sortBy) {
results = searchHelper.search(query, site, sortBy);
resultsSource = site.isPrivate() ? site.getKey() : null;
showResults();
}
@UiThread
protected void showResults() {
loadingProgress.setVisibility(View.GONE);
if (results == null || results.size() == 0) {
resultsList.setVisibility(View.GONE);
emptyText.setVisibility(View.VISIBLE);
return;
}
resultsAdapter.update(results);
resultsList.setVisibility(View.VISIBLE);
emptyText.setVisibility(View.GONE);
}
public void clearResults() {
loadingProgress.setVisibility(View.GONE);
resultsList.setVisibility(View.GONE);
emptyText.setVisibility(View.VISIBLE);
}
@ItemClick(R.id.searchresults_list)
protected void onItemClicked(SearchResult item) {
if (item.getTorrentUrl() == null) {
SnackbarManager.show(Snackbar.with(getActivity()).text(R.string.error_notorrentfile).colorResource(R.color.red));
return;
}
// Don't broadcast this intent; we can safely assume this is intended for Transdroid only
Intent i = TorrentsActivity_.intent(getActivity()).get();
i.setData(Uri.parse(item.getTorrentUrl()));
i.putExtra("TORRENT_TITLE", item.getName());
if (resultsSource != null) {
i.putExtra("PRIVATE_SOURCE", resultsSource);
}
startActivity(i);
}
private MultiChoiceModeListener onItemsSelected = new MultiChoiceModeListener() {
SelectionManagerMode selectionManagerMode;
@ -225,4 +157,71 @@ public class SearchResultsFragment extends Fragment { @@ -225,4 +157,71 @@ public class SearchResultsFragment extends Fragment {
};
@AfterViews
protected void init() {
// On large screens where this fragment is shown next to the sites list; we show a continues grey vertical line
// to separate the lists visually
if (!NavigationHelper_.getInstance_(getActivity()).isSmallScreen()) {
resultsList.setBackgroundResource(R.drawable.details_list_background);
}
// Set up the list adapter, which allows multi-select
resultsList.setAdapter(resultsAdapter);
resultsList.setMultiChoiceModeListener(onItemsSelected);
if (results != null) {
showResults();
}
}
public void startSearch(String query, SearchSite site, SearchSortOrder sortBy) {
loadingProgress.setVisibility(View.VISIBLE);
resultsList.setVisibility(View.GONE);
emptyText.setVisibility(View.GONE);
performSearch(query, site, sortBy);
}
@Background
protected void performSearch(String query, SearchSite site, SearchSortOrder sortBy) {
results = searchHelper.search(query, site, sortBy);
resultsSource = site.isPrivate() ? site.getKey() : null;
showResults();
}
@UiThread
protected void showResults() {
loadingProgress.setVisibility(View.GONE);
if (results == null || results.size() == 0) {
resultsList.setVisibility(View.GONE);
emptyText.setVisibility(View.VISIBLE);
return;
}
resultsAdapter.update(results);
resultsList.setVisibility(View.VISIBLE);
emptyText.setVisibility(View.GONE);
}
public void clearResults() {
loadingProgress.setVisibility(View.GONE);
resultsList.setVisibility(View.GONE);
emptyText.setVisibility(View.VISIBLE);
}
@ItemClick(R.id.searchresults_list)
protected void onItemClicked(SearchResult item) {
if (item.getTorrentUrl() == null) {
SnackbarManager.show(Snackbar.with(getActivity()).text(R.string.error_notorrentfile).colorResource(R.color.red));
return;
}
// Don't broadcast this intent; we can safely assume this is intended for Transdroid only
Intent i = TorrentsActivity_.intent(getActivity()).get();
i.setData(Uri.parse(item.getTorrentUrl()));
i.putExtra("TORRENT_TITLE", item.getName());
if (resultsSource != null) {
i.putExtra("PRIVATE_SOURCE", resultsSource);
}
startActivity(i);
}
}

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

@ -36,10 +36,9 @@ import java.util.List; @@ -36,10 +36,9 @@ import java.util.List;
@EBean
public class SearchSitesAdapter extends BaseAdapter {
private List<SearchSetting> sites = null;
@RootContext
protected Context context;
private List<SearchSetting> sites = null;
/**
* Allows updating the full internal list of sites at once, replacing the old list

50
app/src/main/java/org/transdroid/core/gui/settings/HelpSettingsActivity.java

@ -51,30 +51,6 @@ public class HelpSettingsActivity extends PreferenceCompatActivity { @@ -51,30 +51,6 @@ public class HelpSettingsActivity extends PreferenceCompatActivity {
protected ErrorLogSender errorLogSender;
@Bean
protected SettingsPersistence settingsPersistence;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
// Just load the system-related preferences from XML
addPreferencesFromResource(R.xml.pref_help);
// Handle outgoing links and preference changes
findPreference("system_sendlog").setOnPreferenceClickListener(onSendLogClick);
findPreference("system_installhelp").setOnPreferenceClickListener(onInstallHelpClick);
findPreference("system_changelog").setOnPreferenceClickListener(onChangeLogClick);
findPreference("system_about").setTitle(getString(R.string.pref_about, getString(R.string.app_name)));
findPreference("system_about").setOnPreferenceClickListener(onAboutClick);
}
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@OptionsItem(android.R.id.home)
protected void navigateUp() {
MainSettingsActivity_.intent(this).flags(Intent.FLAG_ACTIVITY_CLEAR_TOP).start();
}
private OnPreferenceClickListener onSendLogClick = new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
@ -82,7 +58,6 @@ public class HelpSettingsActivity extends PreferenceCompatActivity { @@ -82,7 +58,6 @@ public class HelpSettingsActivity extends PreferenceCompatActivity {
return true;
}
};
private OnPreferenceClickListener onInstallHelpClick = new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
@ -90,7 +65,6 @@ public class HelpSettingsActivity extends PreferenceCompatActivity { @@ -90,7 +65,6 @@ public class HelpSettingsActivity extends PreferenceCompatActivity {
return true;
}
};
private OnPreferenceClickListener onChangeLogClick = new OnPreferenceClickListener() {
@SuppressWarnings("deprecation")
@Override
@ -99,7 +73,6 @@ public class HelpSettingsActivity extends PreferenceCompatActivity { @@ -99,7 +73,6 @@ public class HelpSettingsActivity extends PreferenceCompatActivity {
return true;
}
};
private OnPreferenceClickListener onAboutClick = new OnPreferenceClickListener() {
@SuppressWarnings("deprecation")
@Override
@ -109,6 +82,29 @@ public class HelpSettingsActivity extends PreferenceCompatActivity { @@ -109,6 +82,29 @@ public class HelpSettingsActivity extends PreferenceCompatActivity {
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
// Just load the system-related preferences from XML
addPreferencesFromResource(R.xml.pref_help);
// Handle outgoing links and preference changes
findPreference("system_sendlog").setOnPreferenceClickListener(onSendLogClick);
findPreference("system_installhelp").setOnPreferenceClickListener(onInstallHelpClick);
findPreference("system_changelog").setOnPreferenceClickListener(onChangeLogClick);
findPreference("system_about").setTitle(getString(R.string.pref_about, getString(R.string.app_name)));
findPreference("system_about").setOnPreferenceClickListener(onAboutClick);
}
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@OptionsItem(android.R.id.home)
protected void navigateUp() {
MainSettingsActivity_.intent(this).flags(Intent.FLAG_ACTIVITY_CLEAR_TOP).start();
}
protected Dialog onCreateDialog(int id) {
switch (id) {
case DIALOG_CHANGELOG:

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

@ -51,6 +51,13 @@ public abstract class KeyBoundPreferencesActivity extends PreferenceCompatActivi @@ -51,6 +51,13 @@ public abstract class KeyBoundPreferencesActivity extends PreferenceCompatActivi
private SharedPreferences sharedPrefs;
private Map<String, String> originalSummaries = new HashMap<>();
private OnSharedPreferenceChangeListener onPreferenceChangeListener = new OnSharedPreferenceChangeListener() {
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
showValueOnSummary(key);
onPreferencesChanged();
}
};
/**
* Should be called during the activity {@link #onCreate(android.os.Bundle)} (but after super.onCreate(Bundle)) to
@ -88,14 +95,6 @@ public abstract class KeyBoundPreferencesActivity extends PreferenceCompatActivi @@ -88,14 +95,6 @@ public abstract class KeyBoundPreferencesActivity extends PreferenceCompatActivi
onPreferenceChangeListener);
}
private OnSharedPreferenceChangeListener onPreferenceChangeListener = new OnSharedPreferenceChangeListener() {
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
showValueOnSummary(key);
onPreferencesChanged();
}
};
/**
* Key-bound preference activities may override this method if they want to react to preference changes.
*/

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

@ -33,6 +33,14 @@ public class RssfeedPreference extends Preference { @@ -33,6 +33,14 @@ public class RssfeedPreference extends Preference {
private RssfeedSetting rssfeedSetting;
private OnRssfeedClickedListener onRssfeedClickedListener = null;
private OnPreferenceClickListener onPreferenceClicked = new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
if (onRssfeedClickedListener != null)
onRssfeedClickedListener.onRssfeedClicked(rssfeedSetting);
return true;
}
};
public RssfeedPreference(Context context) {
super(context);
@ -65,15 +73,6 @@ public class RssfeedPreference extends Preference { @@ -65,15 +73,6 @@ public class RssfeedPreference extends Preference {
return this;
}
private OnPreferenceClickListener onPreferenceClicked = new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
if (onRssfeedClickedListener != null)
onRssfeedClickedListener.onRssfeedClicked(rssfeedSetting);
return true;
}
};
public interface OnRssfeedClickedListener {
void onRssfeedClicked(RssfeedSetting rssfeedSetting);
}

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

@ -33,6 +33,14 @@ public class ServerPreference extends Preference { @@ -33,6 +33,14 @@ public class ServerPreference extends Preference {
protected ServerSetting serverSetting;
private OnServerClickedListener onServerClickedListener = null;
private OnPreferenceClickListener onPreferenceClicked = new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
if (onServerClickedListener != null)
onServerClickedListener.onServerClicked(serverSetting);
return true;
}
};
public ServerPreference(Context context) {
super(context);
@ -65,15 +73,6 @@ public class ServerPreference extends Preference { @@ -65,15 +73,6 @@ public class ServerPreference extends Preference {
return this;
}
private OnPreferenceClickListener onPreferenceClicked = new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
if (onServerClickedListener != null)
onServerClickedListener.onServerClicked(serverSetting);
return true;
}
};
public interface OnServerClickedListener {
public void onServerClicked(ServerSetting serverSetting);
}

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

@ -49,11 +49,9 @@ import org.transdroid.daemon.Daemon; @@ -49,11 +49,9 @@ import org.transdroid.daemon.Daemon;
@OptionsMenu(R.menu.activity_deleteableprefs)
public class ServerSettingsActivity extends KeyBoundPreferencesActivity {
private static final int DIALOG_CONFIRMREMOVE = 0;
@Bean
protected ConnectivityHelper connectivityHelper;
private static final int DIALOG_CONFIRMREMOVE = 0;
private EditTextPreference extraPass, folder, downloadDir, excludeFilter, includeFilter, localNetworkPreference;
@Override

24
app/src/main/java/org/transdroid/core/gui/settings/SystemSettingsActivity.java

@ -58,6 +58,17 @@ import java.io.OutputStream; @@ -58,6 +58,17 @@ import java.io.OutputStream;
public class SystemSettingsActivity extends PreferenceCompatActivity {
protected static final int DIALOG_IMPORTSETTINGS = 0;
protected static final int DIALOG_EXPORTSETTINGS = 1;
protected static final int ACTIVITY_IMPORT_SETTINGS = 1;
protected static final int ACTIVITY_EXPORT_SETTINGS = 2;
@Bean
protected NavigationHelper navigationHelper;
@Bean
protected ApplicationSettings applicationSettings;
@Bean
protected ErrorLogSender errorLogSender;
@Bean
protected SettingsPersistence settingsPersistence;
private OnPreferenceClickListener onImportSettingsClick = new OnPreferenceClickListener() {
@SuppressWarnings("deprecation")
@Override
@ -66,7 +77,6 @@ public class SystemSettingsActivity extends PreferenceCompatActivity { @@ -66,7 +77,6 @@ public class SystemSettingsActivity extends PreferenceCompatActivity {
return true;
}
};
protected static final int DIALOG_EXPORTSETTINGS = 1;
private OnPreferenceClickListener onExportSettingsClick = new OnPreferenceClickListener() {
@SuppressWarnings("deprecation")
@Override
@ -75,18 +85,6 @@ public class SystemSettingsActivity extends PreferenceCompatActivity { @@ -75,18 +85,6 @@ public class SystemSettingsActivity extends PreferenceCompatActivity {
return true;
}
};
protected static final int ACTIVITY_IMPORT_SETTINGS = 1;
protected static final int ACTIVITY_EXPORT_SETTINGS = 2;
@Bean
protected NavigationHelper navigationHelper;
@Bean
protected ApplicationSettings applicationSettings;
@Bean
protected ErrorLogSender errorLogSender;
@Bean
protected SettingsPersistence settingsPersistence;
private OnPreferenceClickListener onCheckUpdatesClick = new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {

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

@ -33,6 +33,14 @@ public class WebsearchPreference extends Preference { @@ -33,6 +33,14 @@ public class WebsearchPreference extends Preference {
private WebsearchSetting websearchSetting;
private OnWebsearchClickedListener onWebsearchClickedListener = null;
private OnPreferenceClickListener onPreferenceClicked = new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
if (onWebsearchClickedListener != null)
onWebsearchClickedListener.onWebsearchClicked(websearchSetting);
return true;
}
};
public WebsearchPreference(Context context) {
super(context);
@ -65,15 +73,6 @@ public class WebsearchPreference extends Preference { @@ -65,15 +73,6 @@ public class WebsearchPreference extends Preference {
return this;
}
private OnPreferenceClickListener onPreferenceClicked = new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
if (onWebsearchClickedListener != null)
onWebsearchClickedListener.onWebsearchClicked(websearchSetting);
return true;
}
};
public interface OnWebsearchClickedListener {
void onWebsearchClicked(WebsearchSetting serverSetting);
}

85
app/src/main/java/org/transdroid/core/rssparser/Channel.java

@ -13,6 +13,15 @@ import java.util.List; @@ -13,6 +13,15 @@ import java.util.List;
public class Channel implements Parcelable {
public static final Parcelable.Creator<Channel> CREATOR = new Parcelable.Creator<Channel>() {
public Channel createFromParcel(Parcel in) {
return new Channel(in);
}
public Channel[] newArray(int size) {
return new Channel[size];
}
};
private int id;
private String title;
private String link;
@ -28,56 +37,67 @@ public class Channel implements Parcelable { @@ -28,56 +37,67 @@ public class Channel implements Parcelable {
this.items = new ArrayList<>();
}
public void setId(int id) {
this.id = id;
private Channel(Parcel in) {
this();
id = in.readInt();
title = in.readString();
link = in.readString();
description = in.readString();
long pubDateIn = in.readLong();
pubDate = pubDateIn == -1 ? null : new Date(pubDateIn);
lastBuildDate = in.readLong();
categories = new ArrayList<>();
in.readTypedList(items, Item.CREATOR);
in.readStringList(categories);
image = in.readString();
}
public int getId() {
return id;
}
public void setTitle(String title) {
this.title = title;
public void setId(int id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setLink(String link) {
this.link = link;
public void setTitle(String title) {
this.title = title;
}
public String getLink() {
return link;
}
public void setDescription(String description) {
this.description = description;
public void setLink(String link) {
this.link = link;
}
public String getDescription() {
return description;
}
public void setPubDate(Date date) {
this.pubDate = date;
public void setDescription(String description) {
this.description = description;
}
public Date getPubDate() {
return pubDate;
}
public void setLastBuildDate(long lastBuildDate) {
this.lastBuildDate = lastBuildDate;
public void setPubDate(Date date) {
this.pubDate = date;
}
public long getLastBuildDate() {
return lastBuildDate;
}
public void setCategories(List<String> categories) {
this.categories = categories;
public void setLastBuildDate(long lastBuildDate) {
this.lastBuildDate = lastBuildDate;
}
public void addCategory(String category) {
@ -88,8 +108,8 @@ public class Channel implements Parcelable { @@ -88,8 +108,8 @@ public class Channel implements Parcelable {
return categories;
}
public void setItems(List<Item> items) {
this.items = items;
public void setCategories(List<String> categories) {
this.categories = categories;
}
public void addItem(Item item) {
@ -100,14 +120,18 @@ public class Channel implements Parcelable { @@ -100,14 +120,18 @@ public class Channel implements Parcelable {
return items;
}
public void setImage(String image) {
this.image = image;
public void setItems(List<Item> items) {
this.items = items;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
@Override
public int describeContents() {
return 0;
@ -126,29 +150,4 @@ public class Channel implements Parcelable { @@ -126,29 +150,4 @@ public class Channel implements Parcelable {
out.writeString(image);
}
public static final Parcelable.Creator<Channel> CREATOR = new Parcelable.Creator<Channel>() {
public Channel createFromParcel(Parcel in) {
return new Channel(in);
}
public Channel[] newArray(int size) {
return new Channel[size];
}
};
private Channel(Parcel in) {
this();
id = in.readInt();
title = in.readString();
link = in.readString();
description = in.readString();
long pubDateIn = in.readLong();
pubDate = pubDateIn == -1 ? null : new Date(pubDateIn);
lastBuildDate = in.readLong();
categories = new ArrayList<>();
in.readTypedList(items, Item.CREATOR);
in.readStringList(categories);
image = in.readString();
}
}

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

@ -12,6 +12,15 @@ import java.util.Date; @@ -12,6 +12,15 @@ import java.util.Date;
public class Item implements Parcelable {
public static final Parcelable.Creator<Item> CREATOR = new Parcelable.Creator<Item>() {
public Item createFromParcel(Parcel in) {
return new Item(in);
}
public Item[] newArray(int size) {
return new Item[size];
}
};
private int id;
private String title;
private String link;
@ -20,76 +29,91 @@ public class Item implements Parcelable { @@ -20,76 +29,91 @@ public class Item implements Parcelable {
private String enclosureUrl;
private String enclosureType;
private long enclosureLength;
/**
* isNew is not parsed from the RSS feed but may be set using {@link #setIsNew(boolean)} manually
*/
private boolean isNew;
public void setId(int id) {
this.id = id;
public Item() {
}
private Item(Parcel in) {
id = in.readInt();
title = in.readString();
link = in.readString();
description = in.readString();
long pubDateIn = in.readLong();
pubDate = pubDateIn == -1 ? null : new Date(pubDateIn);
enclosureUrl = in.readString();
enclosureType = in.readString();
enclosureLength = in.readLong();
isNew = in.readInt() == 1;
}
public int getId() {
return id;
}
public void setTitle(String title) {
this.title = title;
public void setId(int id) {
this.id = id;
}
public String getTitle() {
return this.title;
}
public void setDescription(String description) {
this.description = description;
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return this.description;
}
public void setLink(String link) {
this.link = link;
public void setDescription(String description) {
this.description = description;
}
public String getLink() {
return this.link;
}
public void setPubdate(Date pubdate) {
this.pubDate = pubdate;
public void setLink(String link) {
this.link = link;
}
public Date getPubdate() {
return this.pubDate;
}
public void setEnclosureUrl(String enclosureUrl) {
this.enclosureUrl = enclosureUrl;
}
public void setEnclosureLength(long enclosureLength) {
this.enclosureLength = enclosureLength;
}
public void setEnclosureType(String enclosureType) {
this.enclosureType = enclosureType;
public void setPubdate(Date pubdate) {
this.pubDate = pubdate;
}
public String getEnclosureUrl() {
return this.enclosureUrl;
}
public void setEnclosureUrl(String enclosureUrl) {
this.enclosureUrl = enclosureUrl;
}
public String getEnclosureType() {
return this.enclosureType;
}
public void setEnclosureType(String enclosureType) {
this.enclosureType = enclosureType;
}
public long getEnclosureLength() {
return this.enclosureLength;
}
public void setEnclosureLength(long enclosureLength) {
this.enclosureLength = enclosureLength;
}
public void setIsNew(boolean isNew) {
this.isNew = isNew;
}
@ -140,30 +164,4 @@ public class Item implements Parcelable { @@ -140,30 +164,4 @@ public class Item implements Parcelable {
out.writeInt(isNew ? 1 : 0);
}
public static final Parcelable.Creator<Item> CREATOR = new Parcelable.Creator<Item>() {
public Item createFromParcel(Parcel in) {
return new Item(in);
}
public Item[] newArray(int size) {
return new Item[size];
}
};
public Item() {
}
private Item(Parcel in) {
id = in.readInt();
title = in.readString();
link = in.readString();
description = in.readString();
long pubDateIn = in.readLong();
pubDate = pubDateIn == -1 ? null : new Date(pubDateIn);
enclosureUrl = in.readString();
enclosureType = in.readString();
enclosureLength = in.readLong();
isNew = in.readInt() == 1;
}
}

17
app/src/main/java/org/transdroid/core/seedbox/SeedboxPreference.java

@ -33,6 +33,14 @@ public class SeedboxPreference extends ServerPreference { @@ -33,6 +33,14 @@ public class SeedboxPreference extends ServerPreference {
private SeedboxProvider provider = null;
private OnSeedboxClickedListener onSeedboxClickedListener = null;
private int onSeedboxClickedListenerOffset = 0;
private OnPreferenceClickListener onSeedboxPreferenceClicked = new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
if (onSeedboxClickedListener != null)
onSeedboxClickedListener.onSeedboxClicked(serverSetting, provider, onSeedboxClickedListenerOffset);
return true;
}
};
public SeedboxPreference(Context context) {
super(context);
@ -74,15 +82,6 @@ public class SeedboxPreference extends ServerPreference { @@ -74,15 +82,6 @@ public class SeedboxPreference extends ServerPreference {
return provider;
}
private OnPreferenceClickListener onSeedboxPreferenceClicked = new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
if (onSeedboxClickedListener != null)
onSeedboxClickedListener.onSeedboxClicked(serverSetting, provider, onSeedboxClickedListenerOffset);
return true;
}
};
/**
* Set a listener that will be notified of click events on this preference
*

3
app/src/main/java/org/transdroid/core/seedbox/XirvikSharedSettingsActivity.java

@ -55,10 +55,9 @@ import java.io.InputStream; @@ -55,10 +55,9 @@ import java.io.InputStream;
@OptionsMenu(resName = "activity_deleteableprefs")
public class XirvikSharedSettingsActivity extends KeyBoundPreferencesActivity {
private EditTextPreference excludeFilter, includeFilter;
@Bean
protected Log log;
private EditTextPreference excludeFilter, includeFilter;
@Override
public void onCreate(Bundle savedInstanceState) {

12
app/src/main/java/org/transdroid/core/widget/ListWidgetConfigActivity.java

@ -92,12 +92,6 @@ public class ListWidgetConfigActivity extends AppCompatActivity { @@ -92,12 +92,6 @@ public class ListWidgetConfigActivity extends AppCompatActivity {
protected ApplicationSettings applicationSettings;
@Bean
protected SystemSettings systemSettings;
protected OnCheckedChangeListener reverseorderCheckedChanged = new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
filterTorrents();
}
};
protected OnCheckedChangeListener showstatusCheckChanged = new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
@ -106,6 +100,12 @@ public class ListWidgetConfigActivity extends AppCompatActivity { @@ -106,6 +100,12 @@ public class ListWidgetConfigActivity extends AppCompatActivity {
}
};
private List<Torrent> previewTorrents = null;
protected OnCheckedChangeListener reverseorderCheckedChanged = new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
filterTorrents();
}
};
private int appWidgetId;
private OnClickListener doneClicked = new OnClickListener() {
@Override

4
app/src/main/java/org/transdroid/daemon/Daemon.java

@ -137,8 +137,6 @@ public enum Daemon { @@ -137,8 +137,6 @@ public enum Daemon {
}
};
public abstract IDaemonAdapter createAdapter(DaemonSettings settings);
/**
* Returns the code as used in preferences matching the given daemon type
*
@ -429,4 +427,6 @@ public enum Daemon { @@ -429,4 +427,6 @@ public enum Daemon {
return type == uTorrent || type == DelugeRpc || type == Deluge2Rpc;
}
public abstract IDaemonAdapter createAdapter(DaemonSettings settings);
}

20
app/src/main/java/org/transdroid/daemon/DaemonException.java

@ -34,16 +34,6 @@ public class DaemonException extends Exception { @@ -34,16 +34,6 @@ public class DaemonException extends Exception {
private ExceptionType internalException;
public enum ExceptionType {
MethodUnsupported,
ConnectionError,
UnexpectedResponse,
ParsingFailed,
AuthenticationFailure,
NotConnected,
FileAccessError
}
public DaemonException(ExceptionType internalException, String message) {
super(message);
this.internalException = internalException;
@ -59,4 +49,14 @@ public class DaemonException extends Exception { @@ -59,4 +49,14 @@ public class DaemonException extends Exception {
return internalException.toString() + " exception: " + getMessage();
}
public enum ExceptionType {
MethodUnsupported,
ConnectionError,
UnexpectedResponse,
ParsingFailed,
AuthenticationFailure,
NotConnected,
FileAccessError
}
}

11
app/src/main/java/org/transdroid/daemon/DaemonMethod.java

@ -48,7 +48,6 @@ public enum DaemonMethod { @@ -48,7 +48,6 @@ public enum DaemonMethod {
ToggleSequentialDownload(23),
ToggleFirstLastPieceDownload(24);
private int code;
private static final Map<Integer, DaemonMethod> lookup = new HashMap<>();
static {
@ -56,16 +55,18 @@ public enum DaemonMethod { @@ -56,16 +55,18 @@ public enum DaemonMethod {
lookup.put(s.getCode(), s);
}
private int code;
DaemonMethod(int code) {
this.code = code;
}
public int getCode() {
return code;
}
public static DaemonMethod getStatus(int code) {
return lookup.get(code);
}
public int getCode() {
return code;
}
}

19
app/src/main/java/org/transdroid/daemon/Deluge/DelugeRemoteRssChannel.java

@ -16,6 +16,15 @@ import java.util.List; @@ -16,6 +16,15 @@ import java.util.List;
*/
class DelugeRemoteRssChannel extends RemoteRssChannel {
public static final Parcelable.Creator<DelugeRemoteRssChannel> CREATOR = new Parcelable.Creator<DelugeRemoteRssChannel>() {
public DelugeRemoteRssChannel createFromParcel(Parcel in) {
return new DelugeRemoteRssChannel(in);
}
public DelugeRemoteRssChannel[] newArray(int size) {
return new DelugeRemoteRssChannel[size];
}
};
private final String label;
private final String downloadLocation;
private final String moveCompleted;
@ -73,14 +82,4 @@ class DelugeRemoteRssChannel extends RemoteRssChannel { @@ -73,14 +82,4 @@ class DelugeRemoteRssChannel extends RemoteRssChannel {
public String getMoveCompleted() {
return moveCompleted;
}
public static final Parcelable.Creator<DelugeRemoteRssChannel> CREATOR = new Parcelable.Creator<DelugeRemoteRssChannel>() {
public DelugeRemoteRssChannel createFromParcel(Parcel in) {
return new DelugeRemoteRssChannel(in);
}
public DelugeRemoteRssChannel[] newArray(int size) {
return new DelugeRemoteRssChannel[size];
}
};
}

20
app/src/main/java/org/transdroid/daemon/Deluge/DelugeRemoteRssItem.java

@ -13,6 +13,16 @@ import java.util.Date; @@ -13,6 +13,16 @@ import java.util.Date;
* @author alonalbert
*/
class DelugeRemoteRssItem extends RemoteRssItem {
public static final Parcelable.Creator<DelugeRemoteRssItem> CREATOR = new Parcelable.Creator<DelugeRemoteRssItem>() {
public DelugeRemoteRssItem createFromParcel(Parcel in) {
return new DelugeRemoteRssItem(in);
}
public DelugeRemoteRssItem[] newArray(int size) {
return new DelugeRemoteRssItem[size];
}
};
DelugeRemoteRssItem(String title, String link, String sourceName, Date timestamp) {
this.title = title;
this.link = link;
@ -34,14 +44,4 @@ class DelugeRemoteRssItem extends RemoteRssItem { @@ -34,14 +44,4 @@ class DelugeRemoteRssItem extends RemoteRssItem {
dest.writeString(sourceName);
dest.writeSerializable(timestamp);
}
public static final Parcelable.Creator<DelugeRemoteRssItem> CREATOR = new Parcelable.Creator<DelugeRemoteRssItem>() {
public DelugeRemoteRssItem createFromParcel(Parcel in) {
return new DelugeRemoteRssItem(in);
}
public DelugeRemoteRssItem[] newArray(int size) {
return new DelugeRemoteRssItem[size];
}
};
}

5
app/src/main/java/org/transdroid/daemon/Deluge/DelugeRpcClient.java

@ -52,10 +52,9 @@ class DelugeRpcClient implements Closeable { @@ -52,10 +52,9 @@ class DelugeRpcClient implements Closeable {
private static final int RPC_ERROR = 2;
private static final byte V2_PROTOCOL_VERSION = 1;
private static final int V2_HEADER_SIZE = 5;
private Socket socket;
private final boolean isVersion2;
private static AtomicInteger requestId = new AtomicInteger();
private final boolean isVersion2;
private Socket socket;
DelugeRpcClient(boolean isVersion2) {
this.isVersion2 = isVersion2;

33
app/src/main/java/org/transdroid/daemon/Label.java

@ -28,16 +28,17 @@ import android.os.Parcelable; @@ -28,16 +28,17 @@ import android.os.Parcelable;
*/
public final class Label implements Parcelable, Comparable<Label> {
final private String name;
final private int count;
public String getName() {
return name;
public static final Parcelable.Creator<Label> CREATOR = new Parcelable.Creator<Label>() {
public Label createFromParcel(Parcel in) {
return new Label(in);
}
public int getCount() {
return count;
public Label[] newArray(int size) {
return new Label[size];
}
};
final private String name;
final private int count;
private Label(Parcel in) {
this.name = in.readString();
@ -49,6 +50,14 @@ public final class Label implements Parcelable, Comparable<Label> { @@ -49,6 +50,14 @@ public final class Label implements Parcelable, Comparable<Label> {
this.count = count;
}
public String getName() {
return name;
}
public int getCount() {
return count;
}
@Override
public String toString() {
return name;//+"("+String.valueOf(count)+")";
@ -60,16 +69,6 @@ public final class Label implements Parcelable, Comparable<Label> { @@ -60,16 +69,6 @@ public final class Label implements Parcelable, Comparable<Label> {
return name.compareTo(another.getName());
}
public static final Parcelable.Creator<Label> CREATOR = new Parcelable.Creator<Label>() {
public Label createFromParcel(Parcel in) {
return new Label(in);
}
public Label[] newArray(int size) {
return new Label[size];
}
};
@Override
public int describeContents() {
return 0;

11
app/src/main/java/org/transdroid/daemon/Priority.java

@ -33,7 +33,6 @@ public enum Priority { @@ -33,7 +33,6 @@ public enum Priority {
Normal(2),
High(3);
private int code;
private static final Map<Integer, Priority> lookup = new HashMap<Integer, Priority>();
static {
@ -41,18 +40,20 @@ public enum Priority { @@ -41,18 +40,20 @@ public enum Priority {
lookup.put(s.getCode(), s);
}
private int code;
Priority(int code) {
this.code = code;
}
public int getCode() {
return code;
}
public static Priority getPriority(int code) {
return lookup.get(code);
}
public int getCode() {
return code;
}
public int comparePriorityTo(Priority another) {
return new Integer(this.getCode()).compareTo(new Integer(another.getCode()));
}

38
app/src/main/java/org/transdroid/daemon/Tfb4rt/Tfb4rtAdapter.java

@ -81,6 +81,25 @@ public class Tfb4rtAdapter implements IDaemonAdapter { @@ -81,6 +81,25 @@ public class Tfb4rtAdapter implements IDaemonAdapter {
this.settings = settings;
}
/**
* Calculate the MD5 hash of a password to use with the Torrentflux-b4rt dispatcher requests.
*
* @param pass The plain text password
* @return A hex-formatted MD5-hashed string of the password
*/
public static String md5Pass(String pass) {
try {
MessageDigest m = MessageDigest.getInstance("MD5");
byte[] data = pass.getBytes();
m.update(data, 0, data.length);
BigInteger i = new BigInteger(1, m.digest());
return String.format("%1$032X", i);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
return null;
}
@Override
public DaemonTaskResult executeTask(Log log, DaemonTask task) {
@ -282,25 +301,6 @@ public class Tfb4rtAdapter implements IDaemonAdapter { @@ -282,25 +301,6 @@ public class Tfb4rtAdapter implements IDaemonAdapter {
+ md5Pass((settings.getPassword() == null ? "" : settings.getPassword()));
}
/**
* Calculate the MD5 hash of a password to use with the Torrentflux-b4rt dispatcher requests.
*
* @param pass The plain text password
* @return A hex-formatted MD5-hashed string of the password
*/
public static String md5Pass(String pass) {
try {
MessageDigest m = MessageDigest.getInstance("MD5");
byte[] data = pass.getBytes();
m.update(data, 0, data.length);
BigInteger i = new BigInteger(1, m.digest());
return String.format("%1$032X", i);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
return null;
}
@Override
public Daemon getType() {
return settings.getType();

32
app/src/main/java/org/transdroid/daemon/Torrent.java

@ -30,12 +30,18 @@ import java.util.Date; @@ -30,12 +30,18 @@ import java.util.Date;
*/
public final class Torrent implements Parcelable, Comparable<Torrent>, Finishable {
public static final Parcelable.Creator<Torrent> CREATOR = new Parcelable.Creator<Torrent>() {
public Torrent createFromParcel(Parcel in) {
return new Torrent(in);
}
public Torrent[] newArray(int size) {
return new Torrent[size];
}
};
final private long id;
final private String hash;
final private String name;
private TorrentStatus statusCode;
private String locationDir;
final private int rateDownload;
final private int rateUpload;
final private int seedersConnected;
@ -43,20 +49,20 @@ public final class Torrent implements Parcelable, Comparable<Torrent>, Finishabl @@ -43,20 +49,20 @@ public final class Torrent implements Parcelable, Comparable<Torrent>, Finishabl
final private int leechersConnected;
final private int leechersKnown;
final private int eta;
final private long downloadedEver;
final private long uploadedEver;
final private long totalSize;
final private float partDone;
final private float available;
private String label;
private boolean sequentialDownload;
private boolean firstLastPieceDownload;
final private Date dateAdded;
final private Date dateDone;
final private String error;
final private Daemon daemon;
private TorrentStatus statusCode;
private String locationDir;
private String label;
private boolean sequentialDownload;
private boolean firstLastPieceDownload;
private Torrent(Parcel in) {
this.id = in.readLong();
@ -394,16 +400,6 @@ public final class Torrent implements Parcelable, Comparable<Torrent>, Finishabl @@ -394,16 +400,6 @@ public final class Torrent implements Parcelable, Comparable<Torrent>, Finishabl
return name.compareTo(another.getName());
}
public static final Parcelable.Creator<Torrent> CREATOR = new Parcelable.Creator<Torrent>() {
public Torrent createFromParcel(Parcel in) {
return new Torrent(in);
}
public Torrent[] newArray(int size) {
return new Torrent[size];
}
};
@Override
public int describeContents() {
return 0;

19
app/src/main/java/org/transdroid/daemon/TorrentDetails.java

@ -30,6 +30,15 @@ import java.util.List; @@ -30,6 +30,15 @@ import java.util.List;
*/
public final class TorrentDetails implements Parcelable {
public static final Parcelable.Creator<TorrentDetails> CREATOR = new Parcelable.Creator<TorrentDetails>() {
public TorrentDetails createFromParcel(Parcel in) {
return new TorrentDetails(in);
}
public TorrentDetails[] newArray(int size) {
return new TorrentDetails[size];
}
};
private final List<String> trackers;
private final List<String> errors;
private final List<Integer> pieces;
@ -97,16 +106,6 @@ public final class TorrentDetails implements Parcelable { @@ -97,16 +106,6 @@ public final class TorrentDetails implements Parcelable {
return this.pieces;
}
public static final Parcelable.Creator<TorrentDetails> CREATOR = new Parcelable.Creator<TorrentDetails>() {
public TorrentDetails createFromParcel(Parcel in) {
return new TorrentDetails(in);
}
public TorrentDetails[] newArray(int size) {
return new TorrentDetails[size];
}
};
@Override
public int describeContents() {
return 0;

80
app/src/main/java/org/transdroid/daemon/TorrentFile.java

@ -32,6 +32,16 @@ import java.util.Map; @@ -32,6 +32,16 @@ import java.util.Map;
*/
public final class TorrentFile implements Parcelable, Comparable<TorrentFile>, Finishable {
public static final Parcelable.Creator<TorrentFile> CREATOR = new Parcelable.Creator<TorrentFile>() {
public TorrentFile createFromParcel(Parcel in) {
return new TorrentFile(in);
}
public TorrentFile[] newArray(int size) {
return new TorrentFile[size];
}
};
private static final Map<String, String> mimeTypes = fillMimeTypes();
private final String key;
private final String name;
private final String relativePath;
@ -60,6 +70,35 @@ public final class TorrentFile implements Parcelable, Comparable<TorrentFile>, F @@ -60,6 +70,35 @@ public final class TorrentFile implements Parcelable, Comparable<TorrentFile>, F
this.priority = Priority.getPriority(in.readInt());
}
private static Map<String, String> fillMimeTypes() {
// Full mime type support list is in http://code.google.com/p/android-vlc-remote/source/browse/trunk/AndroidManifest.xml
// We use a selection of the most popular/obvious ones
HashMap<String, String> types = new HashMap<String, String>();
// Application
types.put("m4a", "application/x-extension-m4a");
types.put("flac", "application/x-flac");
types.put("mkv", "application/x-matroska");
types.put("ogg", "application/x-ogg");
// Audio
types.put("m3u", "audio/mpegurl");
types.put("mp3", "audio/mpeg");
types.put("mpa", "audio/mpeg");
types.put("mpc", "audio/x-musepack");
types.put("wav", "audio/x-wav");
types.put("wma", "audio/x-ms-wma");
// Video
types.put("3gp", "video/3gpp");
types.put("avi", "video/x-avi");
types.put("flv", "video/x-flv");
types.put("mov", "video/quicktime");
types.put("mp4", "video/mp4");
types.put("mpg", "video/mpeg");
types.put("mpeg", "video/mpeg");
types.put("vob", "video/mpeg");
types.put("wmv", "video/x-ms-wmv");
return types;
}
public String getKey() {
return this.key;
}
@ -178,47 +217,6 @@ public final class TorrentFile implements Parcelable, Comparable<TorrentFile>, F @@ -178,47 +217,6 @@ public final class TorrentFile implements Parcelable, Comparable<TorrentFile>, F
return name.compareTo(another.getName());
}
private static final Map<String, String> mimeTypes = fillMimeTypes();
private static Map<String, String> fillMimeTypes() {
// Full mime type support list is in http://code.google.com/p/android-vlc-remote/source/browse/trunk/AndroidManifest.xml
// We use a selection of the most popular/obvious ones
HashMap<String, String> types = new HashMap<String, String>();
// Application
types.put("m4a", "application/x-extension-m4a");
types.put("flac", "application/x-flac");
types.put("mkv", "application/x-matroska");
types.put("ogg", "application/x-ogg");
// Audio
types.put("m3u", "audio/mpegurl");
types.put("mp3", "audio/mpeg");
types.put("mpa", "audio/mpeg");
types.put("mpc", "audio/x-musepack");
types.put("wav", "audio/x-wav");
types.put("wma", "audio/x-ms-wma");
// Video
types.put("3gp", "video/3gpp");
types.put("avi", "video/x-avi");
types.put("flv", "video/x-flv");
types.put("mov", "video/quicktime");
types.put("mp4", "video/mp4");
types.put("mpg", "video/mpeg");
types.put("mpeg", "video/mpeg");
types.put("vob", "video/mpeg");
types.put("wmv", "video/x-ms-wmv");
return types;
}
public static final Parcelable.Creator<TorrentFile> CREATOR = new Parcelable.Creator<TorrentFile>() {
public TorrentFile createFromParcel(Parcel in) {
return new TorrentFile(in);
}
public TorrentFile[] newArray(int size) {
return new TorrentFile[size];
}
};
@Override
public int describeContents() {
return 0;

11
app/src/main/java/org/transdroid/daemon/TorrentFilesSortBy.java

@ -26,7 +26,6 @@ public enum TorrentFilesSortBy { @@ -26,7 +26,6 @@ public enum TorrentFilesSortBy {
PartDone(2),
TotalSize(3);
private int code;
private static final Map<Integer, TorrentFilesSortBy> lookup = new HashMap<Integer, TorrentFilesSortBy>();
static {
@ -34,16 +33,18 @@ public enum TorrentFilesSortBy { @@ -34,16 +33,18 @@ public enum TorrentFilesSortBy {
lookup.put(s.getCode(), s);
}
private int code;
TorrentFilesSortBy(int code) {
this.code = code;
}
public int getCode() {
return code;
}
public static TorrentFilesSortBy getStatus(int code) {
return lookup.get(code);
}
public int getCode() {
return code;
}
}

11
app/src/main/java/org/transdroid/daemon/TorrentStatus.java

@ -31,7 +31,6 @@ public enum TorrentStatus { @@ -31,7 +31,6 @@ public enum TorrentStatus {
Error(64),
Unknown(0);
private int code;
private static final Map<Integer, TorrentStatus> lookup = new HashMap<Integer, TorrentStatus>();
static {
@ -39,18 +38,20 @@ public enum TorrentStatus { @@ -39,18 +38,20 @@ public enum TorrentStatus {
lookup.put(s.getCode(), s);
}
private int code;
TorrentStatus(int code) {
this.code = code;
}
public int getCode() {
return code;
}
public static TorrentStatus getStatus(int code) {
return lookup.get(code);
}
public int getCode() {
return code;
}
public int compareStatusCodeTo(TorrentStatus another) {
return new Integer(this.getCode()).compareTo(new Integer(another.getCode()));
}

11
app/src/main/java/org/transdroid/daemon/TorrentsSortBy.java

@ -32,7 +32,6 @@ public enum TorrentsSortBy { @@ -32,7 +32,6 @@ public enum TorrentsSortBy {
Percent(8),
Size(9);
private int code;
private static final Map<Integer, TorrentsSortBy> lookup = new HashMap<Integer, TorrentsSortBy>();
static {
@ -40,16 +39,18 @@ public enum TorrentsSortBy { @@ -40,16 +39,18 @@ public enum TorrentsSortBy {
lookup.put(s.getCode(), s);
}
private int code;
TorrentsSortBy(int code) {
this.code = code;
}
public int getCode() {
return code;
}
public static TorrentsSortBy getStatus(int code) {
return lookup.get(code);
}
public int getCode() {
return code;
}
}

3
app/src/main/java/org/transdroid/daemon/Utorrent/UtorrentAdapter.java

@ -117,11 +117,10 @@ public class UtorrentAdapter implements IDaemonAdapter, RemoteRssSupplier { @@ -117,11 +117,10 @@ public class UtorrentAdapter implements IDaemonAdapter, RemoteRssSupplier {
private static final int RPC_FILEDOWNLOADED_IDX = 2;
private static final int RPC_FILEPRIORITY_IDX = 3;
private static String authtoken;
private static ArrayList<RemoteRssChannel> remoteRssChannels = new ArrayList<>();
private DaemonSettings settings;
private DefaultHttpClient httpclient;
private static ArrayList<RemoteRssChannel> remoteRssChannels = new ArrayList<>();
/**
* Initialises an adapter that provides operations to the uTorrent web daemon

20
app/src/main/java/org/transdroid/daemon/Utorrent/data/UTorrentRemoteRssChannel.java

@ -16,6 +16,16 @@ import java.util.ArrayList; @@ -16,6 +16,16 @@ import java.util.ArrayList;
* @author Twig
*/
public class UTorrentRemoteRssChannel extends RemoteRssChannel {
public static final Parcelable.Creator<UTorrentRemoteRssChannel> CREATOR = new Parcelable.Creator<UTorrentRemoteRssChannel>() {
public UTorrentRemoteRssChannel createFromParcel(Parcel in) {
return new UTorrentRemoteRssChannel(in);
}
public UTorrentRemoteRssChannel[] newArray(int size) {
return new UTorrentRemoteRssChannel[size];
}
};
public UTorrentRemoteRssChannel(JSONArray json) throws JSONException {
// boolean enabled = json.getBoolean(1);
boolean isCustomAlias = !json.getBoolean(2);
@ -61,14 +71,4 @@ public class UTorrentRemoteRssChannel extends RemoteRssChannel { @@ -61,14 +71,4 @@ public class UTorrentRemoteRssChannel extends RemoteRssChannel {
dest.writeLong(lastUpdated);
dest.writeList(items);
}
public static final Parcelable.Creator<UTorrentRemoteRssChannel> CREATOR = new Parcelable.Creator<UTorrentRemoteRssChannel>() {
public UTorrentRemoteRssChannel createFromParcel(Parcel in) {
return new UTorrentRemoteRssChannel(in);
}
public UTorrentRemoteRssChannel[] newArray(int size) {
return new UTorrentRemoteRssChannel[size];
}
};
}

22
app/src/main/java/org/transdroid/daemon/Utorrent/data/UTorrentRemoteRssItem.java

@ -20,6 +20,17 @@ public class UTorrentRemoteRssItem extends RemoteRssItem { @@ -20,6 +20,17 @@ public class UTorrentRemoteRssItem extends RemoteRssItem {
// public int season;
// public int episode;
public static final Parcelable.Creator<UTorrentRemoteRssItem> CREATOR = new Parcelable.Creator<UTorrentRemoteRssItem>() {
public UTorrentRemoteRssItem createFromParcel(Parcel in) {
return new UTorrentRemoteRssItem(in);
}
public UTorrentRemoteRssItem[] newArray(int size) {
return new UTorrentRemoteRssItem[size];
}
};
public UTorrentRemoteRssItem(JSONArray json) throws JSONException {
// name = json.getString(0); // clean name
title = json.getString(1); // filename
@ -33,17 +44,6 @@ public class UTorrentRemoteRssItem extends RemoteRssItem { @@ -33,17 +44,6 @@ public class UTorrentRemoteRssItem extends RemoteRssItem {
// episode = json.getInt(7);
}
public static final Parcelable.Creator<UTorrentRemoteRssItem> CREATOR = new Parcelable.Creator<UTorrentRemoteRssItem>() {
public UTorrentRemoteRssItem createFromParcel(Parcel in) {
return new UTorrentRemoteRssItem(in);
}
public UTorrentRemoteRssItem[] newArray(int size) {
return new UTorrentRemoteRssItem[size];
}
};
public UTorrentRemoteRssItem(Parcel in) {
// name = in.readString();
title = in.readString();

74
app/src/main/java/org/transdroid/daemon/Vuze/VuzeXmlOverHttpClient.java

@ -153,6 +153,43 @@ public class VuzeXmlOverHttpClient { @@ -153,6 +153,43 @@ public class VuzeXmlOverHttpClient {
this(settings, URI.create(url));
}
static Object deserialize(String rawText) {
// Null?
if (rawText == null || rawText.equals("null")) {
return null;
}
/* For now cast all integers as Long; this prevents casting problems later on when
* we know it's a long but the value was small so it is casted to an Integer here
// Integer?
try {
Integer integernum = Integer.parseInt(rawText);
return integernum;
} catch (NumberFormatException e) {
// Just continue trying the next type
}*/
// Long?
try {
Long longnum = Long.parseLong(rawText);
return longnum;
} catch (NumberFormatException e) {
// Just continue trying the next type
}
// Double?
try {
Double doublenum = Double.parseDouble(rawText);
return doublenum;
} catch (NumberFormatException e) {
// Just continue trying the next type
}
// String otherwise
return rawText;
}
protected Map<String, Object> callXMLRPC(Long object, String method, Object[] params, Long connectionID, boolean paramsAreVuzeObjects) throws DaemonException {
try {
@ -338,41 +375,4 @@ public class VuzeXmlOverHttpClient { @@ -338,41 +375,4 @@ public class VuzeXmlOverHttpClient {
return value.toString();
}
static Object deserialize(String rawText) {
// Null?
if (rawText == null || rawText.equals("null")) {
return null;
}
/* For now cast all integers as Long; this prevents casting problems later on when
* we know it's a long but the value was small so it is casted to an Integer here
// Integer?
try {
Integer integernum = Integer.parseInt(rawText);
return integernum;
} catch (NumberFormatException e) {
// Just continue trying the next type
}*/
// Long?
try {
Long longnum = Long.parseLong(rawText);
return longnum;
} catch (NumberFormatException e) {
// Just continue trying the next type
}
// Double?
try {
Double doublenum = Double.parseDouble(rawText);
return doublenum;
} catch (NumberFormatException e) {
// Just continue trying the next type
}
// String otherwise
return rawText;
}
}

19
app/src/main/java/org/transdroid/daemon/util/FileSizeConverter.java

@ -28,16 +28,6 @@ public class FileSizeConverter { @@ -28,16 +28,6 @@ public class FileSizeConverter {
private static final String DECIMAL_FORMATTER = "%.1f";
private static final String DECIMAL_FORMATTER_GB = "%.2f";
/**
* A quantity in which to express a file size.
*
* @author erickok
*/
public enum SizeUnit {
B, KB, MB, GB
}
private static int INC_SIZE = 1024;
/**
@ -118,4 +108,13 @@ public class FileSizeConverter { @@ -118,4 +108,13 @@ public class FileSizeConverter {
}
}
/**
* A quantity in which to express a file size.
*
* @author erickok
*/
public enum SizeUnit {
B, KB, MB, GB
}
}

8
app/src/main/res/drawable-night/details_list_background.xml

@ -16,9 +16,9 @@ @@ -16,9 +16,9 @@
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:left="2dp"
android:drawable="@color/transdroid_divider" />
android:drawable="@color/transdroid_divider"
android:left="2dp" />
<item
android:left="4dp"
android:drawable="@color/transdroid_background" />
android:drawable="@color/transdroid_background"
android:left="4dp" />
</layer-list>

8
app/src/main/res/drawable/activatable_background.xml

@ -15,9 +15,9 @@ @@ -15,9 +15,9 @@
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android" android:exitFadeDuration="@android:integer/config_shortAnimTime">
<item android:state_pressed="false" android:state_selected="true" android:drawable="@drawable/list_focused" />
<item android:state_pressed="false" android:state_focused="true" android:drawable="@drawable/list_focused" />
<item android:state_pressed="true" android:drawable="@drawable/list_pressed" />
<item android:state_activated="true" android:drawable="@drawable/list_focused" />
<item android:drawable="@drawable/list_focused" android:state_pressed="false" android:state_selected="true" />
<item android:drawable="@drawable/list_focused" android:state_focused="true" android:state_pressed="false" />
<item android:drawable="@drawable/list_pressed" android:state_pressed="true" />
<item android:drawable="@drawable/list_focused" android:state_activated="true" />
<item android:drawable="@android:color/transparent" />
</selector>

8
app/src/main/res/drawable/details_list_background.xml

@ -16,9 +16,9 @@ @@ -16,9 +16,9 @@
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:left="2dp"
android:drawable="@color/transdroid_divider" />
android:drawable="@color/transdroid_divider"
android:left="2dp" />
<item
android:left="4dp"
android:drawable="@color/transdroid_background" />
android:drawable="@color/transdroid_background"
android:left="4dp" />
</layer-list>

8
app/src/main/res/layout-land/dialog_color_picker.xml

@ -41,18 +41,18 @@ @@ -41,18 +41,18 @@
android:layout_height="wrap_content"
android:hint="HEX"
android:imeOptions="actionDone"
android:inputType="textCapCharacters"
android:maxLength="7"
android:singleLine="true"
android:inputType="textCapCharacters"
android:visibility="gone"></EditText>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:layout_marginTop="6dp"
android:layout_marginRight="6dp"
android:layout_marginBottom="5dp"
android:gravity="center"
android:text="@string/press_color_to_apply"
android:textAppearance="?android:attr/textAppearanceSmall" />
@ -66,8 +66,8 @@ @@ -66,8 +66,8 @@
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:gravity="center"
android:text="↓"
android:textSize="20sp" />

2
app/src/main/res/layout-w600dp/activity_search.xml

@ -57,8 +57,8 @@ @@ -57,8 +57,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawablePadding="8dip"
android:drawableTop="?attr/loading_progress"
android:drawablePadding="8dip"
android:gravity="center"
android:maxWidth="400dip"
android:padding="@dimen/margin_default"

22
app/src/main/res/layout-w600dp/activity_torrents.xml

@ -16,8 +16,8 @@ @@ -16,8 +16,8 @@
-->
<!-- This layout is for 7" and 10" tablets in portrait and shows torrents and filters. -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
@ -62,24 +62,24 @@ @@ -62,24 +62,24 @@
android:layout_width="@dimen/ui_filters_list"
android:layout_height="wrap_content"
android:layout_above="@id/actions_toolbar"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="5dp"
android:layout_alignParentLeft="true"
android:layout_marginTop="5dp"
android:layout_marginEnd="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
app:searchIcon="@drawable/ic_action_filter"
android:layout_marginBottom="5dp"
app:iconifiedByDefault="false"
app:queryHint="@string/action_filter"
app:iconifiedByDefault="false" />
app:searchIcon="@drawable/ic_action_filter" />
<ListView
android:id="@+id/filters_list"
android:layout_width="@dimen/ui_filters_list"
android:layout_height="match_parent"
android:layout_above="@id/filter_search"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@id/torrents_toolbar"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:choiceMode="singleChoice"
tools:listitem="@layout/list_item_filter" />
@ -107,11 +107,11 @@ @@ -107,11 +107,11 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="@+id/torrents_fragment"
android:layout_alignParentBottom="true"
android:layout_alignRight="@+id/torrents_fragment"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom|end"
android:layout_marginBottom="20dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp" />
android:layout_marginRight="10dp"
android:layout_marginBottom="20dp" />
</RelativeLayout>

30
app/src/main/res/layout-w900dp/activity_torrents.xml

@ -35,22 +35,22 @@ @@ -35,22 +35,22 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignEnd="@id/filters_list"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignRight="@id/filters_list"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:minHeight="?attr/actionBarSize" />
<androidx.appcompat.widget.SearchView
android:id="@+id/filter_search"
android:layout_width="@dimen/ui_filters_list"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="5dp"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:layout_marginTop="5dp"
android:layout_marginEnd="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
app:iconifiedByDefault="false"
app:queryHint="@string/action_filter"
app:searchIcon="@drawable/ic_action_filter" />
@ -60,9 +60,9 @@ @@ -60,9 +60,9 @@
android:layout_width="@dimen/ui_filters_list"
android:layout_height="match_parent"
android:layout_above="@id/filter_search"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@id/selection_toolbar"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:choiceMode="singleChoice"
tools:listitem="@layout/list_item_filter" />
@ -84,8 +84,8 @@ @@ -84,8 +84,8 @@
style="@style/DefaultToolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/fragments_divider"
android:layout_toStartOf="@id/fragments_divider"
android:layout_toLeftOf="@id/fragments_divider"
android:minHeight="?attr/actionBarSize" />
<androidx.appcompat.widget.ActionMenuView
@ -93,9 +93,9 @@ @@ -93,9 +93,9 @@
style="@style/SplitToolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/fragments_divider"
android:layout_toStartOf="@id/fragments_divider"
android:layout_alignParentBottom="true"
android:layout_toStartOf="@id/fragments_divider"
android:layout_toLeftOf="@id/fragments_divider"
android:minHeight="?attr/actionBarSize"
android:visibility="gone"
tools:visibility="visible" />
@ -115,8 +115,8 @@ @@ -115,8 +115,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/torrents_toolbar"
android:layout_toLeftOf="@id/fragments_divider"
android:layout_toStartOf="@id/fragments_divider"
android:layout_toLeftOf="@id/fragments_divider"
tools:layout="@layout/fragment_torrents" />
<fragment
@ -135,11 +135,11 @@ @@ -135,11 +135,11 @@
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom|end"
android:layout_marginBottom="20dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:layout_toLeftOf="@id/fragments_divider"
android:layout_toStartOf="@id/fragments_divider" />
android:layout_marginBottom="20dp"
android:layout_toStartOf="@id/fragments_divider"
android:layout_toLeftOf="@id/fragments_divider" />
</RelativeLayout>

4
app/src/main/res/layout/actionbar_addbutton.xml

@ -1,8 +1,8 @@ @@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<com.getbase.floatingactionbutton.FloatingActionsMenu android:id="@+id/addmenu_button"
xmlns:android="http://schemas.android.com/apk/res/android"
<com.getbase.floatingactionbutton.FloatingActionsMenu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/addmenu_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:fab_addButtonColorNormal="@color/green"

4
app/src/main/res/layout/actionbar_donebutton.xml

@ -15,9 +15,9 @@ @@ -15,9 +15,9 @@
You should have received a copy of the GNU General Public License
along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
-->
<FrameLayout android:id="@+id/actionbar_done"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/actionbar_done"
style="?android:actionButtonStyle"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">

4
app/src/main/res/layout/actionbar_serverselection.xml

@ -16,8 +16,8 @@ @@ -16,8 +16,8 @@
-->
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:layout_width="match_parent"
tools:layout_height="?android:attr/actionBarSize">
tools:layout_height="?android:attr/actionBarSize"
tools:layout_width="match_parent">
<LinearLayout
android:layout_width="wrap_content"

18
app/src/main/res/layout/actionbar_serverstatus.xml

@ -18,8 +18,8 @@ @@ -18,8 +18,8 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
tools:background="@android:color/white"
android:orientation="horizontal">
android:orientation="horizontal"
tools:background="@android:color/white">
<View
android:layout_width="0dp"
@ -50,8 +50,8 @@ @@ -50,8 +50,8 @@
android:id="@+id/downcount_sign"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/downcount_text"
android:layout_toEndOf="@id/downcount_text"
android:layout_toRightOf="@id/downcount_text"
android:fontFamily="sans-serif-light"
android:text="↓"
android:textColor="?attr/text_actionbar"
@ -64,8 +64,8 @@ @@ -64,8 +64,8 @@
android:id="@+id/upcount_text"
android:layout_width="@dimen/ui_serverstatus_width"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/downcount_sign"
android:layout_toEndOf="@id/downcount_sign"
android:layout_toRightOf="@id/downcount_sign"
android:fontFamily="sans-serif-light"
android:gravity="end"
android:textColor="?attr/text_actionbar"
@ -76,8 +76,8 @@ @@ -76,8 +76,8 @@
android:id="@+id/upcount_sign"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/upcount_text"
android:layout_toEndOf="@id/upcount_text"
android:layout_toRightOf="@id/upcount_text"
android:fontFamily="sans-serif-light"
android:text="↑"
android:textColor="?attr/text_actionbar"
@ -90,9 +90,9 @@ @@ -90,9 +90,9 @@
android:id="@+id/downspeed_text"
android:layout_width="@dimen/ui_serverstatus_width"
android:layout_height="wrap_content"
android:layout_below="@id/downcount_text"
android:layout_alignLeft="@id/downcount_text"
android:layout_alignRight="@id/downcount_sign"
android:layout_below="@id/downcount_text"
android:layout_marginTop="-4dip"
android:fontFamily="sans-serif-light"
android:gravity="end"
@ -104,11 +104,11 @@ @@ -104,11 +104,11 @@
android:id="@+id/upspeed_text"
android:layout_width="@dimen/ui_serverstatus_width"
android:layout_height="wrap_content"
android:layout_alignLeft="@id/upcount_text"
android:layout_below="@id/upcount_text"
android:layout_alignStart="@id/upcount_text"
android:layout_alignRight="@id/upcount_sign"
android:layout_alignLeft="@id/upcount_text"
android:layout_alignEnd="@id/upcount_sign"
android:layout_below="@id/upcount_text"
android:layout_alignRight="@id/upcount_sign"
android:layout_marginTop="-4dip"
android:fontFamily="sans-serif-light"
android:gravity="end"

2
app/src/main/res/layout/activity_search.xml

@ -51,8 +51,8 @@ @@ -51,8 +51,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawablePadding="8dip"
android:drawableTop="?attr/loading_progress"
android:drawablePadding="8dip"
android:gravity="center"
android:maxWidth="400dip"
android:padding="@dimen/margin_default"

14
app/src/main/res/layout/activity_torrents.xml

@ -15,10 +15,10 @@ @@ -15,10 +15,10 @@
along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
-->
<!-- This layout is for phones in portrait and shows the torrents list with the filters as navigation drawer. -->
<androidx.drawerlayout.widget.DrawerLayout android:id="@+id/drawer_layout"
xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".core.gui.TorrentsActivity_">
@ -77,13 +77,13 @@ @@ -77,13 +77,13 @@
layout="@layout/actionbar_addbutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom|end"
android:layout_marginBottom="16dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp" />
android:layout_marginRight="10dp"
android:layout_marginBottom="16dp" />
</RelativeLayout>
@ -109,10 +109,10 @@ @@ -109,10 +109,10 @@
android:id="@+id/filter_search"
android:layout_width="@dimen/ui_filters_list"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="5dp"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
app:iconifiedByDefault="false"
app:queryHint="@string/action_filter"
app:searchIcon="@drawable/ic_action_filter" />

2
app/src/main/res/layout/activity_widgetconfig.xml

@ -103,8 +103,8 @@ @@ -103,8 +103,8 @@
android:id="@+id/darktheme_check_box"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/margin_half"
android:layout_marginTop="@dimen/margin_half"
android:layout_marginBottom="@dimen/margin_half"
android:text="@string/widget_usedarktheme" />
</LinearLayout>
</ScrollView>

8
app/src/main/res/layout/dialog_about.xml

@ -29,8 +29,8 @@ @@ -29,8 +29,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="@dimen/margin_half"
android:layout_marginTop="@dimen/margin_half"
android:layout_marginBottom="@dimen/margin_half"
android:drawableLeft="@drawable/ic_launcher"
android:drawablePadding="@dimen/margin_half"
android:fontFamily="sans-serif-condensed"
@ -61,8 +61,8 @@ @@ -61,8 +61,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="@dimen/margin_default"
android:layout_marginTop="4dip"
android:layout_marginBottom="@dimen/margin_default"
android:gravity="center"
android:text="@string/system_license" />
@ -80,8 +80,8 @@ @@ -80,8 +80,8 @@
android:layout_gravity="center_horizontal"
android:layout_marginBottom="@dimen/margin_default"
android:fontFamily="monospace"
android:textSize="12sp"
android:text="@string/system_libraries" />
android:text="@string/system_libraries"
android:textSize="12sp" />
</LinearLayout>
</ScrollView>

8
app/src/main/res/layout/dialog_changelog.xml

@ -17,14 +17,14 @@ @@ -17,14 +17,14 @@
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/margin_default"
android:fillViewport="true"
android:orientation="vertical">
android:orientation="vertical"
android:padding="@dimen/margin_default">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/system_changelog"
android:autoLink="web" />
android:autoLink="web"
android:text="@string/system_changelog" />
</ScrollView>

6
app/src/main/res/layout/dialog_color_picker.xml

@ -33,9 +33,9 @@ @@ -33,9 +33,9 @@
android:id="@+id/text_hex_wrapper"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp">
android:layout_marginRight="6dp"
android:layout_marginBottom="5dp">
<TextView
android:layout_width="wrap_content"
@ -51,9 +51,9 @@ @@ -51,9 +51,9 @@
android:layout_weight="1"
android:hint="HEX"
android:imeOptions="actionDone"
android:inputType="textCapCharacters"
android:maxLength="7"
android:singleLine="true"
android:inputType="textCapCharacters"
android:visibility="gone"></EditText>
</LinearLayout>

16
app/src/main/res/layout/dialog_setlabel.xml

@ -18,16 +18,16 @@ @@ -18,16 +18,16 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/margin_default"
android:orientation="vertical">
android:orientation="vertical"
android:padding="@dimen/margin_default">
<TextView
android:id="@+id/pick_label"
style="@style/SectionHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/status_label_pick"
android:layout_marginBottom="@dimen/margin_half"
style="@style/SectionHeader" />
android:text="@string/status_label_pick" />
<ListView
android:id="@+id/labels_list"
@ -37,19 +37,19 @@ @@ -37,19 +37,19 @@
tools:listitem="@layout/list_item_simple" />
<TextView
style="@style/SectionHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_default"
android:text="@string/status_label_new"
android:layout_marginBottom="@dimen/margin_half"
style="@style/SectionHeader" />
android:text="@string/status_label_new" />
<EditText
android:id="@+id/newlabel_edit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:hint="@string/status_label_hint"
android:inputType="textFilter"
android:hint="@string/status_label_hint" />
android:singleLine="true" />
</LinearLayout>

4
app/src/main/res/layout/dialog_trackers.xml

@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
android:id="@+id/trackers_edit"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minLines="5"
android:inputType="textUri|textMultiLine" />
android:inputType="textUri|textMultiLine"
android:minLines="5" />
</FrameLayout>

8
app/src/main/res/layout/fragment_details.xml

@ -14,9 +14,9 @@ @@ -14,9 +14,9 @@
You should have received a copy of the GNU General Public License
along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
-->
<RelativeLayout xmlns:tools="http://schemas.android.com/tools"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/details_container"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".core.gui.DetailsActivity_">
@ -72,8 +72,8 @@ @@ -72,8 +72,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:drawablePadding="8dip"
android:drawableTop="?attr/loading_progress"
android:drawablePadding="8dip"
android:gravity="center"
android:padding="@dimen/margin_default"
android:text="@string/navigation_emptydetails"
@ -85,8 +85,8 @@ @@ -85,8 +85,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:drawablePadding="8dip"
android:drawableTop="?attr/loading_progress"
android:drawablePadding="8dip"
android:gravity="center"
android:maxWidth="400dip"
android:padding="@dimen/margin_default"

22
app/src/main/res/layout/fragment_details_header.xml

@ -17,23 +17,23 @@ @@ -17,23 +17,23 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="@dimen/margin_default"
android:layout_marginTop="@dimen/margin_default">
android:layout_marginTop="@dimen/margin_default"
android:layout_marginBottom="@dimen/margin_default">
<LinearLayout
android:id="@+id/date_label_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginLeft="@dimen/margin_default"
android:layout_marginRight="@dimen/margin_default">
android:layout_marginRight="@dimen/margin_default"
android:orientation="horizontal">
<TextView
android:id="@+id/dateadded_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:layout_marginRight="@dimen/margin_half"
android:layout_weight="0.5"
android:textIsSelectable="false" />
<TextView
@ -41,10 +41,10 @@ @@ -41,10 +41,10 @@
style="@style/LabelTextView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:layout_marginLeft="@dimen/margin_half"
android:textIsSelectable="true"
android:layout_weight="0.5"
android:gravity="right"
android:textIsSelectable="true"
android:visibility="invisible" />
</LinearLayout>
@ -54,8 +54,8 @@ @@ -54,8 +54,8 @@
android:layout_height="@dimen/ui_details_seperator"
android:layout_below="@id/date_label_wrapper"
android:layout_centerHorizontal="true"
android:layout_marginBottom="@dimen/margin_half"
android:layout_marginTop="@dimen/margin_default"
android:layout_marginBottom="@dimen/margin_half"
android:background="@color/green"
android:textSize="@dimen/text_enlargednumbers" />
@ -98,8 +98,8 @@ @@ -98,8 +98,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/ratio_text"
android:layout_marginBottom="4dip"
android:layout_marginLeft="@dimen/margin_half"
android:layout_marginBottom="4dip"
android:layout_toRightOf="@id/separator"
android:fontFamily="sans-serif-light"
android:textColor="?attr/text_bright"
@ -178,10 +178,10 @@ @@ -178,10 +178,10 @@
android:layout_below="@id/separator"
android:layout_marginBottom="@dimen/margin_half"
android:orientation="vertical"
android:paddingBottom="@dimen/margin_half"
android:paddingLeft="@dimen/margin_default"
android:paddingTop="@dimen/margin_half"
android:paddingRight="@dimen/margin_default"
android:paddingTop="@dimen/margin_half">
android:paddingBottom="@dimen/margin_half">
<TextView
android:id="@+id/status_text"

4
app/src/main/res/layout/fragment_remoterss.xml

@ -27,11 +27,11 @@ @@ -27,11 +27,11 @@
android:spinnerMode="dialog" />
<TextView
android:id="@+id/remoterss_status_message"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/remoterss_loading"
android:gravity="center"
android:id="@+id/remoterss_status_message" />
android:text="@string/remoterss_loading" />
<ListView
android:id="@+id/torrents_list"

2
app/src/main/res/layout/fragment_rssfeeds.xml

@ -31,8 +31,8 @@ @@ -31,8 +31,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawablePadding="8dip"
android:drawableTop="?attr/loading_progress"
android:drawablePadding="8dip"
android:gravity="center"
android:maxWidth="400dip"
android:padding="@dimen/margin_default"

2
app/src/main/res/layout/fragment_rssitems.xml

@ -30,8 +30,8 @@ @@ -30,8 +30,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawablePadding="8dip"
android:drawableTop="?attr/loading_progress"
android:drawablePadding="8dip"
android:gravity="center"
android:maxWidth="400dip"
android:padding="@dimen/margin_default"

2
app/src/main/res/layout/fragment_searchresults.xml

@ -42,8 +42,8 @@ @@ -42,8 +42,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawablePadding="8dip"
android:drawableTop="?attr/loading_progress"
android:drawablePadding="8dip"
android:gravity="center"
android:maxWidth="400dip"
android:padding="@dimen/margin_default"

8
app/src/main/res/layout/fragment_torrents.xml

@ -28,9 +28,9 @@ @@ -28,9 +28,9 @@
android:id="@+id/torrents_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:choiceMode="multipleChoiceModal"
android:clipToPadding="false"
android:paddingBottom="35dp"
android:choiceMode="multipleChoiceModal"
android:visibility="gone"
tools:listitem="@layout/list_item_torrent"
tools:visibility="visible" />
@ -53,8 +53,8 @@ @@ -53,8 +53,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawablePadding="8dip"
android:drawableTop="?attr/loading_progress"
android:drawablePadding="8dip"
android:gravity="center"
android:maxWidth="400dip"
android:padding="@dimen/margin_default"
@ -67,8 +67,8 @@ @@ -67,8 +67,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawablePadding="8dip"
android:drawableTop="?attr/loading_progress"
android:drawablePadding="8dip"
android:gravity="center"
android:maxWidth="400dip"
android:padding="@dimen/margin_default"
@ -80,8 +80,8 @@ @@ -80,8 +80,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawablePadding="8dip"
android:drawableTop="?attr/loading_progress"
android:drawablePadding="8dip"
android:gravity="center"
android:maxWidth="400dip"
android:padding="@dimen/margin_default"

4
app/src/main/res/layout/list_item_filter.xml

@ -18,10 +18,10 @@ @@ -18,10 +18,10 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/activatable_background"
android:paddingBottom="@dimen/margin_half"
android:paddingLeft="@dimen/margin_default"
android:paddingTop="@dimen/margin_half"
android:paddingRight="@dimen/margin_default"
android:paddingTop="@dimen/margin_half">
android:paddingBottom="@dimen/margin_half">
<TextView
android:id="@+id/item_text"

8
app/src/main/res/layout/list_item_remoterssitem.xml

@ -19,10 +19,10 @@ @@ -19,10 +19,10 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="?attr/activatable_background"
android:paddingBottom="@dimen/margin_default"
android:paddingLeft="@dimen/margin_default"
android:paddingTop="@dimen/margin_default"
android:paddingRight="@dimen/margin_default"
android:paddingTop="@dimen/margin_default">
android:paddingBottom="@dimen/margin_default">
<TextView
android:id="@+id/label_text"
@ -37,12 +37,12 @@ @@ -37,12 +37,12 @@
android:id="@+id/name_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/label_text"
android:fontFamily="sans-serif-condensed"
android:textColor="?attr/text_bright"
android:textIsSelectable="false"
android:textSize="@dimen/text_enlarged"
tools:text="Title for torrent"
android:layout_below="@+id/label_text" />
tools:text="Title for torrent" />
<TextView
android:id="@+id/date_text"

6
app/src/main/res/layout/list_item_rssfeed.xml

@ -26,11 +26,11 @@ @@ -26,11 +26,11 @@
android:id="@+id/favicon_image"
android:layout_width="24dip"
android:layout_height="24dip"
android:layout_marginRight="@dimen/margin_default"
android:layout_marginEnd="@dimen/margin_default"
android:layout_marginRight="@dimen/margin_default"
android:scaleType="centerCrop"
tools:src="@drawable/ic_launcher"
tools:ignore="contentDescription" />
tools:ignore="contentDescription"
tools:src="@drawable/ic_launcher" />
<TextView
android:id="@+id/name_text"

4
app/src/main/res/layout/list_item_rssitem.xml

@ -19,10 +19,10 @@ @@ -19,10 +19,10 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="?attr/activatable_background"
android:paddingBottom="@dimen/margin_default"
android:paddingLeft="@dimen/margin_default"
android:paddingTop="@dimen/margin_default"
android:paddingRight="@dimen/margin_default"
android:paddingTop="@dimen/margin_default">
android:paddingBottom="@dimen/margin_default">
<TextView
android:id="@+id/name_text"

10
app/src/main/res/layout/list_item_searchresult.xml

@ -19,10 +19,10 @@ @@ -19,10 +19,10 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="?attr/activatable_background"
android:paddingBottom="@dimen/margin_half"
android:paddingLeft="@dimen/margin_default"
android:paddingTop="@dimen/margin_half"
android:paddingRight="@dimen/margin_default"
android:paddingTop="@dimen/margin_half">
android:paddingBottom="@dimen/margin_half">
<TextView
android:id="@+id/name_text"
@ -38,9 +38,9 @@ @@ -38,9 +38,9 @@
android:id="@+id/leechers_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/name_text"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_below="@id/name_text"
android:layout_marginTop="4dip"
android:textIsSelectable="false"
android:textSize="@dimen/text_small"
@ -53,8 +53,8 @@ @@ -53,8 +53,8 @@
android:layout_alignBaseline="@id/leechers_text"
android:layout_marginEnd="@dimen/margin_default"
android:layout_marginRight="@dimen/margin_default"
android:layout_toLeftOf="@id/leechers_text"
android:layout_toStartOf="@id/leechers_text"
android:layout_toLeftOf="@id/leechers_text"
android:textIsSelectable="false"
android:textSize="@dimen/text_small"
tools:text="@string/search_leechers" />
@ -73,8 +73,8 @@ @@ -73,8 +73,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@id/leechers_text"
android:layout_marginLeft="@dimen/margin_default"
android:layout_marginStart="@dimen/margin_default"
android:layout_marginLeft="@dimen/margin_default"
android:layout_toEndOf="@id/size_text"
android:layout_toRightOf="@id/size_text"
android:textIsSelectable="false"

4
app/src/main/res/layout/list_item_searchsite.xml

@ -20,10 +20,10 @@ @@ -20,10 +20,10 @@
android:layout_height="wrap_content"
android:background="?attr/activatable_background"
android:orientation="horizontal"
android:paddingBottom="@dimen/margin_half"
android:paddingLeft="@dimen/margin_default"
android:paddingTop="@dimen/margin_half"
android:paddingRight="@dimen/margin_default"
android:paddingTop="@dimen/margin_half">
android:paddingBottom="@dimen/margin_half">
<ImageView
android:id="@+id/favicon_image"

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

Loading…
Cancel
Save