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
c6958474
Commit
c6958474
authored
May 24, 2016
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove package object
parent
4a1f6fea
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
17 additions
and
24 deletions
+17
-24
src/main/scala/com/github/shadowsocks/AppManager.scala
src/main/scala/com/github/shadowsocks/AppManager.scala
+1
-1
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
+4
-4
src/main/scala/com/github/shadowsocks/ShadowsocksNatService.scala
.../scala/com/github/shadowsocks/ShadowsocksNatService.scala
+1
-1
src/main/scala/com/github/shadowsocks/ShadowsocksVpnService.scala
.../scala/com/github/shadowsocks/ShadowsocksVpnService.scala
+1
-1
src/main/scala/com/github/shadowsocks/package.scala
src/main/scala/com/github/shadowsocks/package.scala
+0
-17
src/main/scala/com/github/shadowsocks/utils/Utils.scala
src/main/scala/com/github/shadowsocks/utils/Utils.scala
+10
-0
No files found.
src/main/scala/com/github/shadowsocks/AppManager.scala
View file @
c6958474
...
...
@@ -232,7 +232,7 @@ class AppManager extends AppCompatActivity with OnMenuItemClickListener {
def
reloadApps
()
=
if
(!
appsLoading
.
compareAndSet
(
true
,
false
))
loadAppsAsync
()
def
loadAppsAsync
()
{
if
(!
appsLoading
.
compareAndSet
(
false
,
true
))
return
ThrowableFuture
{
Utils
.
ThrowableFuture
{
var
adapter
:
AppsAdapter
=
null
do
{
appsLoading
.
set
(
true
)
...
...
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
View file @
c6958474
...
...
@@ -336,7 +336,7 @@ class Shadowsocks extends AppCompatActivity with ServiceBoundContext {
}
def
prepareStartService
()
{
ThrowableFuture
{
Utils
.
ThrowableFuture
{
if
(
ShadowsocksApplication
.
isVpnEnabled
)
{
val
intent
=
VpnService
.
prepare
(
this
)
if
(
intent
!=
null
)
{
...
...
@@ -381,7 +381,7 @@ class Shadowsocks extends AppCompatActivity with ServiceBoundContext {
handler
.
post
(()
=>
connectionTestText
.
setText
(
R
.
string
.
connection_test_testing
))
testCount
}
ThrowableFuture
{
Utils
.
ThrowableFuture
{
// Based on: https://android.googlesource.com/platform/frameworks/base/+/master/services/core/java/com/android/server/connectivity/NetworkMonitor.java#640
autoDisconnect
(
new
URL
(
"https"
,
"www.google.com"
,
"/generate_204"
).
openConnection
()
.
asInstanceOf
[
HttpURLConnection
])
{
conn
=>
...
...
@@ -562,7 +562,7 @@ class Shadowsocks extends AppCompatActivity with ServiceBoundContext {
def
recovery
()
{
if
(
serviceStarted
)
serviceStop
()
val
h
=
showProgress
(
R
.
string
.
recovering
)
ThrowableFuture
{
Utils
.
ThrowableFuture
{
reset
()
h
.
sendEmptyMessage
(
0
)
}
...
...
@@ -570,7 +570,7 @@ class Shadowsocks extends AppCompatActivity with ServiceBoundContext {
def
flushDnsCache
()
{
val
h
=
showProgress
(
R
.
string
.
flushing
)
ThrowableFuture
{
Utils
.
ThrowableFuture
{
if
(!
Utils
.
toggleAirplaneMode
(
getBaseContext
))
h
.
post
(()
=>
Snackbar
.
make
(
findViewById
(
android
.
R
.
id
.
content
),
R
.
string
.
flush_dnscache_no_root
,
Snackbar
.
LENGTH_LONG
).
show
)
h
.
sendEmptyMessage
(
0
)
...
...
src/main/scala/com/github/shadowsocks/ShadowsocksNatService.scala
View file @
c6958474
...
...
@@ -359,7 +359,7 @@ class ShadowsocksNatService extends BaseService {
changeState
(
State
.
CONNECTING
)
ThrowableFuture
{
Utils
.
ThrowableFuture
{
if
(
config
.
proxy
==
"198.199.101.152"
)
{
val
holder
=
ShadowsocksApplication
.
containerHolder
try
{
...
...
src/main/scala/com/github/shadowsocks/ShadowsocksVpnService.scala
View file @
c6958474
...
...
@@ -150,7 +150,7 @@ class ShadowsocksVpnService extends VpnService with BaseService {
changeState
(
State
.
CONNECTING
)
ThrowableFuture
{
Utils
.
ThrowableFuture
{
if
(
config
.
proxy
==
"198.199.101.152"
)
{
val
holder
=
ShadowsocksApplication
.
containerHolder
try
{
...
...
src/main/scala/com/github/shadowsocks/package.scala
deleted
100644 → 0
View file @
4a1f6fea
package
com.github
import
scala.concurrent.ExecutionContext.Implicits.global
import
scala.concurrent.Future
import
scala.util.
{
Failure
,
Try
}
/**
* @author Mygod
*/
package
object
shadowsocks
{
private
val
handleFailure
:
Try
[
_
]
=>
Unit
=
{
case
Failure
(
e
)
=>
e
.
printStackTrace
()
case
_
=>
}
def
ThrowableFuture
[
T
](
f
:
=>
T
)
=
Future
(
f
)
onComplete
handleFailure
}
src/main/scala/com/github/shadowsocks/utils/Utils.scala
View file @
c6958474
...
...
@@ -54,6 +54,9 @@ import android.widget.Toast
import
com.github.shadowsocks.
{
BuildConfig
,
ShadowsocksApplication
,
ShadowsocksRunnerService
}
import
org.xbill.DNS._
import
scala.concurrent.ExecutionContext.Implicits.global
import
scala.concurrent.Future
import
scala.util.
{
Failure
,
Try
}
object
Utils
{
...
...
@@ -237,4 +240,11 @@ object Utils {
val
intent
=
new
Intent
(
Action
.
CLOSE
)
context
.
sendBroadcast
(
intent
)
}
private
val
handleFailure
:
Try
[
_
]
=>
Unit
=
{
case
Failure
(
e
)
=>
e
.
printStackTrace
()
case
_
=>
}
def
ThrowableFuture
[
T
](
f
:
=>
T
)
=
Future
(
f
)
onComplete
handleFailure
}
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