Skip to content

Commit 6458792

Browse files
committed
include android support jar, better app exit
1 parent 20560a3 commit 6458792

File tree

4 files changed

+20
-6
lines changed

4 files changed

+20
-6
lines changed

core/.classpath

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
<classpath>
33
<classpathentry kind="src" path="src"/>
44
<classpathentry kind="var" path="ANDROID_LIB"/>
5+
<classpathentry kind="lib" path="library/android-support-v4.jar"/>
56
<classpathentry kind="output" path="bin"/>
67
</classpath>

core/build.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
target="1.7"
3434
encoding="UTF-8"
3535
includeAntRuntime="false"
36-
bootclasspath="${env.ANDROID_SDK}/platforms/android-17/android.jar"
36+
bootclasspath="${env.ANDROID_SDK}/platforms/android-17/android.jar;library/android-support-v4.jar"
3737
srcdir="src" destdir="bin" />
3838

3939
<!-- Copy the shaders to the bin folder.

core/library/android-support-v4.jar

1.36 MB
Binary file not shown.

core/src/processing/core/PApplet.java

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,15 @@
3636
import android.content.*;
3737
import android.content.pm.ActivityInfo;
3838
import android.content.pm.ConfigurationInfo;
39+
import android.content.pm.PackageManager;
3940
import android.content.res.AssetManager;
4041
import android.content.res.Configuration;
4142
import android.graphics.*;
4243
import android.net.Uri;
4344
import android.opengl.GLSurfaceView;
4445
import android.os.Bundle;
4546
import android.os.Handler;
47+
import android.support.v4.content.ContextCompat;
4648
//import android.text.format.Time;
4749
import android.util.*;
4850
import android.view.LayoutInflater;
@@ -761,16 +763,19 @@ public void resume() {
761763

762764
@Override
763765
public void onDestroy() {
764-
// stop();
766+
super.onDestroy();
765767
dispose();
768+
exit2();
766769
if (PApplet.DEBUG) {
767770
System.out.println("PApplet.onDestroy() called");
768771
}
769-
super.onDestroy();
770-
//finish();
771772
}
772773

773774

775+
public void onPermissionsGranted() {
776+
777+
}
778+
774779

775780
//////////////////////////////////////////////////////////////
776781

@@ -1181,6 +1186,11 @@ final public int sketchWindowColor() {
11811186
}
11821187

11831188

1189+
public boolean checkPermission(String permission) {
1190+
int check = ContextCompat.checkSelfPermission(activity, permission);
1191+
return check == PackageManager.PERMISSION_GRANTED;
1192+
}
1193+
11841194

11851195
public void orientation(int which) {
11861196
if (which == PORTRAIT) {
@@ -3337,7 +3347,10 @@ public void exit() {
33373347

33383348
void exit2() {
33393349
try {
3340-
System.exit(0);
3350+
if (activity != null) {
3351+
activity.finishAffinity();
3352+
}
3353+
// System.exit(0);
33413354
} catch (SecurityException e) {
33423355
// don't care about applet security exceptions
33433356
}
@@ -3366,7 +3379,7 @@ final public void dispose() {
33663379
// https://github.com/processing/processing-android/issues/213#issuecomment-217348480
33673380
surfaceView.getHolder().getSurface().release();
33683381
surfaceView = null;
3369-
activity = null;
3382+
// activity = null;
33703383
}
33713384

33723385
handleMethods("dispose");

0 commit comments

Comments
 (0)