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
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
f702dfc3
Commit
f702dfc3
authored
11 years ago
by
Maxime Graulich
Browse files
Options
Downloads
Patches
Plain Diff
Android: add stepper
parent
c42db483
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
contrib/mobile/Android/src/org/geuz/onelab/ParameterNumber.java
+17
-0
17 additions, 0 deletions
...b/mobile/Android/src/org/geuz/onelab/ParameterNumber.java
contrib/mobile/Android/src/org/geuz/onelab/Stepper.java
+65
-0
65 additions, 0 deletions
contrib/mobile/Android/src/org/geuz/onelab/Stepper.java
with
82 additions
and
0 deletions
contrib/mobile/Android/src/org/geuz/onelab/ParameterNumber.java
+
17
−
0
View file @
f702dfc3
...
@@ -27,6 +27,7 @@ public class ParameterNumber extends Parameter{
...
@@ -27,6 +27,7 @@ public class ParameterNumber extends Parameter{
private
Spinner
_spinner
;
private
Spinner
_spinner
;
private
CheckBox
_checkbox
;
private
CheckBox
_checkbox
;
private
EditText
_edittext
;
private
EditText
_edittext
;
private
Stepper
_stepper
;
public
ParameterNumber
(
Context
context
,
Gmsh
gmsh
,
String
name
){
public
ParameterNumber
(
Context
context
,
Gmsh
gmsh
,
String
name
){
super
(
context
,
gmsh
,
name
);
super
(
context
,
gmsh
,
name
);
...
@@ -71,6 +72,12 @@ public class ParameterNumber extends Parameter{
...
@@ -71,6 +72,12 @@ public class ParameterNumber extends Parameter{
{
{
_edittext
.
setText
(
""
+
Math
.
round
(
_value
*
Math
.
pow
(
10
,
nDecimal
))/
Math
.
pow
(
10
,
nDecimal
));
_edittext
.
setText
(
""
+
Math
.
round
(
_value
*
Math
.
pow
(
10
,
nDecimal
))/
Math
.
pow
(
10
,
nDecimal
));
}
}
else
if
(
_stepper
!=
null
)
{
_stepper
.
setMaximum
((
int
)
Math
.
round
(
_max
));
_stepper
.
setMinimum
((
int
)
Math
.
round
(
_min
));
_stepper
.
setValue
((
int
)
Math
.
round
(
_value
));
}
}
}
public
void
setValue
(
double
value
)
{
public
void
setValue
(
double
value
)
{
...
@@ -154,6 +161,8 @@ public class ParameterNumber extends Parameter{
...
@@ -154,6 +161,8 @@ public class ParameterNumber extends Parameter{
// ...
// ...
if
(
nLabels
<
1
&&
_step
==
0
)
if
(
nLabels
<
1
&&
_step
==
0
)
_edittext
=
new
EditText
(
_context
);
_edittext
=
new
EditText
(
_context
);
else
if
(
_step
==
1
)
_stepper
=
new
Stepper
(
_context
);
else
if
(
nLabels
<
1
)
else
if
(
nLabels
<
1
)
_bar
=
new
SeekBar
(
_context
);
_bar
=
new
SeekBar
(
_context
);
this
.
update
();
this
.
update
();
...
@@ -236,6 +245,14 @@ public class ParameterNumber extends Parameter{
...
@@ -236,6 +245,14 @@ public class ParameterNumber extends Parameter{
});
});
}
}
else
if
(
_stepper
!=
null
)
{
paramLayout
.
addView
(
_stepper
);
_stepper
.
setOnValueChangedListener
(
new
Stepper
.
OnValueChangedListener
()
{
public
void
onValueChanged
()
{
setValue
(
_stepper
.
getValue
());
}
});
}
return
paramLayout
;
return
paramLayout
;
}
}
private
OnParameterChangedListener
mListener
;
private
OnParameterChangedListener
mListener
;
...
...
This diff is collapsed.
Click to expand it.
contrib/mobile/Android/src/org/geuz/onelab/Stepper.java
0 → 100644
+
65
−
0
View file @
f702dfc3
package
org.geuz.onelab
;
import
android.content.Context
;
import
android.view.View
;
import
android.widget.LinearLayout
;
import
android.widget.Button
;
import
android.widget.EditText
;
class
Stepper
extends
LinearLayout
{
private
int
_min
,
_max
,
_val
;
private
Button
_incBtn
,
_decBtn
;
private
EditText
_valTxt
;
private
OnValueChangedListener
_listener
;
public
Stepper
(
Context
context
){
super
(
context
);
_max
=
_min
=
_val
=
0
;
_incBtn
=
new
Button
(
context
);
_decBtn
=
new
Button
(
context
);
_valTxt
=
new
EditText
(
context
);
_incBtn
.
setText
(
"+"
);
_decBtn
.
setText
(
"-"
);
_valTxt
.
setText
(
Integer
.
toString
(
_val
));
this
.
addView
(
_decBtn
);
this
.
addView
(
_valTxt
);
this
.
addView
(
_incBtn
);
_incBtn
.
setOnClickListener
(
new
OnClickListener
()
{
public
void
onClick
(
View
v
)
{
inc
();
}
});
_decBtn
.
setOnClickListener
(
new
OnClickListener
()
{
public
void
onClick
(
View
v
)
{
dec
();
}
});
}
public
interface
OnValueChangedListener
{
public
void
onValueChanged
();
}
public
void
inc
(){
setValue
(
_val
+
1
);}
public
void
dec
(){
setValue
(
_val
-
1
);}
public
void
setOnValueChangedListener
(
OnValueChangedListener
listener
)
{
_listener
=
listener
;}
public
void
setMaximum
(
int
max
){
_max
=
max
;}
public
void
setMinimum
(
int
min
){
_min
=
min
;}
public
void
setValue
(
int
val
){
if
(
_max
>
_min
)
{
if
(
val
==
_max
)
_incBtn
.
setEnabled
(
false
);
else
if
(
val
==
_min
)
_decBtn
.
setEnabled
(
false
);
else
{
_incBtn
.
setEnabled
(
true
);
_decBtn
.
setEnabled
(
true
);}
}
_val
=
val
;
_valTxt
.
setText
(
Integer
.
toString
(
_val
));
if
(
_listener
!=
null
)
_listener
.
onValueChanged
();
}
public
int
getMaximum
(){
return
_max
;}
public
int
getMinimum
(){
return
_min
;}
public
int
getValue
(){
return
_val
;}
}
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