Skip to content
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

Picker Handlers #433

Merged
merged 12 commits into from
Mar 17, 2021
Merged

Picker Handlers #433

merged 12 commits into from
Mar 17, 2021

Conversation

jsuarezruiz
Copy link
Contributor

@jsuarezruiz jsuarezruiz commented Mar 5, 2021

Description of Change

Picker Handlers. This PR will allow adding a basic Picker support, in the firsts .NET MAUI Preview.

API Android iOS
ItemsSource
SelectedIndex
SelectedItem
Title

Related issues:

Platforms Affected

  • Core
  • iOS
  • Android

@hartez hartez self-requested a review March 5, 2021 17:15
@hartez
Copy link
Contributor

hartez commented Mar 5, 2021

@jsuarezruiz Needs a rebase.

@hartez hartez added this to In progress in Handler Property Backlog via automation Mar 5, 2021
@hartez hartez added this to Admin Tasks in Stable 1 Backlog Mar 5, 2021
@hartez hartez moved this from Admin Tasks to Done/In Review in Stable 1 Backlog Mar 5, 2021
@hartez hartez removed this from Done/In Review in Stable 1 Backlog Mar 5, 2021
Copy link
Member

@mattleibow mattleibow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just went through and made comments as I saw things or had questions. Some might be dumb, so you have been warned. XD

Comment on lines +9 to +10
IList<string> Items { get; }
IList ItemsSource { get; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these two concepts mean anything at the core layer? This feels a bit binding-y. Also, how will Comet do this? Are we maybe forcing something?

Comment on lines +9 to +10
{
UIPickerView? _pickerView;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just found this on the Apple docs. Probably not essential for now, maybe...

Important
UIPickerView and its descendants aren’t available when the user interface idiom is UIUserInterfaceIdiomMac.

https://developer.apple.com/documentation/uikit/uipickerview

src/Core/src/Platform/iOS/NativePicker.cs Outdated Show resolved Hide resolved
string GetNativeText(PickerHandler pickerHandler) =>
GetNativePicker(pickerHandler).Text;

async Task ValidateNativeItemsSource(IPicker picker, int itemsCount)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see this and the one below, are some tests missing that would have used it?

if (pickerView?.Model is PickerSource source)
{
source.SelectedIndex = selectedIndex;
source.SelectedItem = selectedIndex >= 0 ? picker.Items[selectedIndex] : null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to check for upper bounds here at all? selectedIndex >= 0 && selectedIndex < items.count

src/Core/src/Handlers/Picker/PickerHandler.iOS.cs Outdated Show resolved Hide resolved
src/Core/src/Platform/Android/NativePicker.cs Outdated Show resolved Hide resolved

namespace Microsoft.Maui
{
public class NativePicker : NativePickerBase
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we merge these two types at all? Maybe even PickerManager?


namespace Microsoft.Maui
{
internal static class PickerManager
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will something like this be used by TimePicker? Not sure how much overhead there is on this?

@hartez hartez changed the base branch from main to handler-staging March 17, 2021 17:48
@hartez hartez merged commit 977f92b into handler-staging Mar 17, 2021
Handler Property Backlog automation moved this from In progress to Done Mar 17, 2021
@hartez hartez deleted the pickerhandler branch March 17, 2021 18:18
hartez added a commit that referenced this pull request Mar 17, 2021
* PickerHandlers

* Nullability fixes

* Updated Picker device tests

* New things in the tests!

* Removed unnecessary Android Api level validation

* Added Picker Items null validation in iOS PickerHandler

* Moved Picker Handler tests between different classes

* Renamed NativePicker to MauiPicker

* Removed unused code from iOS PickerExtensions

* Fix build error

* Fix build error

* Remove duplicate class

Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
Co-authored-by: E.Z. Hart <hartez@gmail.com>
@hartez hartez mentioned this pull request Mar 18, 2021
hartez added a commit that referenced this pull request Mar 18, 2021
* PickerHandlers

* Nullability fixes

* Updated Picker device tests

* New things in the tests!

* Removed unnecessary Android Api level validation

* Added Picker Items null validation in iOS PickerHandler

* Moved Picker Handler tests between different classes

* Renamed NativePicker to MauiPicker

* Removed unused code from iOS PickerExtensions

* Fix build error

* Fix build error

* Remove duplicate class

Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
Co-authored-by: E.Z. Hart <hartez@gmail.com>
hartez added a commit that referenced this pull request Mar 18, 2021
* TimePicker Handlers (#454)

* TimePickerHandlers

* Undo changes in sample

* Add some nullability fixes

* Fix build error

* Changes from PR feedback

* Fixed build error

* Updated tests

* Roll time picker and popup into one control

* Move 24 hour view check to handler

* Pull NSLocale -> CultureInfo code out to common property

Co-authored-by: E.Z. Hart <hartez@users.noreply.github.com>
Co-authored-by: E.Z. Hart <hartez@gmail.com>

* CheckBoxHandlers (#432)

* Rename ICheck -> ICheckBox, remove Color stuff (to be replaced with Brush
later), fix DeviceTests

* Implement CharacterSpacing property in EditorHandlers (#516)

* Fix broken test and incorrect CharacterSpacing on iOS

* Implement HorizontalTextAlignment property in EntryHandlers (#524)

* Better text on example

* Remove IView from ITextAlignment

* Remove IView from IPlaceholder

* Implement IsTextPredictionEnabled property on Editor (#515)

* Initial implementation

* Added Tests

* Added PortHandler Attributes

* Added Tests

* Handle turning text prediction back on

Co-authored-by: E.Z. Hart <hartez@gmail.com>

* Implement ReturnType property in EntryHandlers (#518)

* Implement CharacterSpacing property in SearchBarHandlers (#494)

* Implement CharacterSpacing in SearchBarHandlers

* Tests failing because of static

* Rounding for Android

* Fix iOS test

* There! No magic numbers!

* Fix rebase issuse and make SearchBar stuff work on iOS

Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
Co-authored-by: E.Z. Hart <hartez@gmail.com>

* Stepper Handlers (#517)

* StepperHandlers

* Fixed Stepper handler broken tests

* Remove duplicate searchbar

* Add IStepper interface

Co-authored-by: E.Z. Hart <hartez@gmail.com>

* IStepper.Increment -> IStepper.Step

* Picker Handlers (#433)

* PickerHandlers

* Nullability fixes

* Updated Picker device tests

* New things in the tests!

* Removed unnecessary Android Api level validation

* Added Picker Items null validation in iOS PickerHandler

* Moved Picker Handler tests between different classes

* Renamed NativePicker to MauiPicker

* Removed unused code from iOS PickerExtensions

* Fix build error

* Fix build error

* Remove duplicate class

Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
Co-authored-by: E.Z. Hart <hartez@gmail.com>

* ActivityIndicator Handlers (#417)

* ActivityIndicatorHandler

* Register IActivityIndicator

* Add comments to IActivityIndicator

* Fix build error

* Implement Font properties in SearchBarHandlers (#533)

* Speed up PR builds (#510)

Reduce the jobs and use the new pools

* implement Font properties in SearchBarHandlers

* Fix rebase issues

Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
Co-authored-by: E.Z. Hart <hartez@gmail.com>

* Implemented LineHeight on Label (#538)

* Implemented LineHeight on Label (#368)

* Fix-up after rebase

Co-authored-by: E.Z. Hart <hartez@gmail.com>

* Fix broken label tests; add some missing label tests; attributed string cleanup

* Consolidate and rename extension method classes

* Fix class names and de-duplicate methods

* Centralize time extensions

* Fix mapping

Co-authored-by: Javier Suárez <javiersuarezruiz@hotmail.com>
Co-authored-by: Glenn Hevey <glenn.hevey@gmail.com>
Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
Co-authored-by: Amr <hassaninamr@yahoo.com>
@samhouts samhouts added legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor area-core-hosting Extensions / Hosting / AppBuilder / Startup area-controls-picker Picker platform/android 🤖 platform/iOS 🍎 labels Jul 11, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Dec 27, 2023
@Eilon Eilon removed the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label May 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

5 participants