Add authMethod preference

This commit is contained in:
dddddd-mmmmmm 2020-01-13 21:51:07 +11:00
parent bf9e9ad1e6
commit 4254c8ad9f
3 changed files with 11 additions and 0 deletions

View File

@ -28,6 +28,7 @@ import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceCategory;
import android.preference.PreferenceScreen;
import android.preference.SwitchPreference;
import android.text.InputType;
import android.util.Log;
import android.view.View;
@ -469,6 +470,12 @@ public class SettingsFragment extends PreferenceCompatFragment implements Shared
serverPasswordPreference.setSummary("***");
serverPasswordPreference.setTitle(R.string.settings_server_password);
final SwitchPreference authMethodPreference = new SwitchPreference(context);
authMethodPreference.setKey(Constants.PREFERENCES_KEY_AUTH_METHOD + instance);
authMethodPreference.setSummary(R.string.settings_auth_summary);
authMethodPreference.setDefaultValue(true); // use Token/Salt by default
authMethodPreference.setTitle(R.string.settings_auth_method);
final Preference serverOpenBrowser = new Preference(context);
serverOpenBrowser.setKey(Constants.PREFERENCES_KEY_OPEN_BROWSER);
serverOpenBrowser.setPersistent(false);
@ -529,6 +536,7 @@ public class SettingsFragment extends PreferenceCompatFragment implements Shared
screen.addPreference(serverLocalNetworkSSIDPreference);
screen.addPreference(serverUsernamePreference);
screen.addPreference(serverPasswordPreference);
screen.addPreference(authMethodPreference);
screen.addPreference(serverTestConnectionPreference);
screen.addPreference(serverOpenBrowser);
screen.addPreference(serverRemoveServerPreference);

View File

@ -71,6 +71,7 @@ public final class Constants {
public static final String PREFERENCES_KEY_MUSIC_FOLDER_ID = "musicFolderId";
public static final String PREFERENCES_KEY_USERNAME = "username";
public static final String PREFERENCES_KEY_PASSWORD = "password";
public static final String PREFERENCES_KEY_AUTH_METHOD = "authMethod";
public static final String PREFERENCES_KEY_THEME = "theme";
public static final String PREFERENCES_KEY_FULL_SCREEN = "fullScreen";
public static final String PREFERENCES_KEY_DISPLAY_TRACK = "displayTrack";

View File

@ -135,6 +135,8 @@
<string name="settings.server_internal_address">Local network address</string>
<string name="settings.server_username">Username</string>
<string name="settings.server_password">Password</string>
<string name="settings.auth_method">Authentication Method</string>
<string name="settings.auth_summary">Use token/salt authentication?</string>
<string name="settings.server_open_browser">Open in browser</string>
<string name="settings.cache_title">Music cache</string>
<string name="settings.preload_wifi">Songs to preload (Wifi)</string>