pop - A quick android dialog building lib
Oneline of code and you have it.
Pop.on(activity).with().title(R.string.title).body(R.string.body).show();
How to include it in your project:
Add compile 'com.vistrav:pop:2.3'
in your app's gradle.build file in dependencies
section and that is it! Just like this.
dependencies {
compile 'com.vistrav:pop:2.3'
}
Adding buttons and custom body
if you want to handle the button click, this is even more fun with naming and you can even have custom body of dialog.
Pop.on(this)
.with()
.title(R.string.title)
.icon(R.drawable.icon)
.cancelable(false)
.layout(R.layout.custom_pop)
.when(new Pop.Yah() {
@Override
public void clicked(DialogInterface dialog, View view) {
Toast.makeText(getBaseContext(), "Yah button clicked", Toast.LENGTH_LONG).show();
}
}
)
.when(new Pop.Nah() {
// ignore if dont need negative button
@Override
public void clicked(DialogInterface dialog, View view) {
Toast.makeText(getBaseContext(), "Nah button clicked", Toast.LENGTH_LONG).show();
}
}
)
.show(new Pop.View() {
// assign value to view element
@Override
public void prepare(View view) {
EditText etName = (EditText) view.findViewById(R.id.et_name);
Log.i(TAG, "etName :: " + etName.getText());
etName.setText("Test Name 123");
}
}
);
You can contribute!
In case you think you have some improvement, please feel free do pull request your feature and I would be happy to include it. Let's make this Pop very easy to use and rich with features.
Other Userful Libraries
Ask - Android runtime permissions make easy
License
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.