Skip to content
This repository has been archived by the owner on Jul 13, 2020. It is now read-only.

Add Activity.contentView property #157

Closed
yanex opened this issue Mar 11, 2016 · 2 comments
Closed

Add Activity.contentView property #157

yanex opened this issue Mar 11, 2016 · 2 comments

Comments

@yanex
Copy link
Member

yanex commented Mar 11, 2016

Kotlin Slack/Gael Ribes:

/**
 * Gets the set content view of this Activity.
 */
val Activity.contentView: View?
    get() = (findViewById(android.R.id.content) as ViewGroup?)?.getChildAt(0)
@Ribesg
Copy link
Contributor

Ribesg commented Mar 11, 2016

/**
 * Gets the content view of this Activity if set, null otherwise.
 */
val Activity.contentView: View?
    get() = (findViewById(android.R.id.content) as ViewGroup?)?.getChildAt(0)

@damianpetla
Copy link
Contributor

I would simplify this code to:

val Activity.contentView: View?
    get() = findOptional<ViewGroup>(android.R.id.content)?.getChildAt(0)

@yanex yanex added this to the Anko 0.9 milestone Mar 28, 2016
yanex added a commit that referenced this issue Apr 19, 2016
yanex added a commit that referenced this issue Apr 21, 2016
@yanex yanex closed this as completed Apr 29, 2016
@yanex yanex added fixed and removed open labels Apr 29, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants