Skip to content
This repository has been archived by the owner on Apr 19, 2018. It is now read-only.

Init the action bar during findViewById #760

Merged
merged 1 commit into from
Dec 27, 2012
Merged

Init the action bar during findViewById #760

merged 1 commit into from
Dec 27, 2012

Conversation

SimonVT
Copy link
Collaborator

@SimonVT SimonVT commented Dec 25, 2012

Ensure that the ActionBar is initialized when findViewById is called.

Closes #623 and #748.

@JakeWharton
Copy link
Owner

I feel like there was an explicit reason why I chose not to use onCreate. Will have to think on it a bit and see if I can remember.

@SimonVT
Copy link
Collaborator Author

SimonVT commented Dec 25, 2012

Maybe it's enough to call installDecor(). But really, only two things can happen. Either setContentView(...) is called, in which case installDecor()/initActionBar() is called during onCreate anyway, or a fragment is added and the view hierarchy is re-ordered, messing it up.

@JakeWharton
Copy link
Owner

I think part of the problem is that you can have code like this:

super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setContentView(R.layout.whatever);

Which would cause the action bar to be initialized too soon and lack a progress bar. You also cannot initialize the just the decor view since then you won't get the overlay either.

@SimonVT
Copy link
Collaborator Author

SimonVT commented Dec 25, 2012

Ah, good point. Hm, well we need some other place to hook in then. findViewById?

@JakeWharton
Copy link
Owner

Yeah that should work. Shame we have to resort to such hacks. When ABS was
integrated with the support lib it was so much easier.

Maybe we could add a hook into the FragmentManager. I'm sure the folk at
Google would allow something simple that was package scoped.
On Dec 25, 2012 12:46 PM, "Simon Vig Therkildsen" notifications@github.com
wrote:

Ah, good point. Hm, well we need some other place to hook in then.
findViewById?


Reply to this email directly or view it on GitHubhttps://github.com//pull/760#issuecomment-11674937.

@SimonVT
Copy link
Collaborator Author

SimonVT commented Dec 25, 2012

Alright, I'll get this done tomorrow.

Maybe, it's worth a try at least. Maybe they'll just tell us to override getSupportFragmentManager() (which could also be a possibility).

@iNoles
Copy link

iNoles commented Dec 25, 2012

I am sure of Google would tell you to override package-scoped FragmentManagerImpl for moveToState methods or Fragment class for package-scoped performCreate methods.

@JakeWharton
Copy link
Owner

@iNoles We can't instantiate the instance that's used so that won't work.

JakeWharton added a commit that referenced this pull request Dec 27, 2012
Init the action bar during findViewById
@JakeWharton JakeWharton merged commit d5e5d5e into JakeWharton:dev Dec 27, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants