Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
com.ccwangluo.accelerator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sheteng
com.ccwangluo.accelerator
Commits
30b56c97
Commit
30b56c97
authored
Dec 14, 2017
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add more tests, fix lint errors and add check to travis
parent
d081d069
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
175 additions
and
39 deletions
+175
-39
.travis.yml
.travis.yml
+1
-1
mobile/build.gradle
mobile/build.gradle
+1
-4
mobile/lint.xml
mobile/lint.xml
+9
-0
mobile/src/androidTest/java/com/github/shadowsocks/acl/AclTest.kt
...rc/androidTest/java/com/github/shadowsocks/acl/AclTest.kt
+41
-0
mobile/src/androidTest/java/com/github/shadowsocks/database/ProfileTest.kt
...dTest/java/com/github/shadowsocks/database/ProfileTest.kt
+36
-0
mobile/src/main/java/com/github/shadowsocks/AppManager.kt
mobile/src/main/java/com/github/shadowsocks/AppManager.kt
+3
-1
mobile/src/main/java/com/github/shadowsocks/ScannerActivity.kt
...e/src/main/java/com/github/shadowsocks/ScannerActivity.kt
+3
-1
mobile/src/main/java/com/github/shadowsocks/database/KeyValuePair.kt
...main/java/com/github/shadowsocks/database/KeyValuePair.kt
+2
-2
mobile/src/main/res/layout/dialog_acl_rule.xml
mobile/src/main/res/layout/dialog_acl_rule.xml
+1
-0
mobile/src/main/res/layout/layout_header.xml
mobile/src/main/res/layout/layout_header.xml
+1
-2
mobile/src/main/res/layout/layout_main.xml
mobile/src/main/res/layout/layout_main.xml
+2
-1
mobile/src/main/res/menu/custom_rules_menu.xml
mobile/src/main/res/menu/custom_rules_menu.xml
+32
-27
mobile/src/test/java/com/github/shadowsocks/database/KeyValuePairTest.kt
.../java/com/github/shadowsocks/database/KeyValuePairTest.kt
+39
-0
plugin/lint.xml
plugin/lint.xml
+4
-0
No files found.
.travis.yml
View file @
30b56c97
...
...
@@ -30,4 +30,4 @@ install:
>/dev/null
script
:
-
./gradlew assembleDebug
-
./gradlew assembleDebug
check
mobile/build.gradle
View file @
30b56c97
...
...
@@ -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"
)
...
...
mobile/lint.xml
0 → 100644
View file @
30b56c97
<?xml version="1.0" encoding="UTF-8"?>
<lint>
<issue
id=
"InvalidPackage"
>
<ignore
regexp=
"ormlite-core"
/>
</issue>
<issue
id=
"ImpliedQuantity"
severity=
"warning"
/>
<issue
id=
"ExtraTranslation"
severity=
"warning"
/>
<issue
id=
"MissingTranslation"
severity=
"informational"
/>
</lint>
mobile/src/androidTest/java/com/github/shadowsocks/acl/AclTest.kt
0 → 100644
View file @
30b56c97
/*******************************************************************************
* *
* Copyright (C) 2017 by Max Lv <max.c.lv@gmail.com> *
* Copyright (C) 2017 by Mygod Studio <contact-shadowsocks-android@mygod.be> *
* *
* 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 <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
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
());
}
}
mobile/src/androidTest/java/com/github/shadowsocks/database/ProfileTest.kt
0 → 100644
View file @
30b56c97
/*******************************************************************************
* *
* Copyright (C) 2017 by Max Lv <max.c.lv@gmail.com> *
* Copyright (C) 2017 by Mygod Studio <contact-shadowsocks-android@mygod.be> *
* *
* 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 <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
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
())
}
}
mobile/src/main/java/com/github/shadowsocks/AppManager.kt
View file @
30b56c97
...
...
@@ -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
)
...
...
mobile/src/main/java/com/github/shadowsocks/ScannerActivity.kt
View file @
30b56c97
...
...
@@ -54,7 +54,9 @@ class ScannerActivity : AppCompatActivity(), ZXingScannerView.ResultHandler {
setContentView
(
R
.
layout
.
layout_scanner
)
val
toolbar
=
findViewById
<
Toolbar
>(
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"
)
...
...
mobile/src/main/java/com/github/shadowsocks/database/KeyValuePair.kt
View file @
30b56c97
...
...
@@ -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
:
Mutable
Set
<
String
>?
val
stringSet
:
Set
<
String
>?
get
()
=
if
(
valueType
==
TYPE_STRING_SET
)
{
val
buffer
=
ByteBuffer
.
wrap
(
value
)
val
result
=
HashSet
<
String
>()
...
...
@@ -95,7 +95,7 @@ class KeyValuePair() {
this
.
value
=
value
.
toByteArray
()
return
this
}
fun
put
(
value
:
Mutable
Set
<
String
>):
KeyValuePair
{
fun
put
(
value
:
Set
<
String
>):
KeyValuePair
{
valueType
=
TYPE_STRING_SET
val
stream
=
ByteArrayOutputStream
()
for
(
v
in
value
)
{
...
...
mobile/src/main/res/layout/dialog_acl_rule.xml
View file @
30b56c97
...
...
@@ -6,6 +6,7 @@
<Spinner
android:id=
"@+id/template_selector"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:labelFor=
"@+id/content"
android:entries=
"@array/acl_rule_templates"
/>
<EditText
android:id=
"@+id/content"
android:layout_width=
"match_parent"
...
...
mobile/src/main/res/layout/layout_header.xml
View file @
30b56c97
...
...
@@ -10,8 +10,7 @@
android:scaleType=
"centerCrop"
android:src=
"@drawable/background_header"
/>
<TextView
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@+id/drawer_title"
<TextView
android:id=
"@+id/drawer_title"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_centerVertical=
"true"
...
...
mobile/src/main/res/layout/layout_main.xml
View file @
30b56c97
...
...
@@ -26,7 +26,8 @@
android:ellipsize=
"marquee"
android:paddingEnd=
"72dip"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
/>
android:layout_height=
"wrap_content"
tools:ignore=
"RtlSymmetry"
/>
<com.github.shadowsocks.widget.BoundedGridLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
app:bounded_width=
"288dp"
...
...
mobile/src/main/res/menu/custom_rules_menu.xml
View file @
30b56c97
<?xml version="1.0" encoding="utf-8"?>
<menu
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<item
android:id=
"@+id/selection"
android:title=
"@string/action_selection"
android:icon=
"@drawable/abc_ic_menu_selectall_mtrl_alpha"
<item
android:id=
"@+id/selection"
android:alphabeticShortcut=
"s"
android:icon=
"?attr/actionModeSelectAllDrawable"
android:numericShortcut=
"0"
android:title=
"@string/action_selection"
android:visible=
"false"
app:showAsAction=
"always"
>
<menu>
<item
android:id=
"@+id/action_select_all"
android:title=
"@android:string/selectA
ll"
<item
android:id=
"@+id/action_select_a
ll"
android:alphabeticShortcut=
"a"
android:numericShortcut=
"1"
android:title=
"@android:string/selectAll"
app:showAsAction=
"always"
/>
<item
android:id=
"@+id/action_cut"
android:title=
"@android:string/
cut"
<item
android:id=
"@+id/action_
cut"
android:alphabeticShortcut=
"t"
android:numericShortcut=
"2"
android:title=
"@android:string/cut"
app:showAsAction=
"always"
/>
<item
android:id=
"@+id/action_copy"
android:title=
"@android:string/
copy"
<item
android:id=
"@+id/action_
copy"
android:alphabeticShortcut=
"c"
android:numericShortcut=
"3"
android:title=
"@android:string/copy"
app:showAsAction=
"always"
/>
<item
android:id=
"@+id/action_delete"
android:title=
"@string/
delete"
<item
android:id=
"@+id/action_
delete"
android:alphabeticShortcut=
"d"
android:numericShortcut=
"4"
android:title=
"@string/delete"
app:showAsAction=
"always"
/>
</menu>
</item>
...
...
mobile/src/test/java/com/github/shadowsocks/database/KeyValuePairTest.kt
0 → 100644
View file @
30b56c97
/*******************************************************************************
* *
* Copyright (C) 2017 by Max Lv <max.c.lv@gmail.com> *
* Copyright (C) 2017 by Mygod Studio <contact-shadowsocks-android@mygod.be> *
* *
* 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 <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
package
com.github.shadowsocks.database
import
org.junit.Assert
import
org.junit.Test
class
KeyValuePairTest
{
@Test
fun
putAndGet
()
{
val
kvp
=
KeyValuePair
()
Assert
.
assertEquals
(
true
,
kvp
.
put
(
true
).
boolean
)
Assert
.
assertEquals
(
3f
,
kvp
.
put
(
3f
).
float
)
Assert
.
assertEquals
(
3
,
kvp
.
put
(
3
).
int
)
Assert
.
assertEquals
(
3L
,
kvp
.
put
(
3L
).
long
)
Assert
.
assertEquals
(
"3"
,
kvp
.
put
(
"3"
).
string
)
val
set
=
(
0
until
3
).
map
(
Int
::
toString
).
toSet
()
Assert
.
assertEquals
(
set
,
kvp
.
put
(
set
).
stringSet
)
Assert
.
assertEquals
(
null
,
kvp
.
boolean
)
}
}
plugin/lint.xml
0 → 100644
View file @
30b56c97
<?xml version="1.0" encoding="UTF-8"?>
<lint>
<issue
id=
"MissingTranslation"
severity=
"informational"
/>
</lint>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment