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
c6246d05
Commit
c6246d05
authored
9 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
allow to remove models
parent
1f81238f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
contrib/mobile/Android/src/org/geuz/onelab/ModelArrayAdapter.java
+6
-0
6 additions, 0 deletions
...mobile/Android/src/org/geuz/onelab/ModelArrayAdapter.java
contrib/mobile/Android/src/org/geuz/onelab/ModelList.java
+30
-9
30 additions, 9 deletions
contrib/mobile/Android/src/org/geuz/onelab/ModelList.java
with
36 additions
and
9 deletions
contrib/mobile/Android/src/org/geuz/onelab/ModelArrayAdapter.java
+
6
−
0
View file @
c6246d05
...
...
@@ -28,6 +28,12 @@ public class ModelArrayAdapter extends ArrayAdapter<Model> {
_models
.
add
(
model
);
}
public
void
reset
()
{
super
.
clear
();
_models
.
clear
();
}
public
void
sortByName
()
{
Collections
.
sort
(
_models
,
new
ModelComp
());
...
...
This diff is collapsed.
Click to expand it.
contrib/mobile/Android/src/org/geuz/onelab/ModelList.java
+
30
−
9
View file @
c6246d05
...
...
@@ -32,6 +32,15 @@ public class ModelList extends Activity {
private
ModelArrayAdapter
_modelArrayAdapter
;
private
void
deleteRecursive
(
File
fileOrDirectory
)
{
if
(
fileOrDirectory
.
isDirectory
()){
for
(
File
child
:
fileOrDirectory
.
listFiles
())
deleteRecursive
(
child
);
}
fileOrDirectory
.
delete
();
}
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
...
...
@@ -66,30 +75,42 @@ public class ModelList extends Activity {
final
Model
m
=
_modelArrayAdapter
.
getModel
(
position
);
CharSequence
[]
actions
;
if
(
m
.
getUrl
()
!=
null
)
{
actions
=
new
CharSequence
[
2
];
actions
=
new
CharSequence
[
3
];
actions
[
0
]
=
"Open model"
;
actions
[
1
]
=
"
View model website
"
;
// FIXME: add "Remove model" as in iOS
actions
[
1
]
=
"
Remove model
"
;
actions
[
2
]
=
"View model website"
;
}
else
{
actions
=
new
CharSequence
[
1
];
actions
=
new
CharSequence
[
2
];
actions
[
0
]
=
"Open model"
;
actions
[
1
]
=
"Remove model"
;
}
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
parent
.
getContext
());
builder
.
setTitle
(
m
.
getName
());
builder
.
setItems
(
actions
,
new
DialogInterface
.
OnClickListener
()
{
public
void
onClick
(
DialogInterface
dialog
,
int
position
)
{
switch
(
position
)
{
case
1
:
Intent
browserIntent
=
new
Intent
(
Intent
.
ACTION_VIEW
,
m
.
getUrl
());
startActivity
(
browserIntent
);
break
;
default
:
case
0
:
Intent
intent
=
new
Intent
(
ModelList
.
this
,
MainActivity
.
class
);
intent
.
putExtra
(
"file"
,
m
.
getFile
().
toString
());
intent
.
putExtra
(
"name"
,
m
.
getName
());
startActivity
(
intent
);
break
;
case
1
:
deleteRecursive
(
m
.
getFile
().
getParentFile
());
_modelArrayAdapter
.
reset
();
try
{
getModels
();
}
catch
(
XmlPullParserException
e
)
{
e
.
printStackTrace
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
break
;
case
2
:
Intent
browserIntent
=
new
Intent
(
Intent
.
ACTION_VIEW
,
m
.
getUrl
());
startActivity
(
browserIntent
);
break
;
}
}
});
...
...
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