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
3bc6113e
Commit
3bc6113e
authored
10 years ago
by
Maxime Graulich
Browse files
Options
Downloads
Patches
Plain Diff
edit value onLongClick
parent
ce8f255c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
contrib/mobile/Android/src/org/geuz/onelab/ParameterNumber.java
+50
-4
50 additions, 4 deletions
...b/mobile/Android/src/org/geuz/onelab/ParameterNumber.java
with
50 additions
and
4 deletions
contrib/mobile/Android/src/org/geuz/onelab/ParameterNumber.java
+
50
−
4
View file @
3bc6113e
...
@@ -2,6 +2,7 @@ package org.geuz.onelab;
...
@@ -2,6 +2,7 @@ package org.geuz.onelab;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
android.app.Activity
;
import
android.content.Context
;
import
android.content.Context
;
import
android.text.Editable
;
import
android.text.Editable
;
import
android.text.TextWatcher
;
import
android.text.TextWatcher
;
...
@@ -18,8 +19,19 @@ import android.widget.SeekBar;
...
@@ -18,8 +19,19 @@ import android.widget.SeekBar;
import
android.widget.Spinner
;
import
android.widget.Spinner
;
import
android.util.Log
;
import
android.util.Log
;
public
class
ParameterNumber
extends
Parameter
{
private
double
_value
,
_min
,
_max
,
_step
;
import
android.app.Dialog
;
import
android.app.AlertDialog
;
import
android.app.DialogFragment
;
import
android.content.DialogInterface
;
import
android.widget.LinearLayout
;
import
android.widget.TextView
;
import
android.widget.EditText
;
import
android.text.TextWatcher
;
import
android.text.Editable
;
public
class
ParameterNumber
extends
Parameter
{
private
double
_value
,
_tmpValue
,
_min
,
_max
,
_step
;
private
SeekBar
_bar
;
private
SeekBar
_bar
;
private
ArrayList
<
Double
>
_values
;
private
ArrayList
<
Double
>
_values
;
private
ArrayList
<
String
>
_choices
;
private
ArrayList
<
String
>
_choices
;
...
@@ -176,8 +188,42 @@ public class ParameterNumber extends Parameter{
...
@@ -176,8 +188,42 @@ public class ParameterNumber extends Parameter{
paramLayout
.
setOnLongClickListener
(
new
View
.
OnLongClickListener
(){
paramLayout
.
setOnLongClickListener
(
new
View
.
OnLongClickListener
(){
@Override
@Override
public
boolean
onLongClick
(
View
v
){
public
boolean
onLongClick
(
View
v
){
Log
.
w
(
"Yeppee"
,
"long click yes..."
);
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
_context
);
return
true
;
LinearLayout
layout
=
new
LinearLayout
(
_context
);
layout
.
setOrientation
(
LinearLayout
.
VERTICAL
);
TextView
label
=
new
TextView
(
_context
);
label
.
setText
(
"Edit value of \n"
+
_name
);
EditText
edit
=
new
EditText
(
_context
);
edit
.
setText
(
String
.
valueOf
(
_value
));
edit
.
addTextChangedListener
(
new
TextWatcher
()
{
public
void
onTextChanged
(
CharSequence
s
,
int
start
,
int
before
,
int
count
)
{
try
{
if
(
s
.
length
()
<
1
)
_tmpValue
=
1
;
_tmpValue
=
Double
.
parseDouble
(
s
.
toString
());
}
catch
(
NumberFormatException
e
)
{
_tmpValue
=
1
;
}
}
public
void
beforeTextChanged
(
CharSequence
s
,
int
start
,
int
count
,
int
after
)
{}
// UNUSED Auto-generated method stub
public
void
afterTextChanged
(
Editable
s
)
{}
// UNUSED Auto-generated method stub
});
edit
.
requestFocus
();
//_context.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
layout
.
addView
(
label
);
layout
.
addView
(
edit
);
builder
.
setView
(
layout
)
.
setPositiveButton
(
"OK"
,
new
DialogInterface
.
OnClickListener
()
{
public
void
onClick
(
DialogInterface
dialog
,
int
id
)
{
setValue
(
_tmpValue
);
}
})
.
setNegativeButton
(
"Cancel"
,
new
DialogInterface
.
OnClickListener
()
{
public
void
onClick
(
DialogInterface
dialog
,
int
id
)
{
// User cancelled the dialog
}
});
builder
.
create
().
show
();
return
true
;
}
}
});
});
if
(
_spinner
!=
null
)
{
if
(
_spinner
!=
null
)
{
...
...
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