Skip to content
Snippets Groups Projects
Commit c43b0302 authored by Maxime Graulich's avatar Maxime Graulich
Browse files

Show all errors (Android)

parent 6212508a
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,7 @@ import android.os.Handler;
import android.os.Vibrator;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
......@@ -53,6 +54,8 @@ public class MainActivity extends Activity {
private GLESRender renderer;
private ProgressDialog loading;
private AlertDialog.Builder dialogBuilder;
private ArrayList<String> errors;
private Dialog errorDialog;
private Gmsh gmsh;
private Button run, reset;
private UndragableViewPager pager;
......@@ -66,7 +69,7 @@ public class MainActivity extends Activity {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
errors = new ArrayList<String>();
LinearLayout layout = new LinearLayout(this);
loading = new ProgressDialog(this);
layout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
......@@ -522,21 +525,36 @@ public class MainActivity extends Activity {
}
private final Handler mainHandler = new Handler(){
public void handleMessage(android.os.Message msg) {
switch (msg.what) {
case 0: // we get a message from gmsh library
String message =(String) msg.obj;
dialogBuilder
.setTitle("Erreur Gmsh/GetDP")
.setMessage(message)
private void showError(){
if(errors.size()>0){
if(errorDialog != null && errorDialog.isShowing()) errorDialog.dismiss();
errorDialog = dialogBuilder
.setTitle("Gmsh/GetDP Error(s)")
.setMessage(errors.get(errors.size()-1))
.setNegativeButton("Stop", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
errors.clear();
errorDialog.dismiss();
}
})
.setPositiveButton("Continue", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
errors.remove(errors.size()-1);
errorDialog.dismiss();
showError();
}
})
.show();
}
}
private final Handler mainHandler = new Handler(){
public void handleMessage(android.os.Message msg) {
switch (msg.what) {
case 0: // we get a message from gmsh library
//get(size() - 1)
String message =(String) msg.obj;
errors.add(message);
showError();
break;
case 1: // request render from gmsh library
if(glView != null)
......
......@@ -33,9 +33,7 @@ class MobileMessage : public GmshMessage
{
if(level == "Error")
{
LOGE("%s", message.c_str());
if(message.size() <= 26 || message.substr(message.size()-25,25) != "check the log for details")
return;
LOGE("Error:\t%s", message.c_str());
JNIEnv *env;
if(gJavaVM->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6) != JNI_OK || !gCallbackObject || (gJavaVM->AttachCurrentThread(&env, NULL)) < 0) return;
jstring jstr = env->NewStringUTF(message.c_str());
......
......@@ -457,10 +457,14 @@ void drawContext::drawScale()
void drawContext::drawMesh()
{
GModel::current()->fillVertexArrays();
glColor4f(0,0,0,1.);
unsigned int col = CTX::instance()->color.mesh.line;
glColor4ub((GLubyte)CTX::instance()->unpackRed(col),
(GLubyte)CTX::instance()->unpackGreen(col),
(GLubyte)CTX::instance()->unpackBlue(col),
(GLubyte)CTX::instance()->unpackAlpha(col));
for(GModel::fiter it = GModel::current()->firstFace(); it != GModel::current()->lastFace(); it++){
if(_fillMesh) drawArray((*it)->va_triangles, GL_TRIANGLES);
else drawArray((*it)->va_lines, GL_LINES);
else drawArray((*it)->va_lines, GL_LINES, true);
}
CTX::instance()->mesh.changed = 0;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment