diff --git a/.travis.yml b/.travis.yml
index 7024fa8b..69a1beb1 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -30,4 +30,4 @@ install:
>/dev/null
script:
- - ./gradlew assembleDebug
+ - ./gradlew assembleDebug check
diff --git a/mobile/build.gradle b/mobile/build.gradle
index 4c68cddb..d5e31b82 100644
--- a/mobile/build.gradle
+++ b/mobile/build.gradle
@@ -9,7 +9,7 @@ def getCurrentFlavor() {
.matcher(getGradle().getStartParameter().getTaskRequests().toString())
if (matcher.find()) return matcher.group(1).toLowerCase() else {
println "NO MATCH FOUND"
- return ""
+ return "debug"
}
}
@@ -36,9 +36,6 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
- lintOptions {
- abortOnError false
- }
sourceSets.main.jniLibs.srcDirs +=
new File(project(':core').buildDir, "intermediates/bundles/${getCurrentFlavor()}/jni")
sourceSets.main.jniLibs.srcDirs += new File(project(':core').projectDir, "src/overture/bin")
diff --git a/mobile/lint.xml b/mobile/lint.xml
new file mode 100644
index 00000000..150b6a37
--- /dev/null
+++ b/mobile/lint.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/mobile/src/androidTest/java/com/github/shadowsocks/acl/AclTest.kt b/mobile/src/androidTest/java/com/github/shadowsocks/acl/AclTest.kt
new file mode 100644
index 00000000..e7c4c454
--- /dev/null
+++ b/mobile/src/androidTest/java/com/github/shadowsocks/acl/AclTest.kt
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * *
+ * Copyright (C) 2017 by Max Lv *
+ * Copyright (C) 2017 by Mygod Studio *
+ * *
+ * This program is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ *******************************************************************************/
+
+package com.github.shadowsocks.acl
+
+import org.junit.Assert
+import org.junit.Test
+import java.io.StringReader
+
+class AclTest {
+ companion object {
+ private const val INPUT1 = """[proxy_all]
+[bypass_list]
+1.0.1.0/24
+[proxy_list]
+(^|\.)4tern\.com${'$'}
+"""
+ }
+
+ @Test
+ fun parse() {
+ Assert.assertEquals(INPUT1, Acl().fromReader(StringReader(INPUT1)).toString());
+ }
+}
diff --git a/mobile/src/androidTest/java/com/github/shadowsocks/database/ProfileTest.kt b/mobile/src/androidTest/java/com/github/shadowsocks/database/ProfileTest.kt
new file mode 100644
index 00000000..2068dd54
--- /dev/null
+++ b/mobile/src/androidTest/java/com/github/shadowsocks/database/ProfileTest.kt
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * *
+ * Copyright (C) 2017 by Max Lv *
+ * Copyright (C) 2017 by Mygod Studio *
+ * *
+ * This program is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ *******************************************************************************/
+
+package com.github.shadowsocks.database
+
+import android.net.Uri
+import org.junit.Assert
+import org.junit.Test
+
+class ProfileTest {
+ @Test
+ fun parsing() {
+ val results = Profile.findAll("garble ss://YmYtY2ZiOnRlc3RAMTkyLjE2OC4xMDAuMTo4ODg4#example-server garble")
+ .toList()
+ Assert.assertEquals(1, results.size)
+ Assert.assertEquals(Uri.parse("ss://YmYtY2ZiOnRlc3Q@192.168.100.1:8888#example-server"),
+ results.single().toUri())
+ }
+}
diff --git a/mobile/src/main/java/com/github/shadowsocks/AppManager.kt b/mobile/src/main/java/com/github/shadowsocks/AppManager.kt
index dbab37ee..46f6cf8f 100644
--- a/mobile/src/main/java/com/github/shadowsocks/AppManager.kt
+++ b/mobile/src/main/java/com/github/shadowsocks/AppManager.kt
@@ -180,7 +180,9 @@ class AppManager : AppCompatActivity(), Toolbar.OnMenuItemClickListener {
setContentView(R.layout.layout_apps)
toolbar = findViewById(R.id.toolbar)
toolbar.setTitle(R.string.proxied_apps)
- toolbar.setNavigationIcon(R.drawable.abc_ic_ab_back_material)
+ val arr = obtainStyledAttributes(intArrayOf(R.attr.homeAsUpIndicator))
+ toolbar.navigationIcon = arr.getDrawable(0)
+ arr.recycle()
toolbar.setNavigationOnClickListener {
val intent = parentActivityIntent
if (shouldUpRecreateTask(intent) || isTaskRoot)
diff --git a/mobile/src/main/java/com/github/shadowsocks/ScannerActivity.kt b/mobile/src/main/java/com/github/shadowsocks/ScannerActivity.kt
index b7be6292..dacb0a0d 100644
--- a/mobile/src/main/java/com/github/shadowsocks/ScannerActivity.kt
+++ b/mobile/src/main/java/com/github/shadowsocks/ScannerActivity.kt
@@ -54,7 +54,9 @@ class ScannerActivity : AppCompatActivity(), ZXingScannerView.ResultHandler {
setContentView(R.layout.layout_scanner)
val toolbar = findViewById(R.id.toolbar)
toolbar.title = title
- toolbar.setNavigationIcon(R.drawable.abc_ic_ab_back_material)
+ val arr = obtainStyledAttributes(intArrayOf(R.attr.homeAsUpIndicator))
+ toolbar.navigationIcon = arr.getDrawable(0)
+ arr.recycle()
toolbar.setNavigationOnClickListener { navigateUp() }
scannerView = findViewById(R.id.scanner)
if (Build.VERSION.SDK_INT >= 25) getSystemService(ShortcutManager::class.java).reportShortcutUsed("scan")
diff --git a/mobile/src/main/java/com/github/shadowsocks/database/KeyValuePair.kt b/mobile/src/main/java/com/github/shadowsocks/database/KeyValuePair.kt
index 970e7550..6998c15a 100644
--- a/mobile/src/main/java/com/github/shadowsocks/database/KeyValuePair.kt
+++ b/mobile/src/main/java/com/github/shadowsocks/database/KeyValuePair.kt
@@ -53,7 +53,7 @@ class KeyValuePair() {
get() = if (valueType == TYPE_LONG) ByteBuffer.wrap(value).long else null
val string: String?
get() = if (valueType == TYPE_STRING) String(value) else null
- val stringSet: MutableSet?
+ val stringSet: Set?
get() = if (valueType == TYPE_STRING_SET) {
val buffer = ByteBuffer.wrap(value)
val result = HashSet()
@@ -95,7 +95,7 @@ class KeyValuePair() {
this.value = value.toByteArray()
return this
}
- fun put(value: MutableSet): KeyValuePair {
+ fun put(value: Set): KeyValuePair {
valueType = TYPE_STRING_SET
val stream = ByteArrayOutputStream()
for (v in value) {
diff --git a/mobile/src/main/res/layout/dialog_acl_rule.xml b/mobile/src/main/res/layout/dialog_acl_rule.xml
index dfb27e8d..88668903 100644
--- a/mobile/src/main/res/layout/dialog_acl_rule.xml
+++ b/mobile/src/main/res/layout/dialog_acl_rule.xml
@@ -6,6 +6,7 @@
-
+ android:layout_height="wrap_content"
+ tools:ignore="RtlSymmetry"/>