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

Android: do not allow sharing if it's compute

parent bf548aab
No related branches found
No related tags found
No related merge requests found
......@@ -54,7 +54,7 @@ public class GLESRender implements Renderer{
public void onSurfaceChanged(GL10 gl, int width, int height) {
mGModel.viewInit(width, height);
_width = width + 5;
_width = width;
_height = height;
}
......
package org.geuz.onelab;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import android.app.ActionBar;
import android.app.Activity;
......@@ -121,21 +123,36 @@ public class MainActivity extends Activity{
_gmsh.onelabCB("stop");
}
else if(item.getTitle().equals("Share ...")) {
File file = new File(this.getExternalFilesDir(null), "onelab_screenshot.png");
file.setReadable(true, false);
_modelFragment.takeScreenshot(file);
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
shareIntent.setType("image/jpeg");
startActivity(Intent.createChooser(shareIntent, "Share screenshot with ..."));
if(this._compute) {
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
_errorDialog = dialogBuilder.setTitle("Can't show the models list")
.setMessage("The computing have to be finished before you can take a screenshot.")
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
})
.show();
}
else {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy_MM_dd-HH_mm_ss");
File file = new File(this.getExternalFilesDir(null), "onelab-screenshot-"+dateFormat.format(new Date())+".png");
file.setReadable(true, false);
_modelFragment.takeScreenshot(file);
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
shareIntent.setType("image/jpeg");
startActivity(Intent.createChooser(shareIntent, "Share screenshot with"));
}
}
else if(item.getItemId() == android.R.id.home)
{
if(this._compute) {
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
_errorDialog = dialogBuilder.setTitle("Can't show the models list")
.setMessage("The compute have to be finished before you can select an other model.")
.setMessage("The computing have to be finished before you can select an other model.")
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment