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
26acea8e
Commit
26acea8e
authored
Mar 30, 2018
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix code style issues
parent
a7d77461
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
65 additions
and
51 deletions
+65
-51
detekt.yml
detekt.yml
+26
-16
mobile/src/main/java/com/github/shadowsocks/AppManager.kt
mobile/src/main/java/com/github/shadowsocks/AppManager.kt
+14
-16
mobile/src/main/java/com/github/shadowsocks/bg/BaseService.kt
...le/src/main/java/com/github/shadowsocks/bg/BaseService.kt
+12
-3
mobile/src/main/java/com/github/shadowsocks/plugin/PluginManager.kt
.../main/java/com/github/shadowsocks/plugin/PluginManager.kt
+11
-13
mobile/src/main/java/com/github/shadowsocks/preference/DataStore.kt
.../main/java/com/github/shadowsocks/preference/DataStore.kt
+0
-1
mobile/src/main/java/com/github/shadowsocks/tasker/Settings.kt
...e/src/main/java/com/github/shadowsocks/tasker/Settings.kt
+2
-2
No files found.
detekt.yml
View file @
26acea8e
# https://github.com/arturbosch/detekt/blob/
801994bd60cc759b181649356cea045b8125301b
/detekt-cli/src/main/resources/default-detekt-config.yml
# https://github.com/arturbosch/detekt/blob/
RC6-4
/detekt-cli/src/main/resources/default-detekt-config.yml
comments
:
active
:
false
...
...
@@ -7,7 +7,7 @@ complexity:
active
:
true
ComplexCondition
:
active
:
true
threshold
:
3
threshold
:
4
ComplexInterface
:
active
:
true
threshold
:
10
...
...
@@ -15,6 +15,7 @@ complexity:
ComplexMethod
:
active
:
true
threshold
:
10
ignoreSingleWhenExpression
:
false
LabeledExpression
:
active
:
true
LargeClass
:
...
...
@@ -25,31 +26,32 @@ complexity:
threshold
:
20
LongParameterList
:
active
:
true
threshold
:
5
threshold
:
6
ignoreDefaultParameters
:
true
MethodOverloading
:
active
:
false
NestedBlockDepth
:
active
:
true
threshold
:
3
threshold
:
4
StringLiteralDuplication
:
active
:
true
threshold
:
2
threshold
:
3
ignoreAnnotation
:
true
excludeStringsWithLessThan5Characters
:
true
ignoreStringsRegex
:
'
$^'
TooManyFunctions
:
active
:
true
thresholdInFiles
:
1
0
thresholdInClasses
:
1
0
thresholdInInterfaces
:
1
0
thresholdInObjects
:
1
0
thresholdInEnums
:
1
0
thresholdInFiles
:
1
1
thresholdInClasses
:
1
1
thresholdInInterfaces
:
1
1
thresholdInObjects
:
1
1
thresholdInEnums
:
1
1
empty-blocks
:
active
:
true
EmptyCatchBlock
:
active
:
false
active
:
true
allowedExceptionNameRegex
:
"
^(_|ignore|expected).*"
EmptyClassBlock
:
active
:
true
EmptyDefaultConstructor
:
...
...
@@ -64,6 +66,7 @@ empty-blocks:
active
:
true
EmptyFunctionBlock
:
active
:
true
ignoreOverriddenFunctions
:
false
EmptyIfBlock
:
active
:
true
EmptyInitBlock
:
...
...
@@ -105,7 +108,7 @@ exceptions:
active
:
true
TooGenericExceptionCaught
:
active
:
true
exceptions
:
exception
Name
s
:
-
ArrayIndexOutOfBoundsException
-
Error
-
Exception
...
...
@@ -116,10 +119,9 @@ exceptions:
-
Throwable
TooGenericExceptionThrown
:
active
:
true
exceptions
:
exception
Name
s
:
-
Error
-
Exception
-
NullPointerException
-
Throwable
-
RuntimeException
...
...
@@ -143,6 +145,7 @@ naming:
FunctionNaming
:
active
:
true
functionPattern
:
'
^([a-z$][a-zA-Z$0-9]*)|(`.*`)$'
excludeClassPattern
:
'
$^'
MatchingDeclarationName
:
active
:
true
MemberNameEqualsClassName
:
...
...
@@ -167,6 +170,7 @@ naming:
active
:
true
variablePattern
:
'
[a-z][A-Za-z0-9]*'
privateVariablePattern
:
'
(_)?[a-z][A-Za-z0-9]*'
excludeClassPattern
:
'
$^'
performance
:
active
:
true
...
...
@@ -239,15 +243,17 @@ style:
maxLineLength
:
120
excludePackageStatements
:
false
excludeImportStatements
:
false
MayBeConst
:
active
:
true
ModifierOrder
:
active
:
true
NestedClassesVisibility
:
active
:
true
NewLineAtEndOfFile
:
active
:
true
OptionalAbstractKeyword
:
NoTabs
:
active
:
true
Optional
Return
Keyword
:
Optional
Abstract
Keyword
:
active
:
true
OptionalUnit
:
active
:
true
...
...
@@ -268,6 +274,8 @@ style:
ThrowsCount
:
active
:
true
max
:
2
TrailingWhitespace
:
active
:
true
UnnecessaryAbstractClass
:
active
:
true
UnnecessaryInheritance
:
...
...
@@ -278,6 +286,8 @@ style:
active
:
true
UnusedImports
:
active
:
true
UnusedPrivateMember
:
active
:
true
UseDataClass
:
active
:
false
UtilityClassWithPublicConstructor
:
...
...
mobile/src/main/java/com/github/shadowsocks/AppManager.kt
View file @
26acea8e
...
...
@@ -62,8 +62,7 @@ class AppManager : AppCompatActivity(), Toolbar.OnMenuItemClickListener {
private
var
receiver
:
BroadcastReceiver
?
=
null
private
var
cachedApps
:
List
<
PackageInfo
>?
=
null
private
fun
getApps
(
pm
:
PackageManager
):
List
<
ProxiedApp
>
{
return
synchronized
(
AppManager
)
{
private
fun
getApps
(
pm
:
PackageManager
)
=
synchronized
(
AppManager
)
{
if
(
receiver
==
null
)
receiver
=
app
.
listenForPackageChanges
{
synchronized
(
AppManager
)
{
receiver
=
null
...
...
@@ -79,7 +78,6 @@ class AppManager : AppCompatActivity(), Toolbar.OnMenuItemClickListener {
cachedApps
}.
map
{
ProxiedApp
(
pm
,
it
.
applicationInfo
,
it
.
packageName
)
}
}
}
private
class
ProxiedApp
(
private
val
pm
:
PackageManager
,
private
val
appInfo
:
ApplicationInfo
,
val
packageName
:
String
)
{
...
...
mobile/src/main/java/com/github/shadowsocks/bg/BaseService.kt
View file @
26acea8e
...
...
@@ -117,7 +117,10 @@ object BaseService {
val
item
=
callbacks
.
getBroadcastItem
(
i
)
if
(
bandwidthListeners
.
contains
(
item
.
asBinder
()))
item
.
trafficUpdated
(
profile
!!
.
id
,
txRate
,
rxRate
,
txTotal
,
rxTotal
)
}
catch
(
_
:
Exception
)
{
}
// ignore
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
app
.
track
(
e
)
}
callbacks
.
finishBroadcast
()
}
}
...
...
@@ -159,7 +162,10 @@ object BaseService {
try
{
val
item
=
callbacks
.
getBroadcastItem
(
i
)
if
(
bandwidthListeners
.
contains
(
item
.
asBinder
()))
item
.
trafficPersisted
(
profile
.
id
)
}
catch
(
_
:
Exception
)
{
}
// ignore
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
app
.
track
(
e
)
}
}
callbacks
.
finishBroadcast
()
}
...
...
@@ -211,7 +217,10 @@ object BaseService {
val
n
=
callbacks
.
beginBroadcast
()
for
(
i
in
0
until
n
)
try
{
callbacks
.
getBroadcastItem
(
i
).
stateChanged
(
s
,
binder
.
profileName
,
msg
)
}
catch
(
_
:
Exception
)
{
}
// ignore
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
app
.
track
(
e
)
}
callbacks
.
finishBroadcast
()
}
state
=
s
...
...
mobile/src/main/java/com/github/shadowsocks/plugin/PluginManager.kt
View file @
26acea8e
...
...
@@ -87,8 +87,7 @@ object PluginManager {
private
var
receiver
:
BroadcastReceiver
?
=
null
private
var
cachedPlugins
:
Map
<
String
,
Plugin
>?
=
null
fun
fetchPlugins
():
Map
<
String
,
Plugin
>
{
return
synchronized
(
this
)
{
fun
fetchPlugins
():
Map
<
String
,
Plugin
>
=
synchronized
(
this
)
{
if
(
receiver
==
null
)
receiver
=
app
.
listenForPackageChanges
{
synchronized
(
this
)
{
receiver
=
null
...
...
@@ -102,7 +101,6 @@ object PluginManager {
}
cachedPlugins
!!
}
}
private
fun
buildUri
(
id
:
String
)
=
Uri
.
Builder
()
.
scheme
(
PluginContract
.
SCHEME
)
...
...
mobile/src/main/java/com/github/shadowsocks/preference/DataStore.kt
View file @
26acea8e
...
...
@@ -22,7 +22,6 @@ package com.github.shadowsocks.preference
import
android.os.Binder
import
com.github.shadowsocks.App.Companion.app
import
com.github.shadowsocks.BootReceiver
import
com.github.shadowsocks.database.PrivateDatabase
import
com.github.shadowsocks.database.PublicDatabase
import
com.github.shadowsocks.utils.DirectBoot
...
...
mobile/src/main/java/com/github/shadowsocks/tasker/Settings.kt
View file @
26acea8e
...
...
@@ -29,8 +29,8 @@ import com.twofortyfouram.locale.api.Intent as ApiIntent
class
Settings
(
bundle
:
Bundle
?)
{
companion
object
{
private
val
KEY_SWITCH_ON
=
"switch_on"
private
val
KEY_PROFILE_ID
=
"profile_id"
private
const
val
KEY_SWITCH_ON
=
"switch_on"
private
const
val
KEY_PROFILE_ID
=
"profile_id"
fun
fromIntent
(
intent
:
Intent
)
=
Settings
(
intent
.
getBundleExtra
(
ApiIntent
.
EXTRA_BUNDLE
))
}
...
...
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