diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-10-04 17:21:52 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-10-04 17:21:52 -0700 |
commit | e28c8eabbc2283bbbb214c3c15743d492840ae00 (patch) | |
tree | c4e6eadcff482a8407fac7412dd61e3ff40d82c5 | |
parent | 585ce314976f7afdc48cee40ebc6a401e4fd3f73 (diff) | |
download | dsub-e28c8eabbc2283bbbb214c3c15743d492840ae00.tar.gz dsub-e28c8eabbc2283bbbb214c3c15743d492840ae00.tar.bz2 dsub-e28c8eabbc2283bbbb214c3c15743d492840ae00.zip |
Change text to a button to set current SSID
-rw-r--r-- | src/github/daneren2005/dsub/activity/SettingsActivity.java | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/github/daneren2005/dsub/activity/SettingsActivity.java b/src/github/daneren2005/dsub/activity/SettingsActivity.java index c1618b7d..8335463b 100644 --- a/src/github/daneren2005/dsub/activity/SettingsActivity.java +++ b/src/github/daneren2005/dsub/activity/SettingsActivity.java @@ -39,6 +39,10 @@ import android.preference.PreferenceScreen; import android.text.InputType; import android.util.Log; import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.EditText; import github.daneren2005.dsub.R; import github.daneren2005.dsub.service.DownloadService; @@ -55,6 +59,7 @@ import java.io.File; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.net.URL; +import java.security.acl.Group; import java.util.LinkedHashMap; import java.util.Locale; import java.util.Map; @@ -87,6 +92,7 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer private Preference replayGainBump; private Preference replayGainUntagged; private String internalSSID; + private String internalSSIDDisplay; private int serverCount = 3; private SharedPreferences settings; @@ -102,7 +108,7 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer if(internalSSID == null) { internalSSID = ""; } - internalSSID = this.getResources().getString(R.string.settings_server_local_network_ssid_hint, internalSSID); + internalSSIDDisplay = this.getResources().getString(R.string.settings_server_local_network_ssid_hint, internalSSID); theme = (ListPreference) findPreference(Constants.PREFERENCES_KEY_THEME); maxBitrateWifi = (ListPreference) findPreference(Constants.PREFERENCES_KEY_MAX_BITRATE_WIFI); @@ -372,11 +378,26 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer serverUrlPreference.setSummary(serverUrlPreference.getText()); screen.setSummary(serverUrlPreference.getText()); - final EditTextPreference serverLocalNetworkSSIDPreference = new EditTextPreference(this); + final EditTextPreference serverLocalNetworkSSIDPreference = new EditTextPreference(this) { + @Override + protected void onAddEditTextToDialogView(View dialogView, final EditText editText) { + super.onAddEditTextToDialogView(dialogView, editText); + ViewGroup root = (ViewGroup) ((ViewGroup) dialogView).getChildAt(0); + + Button defaultButton = new Button(getContext()); + defaultButton.setText(internalSSIDDisplay); + defaultButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + editText.setText(internalSSID); + } + }); + root.addView(defaultButton); + } + }; serverLocalNetworkSSIDPreference.setKey(Constants.PREFERENCES_KEY_SERVER_LOCAL_NETWORK_SSID + instance); serverLocalNetworkSSIDPreference.setTitle(R.string.settings_server_local_network_ssid); serverLocalNetworkSSIDPreference.setDialogTitle(R.string.settings_server_local_network_ssid); - serverLocalNetworkSSIDPreference.setDialogMessage(internalSSID); final EditTextPreference serverInternalUrlPreference = new EditTextPreference(this); serverInternalUrlPreference.setKey(Constants.PREFERENCES_KEY_SERVER_INTERNAL_URL + instance); |