Add back auto complete interface names from 0.1.0

This commit is contained in:
Mygod
2018-06-02 07:38:03 +08:00
parent da9bf4867e
commit f6d98d0e88
8 changed files with 133 additions and 3 deletions

View File

@@ -0,0 +1,24 @@
package be.mygod.vpnhotspot.preference
import android.content.Context
import android.text.TextUtils
import android.util.AttributeSet
import be.mygod.vpnhotspot.R
import be.mygod.vpnhotspot.widget.AlwaysAutoCompleteEditText
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()
}
}