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
1f695b9c
Commit
1f695b9c
authored
Nov 08, 2015
by
Max Lv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refine the action button style
parent
aedb5811
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
17 deletions
+33
-17
src/main/res/layout/layout_main.xml
src/main/res/layout/layout_main.xml
+1
-1
src/main/res/layout/toolbar_light_dark.xml
src/main/res/layout/toolbar_light_dark.xml
+11
-6
src/main/res/values/styles.xml
src/main/res/values/styles.xml
+3
-0
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
+18
-10
No files found.
src/main/res/layout/layout_main.xml
View file @
1f695b9c
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
android:layout_marginBottom=
"@dimen/fab_margin_bottom"
>
android:layout_marginBottom=
"@dimen/fab_margin_bottom"
>
<android.support.design.widget.FloatingActionButton
android:id=
"@+id/fab"
android:layout_width=
"wrap_content"
<android.support.design.widget.FloatingActionButton
android:id=
"@+id/fab"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
app:backgroundTint=
"@color/material_
green_6
00"
app:backgroundTint=
"@color/material_
blue_grey_7
00"
android:src=
"@drawable/ic_cloud_off"
android:src=
"@drawable/ic_cloud_off"
app:pressedTranslationZ=
"6dp"
app:borderWidth=
"0dp"
/>
app:pressedTranslationZ=
"6dp"
app:borderWidth=
"0dp"
/>
</com.github.jorgecastilloprz.FABProgressCircle>
</com.github.jorgecastilloprz.FABProgressCircle>
...
...
src/main/res/layout/toolbar_light_dark.xml
View file @
1f695b9c
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar
xmlns:android=
"http://schemas.android.com/apk/res/android"
<android.support.v7.widget.Toolbar
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_height=
"?attr/actionBarSize"
android:layout_width=
"match_parent"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:background=
"?attr/colorPrimary"
android:elevation=
"4dp"
android:layout_height=
"?attr/actionBarSize"
android:theme=
"@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:layout_width=
"match_parent"
app:popupTheme=
"@style/ThemeOverlay.AppCompat.Light"
android:id=
"@+id/toolbar"
/>
android:background=
"?attr/colorPrimary"
\ No newline at end of file
android:elevation=
"4dp"
android:theme=
"@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:titleTextAppearance=
"@style/Toolbar.TitleText"
app:popupTheme=
"@style/ThemeOverlay.AppCompat.Light"
android:id=
"@+id/toolbar"
/>
src/main/res/values/styles.xml
View file @
1f695b9c
...
@@ -16,6 +16,9 @@
...
@@ -16,6 +16,9 @@
<resources>
<resources>
<style
name=
"Toolbar.TitleText"
parent=
"TextAppearance.Widget.AppCompat.Toolbar.Title"
>
<item
name=
"android:textSize"
>
24sp
</item>
</style>
<style
name=
"Theme.Material"
parent=
"Theme.AppCompat.Light.NoActionBar"
>
<style
name=
"Theme.Material"
parent=
"Theme.AppCompat.Light.NoActionBar"
>
<item
name=
"android:alertDialogTheme"
>
@style/Theme.Material.Dialog.Alert
</item>
<item
name=
"android:alertDialogTheme"
>
@style/Theme.Material.Dialog.Alert
</item>
<item
name=
"android:dialogTheme"
>
@style/Theme.Material.Dialog
</item>
<item
name=
"android:dialogTheme"
>
@style/Theme.Material.Dialog
</item>
...
...
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
View file @
1f695b9c
...
@@ -51,6 +51,7 @@ import android.graphics.{Bitmap, Color, Typeface}
...
@@ -51,6 +51,7 @@ import android.graphics.{Bitmap, Color, Typeface}
import
android.net.
{
Uri
,
VpnService
}
import
android.net.
{
Uri
,
VpnService
}
import
android.os._
import
android.os._
import
android.preference.
{
Preference
,
PreferenceManager
,
SwitchPreference
}
import
android.preference.
{
Preference
,
PreferenceManager
,
SwitchPreference
}
import
android.support.v4.content.ContextCompat
import
android.support.design.widget.
{
FloatingActionButton
,
Snackbar
}
import
android.support.design.widget.
{
FloatingActionButton
,
Snackbar
}
import
android.support.v7.app.AppCompatActivity
import
android.support.v7.app.AppCompatActivity
import
android.support.v7.widget.Toolbar
import
android.support.v7.widget.Toolbar
...
@@ -214,13 +215,7 @@ class Shadowsocks
...
@@ -214,13 +215,7 @@ class Shadowsocks
}
}
// Update the UI
// Update the UI
if
(
fab
!=
null
)
fab
.
setEnabled
(
true
)
if
(
fab
!=
null
)
fab
.
setEnabled
(
true
)
if
(
State
.
isAvailable
(
bgService
.
getState
))
{
stateUpdate
()
setPreferenceEnabled
(
enabled
=
true
)
}
else
{
changeSwitch
(
checked
=
true
)
setPreferenceEnabled
(
enabled
=
false
)
}
state
=
bgService
.
getState
if
(!
status
.
getBoolean
(
getVersionName
,
false
))
{
if
(!
status
.
getBoolean
(
getVersionName
,
false
))
{
status
.
edit
.
putBoolean
(
getVersionName
,
true
).
apply
()
status
.
edit
.
putBoolean
(
getVersionName
,
true
).
apply
()
...
@@ -249,8 +244,9 @@ class Shadowsocks
...
@@ -249,8 +244,9 @@ class Shadowsocks
private
lazy
val
listView
=
new
ListView
(
this
)
private
lazy
val
listView
=
new
ListView
(
this
)
private
lazy
val
profileManager
=
private
lazy
val
profileManager
=
new
ProfileManager
(
settings
,
getApplication
.
asInstanceOf
[
ShadowsocksApplication
].
dbHelper
)
new
ProfileManager
(
settings
,
getApplication
.
asInstanceOf
[
ShadowsocksApplication
].
dbHelper
)
private
lazy
val
application
=
getApplication
.
asInstanceOf
[
ShadowsocksApplication
]
private
lazy
val
application
=
getApplication
.
asInstanceOf
[
ShadowsocksApplication
]
private
lazy
val
greyTint
=
ContextCompat
.
getColorStateList
(
this
,
R
.
color
.
material_blue_grey_700
)
private
lazy
val
greenTint
=
ContextCompat
.
getColorStateList
(
this
,
R
.
color
.
material_green_600
)
var
handler
=
new
Handler
()
var
handler
=
new
Handler
()
...
@@ -778,25 +774,33 @@ class Shadowsocks
...
@@ -778,25 +774,33 @@ class Shadowsocks
prepared
=
false
prepared
=
false
}
}
protected
override
def
onResume
()
{
private
def
stateUpdate
()
{
super
.
onResume
()
if
(
bgService
!=
null
)
{
if
(
bgService
!=
null
)
{
bgService
.
getState
match
{
bgService
.
getState
match
{
case
State
.
CONNECTING
=>
case
State
.
CONNECTING
=>
fab
.
setBackgroundTintList
(
greyTint
);
fabProgressCircle
.
show
()
fabProgressCircle
.
show
()
changeSwitch
(
checked
=
true
)
changeSwitch
(
checked
=
true
)
case
State
.
CONNECTED
=>
case
State
.
CONNECTED
=>
fab
.
setBackgroundTintList
(
greenTint
);
fabProgressCircle
.
hide
()
fabProgressCircle
.
hide
()
changeSwitch
(
checked
=
true
)
changeSwitch
(
checked
=
true
)
case
State
.
STOPPING
=>
case
State
.
STOPPING
=>
fab
.
setBackgroundTintList
(
greyTint
);
fabProgressCircle
.
show
()
fabProgressCircle
.
show
()
changeSwitch
(
checked
=
false
)
changeSwitch
(
checked
=
false
)
case
_
=>
case
_
=>
fab
.
setBackgroundTintList
(
greyTint
);
fabProgressCircle
.
hide
()
fabProgressCircle
.
hide
()
changeSwitch
(
checked
=
false
)
changeSwitch
(
checked
=
false
)
}
}
state
=
bgService
.
getState
state
=
bgService
.
getState
}
}
}
protected
override
def
onResume
()
{
super
.
onResume
()
stateUpdate
()
ConfigUtils
.
refresh
(
this
)
ConfigUtils
.
refresh
(
this
)
// Check if profile list changed
// Check if profile list changed
...
@@ -1022,11 +1026,13 @@ class Shadowsocks
...
@@ -1022,11 +1026,13 @@ class Shadowsocks
handler
.
post
(()
=>
if
(
state
!=
s
)
{
handler
.
post
(()
=>
if
(
state
!=
s
)
{
s
match
{
s
match
{
case
State
.
CONNECTING
=>
case
State
.
CONNECTING
=>
fab
.
setBackgroundTintList
(
greyTint
);
fab
.
setImageResource
(
R
.
drawable
.
ic_cloud_queue
)
fab
.
setImageResource
(
R
.
drawable
.
ic_cloud_queue
)
fab
.
setEnabled
(
false
)
fab
.
setEnabled
(
false
)
fabProgressCircle
.
show
()
fabProgressCircle
.
show
()
setPreferenceEnabled
(
enabled
=
false
)
setPreferenceEnabled
(
enabled
=
false
)
case
State
.
CONNECTED
=>
case
State
.
CONNECTED
=>
fab
.
setBackgroundTintList
(
greenTint
);
if
(
state
==
State
.
CONNECTING
)
{
if
(
state
==
State
.
CONNECTING
)
{
fabProgressCircle
.
beginFinalAnimation
()
fabProgressCircle
.
beginFinalAnimation
()
}
else
{
}
else
{
...
@@ -1036,6 +1042,7 @@ class Shadowsocks
...
@@ -1036,6 +1042,7 @@ class Shadowsocks
changeSwitch
(
checked
=
true
)
changeSwitch
(
checked
=
true
)
setPreferenceEnabled
(
enabled
=
false
)
setPreferenceEnabled
(
enabled
=
false
)
case
State
.
STOPPED
=>
case
State
.
STOPPED
=>
fab
.
setBackgroundTintList
(
greyTint
);
handler
.
postDelayed
(()
=>
fabProgressCircle
.
hide
(),
1000
)
handler
.
postDelayed
(()
=>
fabProgressCircle
.
hide
(),
1000
)
fab
.
setEnabled
(
true
)
fab
.
setEnabled
(
true
)
changeSwitch
(
checked
=
false
)
changeSwitch
(
checked
=
false
)
...
@@ -1043,6 +1050,7 @@ class Shadowsocks
...
@@ -1043,6 +1050,7 @@ class Shadowsocks
getString
(
R
.
string
.
vpn_error
).
formatLocal
(
Locale
.
ENGLISH
,
m
),
Snackbar
.
LENGTH_LONG
).
show
getString
(
R
.
string
.
vpn_error
).
formatLocal
(
Locale
.
ENGLISH
,
m
),
Snackbar
.
LENGTH_LONG
).
show
setPreferenceEnabled
(
enabled
=
true
)
setPreferenceEnabled
(
enabled
=
true
)
case
State
.
STOPPING
=>
case
State
.
STOPPING
=>
fab
.
setBackgroundTintList
(
greyTint
);
fab
.
setImageResource
(
R
.
drawable
.
ic_cloud_queue
)
fab
.
setImageResource
(
R
.
drawable
.
ic_cloud_queue
)
fab
.
setEnabled
(
false
)
fab
.
setEnabled
(
false
)
fabProgressCircle
.
show
()
fabProgressCircle
.
show
()
...
...
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