Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

@EViewGroup and @EView should be programmatically instantiable  #111

Copy link
Copy link
@JoanZapata

Description

@JoanZapata
Issue body actions

Given the following ViewGroup:

@EViewGroup(R.layout.component)
public class CustomFrameLayout extends FrameLayout {
       // This is what Android call when inflated from an XML layout file
    public CustomFrameLayout(Context context, AttributeSet attrs) { 
        super(context, attrs);
    }
       // The user can define as many constructor he wants, and these should be programmatically usable.
       public CustomFrameLayout(Context context, int i) {
        super(context);
    }
        ...
}

Every constructor is copied into the subclass. The following can't work because the implementation behind would'nt be able to know if it should call inflate() or not.

@EActivity(R.layout.main)
public class CustomFrameLayoutActivity extends Activity {
...
    CustomFrameLayout layout = new CustomFrameLayout_(this, 2);
... 
}

But having a static factory method would do:

@EActivity(R.layout.main)
public class CustomFrameLayoutActivity extends Activity {
...
    CustomFrameLayout layout = CustomFrameLayout_.getInflatedInstance(this, 2);
... 
}
Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.