Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(android): Enable AndroidX and use AndroidX dependencies #2045

Merged
merged 32 commits into from
Feb 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
ed51e93
Add AndroidX support
priyankpat Oct 13, 2019
0c04e93
Add gradle cli arguments for Androidx Support
priyankpat Oct 13, 2019
b23ed1a
Merge branch 'master' of https://github.com/ionic-team/capacitor
priyankpat Oct 18, 2019
337e51c
Merge remote-tracking branch 'upstream/master'
priyankpat Oct 23, 2019
76d4a15
Merge branch 'master' into develop
priyankpat Oct 23, 2019
4aff4e4
Merge remote-tracking branch 'upstream/master'
priyankpat Oct 25, 2019
a255da9
Merge branch 'master' into develop
priyankpat Oct 25, 2019
e6e45a1
Replace test instrumentation/dependency for androidx support
priyankpat Oct 25, 2019
63d9ac3
Add androidx support for example
priyankpat Oct 25, 2019
b5b523e
Merge branch 'master' of https://github.com/ionic-team/capacitor into…
priyankpat Nov 11, 2019
646e8d4
Merge branch 'master' of https://github.com/ionic-team/capacitor
priyankpat Nov 11, 2019
f5c43ad
Merge branch 'develop' of https://github.com/PR1YANKPAT3L/capacitor i…
priyankpat Nov 11, 2019
9b66583
Merge branch 'master' into develop
priyankpat Nov 11, 2019
79ad0e2
Bump gradle wrapper, build tool, gms google service
priyankpat Nov 11, 2019
ffe7a5e
Revert "Bump gradle wrapper, build tool, gms google service"
priyankpat Nov 11, 2019
3b4f017
Merge branch 'master' of https://github.com/ionic-team/capacitor
priyankpat Nov 14, 2019
9ca5521
Merge branch 'master' into develop
priyankpat Nov 14, 2019
b846745
Merge branch 'master' of https://github.com/ionic-team/capacitor
Nov 24, 2019
37abae7
Merge branch 'master' into develop
Nov 24, 2019
a073c0b
Merge branch 'master' of https://github.com/ionic-team/capacitor
priyankpat Nov 28, 2019
35089b6
Merge branch 'master' into develop
priyankpat Nov 28, 2019
f29c41c
Merge branch 'master' of https://github.com/ionic-team/capacitor
Dec 3, 2019
597bf7c
Merge branch 'master' of https://github.com/PR1YANKPAT3L/capacitor
Dec 3, 2019
c15d4e2
Merge branch 'master' into develop
Dec 3, 2019
76c0447
Merge branch 'develop' of https://github.com/PR1YANKPAT3L/capacitor i…
Dec 3, 2019
763c9aa
Merge branch 'master' of https://github.com/ionic-team/capacitor
priyankpat Dec 17, 2019
bdf800b
Merge branch 'master' into develop
priyankpat Dec 17, 2019
95487ee
Merge branch 'master' of https://github.com/ionic-team/capacitor
priyankpat Jan 20, 2020
cc56ed5
Merge branch 'master' into develop
priyankpat Jan 20, 2020
bd22ee5
Fix androidx FileProvider import
priyankpat Feb 13, 2020
f039aa1
Replace androidx artifact mappings
priyankpat Feb 13, 2020
2339f9b
Merge branch 'master' into develop
priyankpat Feb 13, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
steps:
- checkout
- run:
command: ./gradlew clean build -b capacitor/build.gradle
command: ./gradlew clean build -b capacitor/build.gradle -Pandroid.useAndroidX=true -Pandroid.enableJetifier=true
working_directory: /tmp/workspace/android

workflows:
Expand Down
8 changes: 4 additions & 4 deletions android-template/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ android {
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
Expand All @@ -29,11 +29,11 @@ repositories {

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation project(':capacitor-android')
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
implementation project(':capacitor-cordova-android-plugins')
}

Expand Down
2 changes: 1 addition & 1 deletion android-template/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</activity>

<provider
android:name="android.support.v4.content.FileProvider"
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
Expand Down
4 changes: 2 additions & 2 deletions android-template/app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
Expand All @@ -9,4 +9,4 @@
<WebView
android:layout_width="match_parent"
android:layout_height="match_parent" />
</android.support.design.widget.CoordinatorLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
4 changes: 4 additions & 0 deletions android-template/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ org.gradle.jvmargs=-Xmx1536m
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

# Supports AndroidX
android.useAndroidX=true
android.enableJetifier=true
14 changes: 7 additions & 7 deletions android/capacitor/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ android {
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
Expand All @@ -42,15 +42,15 @@ repositories {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-compat:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:customtabs:28.0.0'
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.core:core:1.2.0'
implementation 'com.google.android.material:material:1.1.0-rc02'
implementation 'androidx.browser:browser:1.2.0'
implementation 'com.google.firebase:firebase-messaging:18.0.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
implementation 'org.apache.cordova:framework:7.0.0'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.webkit.WebView;

import androidx.appcompat.app.AppCompatActivity;

import com.getcapacitor.android.R;
import com.getcapacitor.cordova.MockCordovaInterfaceImpl;
import com.getcapacitor.cordova.MockCordovaWebViewImpl;
Expand Down
4 changes: 2 additions & 2 deletions android/capacitor/src/main/java/com/getcapacitor/Dialogs.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
import android.content.DialogInterface;
import android.os.Handler;
import android.os.Looper;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AppCompatActivity;
import android.widget.EditText;

import androidx.appcompat.app.AppCompatActivity;

import com.getcapacitor.ui.ModalsBottomSheetDialogFragment;

import org.json.JSONException;
Expand Down
6 changes: 4 additions & 2 deletions android/capacitor/src/main/java/com/getcapacitor/Plugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;

import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;

import org.json.JSONException;
import org.json.JSONObject;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.support.customtabs.CustomTabsCallback;
import android.support.customtabs.CustomTabsClient;
import android.support.customtabs.CustomTabsIntent;
import android.support.customtabs.CustomTabsServiceConnection;
import android.support.customtabs.CustomTabsSession;
import android.util.Log;

import androidx.browser.customtabs.CustomTabsCallback;
import androidx.browser.customtabs.CustomTabsClient;
import androidx.browser.customtabs.CustomTabsIntent;
import androidx.browser.customtabs.CustomTabsServiceConnection;
import androidx.browser.customtabs.CustomTabsSession;

import com.getcapacitor.JSArray;
import com.getcapacitor.JSObject;
import com.getcapacitor.NativePlugin;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.support.v4.content.FileProvider;
import android.util.Base64;
import android.util.Log;

import androidx.core.content.FileProvider;

import com.getcapacitor.Dialogs;
import com.getcapacitor.FileUtils;
import com.getcapacitor.JSObject;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,7 @@
package com.getcapacitor.plugin;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Dialog;
import android.graphics.Color;
import android.support.annotation.NonNull;
import android.support.design.widget.BottomSheetBehavior;
import android.support.design.widget.BottomSheetDialogFragment;
import android.support.design.widget.CoordinatorLayout;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.getcapacitor.Bridge;

import com.getcapacitor.Dialogs;
import com.getcapacitor.JSArray;
import com.getcapacitor.JSObject;
Expand All @@ -24,11 +11,6 @@
import com.getcapacitor.PluginMethod;
import com.getcapacitor.ui.ModalsBottomSheetDialogFragment;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.List;

/**
* Common popup modals
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

import android.Manifest;
import android.content.pm.PackageManager;
import android.support.v4.app.NotificationManagerCompat;
import android.support.v4.content.ContextCompat;

import androidx.core.app.NotificationManagerCompat;
import androidx.core.content.ContextCompat;

import com.getcapacitor.JSObject;
import com.getcapacitor.NativePlugin;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
import android.os.Build;
import android.os.Bundle;
import android.service.notification.StatusBarNotification;
import android.support.v4.app.NotificationCompat;
import androidx.core.app.NotificationCompat;
import android.net.Uri;


import android.util.Log;

import com.getcapacitor.Bridge;
import com.getcapacitor.JSArray;
import com.getcapacitor.JSObject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

import android.content.Intent;
import android.net.Uri;
import android.support.v4.content.FileProvider;
import android.webkit.MimeTypeMap;

import androidx.core.content.FileProvider;

import com.getcapacitor.NativePlugin;
import com.getcapacitor.Plugin;
import com.getcapacitor.PluginCall;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.support.v4.content.LocalBroadcastManager;
import android.util.Log;

import androidx.localbroadcastmanager.content.LocalBroadcastManager;

import com.getcapacitor.Bridge;
import com.getcapacitor.JSObject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import android.app.IntentService;
import android.content.Intent;
import android.support.v4.content.LocalBroadcastManager;
import android.util.Log;

import androidx.localbroadcastmanager.content.LocalBroadcastManager;

import com.getcapacitor.LogUtils;

public class BackgroundTaskService extends IntentService {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
import android.app.Activity;
import android.net.Uri;
import android.os.Environment;
import android.support.v4.content.FileProvider;
import android.util.Log;

import androidx.core.content.FileProvider;

import com.getcapacitor.LogUtils;

import java.io.File;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.NotificationCompat;
import android.support.v4.app.NotificationManagerCompat;
import android.support.v4.app.RemoteInput;
import android.util.Log;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
import androidx.core.app.RemoteInput;

import com.getcapacitor.JSObject;
import com.getcapacitor.LogUtils;
import com.getcapacitor.PluginCall;
Expand All @@ -27,6 +29,8 @@
import java.util.Date;
import java.util.List;

import static androidx.core.app.NotificationCompat.VISIBILITY_PRIVATE;

/**
* Contains implementations for all notification actions
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.StrictMode;
import android.support.v4.content.FileProvider;
import android.util.Log;

import androidx.core.content.FileProvider;

import com.getcapacitor.LogUtils;

import java.io.File;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,21 @@
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.graphics.Color;
import android.support.annotation.NonNull;
import android.support.design.widget.BottomSheetBehavior;
import android.support.design.widget.BottomSheetDialogFragment;
import android.support.design.widget.CoordinatorLayout;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.coordinatorlayout.widget.CoordinatorLayout;

import com.getcapacitor.JSArray;
import com.getcapacitor.JSObject;
import com.getcapacitor.LogUtils;
import com.google.android.material.bottomsheet.BottomSheetBehavior;
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;

import org.json.JSONException;
import org.json.JSONObject;

Expand Down
4 changes: 2 additions & 2 deletions android/capacitor/src/main/res/layout/bridge_layout_main.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
Expand All @@ -12,4 +12,4 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent" />

</android.support.design.widget.CoordinatorLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
4 changes: 4 additions & 0 deletions android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ org.gradle.jvmargs=-Xmx1536m
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

# Supports AndroidX
android.useAndroidX=true
android.enableJetifier=true
4 changes: 2 additions & 2 deletions example/android/app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.getcapacitor.myapp.MainActivity"
>

</android.support.design.widget.CoordinatorLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
4 changes: 4 additions & 0 deletions example/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ org.gradle.jvmargs=-Xmx1536m
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

# Supports AndroidX
android.useAndroidX=true
android.enableJetifier=true
4 changes: 4 additions & 0 deletions plugin-template/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ org.gradle.jvmargs=-Xmx1536m
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

# Supports AndroidX
android.useAndroidX=true
android.enableJetifier=true
Loading