Skip to content

Commit 9cac8d9

Browse files
author
Shaon
committed
negative color added
1 parent 21d8ba8 commit 9cac8d9

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

app/src/main/java/com/lastblade/spinnerdialogtest/MainActivity.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ class MainActivity : AppCompatActivity() {
2424

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

32-
negativeButton(textColor = resources.getColor(R.color.colorAccent))
32+
negativeButton()
3333
}
3434
}
3535

rvdialog/src/main/java/com/lastblade/rvdialog/RvDialog.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,13 @@ class RvDialog(context: Context) : Dialog(context, R.style.customRVDialog) {
5353
}
5454

5555
@JvmOverloads
56-
fun negativeButton(text: String = "Cancel", @ColorInt textColor: Int = 0): RvDialog = apply {
56+
fun negativeButton(
57+
text: String = "Cancel",
58+
@ColorInt textColor: Int = ContextCompat.getColor(
59+
context,
60+
android.R.color.holo_red_light
61+
)
62+
): RvDialog = apply {
5763
cancel.text = text
5864
cancel.setTextColor(textColor)
5965
cancel.setOnClickListener { dismiss() }

screenshot/image1.png

1004 Bytes
Loading

0 commit comments

Comments
 (0)