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
fe8c2bcb
Commit
fe8c2bcb
authored
10 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
fix english
parent
44a8525e
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/MainActivity.java
+30
-30
30 additions, 30 deletions
contrib/mobile/Android/src/org/geuz/onelab/MainActivity.java
with
30 additions
and
30 deletions
contrib/mobile/Android/src/org/geuz/onelab/MainActivity.java
+
30
−
30
View file @
fe8c2bcb
...
...
@@ -43,7 +43,7 @@ public class MainActivity extends Activity{
public
MainActivity
()
{
}
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
...
...
@@ -61,7 +61,7 @@ public class MainActivity extends Activity{
else
if
(
intent
.
getAction
()
!=
null
&&
intent
.
getAction
().
equals
(
Intent
.
ACTION_VIEW
))
{
String
tmp
=
intent
.
getData
().
getPath
();
_gmsh
.
load
(
tmp
);
}
}
else
if
(
extras
!=
null
)
{
String
name
=
extras
.
getString
(
"name"
);
this
.
getActionBar
().
setTitle
(
name
);
...
...
@@ -77,20 +77,20 @@ public class MainActivity extends Activity{
_optionsFragment
=
OptionsFragment
.
newInstance
(
_gmsh
);
getFragmentManager
().
beginTransaction
().
replace
(
R
.
id
.
parameter_fragment
,
_optionsFragment
).
commit
();
_optionsFragment
.
setOnOptionsChangedListener
(
new
OptionsFragment
.
OnOptionsChangedListener
()
{
public
void
OnOptionsChanged
()
{
_modelFragment
.
requestRender
();
}
});
}
}
@Override
protected
void
onSaveInstanceState
(
Bundle
outState
)
{
outState
.
putBoolean
(
"Compute"
,
_compute
);
super
.
onSaveInstanceState
(
outState
);
}
@Override
public
boolean
onCreateOptionsMenu
(
Menu
menu
)
{
super
.
onCreateOptionsMenu
(
menu
);
...
...
@@ -129,10 +129,10 @@ public class MainActivity extends Activity{
else
if
(
item
.
getTitle
().
equals
(
getString
(
R
.
string
.
menu_share
)))
{
if
(
this
.
_compute
)
{
AlertDialog
.
Builder
dialogBuilder
=
new
AlertDialog
.
Builder
(
this
);
_errorDialog
=
dialogBuilder
.
setTitle
(
"Can't show the model
s
list"
)
.
setMessage
(
"The comput
ing
ha
ve
to
be finished
before you can take a screenshot
.
"
)
_errorDialog
=
dialogBuilder
.
setTitle
(
"Can't show the model list"
)
.
setMessage
(
"The comput
ation
ha
s
to
complete
before you can take a screenshot"
)
.
setPositiveButton
(
"OK"
,
new
DialogInterface
.
OnClickListener
()
{
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
dialog
.
dismiss
();
}
...
...
@@ -154,10 +154,10 @@ public class MainActivity extends Activity{
else
if
(
item
.
getItemId
()
==
android
.
R
.
id
.
home
)
{
if
(
this
.
_compute
)
{
AlertDialog
.
Builder
dialogBuilder
=
new
AlertDialog
.
Builder
(
this
);
_errorDialog
=
dialogBuilder
.
setTitle
(
"Can't show the model
s
list"
)
.
setMessage
(
"The comput
ing
ha
ve
to
be finished
before you can select an
other model
.
"
)
_errorDialog
=
dialogBuilder
.
setTitle
(
"Can't show the model list"
)
.
setMessage
(
"The comput
ation
ha
s
to
complete
before you can select another model"
)
.
setPositiveButton
(
"OK"
,
new
DialogInterface
.
OnClickListener
()
{
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
dialog
.
dismiss
();
}
...
...
@@ -169,7 +169,7 @@ public class MainActivity extends Activity{
}
return
super
.
onMenuItemSelected
(
featureId
,
item
);
}
@Override
protected
void
onActivityResult
(
int
requestCode
,
int
resultCode
,
Intent
data
)
{
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
);
...
...
@@ -180,7 +180,7 @@ public class MainActivity extends Activity{
break
;
}
}
public
String
getRealPathFromURI
(
Uri
contentUri
)
{
String
[]
proj
=
{
MediaStore
.
Images
.
Media
.
DATA
};
Cursor
cursor
=
managedQuery
(
contentUri
,
proj
,
null
,
null
,
null
);
...
...
@@ -188,7 +188,7 @@ public class MainActivity extends Activity{
cursor
.
moveToFirst
();
return
cursor
.
getString
(
column_index
);
}
private
class
Run
extends
AsyncTask
<
Void
,
Void
,
Integer
[]>
{
@Override
...
...
@@ -197,7 +197,7 @@ public class MainActivity extends Activity{
_runStopMenuItem
.
setTitle
(
R
.
string
.
menu_stop
);
super
.
onPreExecute
();
}
@Override
protected
Integer
[]
doInBackground
(
Void
...
params
)
{
_gmsh
.
onelabCB
(
"compute"
);
...
...
@@ -214,7 +214,7 @@ public class MainActivity extends Activity{
if
(
_notify
)
notifyEndComputing
();
super
.
onPostExecute
(
result
);
}
}
private
void
showError
(){
if
(
_errors
.
size
()>
0
){
...
...
@@ -244,7 +244,7 @@ public class MainActivity extends Activity{
super
.
onPause
();
_notify
=
true
;
}
@Override
protected
void
onResume
()
{
super
.
onResume
();
...
...
@@ -253,36 +253,36 @@ public class MainActivity extends Activity{
mNotificationManager
.
cancel
(
1337
);
_notify
=
false
;
}
@Override
protected
void
onStop
()
{
super
.
onStop
();
if
(
_compute
)
notifyComputing
();
_notify
=
true
;
}
@Override
public
void
onLowMemory
()
{
if
(!
_compute
)
return
;
_gmsh
.
onelabCB
(
"stop"
);
Toast
.
makeText
(
this
,
"Low memory
!!
!
c
omput
ing
is going to stop"
,
Toast
.
LENGTH_LONG
).
show
();
Toast
.
makeText
(
this
,
"Low memory!
C
omput
ation
is going to stop"
,
Toast
.
LENGTH_LONG
).
show
();
super
.
onLowMemory
();
}
@Override
public
void
onTrimMemory
(
int
level
)
{
if
(!
_compute
)
return
;
if
(
level
==
Activity
.
TRIM_MEMORY_COMPLETE
){
_gmsh
.
onelabCB
(
"stop"
);
notifyEndComputing
(
"The comput
ing
had to stop because your device ran out of memory"
);
notifyEndComputing
(
"The comput
ation
had to stop because your device ran out of memory"
);
_notify
=
false
;
}
else
if
(
level
==
Activity
.
TRIM_MEMORY_MODERATE
)
{
notifyComputing
(
"Comput
ing
in progress - low memory"
,
true
);
notifyComputing
(
"Comput
ation
in progress - low memory"
,
true
);
}
super
.
onTrimMemory
(
level
);
}
private
void
notifyComputing
(
String
msg
,
boolean
alert
)
{
Intent
intent
=
new
Intent
(
this
,
MainActivity
.
class
);
intent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
|
Intent
.
FLAG_ACTIVITY_SINGLE_TOP
);
...
...
@@ -297,15 +297,15 @@ public class MainActivity extends Activity{
NotificationManager
mNotificationManager
=
(
NotificationManager
)
getSystemService
(
Context
.
NOTIFICATION_SERVICE
);
mNotificationManager
.
notify
(
1337
,
notifyBuilder
.
getNotification
());
}
private
void
notifyComputing
()
{
notifyComputing
(
"Comput
ing
in progress"
,
false
);
notifyComputing
(
"Comput
ation
in progress"
,
false
);
}
private
void
notifyEndComputing
()
{
notifyEndComputing
(
"
The computing is finished
"
);
notifyEndComputing
(
"
Computation done!
"
);
}
private
void
notifyEndComputing
(
String
msg
)
{
Intent
intent
=
new
Intent
(
this
,
MainActivity
.
class
);
intent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
|
Intent
.
FLAG_ACTIVITY_SINGLE_TOP
);
...
...
@@ -345,6 +345,6 @@ public class MainActivity extends Activity{
}
};
};
public
boolean
isComputing
()
{
return
_compute
;}
}
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