Commit 0cee695f authored by Mygod's avatar Mygod

Fix bottom app bar

This version introduces another crash on Android 9.0.
parent e6f11d66
...@@ -39,7 +39,6 @@ import androidx.coordinatorlayout.widget.CoordinatorLayout ...@@ -39,7 +39,6 @@ import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.core.net.toUri import androidx.core.net.toUri
import androidx.core.view.GravityCompat import androidx.core.view.GravityCompat
import androidx.core.view.updateLayoutParams
import androidx.drawerlayout.widget.DrawerLayout import androidx.drawerlayout.widget.DrawerLayout
import androidx.preference.PreferenceDataStore import androidx.preference.PreferenceDataStore
import com.crashlytics.android.Crashlytics import com.crashlytics.android.Crashlytics
...@@ -57,7 +56,6 @@ import com.github.shadowsocks.widget.ServiceButton ...@@ -57,7 +56,6 @@ import com.github.shadowsocks.widget.ServiceButton
import com.github.shadowsocks.widget.StatsBar import com.github.shadowsocks.widget.StatsBar
import com.google.android.material.navigation.NavigationView import com.google.android.material.navigation.NavigationView
import com.google.android.material.snackbar.Snackbar import com.google.android.material.snackbar.Snackbar
import kotlin.math.roundToInt
class MainActivity : AppCompatActivity(), ShadowsocksConnection.Interface, OnPreferenceDataStoreChangeListener, class MainActivity : AppCompatActivity(), ShadowsocksConnection.Interface, OnPreferenceDataStoreChangeListener,
NavigationView.OnNavigationItemSelectedListener { NavigationView.OnNavigationItemSelectedListener {
...@@ -76,9 +74,7 @@ class MainActivity : AppCompatActivity(), ShadowsocksConnection.Interface, OnPre ...@@ -76,9 +74,7 @@ class MainActivity : AppCompatActivity(), ShadowsocksConnection.Interface, OnPre
val snackbar by lazy { findViewById<CoordinatorLayout>(R.id.snackbar) } val snackbar by lazy { findViewById<CoordinatorLayout>(R.id.snackbar) }
fun snackbar(text: CharSequence = "") = Snackbar.make(snackbar, text, Snackbar.LENGTH_LONG).apply { fun snackbar(text: CharSequence = "") = Snackbar.make(snackbar, text, Snackbar.LENGTH_LONG).apply {
view.updateLayoutParams<CoordinatorLayout.LayoutParams> { view.translationY += fab.top + fab.translationY - snackbar.measuredHeight
bottomMargin += snackbar.measuredHeight - fab.top - fab.translationY.roundToInt()
}
} }
private val customTabsIntent by lazy { private val customTabsIntent by lazy {
......
...@@ -25,7 +25,7 @@ android { ...@@ -25,7 +25,7 @@ android {
dependencies { dependencies {
api "androidx.core:core-ktx:$androidxVersion" api "androidx.core:core-ktx:$androidxVersion"
api "com.google.android.material:material:$androidxVersion" api "com.google.android.material:material:1.1.0-alpha01"
api "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion" api "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
testImplementation "junit:junit:$junitVersion" testImplementation "junit:junit:$junitVersion"
androidTestImplementation "androidx.test:runner:$androidTestVersion" androidTestImplementation "androidx.test:runner:$androidTestVersion"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment