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

Fix the black screen issue

parent 8995af56
No related branches found
No related tags found
No related merge requests found
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:orientation="horizontal" > android:orientation="horizontal" >
<ImageView <ImageView
android:id="@+id/icone" android:id="@+id/icon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:contentDescription="icone" android:contentDescription="icon"
android:src="@drawable/ic_launcher" /> android:src="@drawable/ic_launcher" />
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:orientation="vertical" > android:orientation="vertical" >
<TextView <TextView
android:id="@+id/titre" android:id="@+id/title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge" android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#ffffff" /> android:textColor="#ffffff"
android:textIsSelectable="false" />
<TextView <TextView
android:id="@+id/description" android:id="@+id/description"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium" android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#ffffff" /> android:textColor="#ffffff"
android:textIsSelectable="false" />
</LinearLayout> </LinearLayout>
......
...@@ -58,6 +58,7 @@ public class MainActivity extends Activity { ...@@ -58,6 +58,7 @@ public class MainActivity extends Activity {
private UndragableViewPager pager; private UndragableViewPager pager;
private List<Parameter> params = new ArrayList<Parameter>(); private List<Parameter> params = new ArrayList<Parameter>();
private SeparatedListView paramListView; private SeparatedListView paramListView;
private boolean compute = false;
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
...@@ -65,8 +66,7 @@ public class MainActivity extends Activity { ...@@ -65,8 +66,7 @@ public class MainActivity extends Activity {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN); WindowManager.LayoutParams.FLAG_FULLSCREEN);
//this.requestWindowFeature(Window.FEATURE_NO_TITLE);
LinearLayout layout = new LinearLayout(this); LinearLayout layout = new LinearLayout(this);
loading = new ProgressDialog(this); loading = new ProgressDialog(this);
layout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); layout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
...@@ -74,7 +74,7 @@ public class MainActivity extends Activity { ...@@ -74,7 +74,7 @@ public class MainActivity extends Activity {
pager = new UndragableViewPager(this); pager = new UndragableViewPager(this);
pager.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); pager.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
pager.setAdapter(new AdaptedPager()); pager.setAdapter(new AdaptedPager());
pager.setOffscreenPageLimit(3); pager.setOffscreenPageLimit(2);
pager.setCurrentItem(0); pager.setCurrentItem(0);
layout.addView(pager); layout.addView(pager);
dialogBuilder = new AlertDialog.Builder(this); dialogBuilder = new AlertDialog.Builder(this);
...@@ -85,11 +85,11 @@ public class MainActivity extends Activity { ...@@ -85,11 +85,11 @@ public class MainActivity extends Activity {
Bundle extras = getIntent().getExtras(); Bundle extras = getIntent().getExtras();
if(intent != null && intent.getAction() != null && intent.getAction().equals(Intent.ACTION_VIEW)) { if(intent != null && intent.getAction() != null && intent.getAction().equals(Intent.ACTION_VIEW)) {
String tmp = intent.getData().getPath(); String tmp = intent.getData().getPath();
pager.setCurrentItem(1); pager.setCurrentItem(1, true);
gmsh.load(tmp); gmsh.load(tmp);
} }
else if(extras != null) { else if(extras != null) {
pager.setCurrentItem(0); pager.setCurrentItem(0, true);
//extras.getInt("model"); //extras.getInt("model");
//extras.getString("name"); //extras.getString("name");
String tmp = extras.getString("file"); String tmp = extras.getString("file");
...@@ -201,7 +201,6 @@ public class MainActivity extends Activity { ...@@ -201,7 +201,6 @@ public class MainActivity extends Activity {
case 1: // OpenGL ES view case 1: // OpenGL ES view
renderer = new GLESRender(gmsh); renderer = new GLESRender(gmsh);
glView = new mGLSurfaceView(container.getContext(), renderer); glView = new mGLSurfaceView(container.getContext(), renderer);
//TODO the glView seems break the ViewPager (black square appear ...)
glView.setEGLContextClientVersion(1); glView.setEGLContextClientVersion(1);
glView.setRenderer(renderer); glView.setRenderer(renderer);
glView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY); glView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
...@@ -411,17 +410,17 @@ public class MainActivity extends Activity { ...@@ -411,17 +410,17 @@ public class MainActivity extends Activity {
reset = new Button(ctx); reset = new Button(ctx);
run.setText("Run"); run.setText("Run");
reset.setText("Reset"); reset.setText("Reset");
run.setOnClickListener(new OnClickListener() {public void onClick(View v) { run.setOnClickListener(new OnClickListener() {
if(run.getText().equals("Show progress")) public void onClick(View v) {
{ if(compute) {
loading.show(); loading.show();
return; }
else {
new Run().execute();
pager.setCurrentItem(1, true);
}
} }
else });
new Run().execute();
pager.setCurrentItem(1, true);
}});
reset.setOnClickListener(new OnClickListener() {public void onClick(View v) { reset.setOnClickListener(new OnClickListener() {public void onClick(View v) {
if(gmsh.onelabCB("reset") == 1){ if(gmsh.onelabCB("reset") == 1){
getAvailableParam(); getAvailableParam();
...@@ -469,6 +468,7 @@ public class MainActivity extends Activity { ...@@ -469,6 +468,7 @@ public class MainActivity extends Activity {
@Override @Override
protected void onPreExecute() { protected void onPreExecute() {
compute = true;
loading.setTitle("Please wait"); loading.setTitle("Please wait");
loading.setButton(DialogInterface.BUTTON_NEUTRAL, "Hide", new DialogInterface.OnClickListener() { loading.setButton(DialogInterface.BUTTON_NEUTRAL, "Hide", new DialogInterface.OnClickListener() {
...@@ -485,7 +485,7 @@ public class MainActivity extends Activity { ...@@ -485,7 +485,7 @@ public class MainActivity extends Activity {
}); });
loading.setMessage("..."); loading.setMessage("...");
loading.show(); loading.show();
run.setText("Show progress"); //run.setText("Show progress");
reset.setEnabled(false); reset.setEnabled(false);
super.onPreExecute(); super.onPreExecute();
} }
...@@ -498,14 +498,16 @@ public class MainActivity extends Activity { ...@@ -498,14 +498,16 @@ public class MainActivity extends Activity {
@Override @Override
protected void onPostExecute(Integer[] result) { protected void onPostExecute(Integer[] result) {
loading.dismiss();
run.setText("Run");
Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
v.vibrate(350); v.vibrate(350);
run.setEnabled(true);
reset.setEnabled(true); reset.setEnabled(true);
run.setEnabled(true);
//run.setText("Run"); // TODO this seems break the ViewPager
pager.postInvalidate();
glView.requestRender(); glView.requestRender();
super.onPostExecute(result); super.onPostExecute(result);
loading.dismiss();
compute = false;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment