This library should help you create beautiful alerts for Android. Make it easy and fast
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}Add the following line to your dependencies:
dependencies {
implementation 'com.github.kirvigen:EasyAlert:0.1.0'
} EasyAlert(this).setTitle("Warning!").setTextBody("This is simple Alert")
.setNeutral("Ok",
{a->a.dismiss()},
Color.parseColor("#4988f4"))
.show()Using Negative and Positive buttons.
EasyAlert(this).setTitle("Warning!").setTextBody("This is medium Alert")
.setPositive("Yes!") { a-> a.dismiss()}
.setNegative("No!"){a->a.dismiss()}
.setNeutral("Cancel",{a->a.dismiss()})
.show()Image from resources in top alert
EasyAlert(this).setTopImage(R.drawable.image)
.setTitle("Warning!").setTextBody("You can show image resource in top alert.")
.setPositive("Yes!") { a-> a.dismiss()}
.setNegative("No!"){a->a.dismiss()}
.setNeutral("Cancel",{a->a.dismiss()})
.show()Image from url in top alert
EasyAlert(this).setTopImage("https://avatars.mds.yandex.net/get-pdb/1964870/f271cd11-8868-4bcd-93e7-e911d2254a90/s1200")
.setTitle("Warning!").setTextBody("You can show image from internet in top alert.")
.setPositive("Yes!") { a-> a.dismiss()}
.setNegative("No!"){a->a.dismiss()}
.setNeutral("Cancel",{a->a.dismiss()})
.show() EasyAlert(this)
.setTitle("Warning!").setTextBody("Please enter your Name")
.setEditText("Name")
.setPositive("Send") { a-> a.dismiss()
Toast.makeText(this,"Your Name is \"${a.inputText}\"",Toast.LENGTH_LONG).show()
}
.setNeutral("Cancel",{a->a.dismiss()})
.show() val colors = arrayOf("Red","Green","Blue")
EasyAlert(this)
.setTitle("Choose").setTextBody("Do choose your favorite color")
.setListItems(colors){a,position->
a.dismiss()
Toast.makeText(this,colors[position],Toast.LENGTH_LONG).show()
}
.setNeutral("Cancel",{a->a.dismiss()})
.show()EasyAlert(this)
.setTopImage(R.drawable.image)
.setTitle("This is combination!").setTextBody("Please enter your Name")
.setEditText("Name")
.setPositive("Send") { a-> a.dismiss()
Toast.makeText(this,"Your Name is \"${a.inputText}\"",Toast.LENGTH_LONG).show()
}
.setNegative("I don`t enter my name"){
a->a.dismiss()
}
.setNeutral("Cancel",{a->a.dismiss()})
.show()Copyright 2020 kirvigen, Inc.
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.







