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
ed0dba8f
Commit
ed0dba8f
authored
Dec 26, 2016
by
Max Lv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Prevent snackbar overlapping with bottom bar"
This reverts commit
806f4e13
.
parent
a18eb32b
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
15 additions
and
160 deletions
+15
-160
src/main/res/layout/layout_main.xml
src/main/res/layout/layout_main.xml
+10
-14
src/main/res/values-v21/dimen.xml
src/main/res/values-v21/dimen.xml
+1
-1
src/main/res/values/dimen.xml
src/main/res/values/dimen.xml
+1
-1
src/main/scala/com/github/shadowsocks/GlobalConfigFragment.scala
...n/scala/com/github/shadowsocks/GlobalConfigFragment.scala
+1
-1
src/main/scala/com/github/shadowsocks/MainActivity.scala
src/main/scala/com/github/shadowsocks/MainActivity.scala
+2
-2
src/main/scala/com/github/shadowsocks/widget/BottomAwareBehavior.scala
...a/com/github/shadowsocks/widget/BottomAwareBehavior.scala
+0
-43
src/main/scala/com/github/shadowsocks/widget/BottomBehavior.scala
.../scala/com/github/shadowsocks/widget/BottomBehavior.scala
+0
-98
No files found.
src/main/res/layout/layout_main.xml
View file @
ed0dba8f
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
tools:ignore=
"UnknownIdInLayout"
android:clipChildren=
"false"
>
android:clipChildren=
"false"
>
<FrameLayout
android:id=
"@+id/content"
<FrameLayout
android:id=
"@+id/content"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
app:layout_anchor=
"@+id/stat"
android:layout_above=
"@+id/stat"
/>
app:layout_behavior=
"com.github.shadowsocks.widget.BottomAwareBehavior"
/>
<LinearLayout
android:id=
"@+id/stat"
<LinearLayout
android:id=
"@+id/stat"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"bottom"
android:elevation=
"4dp"
android:elevation=
"4dp"
android:paddingStart=
"16dip"
android:paddingStart=
"16dip"
android:paddingEnd=
"16dip"
android:paddingEnd=
"16dip"
...
@@ -22,7 +19,7 @@
...
@@ -22,7 +19,7 @@
android:background=
"@drawable/background_stat"
android:background=
"@drawable/background_stat"
android:orientation=
"vertical"
android:orientation=
"vertical"
android:nextFocusRight=
"@+id/fab"
android:nextFocusRight=
"@+id/fab"
a
pp:layout_behavior=
"com.github.shadowsocks.widget.BottomBehavior
"
>
a
ndroid:layout_alignParentBottom=
"true
"
>
<TextView
android:id=
"@+id/status"
<TextView
android:id=
"@+id/status"
android:textSize=
"16sp"
android:textSize=
"16sp"
android:textColor=
"?android:attr/textColorPrimary"
android:textColor=
"?android:attr/textColorPrimary"
...
@@ -74,15 +71,14 @@
...
@@ -74,15 +71,14 @@
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:elevation=
"6dp"
android:elevation=
"6dp"
app:layout_anchorGravity=
"end"
android:layout_alignTop=
"@+id/stat"
android:layout_alignParentEnd=
"true"
android:layout_marginEnd=
"16dp"
android:layout_marginEnd=
"16dp"
android:layout_marginBottom=
"@dimen/fab_margin_bottom"
android:layout_marginTop=
"@dimen/fab_margin_top"
>
app:layout_behavior=
"com.github.shadowsocks.widget.BottomBehavior"
app:layout_anchor=
"@+id/stat"
>
<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_primary_500"
app:backgroundTint=
"@color/material_primary_500"
app:srcCompat=
"@drawable/ic_start_idle"
app:srcCompat=
"@drawable/ic_start_idle"
app:pressedTranslationZ=
"6dp"
app:borderWidth=
"0dp"
/>
app:pressedTranslationZ=
"6dp"
app:borderWidth=
"0dp"
/>
</com.github.jorgecastilloprz.FABProgressCircle>
</com.github.jorgecastilloprz.FABProgressCircle>
</
android.support.design.widget.Coordinator
Layout>
</
Relative
Layout>
src/main/res/values-v21/dimen.xml
View file @
ed0dba8f
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<resources>
<dimen
name=
"fab_margin_
bottom
"
>
-28dp
</dimen>
<dimen
name=
"fab_margin_
top
"
>
-28dp
</dimen>
</resources>
</resources>
src/main/res/values/dimen.xml
View file @
ed0dba8f
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<resources>
<!-- TODO: Remove when this issue is fixed: https://github.com/JorgeCastilloPrz/FABProgressCircle/issues/19 -->
<!-- TODO: Remove when this issue is fixed: https://github.com/JorgeCastilloPrz/FABProgressCircle/issues/19 -->
<dimen
name=
"fab_margin_
bottom
"
>
-44dp
</dimen>
<dimen
name=
"fab_margin_
top
"
>
-44dp
</dimen>
</resources>
</resources>
src/main/scala/com/github/shadowsocks/GlobalConfigFragment.scala
View file @
ed0dba8f
...
@@ -46,7 +46,7 @@ class GlobalConfigFragment extends PreferenceFragment {
...
@@ -46,7 +46,7 @@ class GlobalConfigFragment extends PreferenceFragment {
val
value
=
v
.
asInstanceOf
[
Boolean
]
val
value
=
v
.
asInstanceOf
[
Boolean
]
val
result
=
TcpFastOpen
.
enabled
(
value
)
val
result
=
TcpFastOpen
.
enabled
(
value
)
if
(
result
!=
null
&&
result
!=
"Success."
)
if
(
result
!=
null
&&
result
!=
"Success."
)
Snackbar
.
make
(
getActivity
.
findViewById
(
R
.
id
.
content
),
result
,
Snackbar
.
LENGTH_LONG
).
show
()
Snackbar
.
make
(
getActivity
.
findViewById
(
android
.
R
.
id
.
content
),
result
,
Snackbar
.
LENGTH_LONG
).
show
()
value
==
TcpFastOpen
.
sendEnabled
value
==
TcpFastOpen
.
sendEnabled
})
})
if
(!
TcpFastOpen
.
supported
)
{
if
(!
TcpFastOpen
.
supported
)
{
...
...
src/main/scala/com/github/shadowsocks/MainActivity.scala
View file @
ed0dba8f
...
@@ -105,7 +105,7 @@ class MainActivity extends Activity with ServiceBoundContext with Drawer.OnDrawe
...
@@ -105,7 +105,7 @@ class MainActivity extends Activity with ServiceBoundContext with Drawer.OnDrawe
fab
.
setEnabled
(
true
)
fab
.
setEnabled
(
true
)
changeSwitch
(
checked
=
false
)
changeSwitch
(
checked
=
false
)
if
(
m
!=
null
)
{
if
(
m
!=
null
)
{
val
snackbar
=
Snackbar
.
make
(
findViewById
(
R
.
id
.
content
),
val
snackbar
=
Snackbar
.
make
(
findViewById
(
android
.
R
.
id
.
content
),
getString
(
R
.
string
.
vpn_error
).
formatLocal
(
Locale
.
ENGLISH
,
m
),
Snackbar
.
LENGTH_LONG
)
getString
(
R
.
string
.
vpn_error
).
formatLocal
(
Locale
.
ENGLISH
,
m
),
Snackbar
.
LENGTH_LONG
)
if
(
m
==
getString
(
R
.
string
.
nat_no_root
))
addDisableNatToSnackbar
(
snackbar
)
if
(
m
==
getString
(
R
.
string
.
nat_no_root
))
addDisableNatToSnackbar
(
snackbar
)
snackbar
.
show
()
snackbar
.
show
()
...
@@ -276,7 +276,7 @@ class MainActivity extends Activity with ServiceBoundContext with Drawer.OnDrawe
...
@@ -276,7 +276,7 @@ class MainActivity extends Activity with ServiceBoundContext with Drawer.OnDrawe
synchronized
(
if
(
serviceStarted
&&
testCount
==
id
&&
app
.
isVpnEnabled
)
handler
.
post
(()
=>
synchronized
(
if
(
serviceStarted
&&
testCount
==
id
&&
app
.
isVpnEnabled
)
handler
.
post
(()
=>
if
(
success
)
statusText
.
setText
(
result
)
else
{
if
(
success
)
statusText
.
setText
(
result
)
else
{
statusText
.
setText
(
R
.
string
.
connection_test_fail
)
statusText
.
setText
(
R
.
string
.
connection_test_fail
)
Snackbar
.
make
(
findViewById
(
R
.
id
.
content
),
result
,
Snackbar
.
LENGTH_LONG
).
show
()
Snackbar
.
make
(
findViewById
(
android
.
R
.
id
.
content
),
result
,
Snackbar
.
LENGTH_LONG
).
show
()
}))
}))
}
}
}
}
...
...
src/main/scala/com/github/shadowsocks/widget/BottomAwareBehavior.scala
deleted
100644 → 0
View file @
a18eb32b
/*******************************************************************************/
/* */
/* Copyright (C) 2016 by Max Lv <max.c.lv@gmail.com> */
/* Copyright (C) 2016 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.widget
import
android.content.Context
import
android.support.design.widget.CoordinatorLayout
import
android.util.AttributeSet
import
android.view.View
/**
* Behavior for content area that's aware of bottom bars.
*
* @author Mygod
*/
class
BottomAwareBehavior
(
context
:
Context
,
attrs
:
AttributeSet
)
extends
CoordinatorLayout
.
Behavior
[
View
](
context
,
attrs
)
{
override
def
onDependentViewChanged
(
parent
:
CoordinatorLayout
,
child
:
View
,
dependency
:
View
)
:
Boolean
=
{
val
params
=
child
.
getLayoutParams
.
asInstanceOf
[
CoordinatorLayout.LayoutParams
]
val
margin
=
parent
.
getHeight
-
dependency
.
getTop
-
dependency
.
getTranslationY
.
toInt
if
(
params
.
bottomMargin
!=
margin
)
{
params
.
bottomMargin
=
margin
true
}
else
false
}
}
src/main/scala/com/github/shadowsocks/widget/BottomBehavior.scala
deleted
100644 → 0
View file @
a18eb32b
/*******************************************************************************/
/* */
/* Copyright (C) 2016 by Max Lv <max.c.lv@gmail.com> */
/* Copyright (C) 2016 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.widget
import
android.animation.ValueAnimator
import
android.content.Context
import
android.support.design.widget.CoordinatorLayout
import
android.support.design.widget.Snackbar.SnackbarLayout
import
android.support.v4.view.animation.FastOutSlowInInterpolator
import
android.util.AttributeSet
import
android.view.View
import
scala.collection.JavaConverters._
/**
* A SnackbarLayout-aware behavior.
*
* TODO: What happened to the animations?
*
* @author Mygod
*/
class
BottomBehavior
(
context
:
Context
,
attrs
:
AttributeSet
)
extends
CoordinatorLayout
.
Behavior
[
View
](
context
,
attrs
)
{
private
var
translationYAnimator
:
ValueAnimator
=
_
private
var
translationY
:
Float
=
_
override
def
layoutDependsOn
(
parent
:
CoordinatorLayout
,
child
:
View
,
dependency
:
View
)
:
Boolean
=
dependency
match
{
case
_:
SnackbarLayout
=>
true
case
_
=>
super
.
layoutDependsOn
(
parent
,
child
,
dependency
)
}
override
def
onDependentViewChanged
(
parent
:
CoordinatorLayout
,
child
:
View
,
dependency
:
View
)
:
Boolean
=
{
dependency
match
{
case
_:
SnackbarLayout
=>
var
targetTransY
=
parent
.
getDependencies
(
child
).
asScala
.
filter
(
view
=>
view
.
isInstanceOf
[
SnackbarLayout
]
&&
parent
.
doViewsOverlap
(
child
,
view
))
.
map
(
view
=>
view
.
getTranslationY
-
view
.
getHeight
).
reduceOption
(
_
min
_
).
getOrElse
(
0F
)
if
(
targetTransY
>
0
)
targetTransY
=
0
if
(
translationY
!=
targetTransY
)
{
val
currentTransY
=
child
.
getTranslationY
if
(
translationYAnimator
!=
null
&&
translationYAnimator
.
isRunning
)
translationYAnimator
.
cancel
()
if
(
child
.
isShown
&&
Math
.
abs
(
currentTransY
-
targetTransY
)
>
child
.
getHeight
*
0.667F
)
{
if
(
translationYAnimator
==
null
)
{
translationYAnimator
=
new
ValueAnimator
translationYAnimator
.
setInterpolator
(
new
FastOutSlowInInterpolator
())
translationYAnimator
.
addUpdateListener
(
animation
=>
child
.
setTranslationY
(
animation
.
getAnimatedValue
.
asInstanceOf
[
Float
]))
}
translationYAnimator
.
setFloatValues
(
currentTransY
,
targetTransY
)
translationYAnimator
.
start
()
}
else
child
.
setTranslationY
(
targetTransY
)
translationY
=
targetTransY
}
true
case
_
=>
super
.
onDependentViewChanged
(
parent
,
child
,
dependency
)
}
}
override
def
onDependentViewRemoved
(
parent
:
CoordinatorLayout
,
child
:
View
,
dependency
:
View
)
:
Unit
=
{
dependency
match
{
case
_:
SnackbarLayout
=>
if
(
translationY
!=
0
)
{
val
currentTransY
=
child
.
getTranslationY
if
(
translationYAnimator
!=
null
&&
translationYAnimator
.
isRunning
)
translationYAnimator
.
cancel
()
if
(
child
.
isShown
&&
Math
.
abs
(
currentTransY
)
>
child
.
getHeight
*
0.667F
)
{
if
(
translationYAnimator
==
null
)
{
translationYAnimator
=
new
ValueAnimator
translationYAnimator
.
setInterpolator
(
new
FastOutSlowInInterpolator
())
translationYAnimator
.
addUpdateListener
(
animation
=>
child
.
setTranslationY
(
animation
.
getAnimatedValue
.
asInstanceOf
[
Float
]))
}
translationYAnimator
.
setFloatValues
(
currentTransY
,
0
)
translationYAnimator
.
start
()
}
else
child
.
setTranslationY
(
0
)
translationY
=
0
}
parent
.
dispatchDependentViewsChanged
(
child
)
}
super
.
onDependentViewRemoved
(
parent
,
child
,
dependency
)
}
}
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