From 77906dc45c48727f6422691ef92e857f38b34e3e Mon Sep 17 00:00:00 2001 From: "DESKTOP-NEC290S\\HSP" <1101121039@qq.com> Date: Mon, 28 Dec 2020 18:28:51 +0800 Subject: [PATCH] update to androidX --- .idea/caches/build_file_checksums.ser | Bin 537 -> 535 bytes .idea/checkstyle-idea.xml | 15 -- .idea/codeStyles/Project.xml | 184 +++++++++++++++--- .idea/codeStyles/codeStyleConfig.xml | 5 + .idea/dictionaries/reese.xml | 3 - .idea/encodings.xml | 6 - .idea/gradle.xml | 18 -- .idea/misc.xml | 37 ---- .idea/runConfigurations.xml | 12 -- .idea/vcs.xml | 6 - app/build.gradle | 51 +++-- .../reesehu/hcountdowntimer/MainActivity.kt | 6 +- .../reesehu/hcountdowntimer/PageActivity.java | 3 +- .../hcountdowntimer/view/FlipsView.java | 3 +- .../hcountdowntimer/view/NumberCDView.java | 3 +- app/src/main/res/layout/activity_main.xml | 12 +- build.gradle | 7 +- gradle.properties | 10 +- gradle/wrapper/gradle-wrapper.properties | 2 +- 19 files changed, 229 insertions(+), 154 deletions(-) delete mode 100644 .idea/checkstyle-idea.xml create mode 100644 .idea/codeStyles/codeStyleConfig.xml delete mode 100644 .idea/dictionaries/reese.xml delete mode 100644 .idea/encodings.xml delete mode 100644 .idea/gradle.xml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/runConfigurations.xml delete mode 100644 .idea/vcs.xml diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index f5d5bb97b3f317fbc4f03799008ace2e71945c09..d0978f3a74708666871dd5d9bf79f8cc36215a00 100644 GIT binary patch delta 231 zcmbQqGM#0@bk?#J54bl@oZ}xLkXTRZS?2_kE`DbpNfHl_d;n&Q>v@#i>QbF&@DIF;LwxlMgUTPhQI? z6wF_oT2hjkmtG7rw~(QZfemETyqgL8Z0@t?=_cq&g*zQySi-=A;sCfpS0|}OH;kss z?_Tij-unr5UnhGr$_gB;dEnHQof~oPN^ER(a6{7My^L~#6;B=X^Pxe*a2KSRAjYsb||)!l0oaTAW%`tY4IxTAZ3ust+|sf3h{B zE~6ljl(rMtT^4Zut>zDlRSpLWJ|*dwFbE_T6zF5O_Cv1a&z%yw2LvUgZ?u+$NL2s; D=fhS_ diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml deleted file mode 100644 index 62c5175..0000000 --- a/.idea/checkstyle-idea.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml index 30aa626..b38a501 100644 --- a/.idea/codeStyles/Project.xml +++ b/.idea/codeStyles/Project.xml @@ -1,29 +1,163 @@ - - - - - - - - - - + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..79ee123 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/dictionaries/reese.xml b/.idea/dictionaries/reese.xml deleted file mode 100644 index 5e39555..0000000 --- a/.idea/dictionaries/reese.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml deleted file mode 100644 index 97626ba..0000000 --- a/.idea/encodings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml deleted file mode 100644 index 7ac24c7..0000000 --- a/.idea/gradle.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 89f8839..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml deleted file mode 100644 index 7f68460..0000000 --- a/.idea/runConfigurations.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index d5b472a..f2fc1af 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,15 +1,16 @@ apply plugin: 'com.android.application' - apply plugin: 'kotlin-android' - apply plugin: 'kotlin-android-extensions' +apply plugin: 'kotlin-kapt' android { - compileSdkVersion 27 + compileSdkVersion 30 + buildToolsVersion "30.0.2" + defaultConfig { applicationId "com.reesehu.hcountdowntimer" - minSdkVersion 14 - targetSdkVersion 27 + minSdkVersion 21 + targetSdkVersion 30 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" @@ -20,15 +21,39 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } + lintOptions { + disable 'InvalidPackage' + disable "ResourceType" + abortOnError false + } + compileOptions { + targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = '1.8' + freeCompilerArgs += ["-Xopt-in=kotlin.RequiresOptIn"] + } } dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" - implementation 'com.android.support:appcompat-v7:27.1.1' - implementation 'com.android.support.constraint:constraint-layout:1.0.2' - implementation 'com.android.support:design:27.1.1' - testImplementation 'junit:junit:4.12' - androidTestImplementation 'com.android.support.test:runner:1.0.1' - androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' + implementation fileTree(dir: "libs", include: ["*.jar"]) + + implementation 'androidx.navigation:navigation-fragment-ktx:2.3.2' + implementation 'androidx.navigation:navigation-ui-ktx:2.3.2' + implementation 'androidx.navigation:navigation-fragment-ktx:2.3.2' + implementation 'androidx.navigation:navigation-ui-ktx:2.3.2' + implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' + implementation 'androidx.lifecycle:lifecycle-common-java8:2.2.0' + //noinspection LifecycleAnnotationProcessorWithJava8 + kapt 'androidx.lifecycle:lifecycle-compiler:2.2.0' + implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.2.0' + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation 'androidx.core:core-ktx:1.3.2' + implementation 'androidx.appcompat:appcompat:1.2.0' + implementation 'com.google.android.material:material:1.2.1' + implementation 'androidx.constraintlayout:constraintlayout:2.0.4' + testImplementation 'junit:junit:4.13.1' + androidTestImplementation 'androidx.test.ext:junit:1.1.2' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' } diff --git a/app/src/main/java/com/reesehu/hcountdowntimer/MainActivity.kt b/app/src/main/java/com/reesehu/hcountdowntimer/MainActivity.kt index 1e97097..1164c79 100644 --- a/app/src/main/java/com/reesehu/hcountdowntimer/MainActivity.kt +++ b/app/src/main/java/com/reesehu/hcountdowntimer/MainActivity.kt @@ -1,10 +1,10 @@ package com.reesehu.hcountdowntimer import android.os.Bundle -import android.support.design.widget.Snackbar -import android.support.v7.app.AppCompatActivity import android.view.Menu import android.view.MenuItem +import androidx.appcompat.app.AppCompatActivity +import com.google.android.material.snackbar.Snackbar import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.content_main.* @@ -24,7 +24,7 @@ class MainActivity : AppCompatActivity() { fab.setOnClickListener { view -> Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) - .setAction("Action", null).show() + .setAction("Action", null).show() } bit_flip.flip(0) // 设置默认为0 btn_test.setOnClickListener { diff --git a/app/src/main/java/com/reesehu/hcountdowntimer/PageActivity.java b/app/src/main/java/com/reesehu/hcountdowntimer/PageActivity.java index d31c7fc..19340ba 100644 --- a/app/src/main/java/com/reesehu/hcountdowntimer/PageActivity.java +++ b/app/src/main/java/com/reesehu/hcountdowntimer/PageActivity.java @@ -1,11 +1,12 @@ package com.reesehu.hcountdowntimer; import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.TextView; +import androidx.appcompat.app.AppCompatActivity; + import com.reesehu.hcountdowntimer.view.NumberCDView; public class PageActivity extends AppCompatActivity implements NumberCDView.OnCountDownStateListener { diff --git a/app/src/main/java/com/reesehu/hcountdowntimer/view/FlipsView.java b/app/src/main/java/com/reesehu/hcountdowntimer/view/FlipsView.java index ccf3efb..5a83e70 100644 --- a/app/src/main/java/com/reesehu/hcountdowntimer/view/FlipsView.java +++ b/app/src/main/java/com/reesehu/hcountdowntimer/view/FlipsView.java @@ -1,12 +1,13 @@ package com.reesehu.hcountdowntimer.view; import android.content.Context; -import android.support.annotation.Nullable; import android.util.AttributeSet; import android.util.Log; import android.view.LayoutInflater; import android.widget.LinearLayout; +import androidx.annotation.Nullable; + import com.reesehu.hcountdowntimer.R; /** diff --git a/app/src/main/java/com/reesehu/hcountdowntimer/view/NumberCDView.java b/app/src/main/java/com/reesehu/hcountdowntimer/view/NumberCDView.java index 517565a..1a8de22 100644 --- a/app/src/main/java/com/reesehu/hcountdowntimer/view/NumberCDView.java +++ b/app/src/main/java/com/reesehu/hcountdowntimer/view/NumberCDView.java @@ -1,11 +1,12 @@ package com.reesehu.hcountdowntimer.view; import android.content.Context; -import android.support.annotation.Nullable; import android.util.AttributeSet; import android.view.LayoutInflater; import android.widget.FrameLayout; +import androidx.annotation.Nullable; + import com.reesehu.hcountdowntimer.MyCountDownTimer; import com.reesehu.hcountdowntimer.R; diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index eed4d89..e9fa907 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -1,28 +1,28 @@ - - - - + - - \ No newline at end of file + \ No newline at end of file diff --git a/build.gradle b/build.gradle index 22447c9..fc34e1a 100644 --- a/build.gradle +++ b/build.gradle @@ -1,17 +1,14 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.2.30' + ext.kotlin_version = "1.4.10" repositories { google() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.1.0' + classpath 'com.android.tools.build:gradle:4.0.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files } } diff --git a/gradle.properties b/gradle.properties index 743d692..98bed16 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,8 +6,16 @@ # http://www.gradle.org/docs/current/userguide/build_environment.html # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. -org.gradle.jvmargs=-Xmx1536m +org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 # When configured, Gradle will run in incubating parallel mode. # 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 +# AndroidX package structure to make it clearer which packages are bundled with the +# Android operating system, and which are packaged with your app"s APK +# https://developer.android.com/topic/libraries/support-library/androidx-rn +android.useAndroidX=true +# Automatically convert third-party libraries to use AndroidX +android.enableJetifier=true +# Kotlin code style for this project: "official" or "obsolete": +kotlin.code.style=official \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index d026ed9..3c02e0b 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.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-all.zip