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
7f226d3f
Commit
7f226d3f
authored
Dec 19, 2014
by
Max Lv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace crouton with snackbar
parent
ee3f3c23
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
17 deletions
+16
-17
build.sbt
build.sbt
+3
-1
src/main/res/values-zh/strings.xml
src/main/res/values-zh/strings.xml
+2
-1
src/main/res/values/strings.xml
src/main/res/values/strings.xml
+2
-1
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
+9
-14
No files found.
build.sbt
View file @
7f226d3f
...
...
@@ -14,6 +14,8 @@ ndkJavah in Android := List()
ndkBuild
in
Android
:=
List
()
typedResources
in
Android
:=
false
resolvers
+=
"JRAF"
at
"http://JRAF.org/static/maven/2"
resolvers
+=
"madeye private releases"
at
"http://madeye-maven-repository.googlecode.com/git/"
...
...
@@ -32,7 +34,7 @@ libraryDependencies ++= Seq(
)
libraryDependencies
++=
Seq
(
"
de.keyboardsurfer.android.widget"
%
"crouton"
%
"1.8.4"
exclude
(
"com.google.android"
,
"support-v4"
)
,
"
com.github.mrengineer13"
%
"snackbar"
%
"0.5.0"
,
"com.nostra13.universalimageloader"
%
"universal-image-loader"
%
"1.8.4"
,
"com.j256.ormlite"
%
"ormlite-core"
%
"4.47"
,
"com.j256.ormlite"
%
"ormlite-android"
%
"4.47"
...
...
src/main/res/values-zh/strings.xml
View file @
7f226d3f
...
...
@@ -47,7 +47,7 @@
<string
name=
"service_failed"
>
无法连接远程服务器
</string>
<string
name=
"stop"
>
停止服务
</string>
<string
name=
"stopping"
>
正在关闭...
</string>
<string
name=
"vpn_error"
>
后台服务启动失败:
\"%s\"。
</string>
<string
name=
"vpn_error"
>
后台服务启动失败:
%s
</string>
<string
name=
"ok_iknow"
>
确定
</string>
<string
name=
"port_alert"
>
端口号应大于1024
</string>
<string
name=
"port_empty"
>
端口号不能为空
</string>
...
...
@@ -94,5 +94,6 @@
<string
name=
"action_export_err"
>
导出失败
</string>
<string
name=
"action_import_msg"
>
导入成功
</string>
<string
name=
"action_import_err"
>
导入失败
</string>
<string
name=
"error"
>
错误
</string>
</resources>
src/main/res/values/strings.xml
View file @
7f226d3f
...
...
@@ -58,9 +58,10 @@
<string
name=
"service_failed"
>
Failed to connect the remote server
</string>
<string
name=
"stop"
>
Stop the service
</string>
<string
name=
"stopping"
>
Shutting down...
</string>
<string
name=
"vpn_error"
>
Error: \"%s\".
</string>
<string
name=
"vpn_error"
>
%s
</string>
<string
name=
"enable_nat"
>
Turn on NAT mode.
</string>
<string
name=
"disable_nat"
>
Turn off NAT mode.
</string>
<string
name=
"error"
>
ERROR
</string>
<!-- alert category -->
<string
name=
"ok_iknow"
>
OK
</string>
...
...
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
View file @
7f226d3f
...
...
@@ -56,6 +56,7 @@ import android.view.View.OnLongClickListener
import
android.view._
import
android.webkit.
{
WebView
,
WebViewClient
}
import
android.widget._
import
com.github.mrengineer13.snackbar._
import
com.github.shadowsocks.aidl.
{
IShadowsocksService
,
IShadowsocksServiceCallback
}
import
com.github.shadowsocks.database._
import
com.github.shadowsocks.preferences.
{
PasswordEditTextPreference
,
ProfileEditTextPreference
,
SummaryEditTextPreference
}
...
...
@@ -64,7 +65,6 @@ import com.google.android.gms.ads.{AdRequest, AdSize, AdView}
import
com.google.android.gms.analytics.HitBuilders
import
com.google.zxing.integration.android.IntentIntegrator
import
com.nostra13.universalimageloader.core.download.BaseImageDownloader
import
de.keyboardsurfer.android.widget.crouton.
{
Configuration
,
Crouton
,
Style
}
import
net.simonvt.menudrawer.MenuDrawer
import
scala.collection.mutable.
{
ArrayBuffer
,
ListBuffer
}
...
...
@@ -205,7 +205,6 @@ class Shadowsocks
// Update the UI
if
(
switchButton
!=
null
)
switchButton
.
setEnabled
(
true
)
if
(
State
.
isAvailable
(
bgService
.
getState
))
{
Crouton
.
cancelAllCroutons
()
setPreferenceEnabled
(
enabled
=
true
)
}
else
{
changeSwitch
(
checked
=
true
)
...
...
@@ -367,7 +366,7 @@ class Shadowsocks
def
isTextEmpty
(
s
:
String
,
msg
:
String
)
:
Boolean
=
{
if
(
s
==
null
||
s
.
length
<=
0
)
{
Crouton
.
makeText
(
this
,
msg
,
Style
.
ALERT
).
show
()
new
SnackBar
.
Builder
(
this
).
withMessage
(
msg
).
withStyle
(
SnackBar
.
Style
.
ALERT
).
show
()
return
true
}
false
...
...
@@ -828,7 +827,6 @@ class Shadowsocks
override
def
onDestroy
()
{
super
.
onDestroy
()
deattachService
()
Crouton
.
cancelAllCroutons
()
unregisterReceiver
(
preferenceReceiver
)
new
BackupManager
(
this
).
dataChanged
()
if
(
handler
!=
null
)
{
...
...
@@ -927,12 +925,12 @@ class Shadowsocks
try
{
val
port
:
Int
=
Integer
.
valueOf
(
text
)
if
(!
low
&&
port
<=
1024
)
{
Crouton
.
makeText
(
this
,
R
.
string
.
port_alert
,
Style
.
ALERT
).
show
()
new
SnackBar
.
Builder
(
this
).
withMessageId
(
R
.
string
.
port_alert
).
withStyle
(
SnackBar
.
Style
.
ALERT
).
show
()
return
false
}
}
catch
{
case
ex
:
Exception
=>
Crouton
.
makeText
(
this
,
R
.
string
.
port_alert
,
Style
.
ALERT
).
show
()
new
SnackBar
.
Builder
(
this
).
withMessageId
(
R
.
string
.
port_alert
).
withStyle
(
SnackBar
.
Style
.
ALERT
).
show
()
return
false
}
true
...
...
@@ -1014,15 +1012,12 @@ class Shadowsocks
case
State
.
STOPPED
=>
clearDialog
()
changeSwitch
(
checked
=
false
)
Crouton
.
cancelAllCroutons
()
if
(
m
!=
null
)
{
val
style
=
new
Style
.
Builder
().
setBackgroundColorValue
(
Style
.
holoRedLight
).
build
()
val
config
=
new
Configuration
.
Builder
()
.
setDuration
(
Configuration
.
DURATION_LONG
)
.
build
()
Crouton
.
makeText
(
Shadowsocks
.
this
,
getString
(
R
.
string
.
vpn_error
).
formatLocal
(
Locale
.
ENGLISH
,
m
),
style
)
.
setConfiguration
(
config
)
new
SnackBar
.
Builder
(
Shadowsocks
.
this
)
.
withMessage
(
getString
(
R
.
string
.
vpn_error
).
formatLocal
(
Locale
.
ENGLISH
,
m
))
.
withActionMessageId
(
R
.
string
.
error
)
.
withStyle
(
SnackBar
.
Style
.
ALERT
)
.
withDuration
(
SnackBar
.
LONG_SNACK
)
.
show
()
}
setPreferenceEnabled
(
enabled
=
true
)
...
...
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