Skip to content

Commit

Permalink
negative color added
Browse files Browse the repository at this point in the history
Shaon committed Nov 17, 2020

Verified

This commit was signed with the committer’s verified signature.
jpandersen87 Joseph Andersen
1 parent 21d8ba8 commit 9cac8d9
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -24,12 +24,12 @@ class MainActivity : AppCompatActivity() {

btnShowDialog.setOnClickListener {
RvDialog(this).show {
title("Title", ContextCompat.getColor(context, R.color.colorPrimaryDark))
title("Title")
listValues(data) { text, position ->
this@MainActivity.tv.text = "Selected item: $text"
}

negativeButton(textColor = resources.getColor(R.color.colorAccent))
negativeButton()
}
}

8 changes: 7 additions & 1 deletion rvdialog/src/main/java/com/lastblade/rvdialog/RvDialog.kt
Original file line number Diff line number Diff line change
@@ -53,7 +53,13 @@ class RvDialog(context: Context) : Dialog(context, R.style.customRVDialog) {
}

@JvmOverloads
fun negativeButton(text: String = "Cancel", @ColorInt textColor: Int = 0): RvDialog = apply {
fun negativeButton(
text: String = "Cancel",
@ColorInt textColor: Int = ContextCompat.getColor(
context,
android.R.color.holo_red_light
)
): RvDialog = apply {
cancel.text = text
cancel.setTextColor(textColor)
cancel.setOnClickListener { dismiss() }
Binary file modified screenshot/image1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9cac8d9

Please sign in to comment.