Android: update toolbar after rotation #1552
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a follow-up to #1507.
The Android toolbar is supposed to respond to rotation in several ways:
None of this is currently happening, because the built-in toolbar can apparently only change these things in response to an activity restart, which we've disabled. So this PR disables the built-in toolbar and adds one of our own.
In order for this to work, these lines have to be removed from the MainActivity:
This LinearLayout was never actually used, because Toga's set_content method simply replaced it by calling setContentView again. However, setContentView is one of the things that can trigger the creation of the built-in toolbar, and once it's created there's no way to remove it.
To move this PR out of draft status, the new toolbar needs to be fixed to have the correct theme. This is awkward because Toga doesn't know what the name of the app's R class will be. One possible solution is to look up the theme resource by name, like this.
I won't be continuing with this in the near future, so anyone else is welcome to pick it up.
PR Checklist: