FreeRDP
Loading...
Searching...
No Matches
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)
 
void setText (String text)
 

Protected Member Functions

String getPersistedString (String defaultReturnValue)
 
boolean persistString (String value)
 

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 }

◆ 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 }

◆ setText()

void com.freerdp.freerdpcore.utils.IntEditTextPreference.setText ( String  text)
inline

Definition at line 84 of file IntEditTextPreference.java.

85 {
86 String valueToSave = getText();
87
88 try
89 {
90 int parsed = Integer.parseInt(text);
91 if (parsed >= bounds_min && parsed <= bounds_max)
92 {
93 valueToSave = text;
94 }
95 }
96 catch (Exception ignored)
97 {
98 }
99
100 if (valueToSave == null)
101 {
102 valueToSave = String.valueOf(bounds_default);
103 }
104
105 super.setText(valueToSave);
106 }

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