Add command to invoke android's "Share picture" functionality

This commit is contained in:
Henrik Rydgard committed 2013-12-04 17:59:16 +01:00
1 parent 563e005101
commit 3c8374d304
3 files changed
+20 -5

No files matched your search

@@ -97,7 +97,7 @@ public class NativeActivity extends Activity {
// Graphics and audio interfaces
private NativeGLView mGLSurfaceView;
private NativeAudioPlayer audioPlayer;
private NativeRenderer nativeRenderer;
protected NativeRenderer nativeRenderer;
boolean useOpenSL = false;
@@ -665,6 +665,11 @@ public class NativeActivity extends Activity {
send.setData(uri);
startActivity(Intent.createChooser(send, "E-mail the app author!"));
return true;
} else if (command.equals("sharejpeg")) {
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("image/jpeg");
share.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + params));
startActivity(Intent.createChooser(share, "Share Picture"));
} else if (command.equals("launchMarket")) {
// Don't need this, can just use launchBrowser with a market:
// http://stackoverflow.com/questions/3442366/android-link-to-market-from-inside-another-app
@@ -23,7 +23,7 @@ public class NativeGLView extends GLSurfaceView implements SensorEventListener,
// Moga controller
private Controller mController = null;
boolean isMogaPro = false;
private boolean isMogaPro = false;
public NativeGLView(NativeActivity activity) {
super(activity);
@@ -207,6 +207,5 @@ public class NativeGLView extends GLSurfaceView implements SensorEventListener,
default:
break;
}
}
}
@@ -3,6 +3,7 @@ package com.henrikrydgard.libnative;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;
import android.opengl.GLES20;
import android.opengl.GLSurfaceView;
import android.util.Log;
@@ -10,13 +11,23 @@ import android.util.Log;
public class NativeRenderer implements GLSurfaceView.Renderer {
private static String TAG = "NativeRenderer";
NativeActivity mActivity;
private boolean isDark = false;
NativeRenderer(NativeActivity act) {
mActivity = act;
}
public void setDark(boolean d) {
isDark = d;
}
public void onDrawFrame(GL10 unused /*use GLES20*/) {
displayRender();
if (isDark) {
GLES20.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_STENCIL_BUFFER_BIT);
} else {
displayRender();
}
}
public void onSurfaceCreated(GL10 unused, EGLConfig config) {