Skip to content

Commit 10f130a

Browse files
committed
SupportDesignExtensions: Snackbar setActionTextColor
Signed-off-by: Fung <fython@163.com>
1 parent b58f493 commit 10f130a

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
BUILD_TOOLS_VERSION=25.0.3
22
org.gradle.jvmargs=-Xmx1536m
3-
VERSION_NAME=0.1.4.2
3+
VERSION_NAME=0.1.5
44
TARGET_SDK_VERSION=25
5-
VERSION_CODE=2
5+
VERSION_CODE=3
66
MIN_SDK_VERSION=19

kotlinyan-appcompat-support/src/main/kotlin/moe/feng/kotlinyan/common/SupportDesignExtensions.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package moe.feng.kotlinyan.common
22

3+
import android.content.res.ColorStateList
34
import android.support.design.widget.Snackbar
45
import android.view.View
56

@@ -18,6 +19,8 @@ interface SupportDesignExtensions {
1819
var message : String? = null
1920
var messageRes : Int = 0
2021
var duration : Int = Snackbar.LENGTH_SHORT
22+
var actionTextColor : Int = -1
23+
var actionTextColorStateList : ColorStateList? = null
2124

2225
fun action(textRes: Int, callback: (View) -> Unit) {
2326
snackbar.setAction(textRes, callback)
@@ -33,6 +36,12 @@ interface SupportDesignExtensions {
3336
} else if (message != null) {
3437
snackbar.setText(message!!)
3538
}
39+
if (actionTextColor != -1) {
40+
snackbar.setActionTextColor(actionTextColor)
41+
} else if (actionTextColorStateList != null) {
42+
snackbar.setActionTextColor(actionTextColorStateList!!)
43+
}
44+
3645
snackbar.duration = duration
3746
return snackbar
3847
}

0 commit comments

Comments
 (0)