For bottom-dialogs check material-elements
An Android Library that shows on the bottom of the screen a fully customisable dialog.
For information on how to get started with Password Strength, take a look at our Getting Started guide.
Bugs or feature requests should be submitted at our GitHub Issues section.
Bottom Dialogs for Android is available through Google's Maven Repository. To use it:
-
Open the
build.gradle
file for your application. -
Make sure that the
repositories
section includes Google's Maven Repositorygoogle()
. For example:allprojects { repositories { google() jcenter() } }
-
Add the library to the
dependencies
section:dependencies { // ... implementation 'com.zeoflow:bottom-dialogs:<version>' // ... }
MainActivity.java
A basic bottom dialog will be shown. You have access to methods such as setTitle()
, setContent()
, setIcon()
, setCancelable()
, dismiss()
, etc. Customizations are explained below.
public class MainActivity extends BindAppActivity<ActivityMainBinding, MainViewBinding>
{
//..
@Override
protected void onCreate(@Nullable Bundle savedInstanceState)
{
//..
new BottomDialog.Builder(this)
.setTitle("Awesome!")
.setContent("What can we improve? Your feedback is always welcome.")
.show();
//..
}
//..
}
The bottom dialog icon will be shown to the left of the title.
public class MainActivity extends BindAppActivity<ActivityMainBinding, MainViewBinding>
{
//..
@Override
protected void onCreate(@Nullable Bundle savedInstanceState)
{
//..
new BottomDialog.Builder(this)
.setTitle("Awesome!")
.setContent("What can we improve? Your feedback is always welcome.")
.setIcon(R.drawable.ic_launcher)
//.setIcon(ContextCompat.getDrawable(this, R.drawable.ic_launcher))
.show();
//..
}
//..
}
Buttons are showed at the end of the bottom dialog. You can add your own text, colors and actions/callbacks.
public class MainActivity extends BindAppActivity<ActivityMainBinding, MainViewBinding>
{
//..
@Override
protected void onCreate(@Nullable Bundle savedInstanceState)
{
//..
new BottomDialog.Builder(this)
.setTitle("Awesome!")
.setContent("What can we improve? Your feedback is always welcome.")
.setPositiveText("OK")
.setPositiveBackgroundColorResource(R.color.colorPrimary)
//.setPositiveBackgroundColor(ContextCompat.getColor(this, R.color.colorPrimary)
.setPositiveTextColorResource(android.R.color.white)
//.setPositiveTextColor(ContextCompat.getColor(this, android.R.color.colorPrimary)
.onPositive(new BottomDialog.ButtonCallback() {
@Override
public void onClick(BottomDialog dialog) {
Log.d("BottomDialogs", "Do something!");
}
}).show();
//..
}
//..
}
You can add custom view to your bottom dialog just by adding the layout to the setCustomView()
method.
public class MainActivity extends BindAppActivity<ActivityMainBinding, MainViewBinding>
{
//..
@Override
protected void onCreate(@Nullable Bundle savedInstanceState)
{
//..
new BottomDialog.Builder(this)
.setTitle("Awesome!")
.setContent("What can we improve? Your feedback is always welcome.")
.setCustomView(R.layout.my_custom_view)
.show();
//..
}
//..
}
Copyright 2020 ZeoFlow
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.