@Override
protected void onCreate( Bundle savedInstanceState )
{
super.onCreate( savedInstanceState );
penClient = PenClientCtrl.getInstance( getApplicationContext() );
if(penClient.getProtocolVersion() == 1)
addPreferencesFromResource( R.xml.pref_settings );
else
addPreferencesFromResource( R.xml.pref_settings2 );
mPasswordPref = (EditTextPreference) getPreferenceScreen().findPreference( Const.Setting.KEY_PASSWORD );
EditText myEditText = (EditText) mPasswordPref.getEditText();
myEditText.setKeyListener( DigitsKeyListener.getInstance( false, true ) );
}
java类android.text.method.DigitsKeyListener的实例源码
SettingActivity.java 文件源码
项目:AndroidSDK2.0
阅读 27
收藏 0
点赞 0
评论 0
PasscodeActivity.java 文件源码
项目:airgram
阅读 24
收藏 0
点赞 0
评论 0
private void updateDropDownTextView() {
if (dropDown != null) {
if (currentPasswordType == 0) {
dropDown.setText(LocaleController.getString("PasscodePIN", R.string.PasscodePIN));
} else if (currentPasswordType == 1) {
dropDown.setText(LocaleController.getString("PasscodePassword", R.string.PasscodePassword));
}
}
if (type == 1 && currentPasswordType == 0 || type == 2 && UserConfig.passcodeType == 0) {
InputFilter[] filterArray = new InputFilter[1];
filterArray[0] = new InputFilter.LengthFilter(4);
passwordEditText.setFilters(filterArray);
passwordEditText.setInputType(InputType.TYPE_CLASS_PHONE);
passwordEditText.setKeyListener(DigitsKeyListener.getInstance("1234567890"));
} else if (type == 1 && currentPasswordType == 1 || type == 2 && UserConfig.passcodeType == 1) {
passwordEditText.setFilters(new InputFilter[0]);
passwordEditText.setKeyListener(null);
passwordEditText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
}
passwordEditText.setTransformationMethod(PasswordTransformationMethod.getInstance());
}
MaskedEditText.java 文件源码
项目:star-dns-changer
阅读 20
收藏 0
点赞 0
评论 0
@Override
public void setInputType(int type) {
if (type == -1) {
type = InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_VARIATION_PASSWORD;
}
if (type == InputType.TYPE_CLASS_NUMBER ||
type == InputType.TYPE_NUMBER_FLAG_SIGNED ||
type == InputType.TYPE_NUMBER_FLAG_DECIMAL ||
type == InputType.TYPE_CLASS_PHONE) {
final String symbolExceptions = getSymbolExceptions();
this.setKeyListener(DigitsKeyListener.getInstance("0123456789." + symbolExceptions));
} else {
super.setInputType(type);
}
}
BasicFieldNumberView.java 文件源码
项目:Blockly
阅读 26
收藏 0
点赞 0
评论 0
protected void updateInputMethod() {
boolean hasNumberField = mNumberField != null;
setEnabled(hasNumberField);
if (hasNumberField) {
int imeOptions = InputType.TYPE_CLASS_NUMBER;
StringBuilder allowedChars = new StringBuilder("0123456789");
if (mAllowExponent) {
allowedChars.append("e");
}
if (mNumberField.getMinimumValue() < 0) {
imeOptions |= InputType.TYPE_NUMBER_FLAG_SIGNED;
allowedChars.append("-");
}
if (!mNumberField.isInteger()) {
imeOptions |= InputType.TYPE_NUMBER_FLAG_DECIMAL;
allowedChars.append(mLocalizedDecimalSymbols.getDecimalSeparator());
}
allowedChars.append(mLocalizedDecimalSymbols.getGroupingSeparator());
setImeOptions(imeOptions);
setKeyListener(DigitsKeyListener.getInstance(allowedChars.toString()));
}
}
DecimalEdit.java 文件源码
项目:MyFlightbookAndroid
阅读 19
收藏 0
点赞 0
评论 0
public void setMode(EditMode value) {
m_editMode = value;
switch (EffectiveMode()) {
case HHMM:
this.setHint(R.string.emptyWaterMarkHHMM);
this.setInputType(InputType.TYPE_CLASS_NUMBER);
setKeyListener(DigitsKeyListener.getInstance(false, false));
break;
case INTEGER:
this.setHint(R.string.emptyWaterMarkInt);
this.setInputType(InputType.TYPE_CLASS_NUMBER);
this.setKeyListener(DigitsKeyListener.getInstance(false, false));
// setKeyListener(DigitsKeyListener.getInstance("01234567890"));
break;
case DECIMAL:
// See Android bug #2626 (http://code.google.com/p/android/issues/detail?id=2626&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars)
// Using SetKeyListener
this.setHint(String.format(Locale.getDefault(), "%.1f", 0.0));
this.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
this.setKeyListener(DigitsKeyListener.getInstance(false, true)); // should work but bug above means it will ALWAYS use a period.
break;
}
}
PasscodeActivity.java 文件源码
项目:PlusGram
阅读 28
收藏 0
点赞 0
评论 0
private void updateDropDownTextView() {
if (dropDown != null) {
if (currentPasswordType == 0) {
dropDown.setText(LocaleController.getString("PasscodePIN", R.string.PasscodePIN));
} else if (currentPasswordType == 1) {
dropDown.setText(LocaleController.getString("PasscodePassword", R.string.PasscodePassword));
}
}
if (type == 1 && currentPasswordType == 0 || type == 2 && UserConfig.passcodeType == 0) {
InputFilter[] filterArray = new InputFilter[1];
filterArray[0] = new InputFilter.LengthFilter(4);
passwordEditText.setFilters(filterArray);
passwordEditText.setInputType(InputType.TYPE_CLASS_PHONE);
passwordEditText.setKeyListener(DigitsKeyListener.getInstance("1234567890"));
} else if (type == 1 && currentPasswordType == 1 || type == 2 && UserConfig.passcodeType == 1) {
passwordEditText.setFilters(new InputFilter[0]);
passwordEditText.setKeyListener(null);
passwordEditText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
}
passwordEditText.setTransformationMethod(PasswordTransformationMethod.getInstance());
}
PreferencesFragment.java 文件源码
项目:RemindrApp-Android
阅读 28
收藏 0
点赞 0
评论 0
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
//Construct the preferences screen form XML config
addPreferencesFromResource(R.xml.task_preferences);
//Use the number keyboard when editing the time preference
EditTextPreference timeDefault = (EditTextPreference)findPreference(getString(R.string.pref_default_time_from_now_key));
timeDefault.getEditText().setKeyListener(DigitsKeyListener.getInstance());
findPreference(this.getString(R.string.title_instructions)).setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Intent intent = new Intent(getActivity(), IntroActivity.class);
startActivity(intent);
return false;
}
});
}
ExIntegerWidget.java 文件源码
项目:ODK-Liberia
阅读 20
收藏 0
点赞 0
评论 0
public ExIntegerWidget(Context context, FormEntryPrompt prompt) {
super(context, prompt);
mAnswer.setInputType(InputType.TYPE_NUMBER_FLAG_SIGNED);
// only allows numbers and no periods
mAnswer.setKeyListener(new DigitsKeyListener(true, false));
// ints can only hold 2,147,483,648. we allow 999,999,999
InputFilter[] fa = new InputFilter[1];
fa[0] = new InputFilter.LengthFilter(9);
mAnswer.setFilters(fa);
Integer i = getIntegerAnswerValue();
if (i != null) {
mAnswer.setText(i.toString());
}
}
PreferencesFragment.java 文件源码
项目:RemindrApp-Android
阅读 36
收藏 0
点赞 0
评论 0
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
//Construct the preferences screen form XML config
addPreferencesFromResource(R.xml.task_preferences);
//Use the number keyboard when editing the time preference
EditTextPreference timeDefault = (EditTextPreference)findPreference(getString(R.string.pref_default_time_from_now_key));
timeDefault.getEditText().setKeyListener(DigitsKeyListener.getInstance());
findPreference(this.getString(R.string.title_instructions)).setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Intent intent = new Intent(getActivity(), IntroActivity.class);
startActivity(intent);
return false;
}
});
}
ActivityMain.java 文件源码
项目:nfcspy
阅读 30
收藏 0
点赞 0
评论 0
private void setDiscoveryDelay() {
final EditText input = new EditText(this);
input.setHint(this.getString(R.string.hint_discoverydelay));
input.setText(Integer.toString(nfc.getDiscoveryDelay()));
input.setInputType(EditorInfo.TYPE_CLASS_NUMBER);
input.setKeyListener(DigitsKeyListener.getInstance("01234567890"));
input.setSingleLine(true);
SetDelayHelper helper = new SetDelayHelper(nfc, input);
new AlertDialog.Builder(this, AlertDialog.THEME_HOLO_LIGHT)
.setTitle(R.string.action_discoverydelay)
.setMessage(R.string.lab_discoverydelay).setView(input)
.setPositiveButton(R.string.action_ok, helper)
.setNegativeButton(R.string.action_cancel, helper).show();
}
TextEntryElement.java 文件源码
项目:vit-04
阅读 23
收藏 0
点赞 0
评论 0
/** gets the key listener by type */
private static KeyListener getKeyListenerForType(NumericType type) {
switch (type) {
case DIALPAD:
return new DialerKeyListener();
case INTEGER:
return new DigitsKeyListener();
case SIGNED:
return new DigitsKeyListener(true, false);
case DECIMAL:
return new DigitsKeyListener(true, true);
case NONE:
default:
return null;
}
}
PinputView.java 文件源码
项目:android-pin
阅读 21
收藏 0
点赞 0
评论 0
private void init(AttributeSet attrs, int defStyle) {
// @formatter:off
final TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.PinputView, defStyle, 0);
// @formatter:on
setFocusableInTouchMode(false);
setKeyListener(DigitsKeyListener.getInstance(false, false));
mPinLen = a.getInt(R.styleable.PinputView_pinputview_len, 4);
mCharPadding = (int) a.getDimension(R.styleable.PinputView_pinputview_characterPadding,
getResources().getDimension(R.dimen.pinputview_default_char_padding));
int foregroundColor = a.getColor(R.styleable.PinputView_pinputview_foregroundColor, Color.BLUE);
int backgroundColor = a.getColor(R.styleable.PinputView_pinputview_backgroundColor, Color.GRAY);
a.recycle();
initDrawables(foregroundColor, backgroundColor);
initFilters();
initializeAnimator();
}
TextEntryElement.java 文件源码
项目:sana.mobile
阅读 31
收藏 0
点赞 0
评论 0
/** gets the key listener by type */
protected static KeyListener getKeyListenerForType(NumericType type) {
switch (type) {
case DIALPAD:
return new DialerKeyListener();
case INTEGER:
return new DigitsKeyListener();
case SIGNED:
return new DigitsKeyListener(true, false);
case DECIMAL:
return new DigitsKeyListener(true, true);
case NONE:
default:
return null;
}
}
ExIntegerWidget.java 文件源码
项目:sagesmobile-mCollect
阅读 22
收藏 0
点赞 0
评论 0
public ExIntegerWidget(Context context, FormEntryPrompt prompt) {
super(context, prompt);
mAnswer.setInputType(InputType.TYPE_NUMBER_FLAG_SIGNED);
// only allows numbers and no periods
mAnswer.setKeyListener(new DigitsKeyListener(true, false));
// ints can only hold 2,147,483,648. we allow 999,999,999
InputFilter[] fa = new InputFilter[1];
fa[0] = new InputFilter.LengthFilter(9);
mAnswer.setFilters(fa);
Integer i = getIntegerAnswerValue();
if (i != null) {
mAnswer.setText(i.toString());
}
}
PasscodeActivity.java 文件源码
项目:Telegram
阅读 25
收藏 0
点赞 0
评论 0
private void updateDropDownTextView() {
if (dropDown != null) {
if (currentPasswordType == 0) {
dropDown.setText(LocaleController.getString("PasscodePIN", R.string.PasscodePIN));
} else if (currentPasswordType == 1) {
dropDown.setText(LocaleController.getString("PasscodePassword", R.string.PasscodePassword));
}
}
if (type == 1 && currentPasswordType == 0 || type == 2 && UserConfig.passcodeType == 0) {
InputFilter[] filterArray = new InputFilter[1];
filterArray[0] = new InputFilter.LengthFilter(4);
passwordEditText.setFilters(filterArray);
passwordEditText.setInputType(InputType.TYPE_CLASS_PHONE);
passwordEditText.setKeyListener(DigitsKeyListener.getInstance("1234567890"));
} else if (type == 1 && currentPasswordType == 1 || type == 2 && UserConfig.passcodeType == 1) {
passwordEditText.setFilters(new InputFilter[0]);
passwordEditText.setKeyListener(null);
passwordEditText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
}
passwordEditText.setTransformationMethod(PasswordTransformationMethod.getInstance());
}
AddSubUtils.java 文件源码
项目:AddSubUtils
阅读 22
收藏 0
点赞 0
评论 0
private void setEditable(boolean editable) {
if (editable) {
etInput.setFocusable(true);
etInput.setKeyListener(new DigitsKeyListener());
} else {
etInput.setFocusable(false);
etInput.setKeyListener(null);
}
}
GlobalSetActivity.java 文件源码
项目:FloatText
阅读 17
收藏 0
点赞 0
评论 0
private void DynamicTimeSet(final SharedPreferences sp) {
int num = sp.getInt("DynamicReloadTime", 1000);
LayoutInflater inflater = LayoutInflater.from(getActivity());
View view = inflater.inflate(R.layout.dialog_text, null);
AlertDialog.Builder set = new AlertDialog.Builder(getActivity());
set.setTitle(R.string.xml_global_dynamicword_reload_time);
final EditText et = (EditText) view.findViewById(R.id.dialog_text_edittext);
et.setText(String.valueOf(num));
et.setKeyListener(new DigitsKeyListener(false, true));
set.setPositiveButton(R.string.done, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface d, int i) {
String str = et.getText().toString();
if (!str.isEmpty()) {
int get = Integer.valueOf(str);
if (get < 500) {
Toast.makeText(getActivity(), R.string.num_err, Toast.LENGTH_SHORT).show();
} else {
sp.edit().putInt("DynamicReloadTime", get).apply();
Toast.makeText(getActivity(), R.string.restart_to_apply, Toast.LENGTH_LONG).show();
}
}
}
});
set.setNegativeButton(R.string.cancel, null);
set.setView(view);
set.show();
}
NumberButton.java 文件源码
项目:NumberButton
阅读 20
收藏 0
点赞 0
评论 0
private void setEditable(boolean editable) {
if (editable) {
mCount.setFocusable(true);
mCount.setKeyListener(new DigitsKeyListener());
} else {
mCount.setFocusable(false);
mCount.setKeyListener(null);
}
}
AddHousenumberForm.java 文件源码
项目:StreetComplete
阅读 19
收藏 0
点赞 0
评论 0
private void initKeyboardButton(View view)
{
final Button toggleKeyboardButton = view.findViewById(R.id.toggleKeyboard);
if(toggleKeyboardButton != null)
{
toggleKeyboardButton.setText("abc");
toggleKeyboardButton.setOnClickListener(v ->
{
View focus = getActivity().getCurrentFocus();
if(focus != null && focus instanceof EditText)
{
EditText input = (EditText) focus;
if ((input.getInputType() & InputType.TYPE_CLASS_NUMBER) != 0)
{
input.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
toggleKeyboardButton.setText("123");
} else
{
input.setInputType(InputType.TYPE_CLASS_NUMBER);
input.setKeyListener(DigitsKeyListener.getInstance("0123456789.,- /"));
toggleKeyboardButton.setText("abc");
}
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(input, InputMethodManager.SHOW_IMPLICIT);
}
});
}
}
TaskPreferences.java 文件源码
项目:Reminder_Android
阅读 22
收藏 0
点赞 0
评论 0
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.task_preferences);
// Set the time default to a numeric number only
EditTextPreference timeDefault = (EditTextPreference) findPreference(getString(R.string.pref_default_time_from_now_key));
timeDefault.getEditText().setKeyListener(DigitsKeyListener.getInstance());
}
ExDecimalWidget.java 文件源码
项目:ODK-Liberia
阅读 19
收藏 0
点赞 0
评论 0
public ExDecimalWidget(Context context, FormEntryPrompt prompt) {
super(context, prompt);
mAnswer.setInputType(InputType.TYPE_NUMBER_FLAG_DECIMAL);
// only allows numbers and no periods
mAnswer.setKeyListener(new DigitsKeyListener(true, true));
// only 15 characters allowed
InputFilter[] fa = new InputFilter[1];
fa[0] = new InputFilter.LengthFilter(15);
mAnswer.setFilters(fa);
Double d = getDoubleAnswerValue();
// apparently an attempt at rounding to no more than 15 digit precision???
NumberFormat nf = NumberFormat.getNumberInstance();
nf.setMaximumFractionDigits(15);
nf.setMaximumIntegerDigits(15);
nf.setGroupingUsed(false);
if (d != null) {
// truncate to 15 digits max...
String dString = nf.format(d);
d = Double.parseDouble(dString.replace(',', '.')); // in case , is decimal pt
mAnswer.setText(d.toString());
}
}
StringNumberWidget.java 文件源码
项目:ODK-Liberia
阅读 18
收藏 0
点赞 0
评论 0
public StringNumberWidget(Context context, FormEntryPrompt prompt, boolean readOnlyOverride) {
super(context, prompt, readOnlyOverride, true);
mAnswer.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mAnswerFontsize);
mAnswer.setInputType(InputType.TYPE_NUMBER_FLAG_SIGNED);
// needed to make long readonly text scroll
mAnswer.setHorizontallyScrolling(false);
mAnswer.setSingleLine(false);
mAnswer.setKeyListener(new DigitsKeyListener() {
@Override
protected char[] getAcceptedChars() {
char[] accepted = {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.', '-', '+', ' ', ','
};
return accepted;
}
});
if (prompt.isReadOnly()) {
setBackgroundDrawable(null);
setFocusable(false);
setClickable(false);
}
String s = null;
if (prompt.getAnswerValue() != null)
s = (String) prompt.getAnswerValue().getValue();
if (s != null) {
mAnswer.setText(s);
}
setupChangeListener();
}
IntegerWidget.java 文件源码
项目:ODK-Liberia
阅读 25
收藏 0
点赞 0
评论 0
public IntegerWidget(Context context, FormEntryPrompt prompt, boolean readOnlyOverride) {
super(context, prompt, readOnlyOverride, true);
mAnswer.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mAnswerFontsize);
mAnswer.setInputType(InputType.TYPE_NUMBER_FLAG_SIGNED);
// needed to make long readonly text scroll
mAnswer.setHorizontallyScrolling(false);
mAnswer.setSingleLine(false);
// only allows numbers and no periods
mAnswer.setKeyListener(new DigitsKeyListener(true, false));
// ints can only hold 2,147,483,648. we allow 999,999,999
InputFilter[] fa = new InputFilter[1];
fa[0] = new InputFilter.LengthFilter(9);
mAnswer.setFilters(fa);
if (prompt.isReadOnly()) {
setBackgroundDrawable(null);
setFocusable(false);
setClickable(false);
}
Integer i = getIntegerAnswerValue();
if (i != null) {
mAnswer.setText(i.toString());
}
setupChangeListener();
}
PreferencesFragment.java 文件源码
项目:easy-a
阅读 30
收藏 0
点赞 0
评论 0
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Construct the preferences screen from the XML config
addPreferencesFromResource(R.xml.task_preferences);
// Use the number keyboard when editing the time preference
EditTextPreference timeDefault = (EditTextPreference)
findPreference(getString(R.string
.pref_default_time_from_now_key));
timeDefault.getEditText().setKeyListener(DigitsKeyListener
.getInstance());
}
MainActivity.java 文件源码
项目:AndroidMaterialDesignCalculator
阅读 18
收藏 0
点赞 0
评论 0
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
calculator_result = (TextView) findViewById(R.id.calculator_result);
button_one = (Button) findViewById(R.id.number_one);
button_two = (Button) findViewById(R.id.number_two);
button_three = (Button) findViewById(R.id.number_three);
button_four = (Button) findViewById(R.id.number_four);
button_five = (Button) findViewById(R.id.number_five);
button_six = (Button) findViewById(R.id.number_six);
button_seven = (Button) findViewById(R.id.number_seven);
button_eight = (Button) findViewById(R.id.number_eight);
button_nine = (Button) findViewById(R.id.number_nine);
button_zero = (Button) findViewById(R.id.number_zero);
button_plus = (Button) findViewById(R.id.button_plus);
button_minus = (Button) findViewById(R.id.button_minus);
button_multiply = (Button) findViewById(R.id.button_multiply);
button_divide = (Button) findViewById(R.id.button_divide);
button_power = (Button) findViewById(R.id.button_power);
button_root = (Button) findViewById(R.id.button_root);
button_abs = (Button) findViewById(R.id.button_abs);
button_clear = (Button) findViewById(R.id.button_clear);
button_equals = (Button) findViewById(R.id.button_equals);
calculator_result.setKeyListener(DigitsKeyListener.getInstance(true,true));
registerListeners();
}
M_LongModifier.java 文件源码
项目:AugmentedOxford
阅读 24
收藏 0
点赞 0
评论 0
@Override
public void applyTextFilterIfNeeded(EditText e) {
e.setInputType(InputType.TYPE_CLASS_NUMBER);
e.setKeyListener(new DigitsKeyListener(true, false));
if (minimumValue != null && maximumValue != null) {
setMinMaxFilterFor(e, minimumValue, maximumValue);
}
}
M_IntModifier.java 文件源码
项目:AugmentedOxford
阅读 34
收藏 0
点赞 0
评论 0
@Override
public void applyTextFilterIfNeeded(EditText e) {
e.setInputType(InputType.TYPE_CLASS_NUMBER);
e.setKeyListener(new DigitsKeyListener(true, false));
if (minimumValue != null && maximumValue != null) {
setMinMaxFilterFor(e, minimumValue, maximumValue);
}
}
StringNumberWidget.java 文件源码
项目:commcare-android
阅读 22
收藏 0
点赞 0
评论 0
public StringNumberWidget(Context context, FormEntryPrompt prompt, boolean secret) {
super(context, prompt, secret);
mAnswer.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mAnswerFontSize);
mAnswer.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI | EditorInfo.IME_ACTION_NEXT);
// needed to make long readonly text scroll
mAnswer.setHorizontallyScrolling(false);
if (!secret) {
mAnswer.setSingleLine(false);
}
mAnswer.setKeyListener(new DigitsKeyListener(true, true) {
@Override
protected char[] getAcceptedChars() {
return new char[]{
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.', '-', '+', ' '
};
}
});
if (prompt.isReadOnly()) {
setBackgroundDrawable(null);
setFocusable(false);
setClickable(false);
}
//This might be redundant, but I assume that it's about there being a difference
//between a display value somewhere. We should double check
if (prompt.getAnswerValue() != null) {
String curAnswer = getCurrentAnswer().getValue().toString().trim();
try {
mAnswer.setText(curAnswer);
} catch (Exception NumberFormatException) {
}
}
}
GraphPreferences.java 文件源码
项目:openScale
阅读 20
收藏 0
点赞 0
评论 0
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.graph_preferences);
regressionLine = (CheckBoxPreference) findPreference(PREFERENCE_KEY_REGRESSION_LINE);
regressionLineOrder = (EditTextPreference) findPreference(PREFERENCE_KEY_REGRESSION_LINE_ORDER);
regressionLineOrder.getEditText().setKeyListener(new DigitsKeyListener());
updateGraphPreferences();
initSummary(getPreferenceScreen());
}
TaskPreferences.java 文件源码
项目:Task-Reminder-App
阅读 23
收藏 0
点赞 0
评论 0
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.task_preferences);
// Set the time default to a numeric number only
EditTextPreference timeDefault = (EditTextPreference) findPreference(getString(R.string.pref_default_time_from_now_key));
timeDefault.getEditText().setKeyListener(DigitsKeyListener.getInstance());
}