Enhance SD usage preference widget

Bug #579438 reported by Guillaume Rosaire
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenSatNav
Fix Released
Medium
Guillaume Rosaire

Bug Description

In http://www.opensatnav.org/issues/show/8#note-23, user willu asked for a more precise way of setting the max SD usage pref than with a slider.

> One more thing.... I have a 16G sd card. I want to allocate about 1G of space to the cache (including wasted formatting space - so about 2-300M on the slider). That is really hard to select on the slider. I think I'd prefer a different widget. Even text entry would be better.

We should have something like an editable textfield in sync with the slider or better.

Revision history for this message
Will Uther (willu-mailinglists) wrote :

It looks like revision 81 made some progress here. There is a problem with that implementation in that it doesn't move the slider when the text is updated. The following patch fixes this:

<pre>
diff --git a/src/com/hlidskialf/android/preference/SeekBarPreference.java b/src/com/hlidskialf/android/preference/SeekBarPreference.java
index e90b5d0..d735277 100644
--- a/src/com/hlidskialf/android/preference/SeekBarPreference.java
+++ b/src/com/hlidskialf/android/preference/SeekBarPreference.java
@@ -122,7 +122,7 @@ public class SeekBarPreference extends DialogPreference implements
   String t = String.valueOf(value);

   mValueText.setText(mSuffix == null ? t : t.concat(mSuffix));
- mValue = value;
+ setProgress(value);

   if (shouldPersist())
    persistInt(value);
</pre>

Revision history for this message
Will Uther (willu-mailinglists) wrote :

After a surprisingly long session to get this right, I think I have a better patch (this should be applied instead of the above). It does two things:
* Tries to get the UI right (Mb on the text iff you're not editing the text. Changes made through either method always change the other. Changes always save.)
* Modifies the slider so that it is non-linear and biased towards smaller sizes. The non-linearity is separated into its own methods, currently just sqrt().

This is all just UI work at this stage. I haven't looked at how it affects the on-disk storage (yet).

Revision history for this message
Guillaume Rosaire (zerog) wrote :

willu wrote:
> After a surprisingly long session to get this right...

I tried to have it right with the Mb suffix showing at startup but that took too much time indeed ^^, I left how it was at that time.

I thought about using a non linear slider but didn't try to implement it. I'll have a look at your patch this evening.

And indeed, the slider not updating when typing a value was something I didn't notice when testing, I should have seen it.

Thanks

Revision history for this message
Guillaume Rosaire (zerog) wrote :

Patch sdPrefs.patch applied in rev 84

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.