Browse Source

Automatic code cleanup by Android Studio

pull/559/head
TacoTheDank 4 years ago
parent
commit
a939b0fa37
  1. 25
      app/src/full/res/values/bools.xml
  2. 12
      app/src/full/res/values/strings.xml
  3. 25
      app/src/lite/res/values/bools.xml
  4. 12
      app/src/lite/res/values/strings.xml
  5. 2
      app/src/main/java/org/transdroid/core/gui/lists/SimpleListItem.java
  6. 2
      app/src/main/java/org/transdroid/core/gui/navigation/NavigationHelper.java
  7. 6
      app/src/main/java/org/transdroid/core/gui/navigation/SelectionModificationSpinner.java
  8. 4
      app/src/main/java/org/transdroid/core/gui/search/SearchSetting.java
  9. 2
      app/src/main/java/org/transdroid/core/gui/settings/ServerPreference.java
  10. 12
      app/src/main/java/org/transdroid/core/seedbox/SeedboxSettings.java
  11. 4
      app/src/main/java/org/transdroid/core/seedbox/XirvikDediSettings.java
  12. 6
      app/src/main/java/org/transdroid/core/service/AppUpdateJobRunner.java
  13. 2
      app/src/main/java/org/transdroid/daemon/Daemon.java
  14. 4
      app/src/main/java/org/transdroid/daemon/DummyAdapter.java
  15. 4
      app/src/main/java/org/transdroid/daemon/Finishable.java
  16. 6
      app/src/main/java/org/transdroid/daemon/IDaemonAdapter.java
  17. 2
      app/src/main/java/org/transdroid/daemon/adapters/aria2c/Aria2Adapter.java
  18. 2
      app/src/main/java/org/transdroid/daemon/adapters/bitComet/BitCometAdapter.java
  19. 4
      app/src/main/java/org/transdroid/daemon/adapters/qBittorrent/QBittorrentAdapter.java
  20. 4
      app/src/main/java/org/transdroid/daemon/adapters/tTorrent/TTorrentAdapter.java
  21. 2
      app/src/main/java/org/transdroid/daemon/util/FileSizeConverter.java
  22. 2
      app/src/main/java/org/transdroid/daemon/util/SelfSignedTrustManager.java
  23. 2
      app/src/main/java/org/transdroid/daemon/util/TimespanConverter.java

25
app/src/full/res/values/bools.xml

@ -1,29 +1,28 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?><!--
<!--
Copyright 2010-2018 Eric Kok et al. Copyright 2010-2018 Eric Kok et al.
Transdroid is free software: you can redistribute it and/or modify Transdroid is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
Transdroid is distributed in the hope that it will be useful, Transdroid is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with Transdroid. If not, see <http://www.gnu.org/licenses/>. along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
--> -->
<resources> <resources>
<!-- Used to enable checking for app updates in the background --> <!-- Used to enable checking for app updates in the background -->
<bool name="updatecheck_available">true</bool> <bool name="updatecheck_available">true</bool>
<!-- Used to enable the search UI --> <!-- Used to enable the search UI -->
<bool name="search_available">true</bool> <bool name="search_available">true</bool>
<!-- Used to enable the RSS UI and background service --> <!-- Used to enable the RSS UI and background service -->
<bool name="rss_available">true</bool> <bool name="rss_available">true</bool>
<!-- Used to allow adding of seedboxes via easy server setup --> <!-- Used to allow adding of seedboxes via easy server setup -->
<bool name="seedboxes_available">true</bool> <bool name="seedboxes_available">true</bool>
</resources> </resources>

12
app/src/full/res/values/strings.xml

@ -1,24 +1,24 @@
<!-- <!--
Copyright 2010-2018 Eric Kok et al. Copyright 2010-2018 Eric Kok et al.
Transdroid is free software: you can redistribute it and/or modify Transdroid is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
Transdroid is distributed in the hope that it will be useful, Transdroid is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with Transdroid. If not, see <http://www.gnu.org/licenses/>. along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
--> -->
<resources> <resources>
<string name="app_name" translatable="false">Transdroid</string> <string name="app_name" translatable="false">Transdroid</string>
<string name="donate_text">Donate with PayPal</string> <string name="donate_text">Donate with PayPal</string>
<string name="donate_url">https://paypal.me/erickoknl</string> <string name="donate_url">https://paypal.me/erickoknl</string>
</resources> </resources>

25
app/src/lite/res/values/bools.xml

@ -1,29 +1,28 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?><!--
<!--
Copyright 2010-2018 Eric Kok et al. Copyright 2010-2018 Eric Kok et al.
Transdroid is free software: you can redistribute it and/or modify Transdroid is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
Transdroid is distributed in the hope that it will be useful, Transdroid is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with Transdroid. If not, see <http://www.gnu.org/licenses/>. along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
--> -->
<resources> <resources>
<!-- Used to enable checking for app updates in the background --> <!-- Used to enable checking for app updates in the background -->
<bool name="updatecheck_available">false</bool> <bool name="updatecheck_available">false</bool>
<!-- Used to enable the search UI --> <!-- Used to enable the search UI -->
<bool name="search_available">false</bool> <bool name="search_available">false</bool>
<!-- Used to enable the RSS UI and background service --> <!-- Used to enable the RSS UI and background service -->
<bool name="rss_available">false</bool> <bool name="rss_available">false</bool>
<!-- Used to allow adding of seedboxes via easy server setup --> <!-- Used to allow adding of seedboxes via easy server setup -->
<bool name="seedboxes_available">true</bool> <bool name="seedboxes_available">true</bool>
</resources> </resources>

12
app/src/lite/res/values/strings.xml

@ -1,24 +1,24 @@
<!-- <!--
Copyright 2010-2018 Eric Kok et al. Copyright 2010-2018 Eric Kok et al.
Transdroid is free software: you can redistribute it and/or modify Transdroid is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
Transdroid is distributed in the hope that it will be useful, Transdroid is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with Transdroid. If not, see <http://www.gnu.org/licenses/>. along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
--> -->
<resources> <resources>
<string name="app_name" translatable="false">Transdrone</string> <string name="app_name" translatable="false">Transdrone</string>
<string name="donate_text"></string> <string name="donate_text" />
<string name="donate_url"></string> <string name="donate_url" />
</resources> </resources>

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

@ -24,6 +24,6 @@ package org.transdroid.core.gui.lists;
*/ */
public interface SimpleListItem { public interface SimpleListItem {
public String getName(); String getName();
} }

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

@ -259,7 +259,7 @@ public class NavigationHelper {
* @return The app name and version, such as 'Transdroid 1.5.0 (180)' * @return The app name and version, such as 'Transdroid 1.5.0 (180)'
*/ */
public String getAppNameAndVersion() { public String getAppNameAndVersion() {
return context.getString(R.string.app_name) + " " + BuildConfig.VERSION_NAME + " (" + Integer.toString(BuildConfig.VERSION_CODE) + ")"; return context.getString(R.string.app_name) + " " + BuildConfig.VERSION_NAME + " (" + BuildConfig.VERSION_CODE + ")";
} }
/** /**

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

@ -84,11 +84,11 @@ public class SelectionModificationSpinner extends AppCompatSpinner {
* Interface to implement if an interface want to respond to selection modification actions. * Interface to implement if an interface want to respond to selection modification actions.
*/ */
public interface OnModificationActionSelectedListener { public interface OnModificationActionSelectedListener {
public void selectAll(); void selectAll();
public void selectFinished(); void selectFinished();
public void invertSelection(); void invertSelection();
} }
/** /**

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

@ -25,13 +25,13 @@ public interface SearchSetting extends SimpleListItem {
* *
* @return A unique string identifying this search setting * @return A unique string identifying this search setting
*/ */
public String getKey(); String getKey();
/** /**
* Should return an URL (which may still be abstract and not the actual search URL) specific to the search site * Should return an URL (which may still be abstract and not the actual search URL) specific to the search site
* *
* @return A clean URL directing to the search site, to, for example, get the favicon of the site * @return A clean URL directing to the search site, to, for example, get the favicon of the site
*/ */
public String getBaseUrl(); String getBaseUrl();
} }

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

@ -74,7 +74,7 @@ public class ServerPreference extends Preference {
} }
public interface OnServerClickedListener { public interface OnServerClickedListener {
public void onServerClicked(ServerSetting serverSetting); void onServerClicked(ServerSetting serverSetting);
} }
} }

12
app/src/main/java/org/transdroid/core/seedbox/SeedboxSettings.java

@ -37,7 +37,7 @@ public interface SeedboxSettings {
* *
* @return A human-readable name of this seedbox provider * @return A human-readable name of this seedbox provider
*/ */
public String getName(); String getName();
/** /**
* Should return the order number of the last specified seedbox of this type (regardless of other seedbox types). * Should return the order number of the last specified seedbox of this type (regardless of other seedbox types).
@ -45,7 +45,7 @@ public interface SeedboxSettings {
* @param prefs The shared preferences to load the settings from * @param prefs The shared preferences to load the settings from
* @return The order number (id) of the last configured seedbox, or -1 if none are configured. * @return The order number (id) of the last configured seedbox, or -1 if none are configured.
*/ */
public int getMaxSeedboxOrder(SharedPreferences prefs); int getMaxSeedboxOrder(SharedPreferences prefs);
/** /**
* Should return a {@link ServerSetting} object that can connect to the seedbox as identified by the given seedbox * Should return a {@link ServerSetting} object that can connect to the seedbox as identified by the given seedbox
@ -57,7 +57,7 @@ public interface SeedboxSettings {
* @param order The seedbox provider-specific order id referring to the specific seedbox to load settings for * @param order The seedbox provider-specific order id referring to the specific seedbox to load settings for
* @return A server settings object corresponding to the user's seedbox settings for the specified order id * @return A server settings object corresponding to the user's seedbox settings for the specified order id
*/ */
public ServerSetting getServerSetting(SharedPreferences prefs, int orderOffset, int order); ServerSetting getServerSetting(SharedPreferences prefs, int orderOffset, int order);
/** /**
* Should return a list of all the {@link ServerSetting}s available for this seedbox type. * Should return a list of all the {@link ServerSetting}s available for this seedbox type.
@ -67,7 +67,7 @@ public interface SeedboxSettings {
* seedbox * seedbox
* @return A list of all server settings objects that are stored for this seedbox type * @return A list of all server settings objects that are stored for this seedbox type
*/ */
public List<ServerSetting> getAllServerSettings(SharedPreferences prefs, int orderOffset); List<ServerSetting> getAllServerSettings(SharedPreferences prefs, int orderOffset);
/** /**
* Should remove the settings of a specific seedbox specification as identified by its seedbox provider-unique order * Should remove the settings of a specific seedbox specification as identified by its seedbox provider-unique order
@ -76,7 +76,7 @@ public interface SeedboxSettings {
* @param prefs The shared preferences to remove the settings from * @param prefs The shared preferences to remove the settings from
* @param order The id referring to a specific seedbox order number within this type of seedbox * @param order The id referring to a specific seedbox order number within this type of seedbox
*/ */
public void removeServerSetting(SharedPreferences prefs, int order); void removeServerSetting(SharedPreferences prefs, int order);
/** /**
* The settings activity in which the user can supply and edit its settings for this specific seedbox type. * The settings activity in which the user can supply and edit its settings for this specific seedbox type.
@ -84,6 +84,6 @@ public interface SeedboxSettings {
* @param context The activity context from where the settings activity will be started * @param context The activity context from where the settings activity will be started
* @return An already prepared intent that points to the settings activity for this specific type of seedbox * @return An already prepared intent that points to the settings activity for this specific type of seedbox
*/ */
public Intent getSettingsActivityIntent(Context context); Intent getSettingsActivityIntent(Context context);
} }

4
app/src/main/java/org/transdroid/core/seedbox/XirvikDediSettings.java

@ -55,8 +55,8 @@ public class XirvikDediSettings extends SeedboxSettingsImpl implements SeedboxSe
0, 0,
null, null,
type == Daemon.uTorrent ? 5010 : 443, type == Daemon.uTorrent ? 5010 : 443,
type == Daemon.uTorrent ? false : true, type != Daemon.uTorrent,
type == Daemon.uTorrent ? false : true, type != Daemon.uTorrent,
false, false,
null, null,
type == Daemon.Deluge ? "/deluge" : null, type == Daemon.Deluge ? "/deluge" : null,

6
app/src/main/java/org/transdroid/core/service/AppUpdateJobRunner.java

@ -115,7 +115,7 @@ public class AppUpdateJobRunner {
newNotification(context.getString(R.string.update_app_newversion), newNotification(context.getString(R.string.update_app_newversion),
context.getString(R.string.update_app_newversion), context.getString(R.string.update_app_newversion),
context.getString(R.string.update_updateto, app[1].trim()), context.getString(R.string.update_updateto, app[1].trim()),
DOWNLOAD_URL_APP + "?" + Integer.toString(random.nextInt()), 90000); DOWNLOAD_URL_APP + "?" + random.nextInt(), 90000);
} }
} catch (PackageManager.NameNotFoundException e) { } catch (PackageManager.NameNotFoundException e) {
// Not installed... this can never happen since this Service is part of the app itself // Not installed... this can never happen since this Service is part of the app itself
@ -131,7 +131,7 @@ public class AppUpdateJobRunner {
newNotification(context.getString(R.string.update_search_newversion), newNotification(context.getString(R.string.update_search_newversion),
context.getString(R.string.update_search_newversion), context.getString(R.string.update_search_newversion),
context.getString(R.string.update_updateto, search[1].trim()), context.getString(R.string.update_updateto, search[1].trim()),
DOWNLOAD_URL_SEARCH + "?" + Integer.toString(random.nextInt()), 90001); DOWNLOAD_URL_SEARCH + "?" + random.nextInt(), 90001);
} }
} catch (PackageManager.NameNotFoundException e) { } catch (PackageManager.NameNotFoundException e) {
// The search module isn't installed yet at all; ignore and wait for the user to manually // The search module isn't installed yet at all; ignore and wait for the user to manually
@ -164,7 +164,7 @@ public class AppUpdateJobRunner {
private String[] retrieveLatestVersion(AbstractHttpClient httpclient, String url) throws IOException { private String[] retrieveLatestVersion(AbstractHttpClient httpclient, String url) throws IOException {
HttpResponse request = httpclient.execute(new HttpGet(url)); HttpResponse request = httpclient.execute(new HttpGet(url));
InputStream stream = request.getEntity().getContent(); InputStream stream = request.getEntity().getContent();
String appVersion[] = HttpHelper.convertStreamToString(stream).split("\\|"); String[] appVersion = HttpHelper.convertStreamToString(stream).split("\\|");
stream.close(); stream.close();
return appVersion; return appVersion;
} }

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

@ -28,9 +28,9 @@ import org.transdroid.daemon.adapters.kTorrent.KTorrentAdapter;
import org.transdroid.daemon.adapters.qBittorrent.QBittorrentAdapter; import org.transdroid.daemon.adapters.qBittorrent.QBittorrentAdapter;
import org.transdroid.daemon.adapters.rTorrent.RTorrentAdapter; import org.transdroid.daemon.adapters.rTorrent.RTorrentAdapter;
import org.transdroid.daemon.adapters.synology.SynologyAdapter; import org.transdroid.daemon.adapters.synology.SynologyAdapter;
import org.transdroid.daemon.adapters.tTorrent.TTorrentAdapter;
import org.transdroid.daemon.adapters.tfb4rt.Tfb4rtAdapter; import org.transdroid.daemon.adapters.tfb4rt.Tfb4rtAdapter;
import org.transdroid.daemon.adapters.transmission.TransmissionAdapter; import org.transdroid.daemon.adapters.transmission.TransmissionAdapter;
import org.transdroid.daemon.adapters.tTorrent.TTorrentAdapter;
import org.transdroid.daemon.adapters.uTorrent.UTorrentAdapter; import org.transdroid.daemon.adapters.uTorrent.UTorrentAdapter;
import org.transdroid.daemon.adapters.vuze.VuzeAdapter; import org.transdroid.daemon.adapters.vuze.VuzeAdapter;

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

@ -82,7 +82,7 @@ public class DummyAdapter implements IDaemonAdapter {
TorrentStatus.Error}; TorrentStatus.Error};
Random random = new Random(); Random random = new Random();
for (int i = 1; i < 2026; i++) { for (int i = 1; i < 2026; i++) {
String name = names[i % names.length] + Integer.toString(i); String name = names[i % names.length] + i;
TorrentStatus status = statuses[i % statuses.length]; TorrentStatus status = statuses[i % statuses.length];
int peersGetting = status == TorrentStatus.Downloading ? i * random.nextInt(16) : 0; int peersGetting = status == TorrentStatus.Downloading ? i * random.nextInt(16) : 0;
int peersSending = status == TorrentStatus.Downloading ? i * random.nextInt(16) : 0; int peersSending = status == TorrentStatus.Downloading ? i * random.nextInt(16) : 0;
@ -144,7 +144,7 @@ public class DummyAdapter implements IDaemonAdapter {
Torrent t = task.getTargetTorrent(); Torrent t = task.getTargetTorrent();
List<TorrentFile> dummyFiles = new ArrayList<TorrentFile>(); List<TorrentFile> dummyFiles = new ArrayList<TorrentFile>();
Priority priorities[] = new Priority[]{Priority.Normal, Priority.Normal, Priority.High, Priority.Low, Priority[] priorities = new Priority[]{Priority.Normal, Priority.Normal, Priority.High, Priority.Low,
Priority.Normal}; Priority.Normal};
for (int i = 1; i < 16; i++) { for (int i = 1; i < 16; i++) {
String fileName = "file_" + i + ".ext"; String fileName = "file_" + i + ".ext";

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

@ -13,7 +13,7 @@ public interface Finishable {
* *
* @return True iif the object (like the data transfer) was started and is in progress, but was not finished yet. * @return True iif the object (like the data transfer) was started and is in progress, but was not finished yet.
*/ */
public boolean isStarted(); boolean isStarted();
/** /**
* Whether the represented object has been finished. * Whether the represented object has been finished.
@ -21,6 +21,6 @@ public interface Finishable {
* @return True iif the object (like the data transfer) was finished, which means it is no longer started or in * @return True iif the object (like the data transfer) was finished, which means it is no longer started or in
* progress. * progress.
*/ */
public boolean isFinished(); boolean isFinished();
} }

6
app/src/main/java/org/transdroid/daemon/IDaemonAdapter.java

@ -29,10 +29,10 @@ import org.transdroid.daemon.task.DaemonTaskResult;
*/ */
public interface IDaemonAdapter { public interface IDaemonAdapter {
public DaemonTaskResult executeTask(Log log, DaemonTask task); DaemonTaskResult executeTask(Log log, DaemonTask task);
public Daemon getType(); Daemon getType();
public DaemonSettings getSettings(); DaemonSettings getSettings();
} }

2
app/src/main/java/org/transdroid/daemon/adapters/aria2c/Aria2Adapter.java

@ -464,7 +464,7 @@ public class Aria2Adapter implements IDaemonAdapter {
private String convertAriaError(int errorCode) { private String convertAriaError(int errorCode) {
// Aria2 sends an exit code as error (http://aria2.sourceforge.net/manual/en/html/aria2c.html#id1) // Aria2 sends an exit code as error (http://aria2.sourceforge.net/manual/en/html/aria2c.html#id1)
String error = "Aria error #" + Integer.toString(errorCode); String error = "Aria error #" + errorCode;
switch (errorCode) { switch (errorCode) {
case 3: case 3:
case 4: case 4:

2
app/src/main/java/org/transdroid/daemon/adapters/bitComet/BitCometAdapter.java

@ -133,7 +133,7 @@ public class BitCometAdapter implements IDaemonAdapter {
// first, check client for the new AJAX interface (BitComet v.1.34 and up) // first, check client for the new AJAX interface (BitComet v.1.34 and up)
try { try {
String xmlResult = makeRequest(log, "/panel/task_list_xml"); String xmlResult = makeRequest(log, "/panel/task_list_xml");
if (xmlResult.startsWith("<?xml", 0)) { if (xmlResult.startsWith("<?xml")) {
return new RetrieveTaskSuccessResult((RetrieveTask) task, parseXmlTorrents(xmlResult), return new RetrieveTaskSuccessResult((RetrieveTask) task, parseXmlTorrents(xmlResult),
null); null);
} }

4
app/src/main/java/org/transdroid/daemon/adapters/qBittorrent/QBittorrentAdapter.java

@ -658,8 +658,8 @@ public class QBittorrentAdapter implements IDaemonAdapter {
for (int i = 0; i < response.length(); i++) { for (int i = 0; i < response.length(); i++) {
JSONObject tor = response.getJSONObject(i); JSONObject tor = response.getJSONObject(i);
double progress = tor.getDouble("progress"); double progress = tor.getDouble("progress");
int leechers[]; int[] leechers;
int seeders[]; int[] seeders;
double ratio; double ratio;
long size; long size;
long uploaded; long uploaded;

4
app/src/main/java/org/transdroid/daemon/adapters/tTorrent/TTorrentAdapter.java

@ -308,8 +308,8 @@ public class TTorrentAdapter implements IDaemonAdapter {
for (int i = 0; i < response.length(); i++) { for (int i = 0; i < response.length(); i++) {
JSONObject tor = response.getJSONObject(i); JSONObject tor = response.getJSONObject(i);
double progress = tor.getDouble("progress"); double progress = tor.getDouble("progress");
int leechers[] = parsePeers(tor.getString("num_leechs")); int[] leechers = parsePeers(tor.getString("num_leechs"));
int seeders[] = parsePeers(tor.getString("num_seeds")); int[] seeders = parsePeers(tor.getString("num_seeds"));
long size = parseSize(tor.getString("size")); long size = parseSize(tor.getString("size"));
double ratio = parseRatio(tor.getString("ratio")); double ratio = parseRatio(tor.getString("ratio"));
int dlspeed = (int) parseSize(tor.getString("dlspeed")); int dlspeed = (int) parseSize(tor.getString("dlspeed"));

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

@ -76,7 +76,7 @@ public class FileSizeConverter {
*/ */
public static String getSize(long from, boolean withUnit) { public static String getSize(long from, boolean withUnit) {
if (from < INC_SIZE) { if (from < INC_SIZE) {
return String.valueOf(from) + (withUnit ? SizeUnit.B.toString() : ""); return from + (withUnit ? SizeUnit.B.toString() : "");
} else if (from < (INC_SIZE * INC_SIZE)) { } else if (from < (INC_SIZE * INC_SIZE)) {
return String.format(Locale.getDefault(), DECIMAL_FORMATTER, ((double) from) / INC_SIZE) return String.format(Locale.getDefault(), DECIMAL_FORMATTER, ((double) from) / INC_SIZE)
+ (withUnit ? SizeUnit.KB.toString() : ""); + (withUnit ? SizeUnit.KB.toString() : "");

2
app/src/main/java/org/transdroid/daemon/util/SelfSignedTrustManager.java

@ -45,7 +45,7 @@ public class SelfSignedTrustManager implements X509TrustManager {
return hexify(digest); return hexify(digest);
} }
private static String hexify(byte bytes[]) { private static String hexify(byte[] bytes) {
char[] hexDigits = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; char[] hexDigits = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
StringBuffer buf = new StringBuffer(bytes.length * 2); StringBuffer buf = new StringBuffer(bytes.length * 2);

2
app/src/main/java/org/transdroid/daemon/util/TimespanConverter.java

@ -38,7 +38,7 @@ public class TimespanConverter {
// less then ONE_MINUTE left // less then ONE_MINUTE left
if (from < ONE_MINUTE) { if (from < ONE_MINUTE) {
return String.valueOf(from) + "s"; return from + "s";
// less than ONE_HOUR left // less than ONE_HOUR left
} else if (from < ONE_HOUR) { } else if (from < ONE_HOUR) {

Loading…
Cancel
Save