Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
31d69513
Commit
31d69513
authored
11 years ago
by
Maxime Graulich
Browse files
Options
Downloads
Patches
Plain Diff
Android: allow user to change value in TextEdit
parent
f80a2484
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
contrib/mobile/Android/src/org/geuz/onelab/Stepper.java
+16
-1
16 additions, 1 deletion
contrib/mobile/Android/src/org/geuz/onelab/Stepper.java
with
16 additions
and
1 deletion
contrib/mobile/Android/src/org/geuz/onelab/Stepper.java
+
16
−
1
View file @
31d69513
...
@@ -5,6 +5,8 @@ import android.view.View;
...
@@ -5,6 +5,8 @@ import android.view.View;
import
android.widget.LinearLayout
;
import
android.widget.LinearLayout
;
import
android.widget.Button
;
import
android.widget.Button
;
import
android.widget.EditText
;
import
android.widget.EditText
;
import
android.text.TextWatcher
;
import
android.text.Editable
;
class
Stepper
extends
LinearLayout
{
class
Stepper
extends
LinearLayout
{
...
@@ -36,6 +38,16 @@ class Stepper extends LinearLayout{
...
@@ -36,6 +38,16 @@ class Stepper extends LinearLayout{
dec
();
dec
();
}
}
});
});
_valTxt
.
addTextChangedListener
(
new
TextWatcher
()
{
public
void
afterTextChanged
(
Editable
s
){}
public
void
beforeTextChanged
(
CharSequence
s
,
int
start
,
int
count
,
int
after
){}
public
void
onTextChanged
(
CharSequence
s
,
int
start
,
int
before
,
int
count
)
{
try
{
setValueButText
(
Integer
.
parseInt
(
s
.
toString
()));
}
catch
(
NumberFormatException
e
)
{}
}
});
}
}
public
interface
OnValueChangedListener
{
public
interface
OnValueChangedListener
{
...
@@ -50,13 +62,16 @@ class Stepper extends LinearLayout{
...
@@ -50,13 +62,16 @@ class Stepper extends LinearLayout{
public
void
setMaximum
(
int
max
){
_max
=
max
;}
public
void
setMaximum
(
int
max
){
_max
=
max
;}
public
void
setMinimum
(
int
min
){
_min
=
min
;}
public
void
setMinimum
(
int
min
){
_min
=
min
;}
public
void
setValue
(
int
val
){
public
void
setValue
(
int
val
){
setValueButText
(
val
);
_valTxt
.
setText
(
Integer
.
toString
(
_val
));
}
public
void
setValueButText
(
int
val
){
if
(
_max
>
_min
)
{
if
(
_max
>
_min
)
{
if
(
val
==
_max
)
_incBtn
.
setEnabled
(
false
);
if
(
val
==
_max
)
_incBtn
.
setEnabled
(
false
);
else
if
(
val
==
_min
)
_decBtn
.
setEnabled
(
false
);
else
if
(
val
==
_min
)
_decBtn
.
setEnabled
(
false
);
else
{
_incBtn
.
setEnabled
(
true
);
_decBtn
.
setEnabled
(
true
);}
else
{
_incBtn
.
setEnabled
(
true
);
_decBtn
.
setEnabled
(
true
);}
}
}
_val
=
val
;
_val
=
val
;
_valTxt
.
setText
(
Integer
.
toString
(
_val
));
if
(
_listener
!=
null
)
_listener
.
onValueChanged
();
if
(
_listener
!=
null
)
_listener
.
onValueChanged
();
}
}
public
int
getMaximum
(){
return
_max
;}
public
int
getMaximum
(){
return
_max
;}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment