diff --git a/contrib/mobile/Android/res/layout/fragment_model.xml b/contrib/mobile/Android/res/layout/fragment_model.xml index 0b1475fcfd336d03bccf9a3f920dca16c0c7e5b6..b65fd9dcbb74f1b240a936234c450d179dfb1708 100644 --- a/contrib/mobile/Android/res/layout/fragment_model.xml +++ b/contrib/mobile/Android/res/layout/fragment_model.xml @@ -1,5 +1,5 @@ <?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" diff --git a/contrib/mobile/Android/src/org/geuz/onelab/MainActivity.java b/contrib/mobile/Android/src/org/geuz/onelab/MainActivity.java index 7b93f7e320ea62031a8cc5cf9989dc5f1f70df26..9c891dfab2a063ea9d28d8e6b405e7fd1872ef27 100644 --- a/contrib/mobile/Android/src/org/geuz/onelab/MainActivity.java +++ b/contrib/mobile/Android/src/org/geuz/onelab/MainActivity.java @@ -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); diff --git a/contrib/mobile/Android/src/org/geuz/onelab/ModelFragment.java b/contrib/mobile/Android/src/org/geuz/onelab/ModelFragment.java index 6a67d9615ad8ca9e0c9370bffda13bb869786bb5..686984fbf0b1bc2eddf702522684b4d6c58d3f0a 100644 --- a/contrib/mobile/Android/src/org/geuz/onelab/ModelFragment.java +++ b/contrib/mobile/Android/src/org/geuz/onelab/ModelFragment.java @@ -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(); } diff --git a/contrib/mobile/Android/src/org/geuz/onelab/OptionsDisplayFragment.java b/contrib/mobile/Android/src/org/geuz/onelab/OptionsDisplayFragment.java index c293ea0e0f10113780740eb79e31f13a46bf0a3f..5f5696b9a6da7e074bd7439ae048e2482b184c61 100644 --- a/contrib/mobile/Android/src/org/geuz/onelab/OptionsDisplayFragment.java +++ b/contrib/mobile/Android/src/org/geuz/onelab/OptionsDisplayFragment.java @@ -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);