Skip to content

Commit 53e445d

Browse files
author
xiangdong.cheng
committed
add rippleEnable property
1 parent 35878ad commit 53e445d

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

app/src/main/java/com/dx/dxloadingbutton/DemoActivity.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ class DemoActivity : AppCompatActivity(), View.OnClickListener {
3535
loading_btn.cancelLoading()
3636
startActivity(Intent(this@DemoActivity, LoginDemoActivity::class.java))
3737
}
38-
R.id.btn_enable -> loading_btn.isEnabled = !loading_btn.isEnabled
38+
R.id.btn_enable -> {
39+
loading_btn.isEnabled = !loading_btn.isEnabled
40+
}
3941
}
4042
}
4143

library/src/main/java/com/dx/dxloadingbutton/lib/LoadingButton.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ class LoadingButton @JvmOverloads constructor(
4242
var animationEndAction: ((AnimationType) -> Unit)? = null
4343

4444
var rippleEnable = true
45+
set(value) {
46+
invalidate()
47+
field = value
48+
}
4549

4650
var rippleColor = Color.BLACK
4751
set(value){
@@ -171,6 +175,7 @@ class LoadingButton @JvmOverloads constructor(
171175
mTextColor = ta.getColor(R.styleable.LoadingButton_lb_textColor, Color.WHITE)
172176
resetAfterFailed = ta.getBoolean(R.styleable.LoadingButton_lb_resetAfterFailed, true)
173177
rippleColor = ta.getColor(R.styleable.LoadingButton_lb_btnRippleColor, Color.BLACK)
178+
rippleEnable = ta.getBoolean(R.styleable.LoadingButton_lb_rippleEnable, true)
174179
mRippleAlpha = ta.getFloat(R.styleable.LoadingButton_lb_btnRippleAlpha, 0.3f)
175180
mButtonCorner = ta.getFloat(R.styleable.LoadingButton_lb_cornerRadius, 2 * mDensity)
176181
ta.recycle()

0 commit comments

Comments
 (0)