Skip to content

Commit fae1f8c

Browse files
authored
Merge pull request #632 from processing/androidx
Migration to AndroidX
2 parents 60212f2 + 4545829 commit fae1f8c

File tree

131 files changed

+875
-495
lines changed

Some content is hidden

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

131 files changed

+875
-495
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ mode/mode/wearable.jar
1010

1111
mode/libraries/vr/library
1212
mode/libraries/ar/library
13-
mode/tools/SDKUpdated/tool
13+
mode/tools/SDKUpdater/tool
14+
mode/tools/SDKUpdater/lib
1415

1516
debug/.gradle
1617
debug/.idea

build.gradle

+21-19
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ apply plugin: 'java'
99
buildscript {
1010
repositories {
1111
google()
12-
jcenter()
12+
jcenter()
1313
}
1414
dependencies {
15-
classpath 'com.android.tools.build:gradle:3.5.1'
16-
classpath group: 'commons-io', name: 'commons-io', version: '2.6'
17-
classpath group: 'org.zeroturnaround', name: 'zt-zip', version: '1.13'
15+
classpath 'com.android.tools.build:gradle:4.1.1'
16+
classpath group: 'commons-io', name: 'commons-io', version: '2.8.0'
17+
classpath group: 'org.zeroturnaround', name: 'zt-zip', version: '1.14'
1818
}
1919
}
2020

@@ -25,7 +25,8 @@ allprojects {
2525
Properties versions = new Properties()
2626
versions.load(project.rootProject.file("mode/version.properties").newDataInputStream())
2727
ext.targetSdkVersion = versions.getProperty("android-platform")
28-
ext.supportLibsVersion = versions.getProperty("com.android.support%support-v4")
28+
ext.appcompatVersion = versions.getProperty("androidx.appcompat%appcompat")
29+
ext.v4legacyVersion = versions.getProperty("androidx.legacy%legacy-support-v4")
2930
ext.wearVersion = versions.getProperty("com.google.android.support%wearable")
3031
ext.gvrVersion = versions.getProperty("com.google.vr")
3132
ext.garVersion = versions.getProperty("com.google.ar")
@@ -72,27 +73,26 @@ allprojects {
7273
localProperties.load(project.rootProject.file("local.properties").newDataInputStream())
7374
def sdkDir = localProperties.getProperty("sdk.dir")
7475
ext.androidPlatformPath = "${sdkDir}/platforms/android-${targetSdkVersion}"
75-
ext.androidToolsLibPath = "${sdkDir}/tools/lib"
76-
7776
ext.coreZipPath = "${rootDir}/mode/processing-core.zip"
7877

7978
repositories {
8079
google()
8180
jcenter()
82-
maven {
83-
// mavenCentral() does not work to download the Gradle releases of gradle-tooling-api, one needs
84-
// to set the artifact url as below to get the latest packages.
85-
// https://mvnrepository.com/artifact/org.gradle/gradle-tooling-api?repo=gradle-libs-releases-local
86-
url "https://repo1.maven.org/maven2"
87-
artifactUrls "https://repo.gradle.org/gradle/libs-releases-local"
88-
}
81+
maven { url "https://maven.google.com" }
82+
maven { url "https://jitpack.io" }
83+
maven { url 'https://repo.gradle.org/gradle/libs-releases' }
8984
flatDir dirs: androidPlatformPath
90-
flatDir dirs: androidToolsLibPath
9185
flatDir dirs: "${rootDir}/core/dist"
9286
}
9387

94-
sourceCompatibility = 1.8
95-
targetCompatibility = 1.8
88+
compileJava {
89+
sourceCompatibility = JavaVersion.VERSION_1_8
90+
targetCompatibility = JavaVersion.VERSION_1_8
91+
92+
// Uncomment this option when building with Java 11+
93+
// https://github.com/processing/processing-android/issues/625
94+
// options.release = 8
95+
}
9696
}
9797

9898
clean.doFirst {
@@ -128,9 +128,11 @@ task dist {
128128
FileUtils.copyDirectory(file("mode/languages"),
129129
file("${root}/languages"))
130130

131-
FileUtils.copyDirectory(file("mode/tools/SDKUpdater/tool"),
131+
FileUtils.copyDirectory(file("mode/tools/SDKUpdater/tool"),
132132
file("${root}/tools/SDKUpdater/tool"))
133-
FileUtils.copyDirectory(file("mode/tools/SDKUpdater/src"),
133+
FileUtils.copyDirectory(file("mode/tools/SDKUpdater/lib"),
134+
file("${root}/tools/SDKUpdater/lib"))
135+
FileUtils.copyDirectory(file("mode/tools/SDKUpdater/src"),
134136
file("${root}/tools/SDKUpdater/src"))
135137

136138
FileUtils.copyDirectory(file("mode/libraries/vr/examples"),

buildSrc/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ repositories {
88
dependencies {
99
implementation gradleApi()
1010
implementation localGroovy()
11-
implementation 'com.android.tools.build:gradle:3.5.1'
11+
implementation 'com.android.tools.build:gradle:4.1.1'
1212
}

core/build.gradle

+6-14
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import java.nio.file.Files
22
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING
33

4-
apply plugin: 'maven'
54
apply plugin: 'aar'
5+
apply plugin: 'maven'
66

77
dependencies {
88
implementation name: "android"
99

10-
implementationAar "com.android.support:support-v4:${supportLibsVersion}"
10+
implementationAar "androidx.legacy:legacy-support-v4:${v4legacyVersion}"
1111
implementationAar "com.google.android.support:wearable:${wearVersion}"
1212
}
1313

@@ -27,9 +27,9 @@ task createPom {
2727
}
2828
dependencies {
2929
dependency {
30-
groupId "com.android.support"
31-
artifactId "support-v4"
32-
version "${supportLibsVersion}"
30+
groupId "androidx.legacy"
31+
artifactId "legacy-support-v4"
32+
version "${v4legacyVersion}"
3333
scope "implementation"
3434
}
3535
dependency {
@@ -80,15 +80,7 @@ clean.doFirst {
8080
}
8181

8282
compileJava.doFirst {
83-
String[] deps = ["percent.jar",
84-
"recyclerview-v7.jar",
85-
"support-compat.jar",
86-
"support-core-ui.jar",
87-
"support-core-utils.jar",
88-
"support-fragment.jar",
89-
"support-media-compat.jar",
90-
"support-v4.jar",
91-
"wearable.jar"]
83+
String[] deps = ["wearable.jar"]
9284
for (String fn : deps) {
9385
Files.copy(file("${rootDir}/build/libs/" + fn).toPath(),
9486
file("${rootDir}/mode/mode/" + fn).toPath(), REPLACE_EXISTING)

core/src/processing/a2d/PGraphicsAndroid2D.java

+14-16
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/*
44
Part of the Processing project - http://processing.org
55
6-
Copyright (c) 2012-16 The Processing Foundation
6+
Copyright (c) 2012-21 The Processing Foundation
77
Copyright (c) 2005-12 Ben Fry and Casey Reas
88
99
This library is free software; you can redistribute it and/or
@@ -23,6 +23,19 @@
2323

2424
package processing.a2d;
2525

26+
import android.annotation.SuppressLint;
27+
import android.app.Activity;
28+
import android.app.ActivityManager;
29+
import android.app.ActivityManager.MemoryInfo;
30+
import android.content.Context;
31+
import android.graphics.*;
32+
import android.graphics.Bitmap.Config;
33+
import android.graphics.Paint.Style;
34+
import android.os.Build;
35+
import android.os.Environment;
36+
import android.view.SurfaceHolder;
37+
import static android.os.Environment.isExternalStorageRemovable;
38+
2639
import java.io.File;
2740
import java.io.FileInputStream;
2841
import java.io.FileOutputStream;
@@ -45,21 +58,6 @@
4558
import processing.core.PSurface;
4659
import processing.data.XML;
4760

48-
import android.annotation.SuppressLint;
49-
import android.app.Activity;
50-
import android.app.ActivityManager;
51-
import android.app.ActivityManager.MemoryInfo;
52-
import android.content.Context;
53-
import android.graphics.*;
54-
import android.graphics.Bitmap.Config;
55-
import android.graphics.Paint.Style;
56-
import android.os.Build;
57-
import android.os.Environment;
58-
import android.view.SurfaceHolder;
59-
60-
import static android.os.Environment.isExternalStorageRemovable;
61-
62-
6361
/**
6462
* Subclass for PGraphics that implements the graphics API using
6563
* the Android 2D graphics model. Similar tradeoffs to JAVA2D mode

core/src/processing/a2d/PShapeAndroid2D.java

+23
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,29 @@
1+
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2+
3+
/*
4+
Part of the Processing project - http://processing.org
5+
6+
Copyright (c) 2016-21 The Processing Foundation
7+
8+
This library is free software; you can redistribute it and/or
9+
modify it under the terms of the GNU Lesser General Public
10+
License version 2.1 as published by the Free Software Foundation.
11+
12+
This library is distributed in the hope that it will be useful,
13+
but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
Lesser General Public License for more details.
16+
17+
You should have received a copy of the GNU Lesser General
18+
Public License along with this library; if not, write to the
19+
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
20+
Boston, MA 02111-1307 USA
21+
*/
22+
123
package processing.a2d;
224

325
import android.graphics.Shader;
26+
427
import processing.core.PGraphics;
528
import processing.core.PShapeSVG;
629
import processing.data.XML;

core/src/processing/a2d/PSurfaceAndroid2D.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/*
44
Part of the Processing project - http://processing.org
55
6-
Copyright (c) 2016 The Processing Foundation
6+
Copyright (c) 2016-21 The Processing Foundation
77
88
This library is free software; you can redistribute it and/or
99
modify it under the terms of the GNU Lesser General Public
@@ -23,14 +23,14 @@
2323
package processing.a2d;
2424

2525
import android.content.Context;
26-
2726
import android.graphics.Color;
2827
import android.graphics.PixelFormat;
2928
import android.service.wallpaper.WallpaperService;
3029
import android.support.wearable.watchface.CanvasWatchFaceService;
3130
import android.view.MotionEvent;
3231
import android.view.SurfaceHolder;
3332
import android.view.SurfaceView;
33+
3434
import processing.android.AppComponent;
3535
import processing.android.PFragment;
3636
import processing.core.PApplet;

core/src/processing/android/ActivityAPI.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/*
44
Part of the Processing project - http://processing.org
55
6-
Copyright (c) 2016-17 The Processing Foundation
6+
Copyright (c) 2016-21 The Processing Foundation
77
88
This library is free software; you can redistribute it and/or
99
modify it under the terms of the GNU Lesser General Public

core/src/processing/android/AppComponent.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/*
44
Part of the Processing project - http://processing.org
55
6-
Copyright (c) 2016-17 The Processing Foundation
6+
Copyright (c) 2016-21 The Processing Foundation
77
88
This library is free software; you can redistribute it and/or
99
modify it under the terms of the GNU Lesser General Public
@@ -23,6 +23,7 @@
2323
package processing.android;
2424

2525
import android.content.Intent;
26+
2627
import processing.core.PApplet;
2728
import processing.core.PConstants;
2829

core/src/processing/android/CompatUtils.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/*
44
Part of the Processing project - http://processing.org
55
6-
Copyright (c) 2017 The Processing Foundation
6+
Copyright (c) 2017-21 The Processing Foundation
77
88
This library is free software; you can redistribute it and/or
99
modify it under the terms of the GNU Lesser General Public
@@ -22,16 +22,17 @@
2222

2323
package processing.android;
2424

25-
import java.nio.charset.Charset;
26-
import java.nio.charset.StandardCharsets;
27-
import java.util.concurrent.atomic.AtomicInteger;
2825
import android.annotation.SuppressLint;
2926
import android.os.Build;
3027
import android.util.DisplayMetrics;
3128
import android.view.Display;
3229
import android.view.View;
3330
import android.graphics.Point;
3431

32+
import java.nio.charset.Charset;
33+
import java.nio.charset.StandardCharsets;
34+
import java.util.concurrent.atomic.AtomicInteger;
35+
3536
/**
3637
* Compatibility utilities that work across versions of Android. Even though
3738
* the mode sets API level 17 (Android 4.2) as the minimum target, because the

core/src/processing/android/PFragment.java

+9-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/*
44
Part of the Processing project - http://processing.org
55
6-
Copyright (c) 2016-17 The Processing Foundation
6+
Copyright (c) 2016-21 The Processing Foundation
77
88
This library is free software; you can redistribute it and/or
99
modify it under the terms of the GNU Lesser General Public
@@ -22,12 +22,6 @@
2222

2323
package processing.android;
2424

25-
import android.support.annotation.IdRes;
26-
import android.support.annotation.LayoutRes;
27-
import android.support.v4.app.Fragment;
28-
import android.support.v4.app.FragmentActivity;
29-
import android.support.v4.app.FragmentManager;
30-
import android.support.v4.app.FragmentTransaction;
3125
import android.util.DisplayMetrics;
3226
import android.content.Intent;
3327
import android.content.pm.ActivityInfo;
@@ -44,6 +38,14 @@
4438
import android.view.ViewGroup;
4539
import android.view.WindowManager;
4640
import android.view.ContextMenu.ContextMenuInfo;
41+
42+
import androidx.annotation.IdRes;
43+
import androidx.annotation.LayoutRes;
44+
import androidx.fragment.app.Fragment;
45+
import androidx.fragment.app.FragmentActivity;
46+
import androidx.fragment.app.FragmentManager;
47+
import androidx.fragment.app.FragmentTransaction;
48+
4749
import processing.core.PApplet;
4850

4951
public class PFragment extends Fragment implements AppComponent {

core/src/processing/android/PWallpaper.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/*
44
Part of the Processing project - http://processing.org
55
6-
Copyright (c) 2016-17 The Processing Foundation
6+
Copyright (c) 2016-21 The Processing Foundation
77
88
This library is free software; you can redistribute it and/or
99
modify it under the terms of the GNU Lesser General Public
@@ -26,12 +26,12 @@
2626
import android.view.MotionEvent;
2727
import android.view.SurfaceHolder;
2828
import android.view.WindowManager;
29-
import processing.core.PApplet;
3029
import android.util.DisplayMetrics;
3130
import android.view.Display;
3231
import android.graphics.Point;
3332
import android.graphics.Rect;
3433

34+
import processing.core.PApplet;
3535

3636
public class PWallpaper extends WallpaperService implements AppComponent {
3737
private Point size;

core/src/processing/android/PWatchFaceCanvas.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/*
44
Part of the Processing project - http://processing.org
55
6-
Copyright (c) 2016-17 The Processing Foundation
6+
Copyright (c) 2016-21 The Processing Foundation
77
88
This library is free software; you can redistribute it and/or
99
modify it under the terms of the GNU Lesser General Public
@@ -38,6 +38,7 @@
3838
import android.view.SurfaceHolder;
3939
import android.view.WindowInsets;
4040
import android.view.WindowManager;
41+
4142
import processing.a2d.PGraphicsAndroid2D;
4243
import processing.core.PApplet;
4344

0 commit comments

Comments
 (0)