kopia lustrzana https://github.com/ge0rg/aprsdroid
rodzic
015b3dd464
commit
88408aedf3
|
@ -2,8 +2,11 @@ package de.duenndns;
|
|||
|
||||
import android.content.Context;
|
||||
import android.preference.EditTextPreference;
|
||||
import android.text.InputFilter;
|
||||
import android.text.InputType;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
|
||||
public class EditTextPreferenceWithValue extends EditTextPreference {
|
||||
CharSequence mSummary;
|
||||
|
@ -16,6 +19,23 @@ public class EditTextPreferenceWithValue extends EditTextPreference {
|
|||
super(context);
|
||||
}
|
||||
|
||||
private void fixupCaps() {
|
||||
EditText et = getEditText();
|
||||
if ((et.getInputType() & InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS) != 0) {
|
||||
// append AllCaps filter
|
||||
InputFilter[] filters = et.getFilters();
|
||||
InputFilter[] newFilters = new InputFilter[filters.length + 1];
|
||||
System.arraycopy(filters, 0, newFilters, 0, filters.length);
|
||||
newFilters[filters.length] = new InputFilter.AllCaps();
|
||||
et.setFilters(newFilters);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void onBindDialogView(View view) {
|
||||
super.onBindDialogView(view);
|
||||
fixupCaps();
|
||||
}
|
||||
|
||||
private void setSummaryToText(String text) {
|
||||
if (mSummary == null)
|
||||
mSummary = getSummary();
|
||||
|
|
Ładowanie…
Reference in New Issue