Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
30 changes: 30 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -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
10 changes: 8 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -15,6 +20,7 @@ buildscript {
allprojects {
repositories {
jcenter()
google()
}
}

Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
15 changes: 7 additions & 8 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand All @@ -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'
}
58 changes: 30 additions & 28 deletions library/quality.gradle
Original file line number Diff line number Diff line change
@@ -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'

Expand All @@ -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()
}
}
4 changes: 2 additions & 2 deletions library/findbugs_exclude.xml → library/spotbugs_exclude.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<FindBugsFilter>
<SpotBugsFilter>

<Match>
<Class name="~.*R\$.*" />
Expand All @@ -7,4 +7,4 @@
<Class name="~.*Manifest\$.*" />
</Match>

</FindBugsFilter>
</SpotBugsFilter>
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
7 changes: 7 additions & 0 deletions library/src/main/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<resources>
<string name="update_alert_message" formatted="false">%s的新版本可用。請立即更新到%s版本。</string>
<string name="update_available">更新可用</string>
<string name="update">更新</string>
<string name="next_time">下一次</string>
<string name="skip_this_version">跳過此版本</string>
</resources>