diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..8defbf9 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,30 @@ +version: 2 +jobs: + build: + working_directory: ~/code + docker: + - image: circleci/android:api-29 + environment: + JVM_OPTS: -Xmx3200m + steps: + - checkout + - restore_cache: + key: jars-{{ checksum "build.gradle" }}-{{ checksum "library/build.gradle" }} + - run: + name: Download Dependencies + command: ./gradlew androidDependencies + - save_cache: + paths: + - ~/.gradle + key: jars-{{ checksum "build.gradle" }}-{{ checksum "library/build.gradle" }} + - run: + name: Run Tests + command: ./gradlew check + - store_artifacts: + path: library/build/reports + destination: reports + - store_artifacts: + path: library/build/outputs + destination: reports + - store_test_results: + path: library/build/test-results \ No newline at end of file diff --git a/build.gradle b/build.gradle index 148e628..e11af28 100644 --- a/build.gradle +++ b/build.gradle @@ -3,10 +3,15 @@ buildscript { repositories { jcenter() + google() + maven { + url 'https://plugins.gradle.org/m2/' + } } dependencies { - classpath 'com.android.tools.build:gradle:2.1.0' - classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' + classpath 'com.android.tools.build:gradle:4.1.1' + classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1' + classpath 'gradle.plugin.com.github.spotbugs:spotbugs-gradle-plugin:1.6.6' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } @@ -15,6 +20,7 @@ buildscript { allprojects { repositories { jcenter() + google() } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index c25cec5..be62bc6 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed Oct 21 11:34:03 PDT 2015 +#Mon Dec 14 10:25:24 CST 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip diff --git a/library/build.gradle b/library/build.gradle index 36c7008..8fdfb4d 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -5,12 +5,11 @@ apply from: "quality.gradle" group = 'com.github.eggheadgames' android { - compileSdkVersion 25 - buildToolsVersion "25.0.1" + compileSdkVersion 26 defaultConfig { minSdkVersion 15 - targetSdkVersion 25 + targetSdkVersion 26 versionCode 13 versionName "1.5.2" } @@ -29,11 +28,11 @@ android { } dependencies { - testCompile 'junit:junit:4.12' - testCompile 'org.mockito:mockito-core:1.10.19' - testCompile 'org.json:json:20160212' + testImplementation 'junit:junit:4.12' + testImplementation 'org.mockito:mockito-core:1.10.19' + testImplementation 'org.json:json:20160212' - compile fileTree(dir: 'libs', include: ['*.jar']) + implementation fileTree(dir: 'libs', include: ['*.jar']) //noinspection GradleDependency - compile 'com.android.support:appcompat-v7:25.0.0' + implementation 'com.android.support:appcompat-v7:26.1.0' } diff --git a/library/quality.gradle b/library/quality.gradle index 49e1373..353c8fa 100644 --- a/library/quality.gradle +++ b/library/quality.gradle @@ -1,37 +1,39 @@ -apply plugin: 'findbugs' +// apply plugin: 'spotbugs' apply plugin: 'pmd' -findbugs { - ignoreFailures = false - reportsDir = file("$project.buildDir/outputs/") - reportLevel = "medium" - effort = "max" -} +//spotbugs { +// toolVersion = '4.2.0' +// showProgress = true +// ignoreFailures = false +// reportsDir = file("$project.buildDir/outputs/") +// reportLevel = "medium" +// effort = "max" +//} pmd { ignoreFailures = false reportsDir = file("$project.buildDir/outputs/") } -task findbugs(type: FindBugs, dependsOn: assembleDebug) { - description 'Run findbugs' - group 'verification' - - classes = fileTree("$project.buildDir/intermediates/classes/debug") - source = fileTree('src/main/java') - classpath = files() - - effort = 'max' - - excludeFilter = file("$project.projectDir/findbugs_exclude.xml") - - reports { - xml.enabled = false - html.enabled = true - } -} - -task pmd(type: Pmd, dependsOn: assembleDebug) { +//task spotbugs(type: SpotBugsTask, dependsOn: "assembleDebug") { +// description 'Run spotbugs' +// group 'verification' +// +// classes = fileTree("$project.buildDir/intermediates/classes/debug") +// source = fileTree('src/main/java') +// classpath = files() +// +// effort = 'max' +// +// excludeFilter = file("$project.projectDir/spotbugs_exclude.xml") +// +// reports { +// xml.enabled = false +// html.enabled = true +// } +//} + +task pmd(type: Pmd, dependsOn: "assembleDebug") { description 'Run pmd' group 'verification' @@ -45,6 +47,6 @@ task pmd(type: Pmd, dependsOn: assembleDebug) { } check.doLast { - project.tasks.getByName("findbugs").execute() + // project.tasks.getByName("spotbugs").execute() project.tasks.getByName("pmd").execute() -} +} \ No newline at end of file diff --git a/library/findbugs_exclude.xml b/library/spotbugs_exclude.xml similarity index 76% rename from library/findbugs_exclude.xml rename to library/spotbugs_exclude.xml index f13278c..21288d7 100644 --- a/library/findbugs_exclude.xml +++ b/library/spotbugs_exclude.xml @@ -1,4 +1,4 @@ - + @@ -7,4 +7,4 @@ - + diff --git a/library/src/main/java/com/eggheadgames/siren/SirenHelper.java b/library/src/main/java/com/eggheadgames/siren/SirenHelper.java index dd7a00d..586bf68 100644 --- a/library/src/main/java/com/eggheadgames/siren/SirenHelper.java +++ b/library/src/main/java/com/eggheadgames/siren/SirenHelper.java @@ -1,9 +1,9 @@ package com.eggheadgames.siren; +import android.annotation.SuppressLint; import android.app.Activity; import android.content.Context; import android.content.Intent; -import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.res.AssetManager; import android.content.res.Configuration; @@ -64,6 +64,7 @@ boolean isVersionSkippedByUser(Context context, String minAppVersion) { return skippedVersion.equals(minAppVersion); } + @SuppressLint("ApplySharedPref") void setLastVerificationDate(Context context) { PreferenceManager.getDefaultSharedPreferences(context).edit() .putLong(Constants.PREFERENCES_LAST_CHECK_DATE, Calendar.getInstance().getTimeInMillis()) @@ -123,6 +124,7 @@ void openGooglePlay(Activity activity) { } } + @SuppressLint("ApplySharedPref") void setVersionSkippedByUser(Context context, String skippedVersion) { PreferenceManager.getDefaultSharedPreferences(context).edit() .putString(Constants.PREFERENCES_SKIPPED_VERSION, skippedVersion) diff --git a/library/src/main/java/com/eggheadgames/siren/SirenSupportedLocales.java b/library/src/main/java/com/eggheadgames/siren/SirenSupportedLocales.java index 3e2b350..c01001b 100644 --- a/library/src/main/java/com/eggheadgames/siren/SirenSupportedLocales.java +++ b/library/src/main/java/com/eggheadgames/siren/SirenSupportedLocales.java @@ -27,7 +27,8 @@ public enum SirenSupportedLocales { SV("sv"), TH("th"), TR("tr"), - ZH("zh"); + ZH("zh"), + ZH_Hant("zh-rTW"); private final String locale; diff --git a/library/src/main/res/values-zh-rTW/strings.xml b/library/src/main/res/values-zh-rTW/strings.xml new file mode 100644 index 0000000..aa2a595 --- /dev/null +++ b/library/src/main/res/values-zh-rTW/strings.xml @@ -0,0 +1,7 @@ + + %s的新版本可用。請立即更新到%s版本。 + 更新可用 + 更新 + 下一次 + 跳過此版本 + \ No newline at end of file