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

Android: show progress informations

parent a831aa9f
No related branches found
No related tags found
No related merge requests found
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
......
......@@ -69,6 +69,7 @@ public class MainActivity extends Activity implements OptionsDisplayFragment.OnO
getFragmentManager().beginTransaction().add(R.id.model_fragment, _modelFragment).commit();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
......@@ -164,7 +165,7 @@ public class MainActivity extends Activity implements OptionsDisplayFragment.OnO
protected void onPostExecute(Integer[] result) {
//(Vibrator) getSystemService(Context.VIBRATOR_SERVICE).vibrate(350);
_runStopMenuItem.setTitle(R.string.menu_run);
//loading.dismiss();
if(_modelFragment != null) _modelFragment.hideProgress();
_compute = false;
super.onPostExecute(result);
}
......@@ -208,8 +209,7 @@ public class MainActivity extends Activity implements OptionsDisplayFragment.OnO
if(_optionsFragment != null) _optionsFragment.refresh();
break;
case 2: // we get a message for loading
/*String loadingMessage =(String) msg.obj;
loading.setMessage(loadingMessage);*/
if(_modelFragment != null) _modelFragment.showProgress((String) msg.obj);
break;
case 3: // we get a progress for loading
//loading.setProgress(msg.arg1);
......
......@@ -7,11 +7,14 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
public class ModelFragment extends Fragment{
Gmsh _gmsh;
mGLSurfaceView _glView;
TextView _progress;
public static ModelFragment newInstance(Gmsh g) {
ModelFragment fragment = new ModelFragment();
......@@ -34,7 +37,7 @@ public class ModelFragment extends Fragment{
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_model, container, false);
LinearLayout glViewLayout = (LinearLayout)rootView.findViewById(R.id.glViewLayout);
RelativeLayout glViewLayout = (RelativeLayout)rootView.findViewById(R.id.glViewLayout);
GLESRender renderer = new GLESRender(_gmsh);
_glView = new mGLSurfaceView(glViewLayout.getContext(), renderer);
_glView.setEGLContextClientVersion(1);
......@@ -42,9 +45,25 @@ public class ModelFragment extends Fragment{
_glView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
_glView.requestRender();
glViewLayout.addView(_glView);
_progress = new TextView(container.getContext());
_progress.setAlpha(0);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.WRAP_CONTENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
_progress.setPadding(10, 0, 10, 10);
_progress.setLayoutParams(layoutParams);
glViewLayout.addView(_progress);
return rootView;
}
public void showProgress(String progress) {
_progress.setAlpha(1);
_progress.setText(progress);
}
public void hideProgress() {
_progress.setAlpha(0);
_progress.setText("");
}
public void requestRender() {
_glView.requestRender();
}
......
......@@ -6,6 +6,7 @@ import android.app.Activity;
import android.app.Fragment;
import android.content.Intent;
import android.graphics.Color;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
......@@ -110,7 +111,7 @@ public class OptionsDisplayFragment extends Fragment{
}
});
Button button = new Button(_listView.getContext());
button.setText("More options");
button.setText("More options >");
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent(getActivity(), PostProcessingActivity.class);
......@@ -121,6 +122,7 @@ public class OptionsDisplayFragment extends Fragment{
});
button.setLayoutParams(new AbsListView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
button.setBackgroundColor(Color.TRANSPARENT);
button.setGravity(Gravity.RIGHT);
layout.addView(checkbox);
layout.addView(button);
_listView.addItem("Result", layout);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment