This commit is contained in:
Mygod
2018-07-16 10:29:51 +08:00
parent af20a084cb
commit eca2329856
4 changed files with 5 additions and 5 deletions

View File

@@ -3,13 +3,13 @@ package be.mygod.vpnhotspot.widget
import android.content.Context
import android.util.AttributeSet
import androidx.appcompat.widget.AppCompatTextView
import androidx.core.view.isVisible
import androidx.core.view.isGone
class AutoCollapseTextView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null,
defStyleAttr: Int = android.R.attr.textViewStyle) :
AppCompatTextView(context, attrs, defStyleAttr) {
override fun onTextChanged(text: CharSequence?, start: Int, lengthBefore: Int, lengthAfter: Int) {
super.onTextChanged(text, start, lengthBefore, lengthAfter)
isVisible = !text.isNullOrEmpty()
isGone = text.isNullOrEmpty()
}
}