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. 22
      app/src/main/java/org/transdroid/core/seedbox/XirvikDediSettings.java
  7. 34
      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 { @@ -7,8 +7,8 @@ android {
defaultConfig {
minSdkVersion 15
targetSdkVersion 30
versionCode 239
versionName '2.5.19'
versionCode 240
versionName '2.5.20'
javaCompileOptions {
annotationProcessorOptions {

2
app/src/main/AndroidManifest.xml

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

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

@ -17,7 +17,6 @@ @@ -17,7 +17,6 @@
package org.transdroid.core.app.settings;
import android.content.Context;
import android.net.Uri;
import android.text.TextUtils;
import org.transdroid.core.gui.lists.SimpleListItem;
@ -124,12 +123,24 @@ public class ServerSetting implements SimpleListItem { @@ -124,12 +123,24 @@ public class ServerSetting implements SimpleListItem {
@Override
public String getName() {
if (!TextUtils.isEmpty(name)) {
return name;
return ServerSetting.getServerName(name, address);
}
public static String getServerName(String giveName, String givenAddress) {
if (giveName != null && !giveName.isEmpty()) {
return giveName;
}
if (!TextUtils.isEmpty(address)) {
String host = Uri.parse(address).getHost();
return host == null ? DEFAULT_NAME : host;
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;
}
}
}
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; @@ -57,8 +57,8 @@ import org.transdroid.core.seedbox.SeedboxPreference.OnSeedboxClickedListener;
import org.transdroid.core.seedbox.SeedboxProvider;
import org.transdroid.core.seedbox.XirvikDediSettings;
import org.transdroid.core.seedbox.XirvikSemiSettings;
import org.transdroid.core.seedbox.XirvikSettingsActivity;
import org.transdroid.core.seedbox.XirvikSharedSettings;
import org.transdroid.core.seedbox.XirvikSharedSettingsActivity;
import java.util.ArrayList;
import java.util.List;
@ -128,7 +128,7 @@ public class MainSettingsActivity extends PreferenceCompatActivity { @@ -128,7 +128,7 @@ public class MainSettingsActivity extends PreferenceCompatActivity {
// Start the configuration activity for this specific chosen seedbox
if (which == 0)
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);
else
startActivity(SeedboxProvider.values()[which - 1].getSettings().getSettingsActivityIntent(MainSettingsActivity.this));
@ -266,10 +266,10 @@ public class MainSettingsActivity extends PreferenceCompatActivity { @@ -266,10 +266,10 @@ public class MainSettingsActivity extends PreferenceCompatActivity {
protected Dialog onCreateDialog(int id) {
if (id == DIALOG_ADDSEEDBOX) {
// 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);
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);
return new AlertDialog.Builder(this).setItems(seedboxes, onAddSeedbox).create();
@ -296,7 +296,7 @@ public class MainSettingsActivity extends PreferenceCompatActivity { @@ -296,7 +296,7 @@ public class MainSettingsActivity extends PreferenceCompatActivity {
final String token = qrResult[2];
final String name = server.replace(".xirvik.com", "");
new XirvikSharedSettingsActivity.RetrieveXirvikAutoConfTask(server, "", "", token) {
new XirvikSettingsActivity.RetrieveXirvikAutoConfTask(server, "", "", token) {
@Override
protected void onPostExecute(String result) {
if (result == null) {

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

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

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

@ -45,7 +45,7 @@ public class XirvikDediSettings extends SeedboxSettingsImpl implements SeedboxSe @@ -45,7 +45,7 @@ public class XirvikDediSettings extends SeedboxSettingsImpl implements SeedboxSe
if (server == 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 pass = prefs.getString("seedbox_xirvikdedi_pass_" + order, null);
String authToken = prefs.getString("seedbox_xirvikdedi_token_" + order, null);
@ -62,7 +62,7 @@ public class XirvikDediSettings extends SeedboxSettingsImpl implements SeedboxSe @@ -62,7 +62,7 @@ public class XirvikDediSettings extends SeedboxSettingsImpl implements SeedboxSe
type != Daemon.uTorrent,
false,
null,
type == Daemon.Deluge ? "/deluge" : "/RPC2-aAoWTED8ngLqZyKnZ7FFEAgfz5lejcof",
type == Daemon.Deluge ? "/deluge" : null,
true,
user,
pass,
@ -106,21 +106,21 @@ public class XirvikDediSettings extends SeedboxSettingsImpl implements SeedboxSe @@ -106,21 +106,21 @@ public class XirvikDediSettings extends SeedboxSettingsImpl implements SeedboxSe
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
// Check server already exists to replace token
for(int i = 0 ; i <= SeedboxProvider.XirvikDedi.getSettings().getMaxSeedboxOrder(PreferenceManager.getDefaultSharedPreferences(context)) ; i++) {
if(prefs.getString("seedbox_xirvikdedi_server_" + i, "").equals(server)) {
for (int i = 0; i <= SeedboxProvider.XirvikDedi.getSettings().getMaxSeedboxOrder(PreferenceManager.getDefaultSharedPreferences(context)); i++) {
if (prefs.getString("seedbox_xirvikdedi_server_" + i, "").equals(server)) {
key = i;
}
}
// Store new seedbox pref
prefs.edit()
.putString("seedbox_xirvikdedi_client_" + key, Daemon.toCode(Daemon.rTorrent))
.putString("seedbox_xirvikdedi_name_" + key, name)
.putString("seedbox_xirvikdedi_server_" + key, server)
.putString("seedbox_xirvikdedi_user_" + key, "")
.putString("seedbox_xirvikdedi_pass_" + key, "")
.putString("seedbox_xirvikdedi_token_" + key, token)
.apply();
.putString("seedbox_xirvikdedi_client_" + key, Daemon.toCode(Daemon.rTorrent))
.putString("seedbox_xirvikdedi_name_" + key, name)
.putString("seedbox_xirvikdedi_server_" + key, server)
.putString("seedbox_xirvikdedi_user_" + key, "")
.putString("seedbox_xirvikdedi_pass_" + key, "")
.putString("seedbox_xirvikdedi_token_" + key, token)
.apply();
}

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

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

@ -35,7 +35,7 @@ public class XirvikSharedSettings extends SeedboxSettingsImpl implements Seedbox @@ -35,7 +35,7 @@ public class XirvikSharedSettings extends SeedboxSettingsImpl implements Seedbox
@Override
public String getName() {
return "Xirvik shared";
return "Xirvik";
}
@Override
@ -45,7 +45,7 @@ public class XirvikSharedSettings extends SeedboxSettingsImpl implements Seedbox @@ -45,7 +45,7 @@ public class XirvikSharedSettings extends SeedboxSettingsImpl implements Seedbox
if (server == 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 pass = prefs.getString("seedbox_xirvikshared_pass_" + order, null);
String rpc = prefs.getString("seedbox_xirvikshared_rpc_" + order, null);
@ -84,7 +84,7 @@ public class XirvikSharedSettings extends SeedboxSettingsImpl implements Seedbox @@ -84,7 +84,7 @@ public class XirvikSharedSettings extends SeedboxSettingsImpl implements Seedbox
@Override
public Intent getSettingsActivityIntent(Context context) {
return XirvikSharedSettingsActivity_.intent(context).get();
return XirvikSettingsActivity_.intent(context).get();
}
@Override
@ -101,13 +101,13 @@ public class XirvikSharedSettings extends SeedboxSettingsImpl implements Seedbox @@ -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) {
// 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
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
// 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)) {
key = i;
}

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

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

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

@ -379,12 +379,12 @@ @@ -379,12 +379,12 @@
<string name="pref_seedbox_client">Torrent client</string>
<string name="pref_seedbox_client_info">Client to connect to</string>
<string name="pref_seedbox_server">Server address</string>
<string name="pref_seedbox_xirvikviaqr">Add Xirvik server via QR</string>
<string name="pref_seedbox_xirvikscanerror">Not a valid Xirvik server QR code</string>
<string name="pref_seedbox_xirvikviaqr">Add Xirvik seedbox via QR</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_xirvikhint2">Like semixl001a.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-array name="pref_seedbox_xirvikclients" translatable="false">
<item>rTorrent</item>

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

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

Loading…
Cancel
Save