-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Android] Add ability to skip setting SoftInputMode during initialization #917
Conversation
|
|
||
| public enum WindowSoftInputModeAdjust | ||
| { | ||
| Unspecified, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if this should be at the top or bottom. Currently Pan is the default value.
| public static readonly BindableProperty WindowSoftInputModeAdjustProperty = | ||
| BindableProperty.Create("WindowSoftInputModeAdjust", typeof(WindowSoftInputModeAdjust), | ||
| typeof(Application), WindowSoftInputModeAdjust.Pan); | ||
| public static readonly BindableProperty WindowSoftInputModeAdjustProperty = BindableProperty.Create(nameof(WindowSoftInputModeAdjust), typeof(WindowSoftInputModeAdjust), typeof(Application), WindowSoftInputModeAdjust.Pan); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since Unspecified was added, it might make sense to rename this property to WindowSoftInputMode (get rid of Adjust at the end). I think a breaking change here should be tolerated, but I haven't made any changes.
| if (Xamarin.Forms.Application.Current.OnThisPlatform().GetShouldSetWindowSoftInputModeAtStartup()) | ||
| SetSoftInputMode(); | ||
| else | ||
| Xamarin.Forms.Application.Current.OnThisPlatform().UseWindowSoftInputModeAdjust(WindowSoftInputModeAdjust.Unspecified); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default to Unspecified since XF is currently defaulting to Pan and we do not want that.
|
I'm thinking if you could reduce startup times significantly with the current XF roadmap, perhaps this change isn't needed otherwise we should look into making soft input mode optional as in this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that you've taken great care to avoid making a breaking behavior change. I'm wondering if we can achieve the same result by just adding the Unspecified option to the end of the enum (to avoid a breaking ABI change) and updating our documentation to suggest that users set the value of WindowSoftInputModeAdjust to Unspecified to take advantage of the performance gain. This would eliminate the need for the new PS. Thoughts?
By the time they set this manually, we will have called |
|
Android documentation on
In my opinion, XF should have refrained from setting this for users since this is a configurable option depending on user needs. I'm not sure why either Pan or Resize needs to be set right off the bat. If we set this to Unspecified by default (by removing the call to |
So, when will they have set |
|
Since this is an application-level platform specifics, it would have to be called in |
|
|
|
If we set it to // inside LoadApplication() but for subsequent calls (i.e. AppOnPropertyChanged), the logic should account for the new value: Let me know if this works. |
|
@adrianknight89: You may have noticed that we're now VS 2017 compatible! Yay! I hope you're able to compile now. If not, please let us know. Yes, I think we're on the same page about skipping that call if the initial value is Thank you! |
|
@samhouts Thanks. I did a fresh install of Win10 and VS2017 (15.5) (which I'd been planning on). Right now, I'm having issues cloning the XF project through the VS Git extension. |
|
@adrianknight89 can you try the command line ? should allow to clone and skipping submodules. |
|
@rmarinho Thanks. Excluding the submodules worked. However, I'm still unable to compile the UI test project for Android. |
|
This is being thrown in |
|
You might try deleting any |
|
@samhouts Thanks. Your suggestions worked! I think I needed to rebuild |
* Fixes #917, make sure to dispose after javacast * C# 8 madness! * ShareFile: describe contentType ctor arg This is related to https://github.com/MicrosoftDocs/xamarin-docs/issues/2246 * Clarify ContentType API (#958) * Clarify ContentType API * Clarify content type API * Clarify Content Type api
Description of Change
I have a debug setup where setting soft input mode at startup takes 14 ms for
AdjustPanand 52 ms forAdjustResize. For most apps, the landing page should not contain any input views, hence, the input mode should not be needed to be set immediately.A platform-specific property was added to skip calling
SetSoftInputMode(). According to Android documentation, the default setting for soft input mode is unspecified.I haven't made documentation changes (yet) since I'm not sure if this PR is okay.
Please make sure to document this here. :)
Bugs Fixed
API Changes
Added:
ShouldSetWindowSoftInputModeAtStartupUnspecifiedenum value for soft input modePR Checklist