Skip to content

Bind layout resource to your activity or fragment with annotation.

License

Notifications You must be signed in to change notification settings

epicmars/layoutbinder

Repository files navigation

LayoutBinder

Download

Bind layout resource to your activity or fragment with annotation.

Dependencies

dependencies {
    implementation 'com.androidpi:layoutbinder:1.3.0'
    annotationProcessor 'com.androidpi:layoutbinder-compiler:1.3.0'
}

As usual, to support kotlin, replace "annotationProcessor" with "kapt", and apply plugin "kotlin-kapt" to your project's build script.

Usage

Quick start

@BindLayout(R.layout.activity_example)
public class ExampleActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        LayoutBinder.bind(this);
    }
}

@BindLayout(R.layout.fragment_example)
public class ExampleFragment extends Fragment {

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return LayoutBinder.bind(this, inflater, container, false).getView();
    }
}

How it works

Like Dagger and ButterKnife you might have used, it generate some boilerplate code for you with an annotation processor.

About

Bind layout resource to your activity or fragment with annotation.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages