Auto-complete interface names

This commit is contained in:
Mygod
2018-01-04 15:54:46 +08:00
parent 2762cf0710
commit 3cfbb82a39
7 changed files with 128 additions and 2 deletions

View File

@@ -0,0 +1,23 @@
package be.mygod.vpnhotspot.preference
import android.content.Context
import android.text.TextUtils
import android.util.AttributeSet
import be.mygod.vpnhotspot.R
import com.takisoft.fix.support.v7.preference.AutoSummaryEditTextPreference
open class AlwaysAutoCompleteEditTextPreference @JvmOverloads constructor(
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = R.attr.editTextPreferenceStyle,
defStyleRes: Int = 0) : AutoSummaryEditTextPreference(context, attrs, defStyleAttr, defStyleRes) {
val editText = AlwaysAutoCompleteEditText(context, attrs)
init {
editText.id = android.R.id.edit
}
override fun setText(text: String) {
val oldText = getText()
super.setText(text)
if (!TextUtils.equals(text, oldText)) notifyChanged()
}
}