Skip to content

DialogBoot is an Android library based on annotation processor (Influenced by ButterKnife). It reduces the boilerplate code to create AlertDialog. It generates the boiler plate code at compile time

License

Notifications You must be signed in to change notification settings

mnhmasum/DialogBoot

Repository files navigation

DialogBoot

DialogBoot is an android library based on annotation processor to create an AlertDialog in your code. You don't need to write boilerplate code anymore to create AlertDialog.

Note: DialogBoot supports only android.app.AlertDialog. It does not support android.support.v7.app.AlertDialog yet

EXAMPLE 1

@InjectDialog(isCancelable = true, getMessage = "Hi I can make your dialog")
public AlertDialog dialog;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    DialogBootLoader.bind(this);
    dialog.show();
}

EXAMPLE 2 with custom layout

public class MainActivity implements View.OnClickListener{
    @InjectDialog(isCancelable = true, getMessage = "Hi I can make your dialog in less coding")
    public AlertDialog dialog;

    @InjectView(layout = R.layout.layout)
    View view;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        DialogBootLoader.bind(this, view);

        Button button = view.findViewById(R.id.button1);
        button.setOnClickListener(this);
        dialog.setView(view);
        dialog.show();
    }

    @Override
    public void onClick(View view) {
        if (view.getId() == R.id.button1) {
            Toast.makeText(this, "Hello World", Toast.LENGTH_SHORT).show();
            dialog.dismiss();
        }
    }

}

DOWNLOAD

To your app level build.gradle

dependencies {
    implementation 'com.masum.dialogboot:dialogboot-library:1.4.5'
    annotationProcessor 'com.masum.dialogboot:dialogboot-compiler:1.4.5'
   
}

DialogBoot Extra Benifit

In Traditional Java

View view = getLayoutInflater.inflate(R.layout.my_layout, null);

With DialogBoot

@InjectView(layout = R.layout.layout)
View view;

License

MIT License

Copyright (c) 2018 Nazmul Hasan Masum

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

About

DialogBoot is an Android library based on annotation processor (Influenced by ButterKnife). It reduces the boilerplate code to create AlertDialog. It generates the boiler plate code at compile time

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages