New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Slider should show user-set value on initial load #378

Merged
merged 1 commit into from Dec 19, 2016

Conversation

Projects
None yet
5 participants
@adrianknight89
Contributor

adrianknight89 commented Sep 25, 2016

Description of Change

Android SeekBar does not allow Min to be set and Progress is an int. This creates a problem when Slider's Min and Max values can be double. For example, when Min is 1 and Max is 10, SeekBar's 1000 ticks need to be distributed over this range. When Slider loads initially with a value of 5, Progress will be calculated as an int which results in precision loss. When we read this int back and try to convert it to a double, then the user sees 4.996. To me, it looked like there is no way to fix this problem.

What I did was letting the user see whatever value they set in XF even if this value is slightly off (4.996 is the correct value whereas 5 would be incorrect). However, once they move the slider, then they should begin seeing floating point numbers.

Perhaps, the truly correct thing to do is to use something like a ValueRequest property and let the user know their requested value might not always come back the same on initial load.

Also made minor refactoring.

@hartez

Bugs Fixed

@dnfclas

This comment has been minimized.

Show comment
Hide comment
@dnfclas

dnfclas Sep 25, 2016

Hi @adrianknight89, I'm your friendly neighborhood .NET Foundation Pull Request Bot (You can call me DNFBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!

The agreement was validated by .NET Foundation and real humans are currently evaluating your PR.

TTYL, DNFBOT;

dnfclas commented Sep 25, 2016

Hi @adrianknight89, I'm your friendly neighborhood .NET Foundation Pull Request Bot (You can call me DNFBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!

The agreement was validated by .NET Foundation and real humans are currently evaluating your PR.

TTYL, DNFBOT;

Drawable thumb = seekbar.Thumb;
int thumbTop = seekbar.Height / 2 - thumb.IntrinsicHeight / 2;
thumb.SetBounds(thumb.Bounds.Left, thumbTop, thumb.Bounds.Left + thumb.IntrinsicWidth, thumbTop + thumb.IntrinsicHeight);

This comment has been minimized.

@StephaneDelcroix

StephaneDelcroix Sep 25, 2016

Member

except for reducing nesting (I like that), have you changed something in this block ?

@StephaneDelcroix

StephaneDelcroix Sep 25, 2016

Member

except for reducing nesting (I like that), have you changed something in this block ?

This comment has been minimized.

@adrianknight89

adrianknight89 Sep 25, 2016

Contributor

No nothing. It was only nesting.

@adrianknight89

adrianknight89 Sep 25, 2016

Contributor

No nothing. It was only nesting.

@rmarinho

This comment has been minimized.

Show comment
Hide comment
@rmarinho

rmarinho Dec 17, 2016

Member

Needs to be rebased.

Member

rmarinho commented Dec 17, 2016

Needs to be rebased.

@adrianknight89

This comment has been minimized.

Show comment
Hide comment
@adrianknight89

adrianknight89 Dec 17, 2016

Contributor

Done.

Contributor

adrianknight89 commented Dec 17, 2016

Done.

@rmarinho rmarinho merged commit e0165ab into xamarin:master Dec 19, 2016

3 checks passed

Android-UITests-C8 Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle 8 :: UI Tests :: OSX Test Cloud Package - Run Android 6.0.1 : Running
Details
OSX-Debug-C8 Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle 8 :: OSX Debug : Running
Details
Windows-Debug-C8 Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle 8 :: Windows Debug : Tests passed: 3685, ignored: 10
Details

rookiejava added a commit to rookiejava/Xamarin.Forms that referenced this pull request Jan 9, 2017

rmarinho added a commit that referenced this pull request Feb 2, 2017

Add pressed and released events to Button (#446)
* Add pressed and released events to Button

* Update ButtonRenderer.cs

* Apply safely casting to android button renderer

* Use safety casting for Android buttin renderer

* [Windows] Fix modal pages being laid out below soft buttons (#395)

* Add sample HanselForms and TwitterDemo to ControlGallery (#651)

* [Controls] Add Hanselforms sample

* Remove extra twitter sample

* [Controls]Add TwitterDemo sample

* [Controls] Fix build

* Slider should show user-set value on initial load (#378)

* [UWP] Use toolbar foreground color on primary items (#640)

* Avoid duplicating code in OmPlatform (#591)

* [iOS] Entry should not pass a newline to the next responder (#397)

* UITextField should not return so that the next field does not get passed a newline

* Added code sample

* [XamlC] import members on x:Static and factories (#642)

* [Xaml] support short Properties for PropertyCondition (#645)

* Xamlc compile data triggers (#648)

* [Xaml] DataTrigger and PropertyCondition no longer use a ServiceProvider

* [XamlC] avoid generating ServiceProvider for unused ProvideValue

* fix tests

* Fix comment typo

* [UWP] Fix TextBox style for foreground focus color (#618)

* Adding image to use for CellsGalleryImageUrlCellList UI test

* Update ImageCellListPage to use an image we control;
Update CellsGalleryImageUrlCellList test to wait longer than 1s for images
to load if necessary

* fix nre when changing content in datepickerselected (#494)

* Make CellsGalleryImageUrlCellList test finish early if possible

* [iOS] Change keyboard type while keyboard is visible (#443)

* Change keyboard while changing text

* add sample code

* [Android] Fix NavigationPage dispose crash when it parents a MasterDetailPage (#577)

* fix navigation page dispose crash

* changes after review

* [XamlC] detect duplicate x:Name at compile time (#655)

* [XamlC] detect duplicate x:Name at compile time

* invoking methods with the right arguments produces better results

* Make UWP toolbar display rules consistent with other platforms (#638)

* Allow subscriber to be collected if MessagingCenter is the only reference to it (#617)

* Repro

* Make messaging center callbacks weak references

* Preserve attribute

* Fix test method name

* Watch for collection of actual delegate target instead of wrapper delegate

* Preserve the original platform instance when changing main page

* Better tests for lambda situations

* Update tests, make callback target a weakreference if it's the subscriber

* Ensure old Platform MessagingCenter subs are gone before creating new Platform

* [iOS] Prevent multiple ListView cells from being swiped simultaneously (#578)

* disable multiple cell swipe

* add sample code

* refactored

* convert to weakreference

* remove null setting

* change weakreference setting place

* remove if

* revert isopen changes

* add instructions

* [WinRT/UWP] Apply BackgroundColor to Stepper buttons (#581)

* [WinRT/UWP] Apply BackgroundColor to Stepper buttons

* Add explanatory text; use nameof

* Move explanatory text to a label

* Return group instead of internal class (#461)

* [iOS/Android] Move Map camera to correct region on layout change (#548)

* Move to region on layout change

* remove visibility check

* [iOS] Platform specifics for controlling Picker SelectedIndex change behavior (#540)

* picker selected index could change when picker view is dismissed

* use enum

* [iOS] Ignore intermittent failing test on XTC (#666)

* [UITest] Update to UITest 2.0.5 (#665)

* Rebase the current branch onto upstream latest

@samhouts samhouts added this to the 2.3.4 milestone Jun 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment