textVisiblePassword inputType
adelpuva opened this issue · comments
Adel Puva commented
android:inputType="textVisiblePassword"
doesn't work, the characters remain hidden.I need them for a keyboard with characters and numbers.
I fixed it this way:
package com.mypackage
import android.content.Context
import android.util.AttributeSet
class PinEntryEditText : com.alimuzaffar.lib.pin.PinEntryEditText {
constructor(context: Context?) : super(context)
constructor(context: Context, attrs: AttributeSet) : super(context, attrs)
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(
context,
attrs,
defStyleAttr
)
override fun setInputType(type: Int) {
super.setInputType(type)
setMask(null)
}
}
<com.mypackage.PinEntryEditText
android:id="@+id/code"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:cursorVisible="false"
android:layoutDirection="ltr"
android:maxLength="10"
android:textIsSelectable="false"
app:pinBackgroundDrawable="@drawable/pin_code"
app:pinCharacterSpacing="4dp"/>
class MyFragment : Fragment() {
override fun onActivityCreated(state: Bundle?) {
super.onActivityCreated(savedInstanceState)
code.inputType = InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD
}
}