cyynf / ConditionController

条件控制器,多个view的状态联动

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ConditionController

条件控制器,支持TextView,EditText,Button,Checkbox,RadioButton,SeekBar,ProgressBar等 image

Usage

添加 jitPack.io 仓库

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

添加依赖

	implementation 'com.github.cyynf:ConditionController:1.1.1'

简单使用

ConditionController()
            .add(phone)
            .add(password)
            .add(agreement)
            .bind(submit)
            .commit()

自定义条件

ConditionController()
            .add(phone) {it.length() == 11}
            .add(password)
            .add(agreement)
            .bind(submit) {
                submit.isEnabled = it
                if (it) {
                    submit.setBackgroundColor(Color.GREEN)
                } else {
                    submit.setBackgroundColor(Color.RED)
                }
            }
            .commit()

About

条件控制器,多个view的状态联动


Languages

Language:Kotlin 100.0%