aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--res/values/strings.xml2
-rw-r--r--res/xml/settings.xml17
-rw-r--r--src/github/daneren2005/dsub/activity/SettingsActivity.java9
-rw-r--r--src/github/daneren2005/dsub/view/SeekBarPreference.java4
4 files changed, 15 insertions, 17 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index b00f66bc..dc2e4980 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -275,7 +275,7 @@
<string name="settings.cache_title">Music cache</string>
<string name="settings.preload_wifi">Songs to preload (Wifi)</string>
<string name="settings.preload_mobile">Songs to preload (Mobile)</string>
- <string name="settings.cache_size">Cache size (MB)</string>
+ <string name="settings.cache_size">Cache size</string>
<string name="settings.cache_location">Cache location</string>
<string name="settings.cache_location_error">Invalid cache location. Using default.</string>
<string name="settings.cache_location_reset">The cache location you have set is no longer writable. If you recently upgraded your phone OS to KitKat 4.4, then the way apps write to the SD Card has changed so that they can only write to a specific location. The location that DSub uses has already been automatically changed to the correct location. In order to delete all of the old app data, you will need to mount the SD Card on your computer and delete the old folder manually</string>
diff --git a/res/xml/settings.xml b/res/xml/settings.xml
index de9c641b..cf093e1d 100644
--- a/res/xml/settings.xml
+++ b/res/xml/settings.xml
@@ -151,11 +151,13 @@
<PreferenceCategory
android:title="@string/button_bar.chat">
- <EditTextPreference
+ <github.daneren2005.dsub.view.SeekBarPreference
android:title="@string/settings.chat_refresh"
android:key="chatRefreshRate"
android:defaultValue="30"
- android:digits="0123456789"/>
+ android:dialogLayout="@layout/seekbar_preference"
+ myns:max="120"
+ myns:display="%.0f seconds"/>
</PreferenceCategory>
</PreferenceScreen>
@@ -210,11 +212,13 @@
<PreferenceCategory
android:title="@string/settings.cache_title">
- <EditTextPreference
+ <github.daneren2005.dsub.view.SeekBarPreference
android:title="@string/settings.cache_size"
android:key="cacheSize"
android:defaultValue="2000"
- android:digits="0123456789"/>
+ android:dialogLayout="@layout/seekbar_preference"
+ myns:max="50000"
+ myns:display="%.0f MB"/>
<EditTextPreference
android:title="@string/settings.cache_location"
@@ -311,11 +315,12 @@
<PreferenceCategory
android:title="@string/settings.playback_title">
- <EditTextPreference
+ <github.daneren2005.dsub.view.SeekBarPreference
android:title="@string/settings.playlist_random_size_title"
android:key="randomSize"
android:defaultValue="20"
- android:digits="0123456789"/>
+ android:dialogLayout="@layout/seekbar_preference"
+ myns:max="100"/>
<ListPreference
android:title="@string/settings.temp_loss_title"
diff --git a/src/github/daneren2005/dsub/activity/SettingsActivity.java b/src/github/daneren2005/dsub/activity/SettingsActivity.java
index 5ca30f62..c1618b7d 100644
--- a/src/github/daneren2005/dsub/activity/SettingsActivity.java
+++ b/src/github/daneren2005/dsub/activity/SettingsActivity.java
@@ -69,16 +69,13 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer
private ListPreference maxVideoBitrateWifi;
private ListPreference maxVideoBitrateMobile;
private ListPreference networkTimeout;
- private EditTextPreference cacheSize;
private EditTextPreference cacheLocation;
private ListPreference preloadCountWifi;
private ListPreference preloadCountMobile;
- private EditTextPreference randomSize;
private ListPreference tempLoss;
private ListPreference pauseDisconnect;
private Preference addServerPreference;
private PreferenceCategory serversCategory;
- private EditTextPreference chatRefreshRate;
private ListPreference videoPlayer;
private ListPreference syncInterval;
private CheckBoxPreference syncEnabled;
@@ -113,16 +110,13 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer
maxVideoBitrateWifi = (ListPreference) findPreference(Constants.PREFERENCES_KEY_MAX_VIDEO_BITRATE_WIFI);
maxVideoBitrateMobile = (ListPreference) findPreference(Constants.PREFERENCES_KEY_MAX_VIDEO_BITRATE_MOBILE);
networkTimeout = (ListPreference) findPreference(Constants.PREFERENCES_KEY_NETWORK_TIMEOUT);
- cacheSize = (EditTextPreference) findPreference(Constants.PREFERENCES_KEY_CACHE_SIZE);
cacheLocation = (EditTextPreference) findPreference(Constants.PREFERENCES_KEY_CACHE_LOCATION);
preloadCountWifi = (ListPreference) findPreference(Constants.PREFERENCES_KEY_PRELOAD_COUNT_WIFI);
preloadCountMobile = (ListPreference) findPreference(Constants.PREFERENCES_KEY_PRELOAD_COUNT_MOBILE);
- randomSize = (EditTextPreference) findPreference(Constants.PREFERENCES_KEY_RANDOM_SIZE);
tempLoss = (ListPreference) findPreference(Constants.PREFERENCES_KEY_TEMP_LOSS);
pauseDisconnect = (ListPreference) findPreference(Constants.PREFERENCES_KEY_PAUSE_DISCONNECT);
serversCategory = (PreferenceCategory) findPreference(Constants.PREFERENCES_KEY_SERVER_KEY);
addServerPreference = (Preference) findPreference(Constants.PREFERENCES_KEY_SERVER_ADD);
- chatRefreshRate = (EditTextPreference) findPreference(Constants.PREFERENCES_KEY_CHAT_REFRESH);
videoPlayer = (ListPreference) findPreference(Constants.PREFERENCES_KEY_VIDEO_PLAYER);
syncInterval = (ListPreference) findPreference(Constants.PREFERENCES_KEY_SYNC_INTERVAL);
syncEnabled = (CheckBoxPreference) findPreference(Constants.PREFERENCES_KEY_SYNC_ENABLED);
@@ -310,14 +304,11 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer
maxVideoBitrateWifi.setSummary(maxVideoBitrateWifi.getEntry());
maxVideoBitrateMobile.setSummary(maxVideoBitrateMobile.getEntry());
networkTimeout.setSummary(networkTimeout.getEntry());
- cacheSize.setSummary(cacheSize.getText());
cacheLocation.setSummary(cacheLocation.getText());
preloadCountWifi.setSummary(preloadCountWifi.getEntry());
preloadCountMobile.setSummary(preloadCountMobile.getEntry());
- randomSize.setSummary(randomSize.getText());
tempLoss.setSummary(tempLoss.getEntry());
pauseDisconnect.setSummary(pauseDisconnect.getEntry());
- chatRefreshRate.setSummary(chatRefreshRate.getText());
videoPlayer.setSummary(videoPlayer.getEntry());
syncInterval.setSummary(syncInterval.getEntry());
if(syncEnabled.isChecked()) {
diff --git a/src/github/daneren2005/dsub/view/SeekBarPreference.java b/src/github/daneren2005/dsub/view/SeekBarPreference.java
index 84aed452..dedea908 100644
--- a/src/github/daneren2005/dsub/view/SeekBarPreference.java
+++ b/src/github/daneren2005/dsub/view/SeekBarPreference.java
@@ -26,6 +26,7 @@ import android.content.Context;
import android.content.res.TypedArray;
import android.preference.DialogPreference;
import android.util.AttributeSet;
+import android.util.Log;
import android.view.View;
import android.widget.SeekBar;
import android.widget.TextView;
@@ -37,6 +38,7 @@ import github.daneren2005.dsub.util.Constants;
* SeekBar preference to set the shake force threshold.
*/
public class SeekBarPreference extends DialogPreference implements SeekBar.OnSeekBarChangeListener {
+ private static final String TAG = SeekBarPreference.class.getSimpleName();
/**
* The current value.
*/
@@ -67,7 +69,7 @@ public class SeekBarPreference extends DialogPreference implements SeekBar.OnSee
mStepSize = a.getFloat(R.styleable.SeekBarPreference_stepSize, 1f);
mDisplay = a.getString(R.styleable.SeekBarPreference_display);
if(mDisplay == null) {
- mDisplay = "%+.1f";
+ mDisplay = "%.0f";
}
}