FreeRDP
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Modules Pages
com.freerdp.freerdpcore.utils.IntEditTextPreference Class Reference
Inheritance diagram for com.freerdp.freerdpcore.utils.IntEditTextPreference:
Collaboration diagram for com.freerdp.freerdpcore.utils.IntEditTextPreference:

Public Member Functions

 IntEditTextPreference (Context context)
 
 IntEditTextPreference (Context context, AttributeSet attrs)
 
 IntEditTextPreference (Context context, AttributeSet attrs, int defStyle)
 
void setBounds (int min, int max, int defaultValue)
 

Protected Member Functions

String getPersistedString (String defaultReturnValue)
 
boolean persistString (String value)
 
void onDialogClosed (boolean positiveResult)
 

Detailed Description

Definition at line 20 of file IntEditTextPreference.java.

Constructor & Destructor Documentation

◆ IntEditTextPreference() [1/3]

com.freerdp.freerdpcore.utils.IntEditTextPreference.IntEditTextPreference ( Context  context)
inline

Definition at line 25 of file IntEditTextPreference.java.

26 {
27 super(context);
28 init(context, null);
29 }

◆ IntEditTextPreference() [2/3]

com.freerdp.freerdpcore.utils.IntEditTextPreference.IntEditTextPreference ( Context  context,
AttributeSet  attrs 
)
inline

Definition at line 31 of file IntEditTextPreference.java.

32 {
33 super(context, attrs);
34 init(context, attrs);
35 }

◆ IntEditTextPreference() [3/3]

com.freerdp.freerdpcore.utils.IntEditTextPreference.IntEditTextPreference ( Context  context,
AttributeSet  attrs,
int  defStyle 
)
inline

Definition at line 37 of file IntEditTextPreference.java.

38 {
39 super(context, attrs, defStyle);
40 init(context, attrs);
41 }

Member Function Documentation

◆ getPersistedString()

String com.freerdp.freerdpcore.utils.IntEditTextPreference.getPersistedString ( String  defaultReturnValue)
inlineprotected

Definition at line 71 of file IntEditTextPreference.java.

72 {
73 int value = getPersistedInt(-1);
74 if (value > bounds_max || value < bounds_min)
75 value = bounds_default;
76 return String.valueOf(value);
77 }

◆ onDialogClosed()

void com.freerdp.freerdpcore.utils.IntEditTextPreference.onDialogClosed ( boolean  positiveResult)
inlineprotected

Definition at line 84 of file IntEditTextPreference.java.

85 {
86 if (positiveResult)
87 {
88 // prevent exception when an empty value is persisted
89 if (getEditText().getText().length() == 0)
90 getEditText().setText("0");
91
92 // check bounds
93 int value = Integer.parseInt(getEditText().getText().toString());
94 if (value > bounds_max || value < bounds_min)
95 value = bounds_default;
96 getEditText().setText(String.valueOf(value));
97 }
98
99 super.onDialogClosed(positiveResult);
100 }

◆ persistString()

boolean com.freerdp.freerdpcore.utils.IntEditTextPreference.persistString ( String  value)
inlineprotected

Definition at line 79 of file IntEditTextPreference.java.

80 {
81 return persistInt(Integer.parseInt(value));
82 }

◆ setBounds()

void com.freerdp.freerdpcore.utils.IntEditTextPreference.setBounds ( int  min,
int  max,
int  defaultValue 
)
inline

Definition at line 64 of file IntEditTextPreference.java.

65 {
66 bounds_min = min;
67 bounds_max = max;
68 bounds_default = defaultValue;
69 }

The documentation for this class was generated from the following file: