diff --git a/src/main/res/layout/layout_main.xml b/src/main/res/layout/layout_main.xml
index de952fa4..20b37318 100644
--- a/src/main/res/layout/layout_main.xml
+++ b/src/main/res/layout/layout_main.xml
@@ -1,18 +1,15 @@
-
+
+ android:layout_above="@+id/stat"/>
+ android:layout_alignParentBottom="true">
+ android:layout_marginTop="@dimen/fab_margin_top">
-
+
diff --git a/src/main/res/values-v21/dimen.xml b/src/main/res/values-v21/dimen.xml
index 4c95daeb..605379c3 100644
--- a/src/main/res/values-v21/dimen.xml
+++ b/src/main/res/values-v21/dimen.xml
@@ -1,4 +1,4 @@
- -28dp
+ -28dp
diff --git a/src/main/res/values/dimen.xml b/src/main/res/values/dimen.xml
index f8e782e7..c11d2a7a 100644
--- a/src/main/res/values/dimen.xml
+++ b/src/main/res/values/dimen.xml
@@ -1,5 +1,5 @@
- -44dp
+ -44dp
diff --git a/src/main/scala/com/github/shadowsocks/GlobalConfigFragment.scala b/src/main/scala/com/github/shadowsocks/GlobalConfigFragment.scala
index f0832964..0a85cf2f 100644
--- a/src/main/scala/com/github/shadowsocks/GlobalConfigFragment.scala
+++ b/src/main/scala/com/github/shadowsocks/GlobalConfigFragment.scala
@@ -46,7 +46,7 @@ class GlobalConfigFragment extends PreferenceFragment {
val value = v.asInstanceOf[Boolean]
val result = TcpFastOpen.enabled(value)
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
})
if (!TcpFastOpen.supported) {
diff --git a/src/main/scala/com/github/shadowsocks/MainActivity.scala b/src/main/scala/com/github/shadowsocks/MainActivity.scala
index 44dbc46b..8b3a64c3 100644
--- a/src/main/scala/com/github/shadowsocks/MainActivity.scala
+++ b/src/main/scala/com/github/shadowsocks/MainActivity.scala
@@ -105,7 +105,7 @@ class MainActivity extends Activity with ServiceBoundContext with Drawer.OnDrawe
fab.setEnabled(true)
changeSwitch(checked = false)
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)
if (m == getString(R.string.nat_no_root)) addDisableNatToSnackbar(snackbar)
snackbar.show()
@@ -276,7 +276,7 @@ class MainActivity extends Activity with ServiceBoundContext with Drawer.OnDrawe
synchronized(if (serviceStarted && testCount == id && app.isVpnEnabled) handler.post(() =>
if (success) statusText.setText(result) else {
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()
}))
}
}
diff --git a/src/main/scala/com/github/shadowsocks/widget/BottomAwareBehavior.scala b/src/main/scala/com/github/shadowsocks/widget/BottomAwareBehavior.scala
deleted file mode 100644
index 309ab2e6..00000000
--- a/src/main/scala/com/github/shadowsocks/widget/BottomAwareBehavior.scala
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************/
-/* */
-/* Copyright (C) 2016 by Max Lv */
-/* Copyright (C) 2016 by Mygod Studio */
-/* */
-/* 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 . */
-/* */
-/*******************************************************************************/
-
-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
- }
-}
diff --git a/src/main/scala/com/github/shadowsocks/widget/BottomBehavior.scala b/src/main/scala/com/github/shadowsocks/widget/BottomBehavior.scala
deleted file mode 100644
index ba37c41a..00000000
--- a/src/main/scala/com/github/shadowsocks/widget/BottomBehavior.scala
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************/
-/* */
-/* Copyright (C) 2016 by Max Lv */
-/* Copyright (C) 2016 by Mygod Studio */
-/* */
-/* 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 . */
-/* */
-/*******************************************************************************/
-
-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)
- }
-}