Skip to content
This repository was archived by the owner on Jun 24, 2024. It is now read-only.

Commit 08eb97a

Browse files
committed
updated tutorial examples
1 parent dfe81d8 commit 08eb97a

File tree

1,536 files changed

+183124
-4598
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,536 files changed

+183124
-4598
lines changed

android_studio/ex2_fragmentsv4/.idea/.name

Lines changed: 0 additions & 1 deletion
This file was deleted.

android_studio/ex2_fragmentsv4/.idea/compiler.xml

Lines changed: 0 additions & 22 deletions
This file was deleted.

android_studio/ex2_fragmentsv4/.idea/copyright/profiles_settings.xml

Lines changed: 0 additions & 3 deletions
This file was deleted.

android_studio/ex2_fragmentsv4/.idea/encodings.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

android_studio/ex2_fragmentsv4/.idea/gradle.xml

Lines changed: 0 additions & 24 deletions
This file was deleted.

android_studio/ex2_fragmentsv4/.idea/misc.xml

Lines changed: 0 additions & 62 deletions
This file was deleted.

android_studio/ex2_fragmentsv4/.idea/modules.xml

Lines changed: 0 additions & 9 deletions
This file was deleted.

android_studio/ex2_fragmentsv4/.idea/runConfigurations.xml

Lines changed: 0 additions & 12 deletions
This file was deleted.

android_studio/ex2_fragmentsv4/app/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
apply plugin: 'com.android.application'
22

33
android {
4-
compileSdkVersion 23
5-
buildToolsVersion "23.0.2"
4+
compileSdkVersion 25
5+
buildToolsVersion '25.0.2'
66

77
defaultConfig {
88
applicationId "tutorials.androidstudio.fragmentsv4"
@@ -20,8 +20,8 @@ android {
2020
}
2121

2222
dependencies {
23-
compile fileTree(dir: 'libs', include: ['*.jar'])
23+
compile fileTree(include: ['*.jar'], dir: 'libs')
2424
testCompile 'junit:junit:4.12'
2525
compile 'com.android.support:appcompat-v7:23.4.0'
26-
compile files('libs/android-core.jar')
26+
compile files('libs/processing-core.jar')
2727
}
Binary file not shown.
Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,36 @@
11
package tutorials.androidstudio.fragmentsv4;
22

3-
import processing.core.PApplet;
4-
import processing.android.PFragment;
5-
import android.app.FragmentManager;
6-
import android.support.v7.app.AppCompatActivity;
3+
74
import android.os.Bundle;
5+
import android.view.ViewGroup;
6+
import android.widget.FrameLayout;
7+
import android.support.v7.app.AppCompatActivity;
8+
9+
import processing.android.PFragment;
10+
import processing.android.ViewIdGenerator;
11+
import processing.core.PApplet;
812

913
public class MainActivity extends AppCompatActivity {
10-
@Override
11-
protected void onCreate(Bundle savedInstanceState) {
12-
super.onCreate(savedInstanceState);
13-
setContentView(R.layout.activity_main);
14-
FragmentManager fragmentManager = getFragmentManager();
15-
PApplet sketch = new Sketch();
16-
PFragment fragment = new PFragment();
17-
fragment.setSketch(sketch);
18-
fragmentManager.beginTransaction()
19-
.replace(R.id.container, fragment)
20-
.commit();
14+
private PApplet sketch;
15+
16+
@Override
17+
protected void onCreate(Bundle savedInstanceState) {
18+
super.onCreate(savedInstanceState);
19+
FrameLayout frame = new FrameLayout(this);
20+
frame.setId(ViewIdGenerator.getUniqueId());
21+
setContentView(frame, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
22+
ViewGroup.LayoutParams.MATCH_PARENT));
23+
24+
sketch = new Sketch();
25+
PFragment fragment = new PFragment(sketch);
26+
fragment.setView(frame, this);
27+
}
28+
29+
@Override
30+
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
31+
if (sketch != null) {
32+
sketch.onRequestPermissionsResult(
33+
requestCode, permissions, grantResults);
2134
}
35+
}
2236
}

android_studio/ex2_fragmentsv4/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55
jcenter()
66
}
77
dependencies {
8-
classpath 'com.android.tools.build:gradle:2.1.0'
8+
classpath 'com.android.tools.build:gradle:2.3.2'
99

1010
// NOTE: Do not place your application dependencies here; they belong
1111
// in the individual module build.gradle files
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Mon Dec 28 10:00:20 PST 2015
1+
#Sun Jun 04 17:06:49 EDT 2017
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip

android_studio/ex3_layoutsv4/.idea/compiler.xml

Lines changed: 0 additions & 22 deletions
This file was deleted.

android_studio/ex3_layoutsv4/.idea/copyright/profiles_settings.xml

Lines changed: 0 additions & 3 deletions
This file was deleted.

android_studio/ex3_layoutsv4/.idea/encodings.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

android_studio/ex3_layoutsv4/.idea/gradle.xml

Lines changed: 0 additions & 19 deletions
This file was deleted.

android_studio/ex3_layoutsv4/.idea/misc.xml

Lines changed: 0 additions & 35 deletions
This file was deleted.

android_studio/ex3_layoutsv4/.idea/modules.xml

Lines changed: 0 additions & 9 deletions
This file was deleted.

android_studio/ex3_layoutsv4/.idea/runConfigurations.xml

Lines changed: 0 additions & 12 deletions
This file was deleted.

android_studio/ex3_layoutsv4/app/build.gradle

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
apply plugin: 'com.android.application'
22

33
android {
4-
compileSdkVersion 23
5-
buildToolsVersion "24.0.1"
4+
compileSdkVersion 25
5+
buildToolsVersion '25.0.2'
66
defaultConfig {
77
applicationId "processing.test.processingintegration"
88
minSdkVersion 21
9-
targetSdkVersion 23
9+
targetSdkVersion 25
1010
versionCode 1
1111
versionName "1.0"
1212
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
@@ -24,8 +24,8 @@ dependencies {
2424
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
2525
exclude group: 'com.android.support', module: 'support-annotations'
2626
})
27-
compile 'com.android.support:appcompat-v7:23.4.0'
28-
compile 'com.android.support:design:23.4.0'
27+
compile 'com.android.support:appcompat-v7:25.2.0'
28+
compile 'com.android.support:design:25.2.0'
2929
testCompile 'junit:junit:4.12'
30-
compile files('libs/android-core.jar')
30+
compile files('libs/processing-core.jar')
3131
}
Binary file not shown.
Loading

0 commit comments

Comments
 (0)