Browse Source

Support for adding dedicated Xirvik servers by QR code

pull/596/head
Eric Kok 4 years ago
parent
commit
df868dfa77
  1. 51
      app/src/main/java/org/transdroid/core/gui/settings/MainSettingsActivity.java
  2. 3
      app/src/main/java/org/transdroid/core/gui/settings/PreferenceCompatActivity.java
  3. 2
      app/src/main/java/org/transdroid/core/seedbox/XirvikDediSettings.java

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

@ -294,34 +294,35 @@ public class MainSettingsActivity extends PreferenceCompatActivity {
protected void onServerBarcodeScanHandled(String[] qrResult) { protected void onServerBarcodeScanHandled(String[] qrResult) {
final String server = qrResult[0]; final String server = qrResult[0];
final String token = qrResult[2]; final String token = qrResult[2];
switch (qrResult[1]) {
case "P": new XirvikSharedSettingsActivity.RetrieveXirvikAutoConfTask(server, "", "", token) {
XirvikDediSettings xirvikDediSettings = new XirvikDediSettings(); @Override
xirvikDediSettings.saveServerSetting(this, server, token); protected void onPostExecute(String result) {
onResume(); if (result == null) {
break; log.d(MainSettingsActivity.this, "Could not retrieve the Xirvik shared seedbox RPC mount point setting");
case "N": }
XirvikSemiSettings xirvikSemiSettings = new XirvikSemiSettings(); switch (qrResult[1]) {
xirvikSemiSettings.saveServerSetting(this, server, token); case "P":
onResume(); XirvikDediSettings xirvikDediSettings = new XirvikDediSettings();
break; xirvikDediSettings.saveServerSetting(getApplicationContext(), server, token);
case "RG": onResume();
new XirvikSharedSettingsActivity.RetrieveXirvikAutoConfTask(server, "", "", token) { break;
@Override case "N":
protected void onPostExecute(String result) { XirvikSemiSettings xirvikSemiSettings = new XirvikSemiSettings();
if (result == null) { xirvikSemiSettings.saveServerSetting(getApplicationContext(), server, token);
log.d(MainSettingsActivity.this, "Could not retrieve the Xirvik shared seedbox RPC mount point setting"); onResume();
} break;
case "RG":
XirvikSharedSettings xirvikSharedSettings = new XirvikSharedSettings(); XirvikSharedSettings xirvikSharedSettings = new XirvikSharedSettings();
xirvikSharedSettings.saveServerSetting(getApplicationContext(), server, token, result); xirvikSharedSettings.saveServerSetting(getApplicationContext(), server, token, result);
onResume(); onResume();
} break;
}.execute(); default:
break; SnackbarManager.show(Snackbar.with(MainSettingsActivity.this).text(R.string.pref_seedbox_xirvikscanerror).colorResource(R.color.red).type(SnackbarType.MULTI_LINE));
default: break;
SnackbarManager.show(Snackbar.with(this).text(R.string.pref_seedbox_xirvikscanerror).colorResource(R.color.red).type(SnackbarType.MULTI_LINE)); }
break; }
} }.execute();
} }

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

@ -43,6 +43,9 @@ public class PreferenceCompatActivity extends AppCompatActivity implements AppCo
private int preferencesResId; private int preferencesResId;
public RootPreferencesFragment() {
}
public RootPreferencesFragment(int preferencesResId) { public RootPreferencesFragment(int preferencesResId) {
this.preferencesResId = preferencesResId; this.preferencesResId = preferencesResId;
} }

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

@ -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" : null, type == Daemon.Deluge ? "/deluge" : "/RPC2-aAoWTED8ngLqZyKnZ7FFEAgfz5lejcof",
true, true,
user, user,
pass, pass,

Loading…
Cancel
Save