Browse Source

Bump version for 2.5.20 release

pull/596/head v2.5.20
Eric Kok 3 years ago
parent
commit
29c3b3b0dc
  1. 4
      app/build.gradle
  2. 2
      app/src/main/AndroidManifest.xml
  3. 23
      app/src/main/java/org/transdroid/core/app/settings/ServerSetting.java
  4. 10
      app/src/main/java/org/transdroid/core/gui/settings/MainSettingsActivity.java
  5. 6
      app/src/main/java/org/transdroid/core/seedbox/SeedboxProvider.java
  6. 4
      app/src/main/java/org/transdroid/core/seedbox/XirvikDediSettings.java
  7. 22
      app/src/main/java/org/transdroid/core/seedbox/XirvikSettingsActivity.java
  8. 10
      app/src/main/java/org/transdroid/core/seedbox/XirvikSharedSettings.java
  9. 6
      app/src/main/java/org/transdroid/daemon/DaemonSettings.java
  10. 6
      app/src/main/res/values/strings.xml
  11. 5
      app/src/main/res/xml/pref_seedbox_xirvikshared.xml

4
app/build.gradle

@ -7,8 +7,8 @@ android {
defaultConfig { defaultConfig {
minSdkVersion 15 minSdkVersion 15
targetSdkVersion 30 targetSdkVersion 30
versionCode 239 versionCode 240
versionName '2.5.19' versionName '2.5.20'
javaCompileOptions { javaCompileOptions {
annotationProcessorOptions { annotationProcessorOptions {

2
app/src/main/AndroidManifest.xml

@ -230,7 +230,7 @@
android:name="org.transdroid.core.seedbox.DediseedboxSettingsActivity_" android:name="org.transdroid.core.seedbox.DediseedboxSettingsActivity_"
android:theme="@style/TransdroidTheme.Settings" /> android:theme="@style/TransdroidTheme.Settings" />
<activity <activity
android:name="org.transdroid.core.seedbox.XirvikSharedSettingsActivity_" android:name="org.transdroid.core.seedbox.XirvikSettingsActivity_"
android:theme="@style/TransdroidTheme.Settings" /> android:theme="@style/TransdroidTheme.Settings" />
<activity <activity
android:name="org.transdroid.core.seedbox.XirvikSemiSettingsActivity_" android:name="org.transdroid.core.seedbox.XirvikSemiSettingsActivity_"

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

@ -17,7 +17,6 @@
package org.transdroid.core.app.settings; package org.transdroid.core.app.settings;
import android.content.Context; import android.content.Context;
import android.net.Uri;
import android.text.TextUtils; import android.text.TextUtils;
import org.transdroid.core.gui.lists.SimpleListItem; import org.transdroid.core.gui.lists.SimpleListItem;
@ -124,12 +123,24 @@ public class ServerSetting implements SimpleListItem {
@Override @Override
public String getName() { public String getName() {
if (!TextUtils.isEmpty(name)) { return ServerSetting.getServerName(name, address);
return name; }
public static String getServerName(String giveName, String givenAddress) {
if (giveName != null && !giveName.isEmpty()) {
return giveName;
}
if (givenAddress != null) {
int dot = givenAddress.lastIndexOf(".");
if (dot > 0) {
try {
Integer.parseInt(givenAddress.substring(dot));
// Last bit is numeric: looks like an IP, so better use the default fallback name
} catch (NumberFormatException e) {
// Not numeric, looks like a domain name we can use
return givenAddress;
}
} }
if (!TextUtils.isEmpty(address)) {
String host = Uri.parse(address).getHost();
return host == null ? DEFAULT_NAME : host;
} }
return DEFAULT_NAME; return DEFAULT_NAME;
} }

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

@ -57,8 +57,8 @@ import org.transdroid.core.seedbox.SeedboxPreference.OnSeedboxClickedListener;
import org.transdroid.core.seedbox.SeedboxProvider; import org.transdroid.core.seedbox.SeedboxProvider;
import org.transdroid.core.seedbox.XirvikDediSettings; import org.transdroid.core.seedbox.XirvikDediSettings;
import org.transdroid.core.seedbox.XirvikSemiSettings; import org.transdroid.core.seedbox.XirvikSemiSettings;
import org.transdroid.core.seedbox.XirvikSettingsActivity;
import org.transdroid.core.seedbox.XirvikSharedSettings; import org.transdroid.core.seedbox.XirvikSharedSettings;
import org.transdroid.core.seedbox.XirvikSharedSettingsActivity;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -128,7 +128,7 @@ public class MainSettingsActivity extends PreferenceCompatActivity {
// Start the configuration activity for this specific chosen seedbox // Start the configuration activity for this specific chosen seedbox
if (which == 0) if (which == 0)
ServerSettingsActivity_.intent(MainSettingsActivity.this).start(); ServerSettingsActivity_.intent(MainSettingsActivity.this).start();
else if (which == SeedboxProvider.values().length + 1) else if (which == SeedboxProvider.activeProviders().length + 1)
BarcodeHelper.startBarcodeScanner(this, BarcodeHelper.ACTIVITY_BARCODE_ADDSERVER); BarcodeHelper.startBarcodeScanner(this, BarcodeHelper.ACTIVITY_BARCODE_ADDSERVER);
else else
startActivity(SeedboxProvider.values()[which - 1].getSettings().getSettingsActivityIntent(MainSettingsActivity.this)); startActivity(SeedboxProvider.values()[which - 1].getSettings().getSettingsActivityIntent(MainSettingsActivity.this));
@ -266,10 +266,10 @@ public class MainSettingsActivity extends PreferenceCompatActivity {
protected Dialog onCreateDialog(int id) { protected Dialog onCreateDialog(int id) {
if (id == DIALOG_ADDSEEDBOX) { if (id == DIALOG_ADDSEEDBOX) {
// Open dialog to pick one of the supported seedbox providers (or a normal server) // Open dialog to pick one of the supported seedbox providers (or a normal server)
String[] seedboxes = new String[SeedboxProvider.values().length + 2]; String[] seedboxes = new String[SeedboxProvider.activeProviders().length + 2];
seedboxes[0] = getString(R.string.pref_addserver_normal); seedboxes[0] = getString(R.string.pref_addserver_normal);
for (int i = 0; i < seedboxes.length - 2; i++) { for (int i = 0; i < seedboxes.length - 2; i++) {
seedboxes[i + 1] = getString(R.string.pref_seedbox_addseedbox, SeedboxProvider.values()[i].getSettings().getName()); seedboxes[i + 1] = getString(R.string.pref_seedbox_addseedbox, SeedboxProvider.activeProviders()[i].getSettings().getName());
} }
seedboxes[seedboxes.length - 1] = getString(R.string.pref_seedbox_xirvikviaqr); seedboxes[seedboxes.length - 1] = getString(R.string.pref_seedbox_xirvikviaqr);
return new AlertDialog.Builder(this).setItems(seedboxes, onAddSeedbox).create(); return new AlertDialog.Builder(this).setItems(seedboxes, onAddSeedbox).create();
@ -296,7 +296,7 @@ public class MainSettingsActivity extends PreferenceCompatActivity {
final String token = qrResult[2]; final String token = qrResult[2];
final String name = server.replace(".xirvik.com", ""); final String name = server.replace(".xirvik.com", "");
new XirvikSharedSettingsActivity.RetrieveXirvikAutoConfTask(server, "", "", token) { new XirvikSettingsActivity.RetrieveXirvikAutoConfTask(server, "", "", token) {
@Override @Override
protected void onPostExecute(String result) { protected void onPostExecute(String result) {
if (result == null) { if (result == null) {

6
app/src/main/java/org/transdroid/core/seedbox/SeedboxProvider.java

@ -32,7 +32,7 @@ public enum SeedboxProvider {
return new DediseedboxSettings(); return new DediseedboxSettings();
} }
}, },
XirvikShared { Xirvik {
@Override @Override
public SeedboxSettings getSettings() { public SeedboxSettings getSettings() {
return new XirvikSharedSettings(); return new XirvikSharedSettings();
@ -51,6 +51,10 @@ public enum SeedboxProvider {
} }
}; };
public static SeedboxProvider[] activeProviders() {
return new SeedboxProvider[]{SeedboxProvider.Dediseedbox, SeedboxProvider.Xirvik};
}
public abstract SeedboxSettings getSettings(); public abstract SeedboxSettings getSettings();
} }

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

@ -45,7 +45,7 @@ public class XirvikDediSettings extends SeedboxSettingsImpl implements SeedboxSe
if (server == null) { if (server == null) {
return null; return null;
} }
Daemon type = Daemon.fromCode(prefs.getString("seedbox_xirvikdedi_client_" + order, null)); Daemon type = Daemon.fromCode(prefs.getString("seedbox_xirvikdedi_client_" + order, Daemon.toCode(Daemon.rTorrent)));
String user = prefs.getString("seedbox_xirvikdedi_user_" + order, null); String user = prefs.getString("seedbox_xirvikdedi_user_" + order, null);
String pass = prefs.getString("seedbox_xirvikdedi_pass_" + order, null); String pass = prefs.getString("seedbox_xirvikdedi_pass_" + order, null);
String authToken = prefs.getString("seedbox_xirvikdedi_token_" + order, null); String authToken = prefs.getString("seedbox_xirvikdedi_token_" + order, null);
@ -62,7 +62,7 @@ public class XirvikDediSettings extends SeedboxSettingsImpl implements SeedboxSe
type != Daemon.uTorrent, type != Daemon.uTorrent,
false, false,
null, null,
type == Daemon.Deluge ? "/deluge" : "/RPC2-aAoWTED8ngLqZyKnZ7FFEAgfz5lejcof", type == Daemon.Deluge ? "/deluge" : null,
true, true,
user, user,
pass, pass,

22
app/src/main/java/org/transdroid/core/seedbox/XirvikSharedSettingsActivity.java → app/src/main/java/org/transdroid/core/seedbox/XirvikSettingsActivity.java

@ -53,7 +53,7 @@ import java.io.InputStream;
*/ */
@EActivity @EActivity
@OptionsMenu(resName = "activity_deleteableprefs") @OptionsMenu(resName = "activity_deleteableprefs")
public class XirvikSharedSettingsActivity extends KeyBoundPreferencesActivity { public class XirvikSettingsActivity extends KeyBoundPreferencesActivity {
@Bean @Bean
protected Log log; protected Log log;
@ -67,12 +67,11 @@ public class XirvikSharedSettingsActivity extends KeyBoundPreferencesActivity {
// Load the raw preferences to show in this screen // Load the raw preferences to show in this screen
init(R.xml.pref_seedbox_xirvikshared, init(R.xml.pref_seedbox_xirvikshared,
SeedboxProvider.XirvikShared.getSettings().getMaxSeedboxOrder(PreferenceManager.getDefaultSharedPreferences(this))); SeedboxProvider.Xirvik.getSettings().getMaxSeedboxOrder(PreferenceManager.getDefaultSharedPreferences(this)));
initTextPreference("seedbox_xirvikshared_name"); initTextPreference("seedbox_xirvikshared_name");
initTextPreference("seedbox_xirvikshared_server"); initTextPreference("seedbox_xirvikshared_server");
initTextPreference("seedbox_xirvikshared_user"); initTextPreference("seedbox_xirvikshared_user");
initTextPreference("seedbox_xirvikshared_pass"); initTextPreference("seedbox_xirvikshared_pass");
initTextPreference("seedbox_xirvikshared_rpc");
initBooleanPreference("seedbox_xirvikshared_alarmfinished", true); initBooleanPreference("seedbox_xirvikshared_alarmfinished", true);
initBooleanPreference("seedbox_xirvikshared_alarmnew", true); initBooleanPreference("seedbox_xirvikshared_alarmnew", true);
excludeFilter = initTextPreference("seedbox_xirvikshared_alarmexclude"); excludeFilter = initTextPreference("seedbox_xirvikshared_alarmexclude");
@ -82,7 +81,6 @@ public class XirvikSharedSettingsActivity extends KeyBoundPreferencesActivity {
@Override @Override
protected void onPreferencesChanged() { protected void onPreferencesChanged() {
// Show the exclude and the include filters if notifying // Show the exclude and the include filters if notifying
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
boolean alarmFinished = prefs.getBoolean("seedbox_xirvikshared_alarmfinished_" + key, true); boolean alarmFinished = prefs.getBoolean("seedbox_xirvikshared_alarmfinished_" + key, true);
@ -96,26 +94,28 @@ public class XirvikSharedSettingsActivity extends KeyBoundPreferencesActivity {
String pass = prefs.getString("seedbox_xirvikshared_pass_" + key, null); String pass = prefs.getString("seedbox_xirvikshared_pass_" + key, null);
String token = prefs.getString("seedbox_xirvikshared_token_" + key, null); String token = prefs.getString("seedbox_xirvikshared_token_" + key, null);
boolean enteredServerName = server != null && !server.isEmpty();
boolean enteredUserCredentials = user != null && !user.isEmpty() && pass != null && !pass.isEmpty();
boolean hasToken = token != null && !token.isEmpty();
if (enteredServerName && (enteredUserCredentials || hasToken)) {
new RetrieveXirvikAutoConfTask(server, user, pass, token) { new RetrieveXirvikAutoConfTask(server, user, pass, token) {
@Override @Override
protected void onPostExecute(String result) { protected void onPostExecute(String result) {
storeScgiMountFolder(result); storeScgiMountFolder(result);
} }
}.execute(); }.execute();
}
} }
protected void storeScgiMountFolder(String result) { protected void storeScgiMountFolder(String result) {
Editor edit = PreferenceManager.getDefaultSharedPreferences(XirvikSharedSettingsActivity.this).edit(); Editor edit = PreferenceManager.getDefaultSharedPreferences(XirvikSettingsActivity.this).edit();
EditTextPreference pref = (EditTextPreference) findPreference("seedbox_xirvikshared_rpc_" + key);
if (result == null) { if (result == null) {
log.d(this, "Could not retrieve the Xirvik shared seedbox RPC mount point setting"); log.d(this, "Could not retrieve the Xirvik shared seedbox RPC mount point setting");
SnackbarManager.show(Snackbar.with(this).text(R.string.pref_seedbox_xirviknofolder).colorResource(R.color.red)); SnackbarManager.show(Snackbar.with(this).text(R.string.pref_seedbox_xirvikfolderfallback).colorResource(R.color.red));
edit.remove("seedbox_xirvikshared_rpc_" + key); edit.putString("seedbox_xirvikshared_rpc_" + key, null);
pref.setSummary("");
} else { } else {
edit.putString("seedbox_xirvikshared_rpc_" + key, result); edit.putString("seedbox_xirvikshared_rpc_" + key, result);
pref.setSummary(result);
} }
edit.apply(); edit.apply();
} }
@ -129,7 +129,7 @@ public class XirvikSharedSettingsActivity extends KeyBoundPreferencesActivity {
@OptionsItem(resName = "action_removesettings") @OptionsItem(resName = "action_removesettings")
protected void removeSettings() { protected void removeSettings() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
SeedboxProvider.XirvikShared.getSettings().removeServerSetting(prefs, key); SeedboxProvider.Xirvik.getSettings().removeServerSetting(prefs, key);
finish(); finish();
} }

10
app/src/main/java/org/transdroid/core/seedbox/XirvikSharedSettings.java

@ -35,7 +35,7 @@ public class XirvikSharedSettings extends SeedboxSettingsImpl implements Seedbox
@Override @Override
public String getName() { public String getName() {
return "Xirvik shared"; return "Xirvik";
} }
@Override @Override
@ -45,7 +45,7 @@ public class XirvikSharedSettings extends SeedboxSettingsImpl implements Seedbox
if (server == null) { if (server == null) {
return null; return null;
} }
Daemon type = Daemon.fromCode(prefs.getString("seedbox_xirvikshared_client_" + order, null)); Daemon type = Daemon.fromCode(prefs.getString("seedbox_xirvikshared_client_" + order, Daemon.toCode(Daemon.rTorrent)));
String user = prefs.getString("seedbox_xirvikshared_user_" + order, null); String user = prefs.getString("seedbox_xirvikshared_user_" + order, null);
String pass = prefs.getString("seedbox_xirvikshared_pass_" + order, null); String pass = prefs.getString("seedbox_xirvikshared_pass_" + order, null);
String rpc = prefs.getString("seedbox_xirvikshared_rpc_" + order, null); String rpc = prefs.getString("seedbox_xirvikshared_rpc_" + order, null);
@ -84,7 +84,7 @@ public class XirvikSharedSettings extends SeedboxSettingsImpl implements Seedbox
@Override @Override
public Intent getSettingsActivityIntent(Context context) { public Intent getSettingsActivityIntent(Context context) {
return XirvikSharedSettingsActivity_.intent(context).get(); return XirvikSettingsActivity_.intent(context).get();
} }
@Override @Override
@ -101,13 +101,13 @@ public class XirvikSharedSettings extends SeedboxSettingsImpl implements Seedbox
public void saveServerSetting(final Context context, String server, String token, String rcp, String name) { public void saveServerSetting(final Context context, String server, String token, String rcp, String name) {
// Get server order // Get server order
int key = SeedboxProvider.XirvikShared.getSettings().getMaxSeedboxOrder(PreferenceManager.getDefaultSharedPreferences(context)) + 1; int key = SeedboxProvider.Xirvik.getSettings().getMaxSeedboxOrder(PreferenceManager.getDefaultSharedPreferences(context)) + 1;
// Shared preferences // Shared preferences
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
// Check server already exists to replace token // Check server already exists to replace token
for (int i = 0; i <= SeedboxProvider.XirvikShared.getSettings().getMaxSeedboxOrder(PreferenceManager.getDefaultSharedPreferences(context)); i++) { for (int i = 0; i <= SeedboxProvider.Xirvik.getSettings().getMaxSeedboxOrder(PreferenceManager.getDefaultSharedPreferences(context)); i++) {
if (prefs.getString("seedbox_xirvikshared_server_" + i, "").equals(server)) { if (prefs.getString("seedbox_xirvikshared_server_" + i, "").equals(server)) {
key = i; key = i;
} }

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

@ -17,6 +17,8 @@
*/ */
package org.transdroid.daemon; package org.transdroid.daemon;
import org.transdroid.core.app.settings.ServerSetting;
/** /**
* A class that contains all the settings for a server daemon to connect. * A class that contains all the settings for a server daemon to connect.
* *
@ -24,8 +26,6 @@ package org.transdroid.daemon;
*/ */
public final class DaemonSettings { public final class DaemonSettings {
private static final String DEFAULT_NAME = "Default";
final private String name; final private String name;
final private Daemon type; final private Daemon type;
final private String address; final private String address;
@ -102,7 +102,7 @@ public final class DaemonSettings {
} }
public String getName() { public String getName() {
return (name == null || name.equals("") ? DEFAULT_NAME : name); return ServerSetting.getServerName(name, address);
} }
public Daemon getType() { public Daemon getType() {

6
app/src/main/res/values/strings.xml

@ -379,12 +379,12 @@
<string name="pref_seedbox_client">Torrent client</string> <string name="pref_seedbox_client">Torrent client</string>
<string name="pref_seedbox_client_info">Client to connect to</string> <string name="pref_seedbox_client_info">Client to connect to</string>
<string name="pref_seedbox_server">Server address</string> <string name="pref_seedbox_server">Server address</string>
<string name="pref_seedbox_xirvikviaqr">Add Xirvik server via QR</string> <string name="pref_seedbox_xirvikviaqr">Add Xirvik seedbox via QR</string>
<string name="pref_seedbox_xirvikscanerror">Not a valid Xirvik server QR code</string> <string name="pref_seedbox_xirvikscanerror">Not a valid Xirvik seedbox QR code</string>
<string name="pref_seedbox_xirvikhint">Like eplus001.xirvik.com</string> <string name="pref_seedbox_xirvikhint">Like eplus001.xirvik.com</string>
<string name="pref_seedbox_xirvikhint2">Like semixl001a.xirvik.com</string> <string name="pref_seedbox_xirvikhint2">Like semixl001a.xirvik.com</string>
<string name="pref_seedbox_xirvikhint3">Like desharedgbit001.xirvik.com</string> <string name="pref_seedbox_xirvikhint3">Like desharedgbit001.xirvik.com</string>
<string name="pref_seedbox_xirviknofolder">Cannot retrieve the Xirvik SCGI folder setting; please try again later or correct your server address setting</string> <string name="pref_seedbox_xirvikfolderfallback">Cannot retrieve the Xirvik SCGI folder setting; using /RPC2 as default</string>
<string name="pref_seedbox_dediseedboxhint">Like abcd123.dediseedbox.com</string> <string name="pref_seedbox_dediseedboxhint">Like abcd123.dediseedbox.com</string>
<string-array name="pref_seedbox_xirvikclients" translatable="false"> <string-array name="pref_seedbox_xirvikclients" translatable="false">
<item>rTorrent</item> <item>rTorrent</item>

5
app/src/main/res/xml/pref_seedbox_xirvikshared.xml

@ -39,11 +39,6 @@
android:key="seedbox_xirvikshared_pass" android:key="seedbox_xirvikshared_pass"
android:title="@string/pref_pass" android:title="@string/pref_pass"
app:iconSpaceReserved="false" /> app:iconSpaceReserved="false" />
<EditTextPreference
android:enabled="false"
android:key="seedbox_xirvikshared_rpc"
android:title="@string/pref_folder"
app:iconSpaceReserved="false" />
<PreferenceScreen <PreferenceScreen
android:title="@string/pref_optional" android:title="@string/pref_optional"

Loading…
Cancel
Save