Conversation
AToolbar bar = null; | ||
|
||
#if __ANDROID_29__ | ||
if (ToolbarResource == 0) |
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.
If you're using API 29 and these Ids are zero then just set them using the internal layout ids.
The one breaking change from this will be if
- users update to androidx
- have no transitive libraries
- they've customized the head project layouts to be different than the forms templates
- In which case they should get the error message below
ie.Message == "Binary XML file line #1: Error inflating class android.support.v7.widget.Toolbar" && | ||
this.TargetSdkVersion() >= 29) | ||
{ | ||
Internals.Log.Warning(nameof(FormsAppCompatActivity), |
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.
If inflation fails and all the above criteria then output a message explaining how to upgrade the templates to Android X or just inform the user that they can delete the layouts all together
|
||
if (ToolbarResource == 0) | ||
{ | ||
ToolbarResource = Resource.Layout.FallbackToolbarDoNotUse; |
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.
Fall back to some AndroidX templates that haven't been replaced by the project head
Xamarin.Forms.Platform.Android/AppCompat/FormsAppCompatActivity.cs
Outdated
Show resolved
Hide resolved
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.
Tested API 28 and API29 with and without the TabBar resources
Description of Change
Account for edge cases where the android head project has zero transitive support library references but is still utilizing the defaults forms layouts
Testing Procedure
Create a Xamarin.Forms application from the template
PR Checklist