aboutsummaryrefslogtreecommitdiff
path: root/src/github/daneren2005/dsub/activity/SettingsActivity.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/github/daneren2005/dsub/activity/SettingsActivity.java')
-rw-r--r--src/github/daneren2005/dsub/activity/SettingsActivity.java32
1 files changed, 29 insertions, 3 deletions
diff --git a/src/github/daneren2005/dsub/activity/SettingsActivity.java b/src/github/daneren2005/dsub/activity/SettingsActivity.java
index c1618b7d..0dd68fcb 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;
@@ -84,9 +89,11 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer
private CheckBoxPreference syncStarred;
private CheckBoxPreference syncMostRecent;
private CheckBoxPreference replayGain;
+ private ListPreference replayGainType;
private Preference replayGainBump;
private Preference replayGainUntagged;
private String internalSSID;
+ private String internalSSIDDisplay;
private int serverCount = 3;
private SharedPreferences settings;
@@ -102,7 +109,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);
@@ -125,6 +132,7 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer
syncStarred = (CheckBoxPreference) findPreference(Constants.PREFERENCES_KEY_SYNC_STARRED);
syncMostRecent = (CheckBoxPreference) findPreference(Constants.PREFERENCES_KEY_SYNC_MOST_RECENT);
replayGain = (CheckBoxPreference) findPreference(Constants.PREFERENCES_KEY_REPLAY_GAIN);
+ replayGainType = (ListPreference) findPreference(Constants.PREFERENCES_KEY_REPLAY_GAIN_TYPE);
replayGainBump = (Preference) findPreference(Constants.PREFERENCES_KEY_REPLAY_GAIN_BUMP);
replayGainUntagged = (Preference) findPreference(Constants.PREFERENCES_KEY_REPLAY_GAIN_UNTAGGED);
@@ -329,12 +337,15 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer
}
}
if(replayGain.isChecked()) {
+ replayGainType.setEnabled(true);
replayGainBump.setEnabled(true);
replayGainUntagged.setEnabled(true);
} else {
+ replayGainType.setEnabled(false);
replayGainBump.setEnabled(false);
replayGainUntagged.setEnabled(false);
}
+ replayGainType.setSummary(replayGainType.getEntry());
for (ServerSettings ss : serverSettings.values()) {
ss.update();
@@ -372,11 +383,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);