Skip to content
Snippets Groups Projects
Commit 4bdb4917 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

fine-tuning

parent df874ef8
No related branches found
No related tags found
No related merge requests found
Showing
with 1597 additions and 1600 deletions
......@@ -15,7 +15,7 @@ public class AboutActivity extends Activity{
WebView webview = new WebView(this);
String aboutGmsh = Gmsh.getAboutGmsh();
String aboutGetDP = Gmsh.getAboutGetDP();
String aboutOnelab = "<center><h3>Onelab/Mobile</h3>";
String aboutOnelab = "<p>&npsp;</p><center><h3>Onelab/Mobile</h3>";
try {
aboutOnelab += "Version "+this.getPackageManager().getPackageInfo(this.getPackageName(), 0).versionName;
}
......@@ -24,7 +24,7 @@ public class AboutActivity extends Activity{
}
aboutOnelab += "<p>Copyright (C) 2014 Christophe Geuzaine and Maxime Graulich, University of Li&egrave;ge</p>";
aboutOnelab += "<p>Visit <a href=\"http://onelab.info/\">http://onelab.info/</a> for more information</p>";
aboutOnelab += "<p>This version of Onelab/Mobile contains:</p>";
aboutOnelab += "<p>&nbsp;</p><p>This version of Onelab/Mobile contains:</p>";
webview.loadDataWithBaseURL("", aboutOnelab + aboutGmsh + aboutGetDP, "text/html", "UTF-8", "");
setContentView(webview);
}
......
......@@ -15,49 +15,34 @@ public class GLESRender implements Renderer{
private Bitmap _screenshot;
private boolean _needScreenshot;
public GLESRender(Gmsh model) {
public GLESRender(Gmsh model)
{
this.mGModel = model;
_needScreenshot = false;
}
public void load(String filename){
mGModel.load(filename);
}
public void startInteraction(float x, float y) {
mGModel.startEvent(x, y);
}
public void endInteraction(float x, float y) {
mGModel.endEvent(x, y);
}
public void rotateModel(float x, float y) {
mGModel.rotate(x, y);
}
public void scaleModel(float s) {
mGModel.scale(s);
}
public void translateModel(float x, float y) {
mGModel.translate(x, y);
}
public void resetModelPosition() {
mGModel.resetPosition();
}
public void load(String filename){ mGModel.load(filename); }
public void startInteraction(float x, float y) { mGModel.startEvent(x, y); }
public void endInteraction(float x, float y) { mGModel.endEvent(x, y); }
public void rotateModel(float x, float y) { mGModel.rotate(x, y); }
public void scaleModel(float s) { mGModel.scale(s); }
public void translateModel(float x, float y) { mGModel.translate(x, y); }
public void resetModelPosition() { mGModel.resetPosition(); }
public void viewX() { mGModel.viewX();}
public void viewY() { mGModel.viewY();}
public void viewZ() { mGModel.viewZ();}
// OpenGL ES methods
public void onDrawFrame(GL10 gl) {
public void onDrawFrame(GL10 gl)
{
mGModel.viewDraw();
if(_needScreenshot) this.screenshot(gl);
}
public void onSurfaceChanged(GL10 gl, int width, int height) {
public void onSurfaceChanged(GL10 gl, int width, int height)
{
mGModel.viewInit(width, height);
_width = width;
_height = height;
}
public void onSurfaceCreated(GL10 gl, EGLConfig config) { }
public void needScreenshot() {_screenshot = null; _needScreenshot = true;}
public Bitmap getScreenshot(){return _screenshot;}
......
......@@ -43,24 +43,23 @@ public class Gmsh implements Parcelable {
/** Java CLASS **/
private long ptr;
private Handler handler;
public Gmsh(Handler handler, float fontFactor) {
public Gmsh(Handler handler, float fontFactor)
{
ptr = this.init(fontFactor);
this.handler = handler;
}
public void viewInit(int w, int h) {
public void viewInit(int w, int h)
{
this.initView(ptr, w, h);
}
public void viewDraw() {
public void viewDraw()
{
this.drawView(ptr);
}
public void load(String filename){
public void load(String filename)
{
this.loadFile(ptr, filename);
}
public void startEvent(float x, float y)
{
this.eventHandler(ptr, 0, x, y);
......@@ -96,29 +95,34 @@ public class Gmsh implements Parcelable {
if(handler != null)
handler.obtainMessage(1).sendToTarget();
}
public void SetLoading(String message) {
public void SetLoading(String message)
{
if(handler != null)
handler.obtainMessage(2, message).sendToTarget();
}
public void SetLoading(int percent) {
public void SetLoading(int percent)
{
if(handler != null)
handler.obtainMessage(3, percent, 100).sendToTarget();
}
// Parcelable methods/constructors
private Gmsh(Parcel in) {
private Gmsh(Parcel in)
{
this.ptr = in.readLong();
}
public int describeContents() {return 0;}
public void writeToParcel(Parcel out, int flags) {
public void writeToParcel(Parcel out, int flags)
{
out.writeLong(this.ptr);
}
public static Parcelable.Creator<Gmsh> CREATOR = new Parcelable.Creator<Gmsh>() {
public Gmsh createFromParcel(Parcel source) {
public static Parcelable.Creator<Gmsh> CREATOR = new Parcelable.Creator<Gmsh>()
{
public Gmsh createFromParcel(Parcel source)
{
return new Gmsh(source);
}
public Gmsh[] newArray(int size) {
public Gmsh[] newArray(int size)
{
return new Gmsh[size];
}
};
......
......@@ -41,8 +41,7 @@ public class MainActivity extends Activity{
private ArrayList<String> _errors = new ArrayList<String>();
private Dialog _errorDialog;
public MainActivity() {
}
public MainActivity() { }
@Override
protected void onCreate(Bundle savedInstanceState) {
......
......@@ -6,7 +6,6 @@ import android.net.Uri;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
class Model {
private String _name, _summary;
private File _file;
......
......@@ -39,7 +39,9 @@ public class ModelFragment extends Fragment{
private Handler _hideDelay;
private SeekBar _animationStepper;
final Runnable hideControlsRunnable = new Runnable() {public void run() {hideControlBar();}};
final Runnable hideControlsRunnable = new Runnable() {
public void run() {hideControlBar();}
};
public static ModelFragment newInstance(Gmsh g) {
ModelFragment fragment = new ModelFragment();
......@@ -99,7 +101,7 @@ public class ModelFragment extends Fragment{
RelativeLayout topRightLayout = new RelativeLayout(container.getContext());
ImageButton rotationButton = new ImageButton(container.getContext());
rotationButton.setBackgroundResource(R.drawable.icon_rotate);
rotationButton.setLayoutParams(new LinearLayout.LayoutParams(50, 50));
rotationButton.setLayoutParams(new LinearLayout.LayoutParams(65, 65));
rotationButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
boolean rotate = !_glView.getRotate();
......@@ -108,10 +110,9 @@ public class ModelFragment extends Fragment{
}
});
topRightLayout.addView(rotationButton);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.WRAP_CONTENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
layoutParams.setMargins(0, 100, 10, 0);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams
(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
layoutParams.setMargins(20, 140, 20, 0);
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
glViewLayout.addView(topRightLayout, layoutParams);
......@@ -127,8 +128,8 @@ public class ModelFragment extends Fragment{
_progressLayout.setAlpha(0);
_progressLayout.setGravity(Gravity.CENTER);
_progressLayout.addView(_progress);
layoutParams = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.WRAP_CONTENT,
layoutParams = new RelativeLayout.LayoutParams
(RelativeLayout.LayoutParams.WRAP_CONTENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
glViewLayout.addView(_progressLayout, layoutParams);
......
......@@ -46,7 +46,8 @@ public class ParameterNumber extends Parameter{
_readOnly = readOnly;
}
protected void update(){
protected void update()
{
super.update();
int nDecimal = String.valueOf(_min).length() - String.valueOf(_min).lastIndexOf('.') - 1; // hack for double round
if(_bar != null) {
......@@ -94,7 +95,8 @@ public class ParameterNumber extends Parameter{
public void setMin(double min) {_min = min;this.update();}
public void setMax(double max) {_max = max;this.update();}
public void setStep(double step) {_step = step;this.update();}
public void addChoice(double choice, String value) {
public void addChoice(double choice, String value)
{
if(_values == null) {
_values = new ArrayList<Double>();
_choices = new ArrayList<String>();
......@@ -107,8 +109,7 @@ public class ParameterNumber extends Parameter{
_spinner.setAdapter(_adapter);
}
}
else
{
else{
for(int i=0;i<_values.size();i++) {
if(_values.get(i).equals(choice) && _choices.size() > i) {
_choices.set(i, value);
......@@ -128,7 +129,8 @@ public class ParameterNumber extends Parameter{
public double getMax() {return _max;}
public double getMin() {return _min;}
public double getStep() {return _step;}
public int fromString(String s){
public int fromString(String s)
{
int pos = super.fromString(s);
if(pos <= 0) return -1; // error
String[] infos = s.split(Character.toString((char)0x03));
......@@ -153,8 +155,7 @@ public class ParameterNumber extends Parameter{
}
if(_choices != null)_choices.clear();
if(_values != null) _values.clear();
for(int i=0; i<nLabels && nChoix == nLabels; i++)
{
for(int i=0; i<nLabels && nChoix == nLabels; i++){
double val = Double.parseDouble(infos[pos++]); // choice
this.addChoice(val, infos[pos++]); // label
}
......@@ -169,7 +170,8 @@ public class ParameterNumber extends Parameter{
return pos;
}
public String getType(){return "ParameterNumber";}
public LinearLayout getView(){
public LinearLayout getView()
{
LinearLayout paramLayout = new LinearLayout(_context);
paramLayout.setOrientation(LinearLayout.VERTICAL);
paramLayout.addView(_title);
......@@ -257,7 +259,8 @@ public class ParameterNumber extends Parameter{
}
private OnParameterChangedListener mListener;
public void setOnParameterChangedListener(OnParameterChangedListener listener) { mListener = listener;}
public interface OnParameterChangedListener {
public interface OnParameterChangedListener
{
void OnParameterChanged();
}
}
......@@ -14,7 +14,7 @@ import android.os.Handler;
import android.os.Message;
public class SplashScreen extends Activity{
private static final int SPLASHTIME = 1000; // duration for the splash screen in milliseconds
private static final int SPLASHTIME = 500; // duration for the splash screen in milliseconds
private static final int STOPSPLASH = 0;
private static final int EXITAPP = 1;
......
......@@ -99,3 +99,9 @@ while read line; do
read line # HACK
target=$(($target+1))
done < <($android_sdk/tools/android list target | grep -A 5 "id:")
# to re-install on the device:
# $android_sdk/platform-tools/adb install -r $gmsh_svn/contrib/mobile/build_android/Onelab/bin/Onelab-release.apk
# to debug and check the log:
# $android_sdk/tools/ddms
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment