Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@jadenwjh
Copy link
Contributor

@jadenwjh jadenwjh commented Dec 30, 2021

Allowing access to FlutterFragmentActivity's content view ID.

Currently this is the way for user to access root layout ID (FRAGMENT_CONTAINER_ID) when extending from FlutterFragmentActivity, but what if there were breaking changes?

private fun getRootViewId(): Int {
var rootView: ViewGroup? = (this.findViewById(android.R.id.content) as ViewGroup).getChildAt(0) as ViewGroup
return rootView?.getId() ?: NO_ROOT_VIEW
}

Activities extending from FlutterFragmentActivity can add views to root layout instead of creating a new layout.
This is especially useful when the user wants to create additional fragments and transact them to the root layout.

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide] and the [C++, Objective-C, Java style guides].
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See [testing the engine] for instructions on
    writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the [CLA].
  • All existing and new tests are passing.

@jadenwjh jadenwjh marked this pull request as ready for review December 30, 2021 16:57
@jadenwjh
Copy link
Contributor Author

jadenwjh commented Jan 5, 2022

Hi @dnfield , can I trouble you to have a look at this PR? Thank you :)

@dnfield dnfield requested a review from blasten January 11, 2022 00:14
@dnfield
Copy link
Contributor

dnfield commented Jan 11, 2022

I think thi sis fine but would defer to @blasten

Copy link

@blasten blasten left a comment

Choose a reason for hiding this comment

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

comment about consistency

@jadenwjh jadenwjh force-pushed the get_root_layout_id branch 6 times, most recently from 3b09d94 to 044a5ac Compare January 12, 2022 06:48
@jadenwjh
Copy link
Contributor Author

Hi @blasten I have since made the change, please have a look. Thanks!

@chinmaygarde
Copy link
Member

Ping @blasten for re-review.

Copy link

@blasten blasten left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants