From 0605ce404e25ed507f9d8ff937ef6f18d214be56 Mon Sep 17 00:00:00 2001 From: Izhan Saqib Date: Sat, 21 Sep 2019 18:29:08 +0530 Subject: [PATCH] Migrated to AndroidX and moved to API 29 --- .idea/codeStyles/Project.xml | 116 ++++++++++++++++++ .idea/gradle.xml | 4 + app/build.gradle | 16 +-- .../ocrcamera/ExampleInstrumentedTest.java | 7 +- .../androidmads/ocrcamera/MainActivity.java | 8 +- app/src/main/res/layout/activity_main.xml | 4 +- build.gradle | 2 +- gradle.properties | 2 + gradle/wrapper/gradle-wrapper.properties | 2 +- 9 files changed, 141 insertions(+), 20 deletions(-) create mode 100644 .idea/codeStyles/Project.xml diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..681f41a --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,116 @@ + + + + + + + +
+ + + + xmlns:android + + ^$ + + + +
+
+ + + + xmlns:.* + + ^$ + + + BY_NAME + +
+
+ + + + .*:id + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + .*:name + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + name + + ^$ + + + +
+
+ + + + style + + ^$ + + + +
+
+ + + + .* + + ^$ + + + BY_NAME + +
+
+ + + + .* + + http://schemas.android.com/apk/res/android + + + ANDROID_ATTRIBUTE_ORDER + +
+
+ + + + .* + + .* + + + BY_NAME + +
+
+
+
+
+
\ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 7ac24c7..ee635a3 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -3,6 +3,9 @@ diff --git a/app/build.gradle b/app/build.gradle index 01b047a..5060364 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -4,14 +4,14 @@ android { configurations.all { resolutionStrategy.force 'com.android.support:support-annotations:26.1.0' } - compileSdkVersion 26 + compileSdkVersion 29 defaultConfig { applicationId "com.androidmads.ocrcamera" minSdkVersion 15 - targetSdkVersion 26 + targetSdkVersion 29 versionCode 1 versionName "1.0" - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { @@ -23,10 +23,10 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'com.android.support:appcompat-v7:26.1.0' - implementation 'com.android.support.constraint:constraint-layout:1.1.0' + implementation 'androidx.appcompat:appcompat:1.1.0' + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 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' - implementation 'com.google.android.gms:play-services-vision:15.0.2' + androidTestImplementation 'androidx.test:runner:1.2.0' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' + implementation 'com.google.android.gms:play-services-vision:18.0.0' } diff --git a/app/src/androidTest/java/com/androidmads/ocrcamera/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/androidmads/ocrcamera/ExampleInstrumentedTest.java index ffd82e7..5ae3481 100644 --- a/app/src/androidTest/java/com/androidmads/ocrcamera/ExampleInstrumentedTest.java +++ b/app/src/androidTest/java/com/androidmads/ocrcamera/ExampleInstrumentedTest.java @@ -1,8 +1,9 @@ package com.androidmads.ocrcamera; import android.content.Context; -import android.support.test.InstrumentationRegistry; -import android.support.test.runner.AndroidJUnit4; +import androidx.test.InstrumentationRegistry; +import androidx.test.runner.AndroidJUnit4; + import org.junit.Test; import org.junit.runner.RunWith; @@ -19,8 +20,8 @@ public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. - Context appContext = InstrumentationRegistry.getTargetContext(); + Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.androidmads.ocrcamera", appContext.getPackageName()); } } diff --git a/app/src/main/java/com/androidmads/ocrcamera/MainActivity.java b/app/src/main/java/com/androidmads/ocrcamera/MainActivity.java index 2ddcd00..75d2f38 100644 --- a/app/src/main/java/com/androidmads/ocrcamera/MainActivity.java +++ b/app/src/main/java/com/androidmads/ocrcamera/MainActivity.java @@ -3,9 +3,9 @@ import android.Manifest; import android.annotation.SuppressLint; import android.content.pm.PackageManager; -import android.support.annotation.NonNull; -import android.support.v4.app.ActivityCompat; -import android.support.v7.app.AppCompatActivity; +import androidx.annotation.NonNull; +import androidx.core.app.ActivityCompat; +import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.util.SparseArray; @@ -19,8 +19,6 @@ import com.google.android.gms.vision.text.TextBlock; import com.google.android.gms.vision.text.TextRecognizer; -import java.io.IOException; - public class MainActivity extends AppCompatActivity implements SurfaceHolder.Callback, Detector.Processor { private SurfaceView cameraView; diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 23ddabd..a5a9dd6 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -1,5 +1,5 @@ - - + diff --git a/build.gradle b/build.gradle index e6b32bc..f53f49f 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.0.1' + classpath 'com.android.tools.build:gradle:3.5.0' // NOTE: Do not place your application dependencies here; they belong diff --git a/gradle.properties b/gradle.properties index 869e8ce..40edf30 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,6 +9,8 @@ # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. +android.enableJetifier=true +android.useAndroidX=true org.gradle.jvmargs=-Xmx1024m # When configured, Gradle will run in incubating parallel mode. diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ba2ae20..f9f765b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip