diff --git a/app/src/main/java/org/transdroid/core/gui/settings/ServerSettingsActivity.java b/app/src/main/java/org/transdroid/core/gui/settings/ServerSettingsActivity.java index e0c1f5d4..e3d26d22 100644 --- a/app/src/main/java/org/transdroid/core/gui/settings/ServerSettingsActivity.java +++ b/app/src/main/java/org/transdroid/core/gui/settings/ServerSettingsActivity.java @@ -25,9 +25,11 @@ import android.content.Intent; import android.content.SharedPreferences; import android.os.Build; import android.os.Bundle; +import android.preference.CheckBoxPreference; import android.preference.EditTextPreference; +import android.preference.ListPreference; +import android.preference.Preference; import android.preference.PreferenceManager; -import android.text.TextUtils; import org.androidannotations.annotations.EActivity; import org.androidannotations.annotations.OptionsItem; @@ -45,8 +47,12 @@ import org.transdroid.daemon.Daemon; public class ServerSettingsActivity extends KeyBoundPreferencesActivity { private static final int DIALOG_CONFIRMREMOVE = 0; + private static final int DIALOG_DELUGE_RPC_SSL = 1; private EditTextPreference extraPass, folder, downloadDir, excludeFilter, includeFilter; + private ListPreference serverType; + private CheckBoxPreference serverSslEnabled; + private CheckBoxPreference serverSslTrustAll; @Override public void onCreate(Bundle savedInstanceState) { @@ -57,7 +63,7 @@ public class ServerSettingsActivity extends KeyBoundPreferencesActivity { // Load the raw preferences to show in this screen init(R.xml.pref_server, ApplicationSettings_.getInstance_(this).getMaxNormalServer()); initTextPreference("server_name"); - initListPreference("server_type"); + serverType = initListPreference("server_type"); initTextPreference("server_address"); initTextPreference("server_port"); initTextPreference("server_user"); @@ -77,9 +83,24 @@ public class ServerSettingsActivity extends KeyBoundPreferencesActivity { initTextPreference("server_ftpurl"); initTextPreference("server_ftppass"); initBooleanPreference("server_disableauth"); - initBooleanPreference("server_sslenabled"); - initBooleanPreference("server_ssltrustall", false, "server_sslenabled"); + serverSslEnabled = initBooleanPreference("server_sslenabled"); + serverSslTrustAll = initBooleanPreference("server_ssltrustall", false, "server_sslenabled"); initTextPreference("server_ssltrustkey", null, "server_sslenabled"); + + serverType.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { + @Override + public boolean onPreferenceChange(Preference preference, Object o) { + if (Daemon.fromCode(o.toString()) == Daemon.DelugeRpc) { + serverSslEnabled.setChecked(true); + serverSslTrustAll.setChecked(true); + showDialog(DIALOG_DELUGE_RPC_SSL); + } else { + serverSslEnabled.setChecked(false); + serverSslTrustAll.setChecked(false); + } + return true; + } + }); onPreferencesChanged(); } @@ -108,6 +129,10 @@ public class ServerSettingsActivity extends KeyBoundPreferencesActivity { finish(); } }).setNegativeButton(android.R.string.cancel, null).create(); + case DIALOG_DELUGE_RPC_SSL: + return new AlertDialog.Builder(this).setMessage(R.string.pref_deluge_rpc_ssl) + .setNeutralButton(android.R.string.ok, null) + .create(); } return null; } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 262fb594..64717d89 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -486,5 +486,6 @@ Some code/libraries are used in the project: AndroidAnnotations\n \u00A0 http://androidannotations.org/\n \u00A0 Pierre-Yves Ricau (eBusinessInformations) et al. \n \u00A0 Apache License, Version 2.0\nMaterial Dialogs\n \u00A0 https://github.com/afollestad/material-dialogs\n \u00A0 Aidan Follestad et al. \n \u00A0 MIT License\nSnackbar\n \u00A0 https://github.com/nispok/snackbar\n \u00A0 William Mora et al. \n \u00A0 MIT License\nFloatingActionButton\n \u00A0 https://github.com/futuresimple/android-floating-action-button\n \u00A0 Jerzy ChaƂupski et al. \n \u00A0 Apache License, Version 2.0\nBase16Encoder\n \u00A0 http://openjpa.apache.org/\n \u00A0 Marc Prud\'hommeaux \n \u00A0 Apache OpenJPA\n MultipartEntity \n \u00A0 Apache Software Foundation \n \u00A0 Apache License, Version 2.0\nRssParser (learning-android)\n \u00A0 http://github.com/digitalspaghetti/learning-android\n \u00A0 Tane Piper \n \u00A0 Public Domain\nBase64\n \u00A0 http://iharder.net/base64\n \u00A0 Robert Harder \n \u00A0 Public Domain\naXMLRPC\n \u00A0 https://github.com/timroes/aXMLRPC\n \u00A0 Tim Roes \n \u00A0 MIT License\nandroid-ColorPickerPreference\n \u00A0 https://github.com/attenzione/android-ColorPickerPreference\n \u00A0 Daniel Nilsson and Sergey Margaritov \n \u00A0 Apache License, Version 2.0\nFunnel icon\n \u00A0 http://thenounproject.com/noun/funnel/#icon-No5608\n \u00A0 Naomi Atkinson from The Noun Project\n \u00A0 Creative Commons Attribution 3.0 Manage your torrents from your Android device + Deluge RPC server uses a Self Signed Certificate by default. Advanced settings have been automatically changed to accept all certificates. If you want to change this, please see Advanced Settings.