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
import androidx.core.content.ContextCompat
import androidx.core.net.toUri
import androidx.core.view.GravityCompat
import androidx.core.view.updateLayoutParams
import androidx.drawerlayout.widget.DrawerLayout
import androidx.preference.PreferenceDataStore
import com.crashlytics.android.Crashlytics
......@@ -57,7 +56,6 @@ import com.github.shadowsocks.widget.ServiceButton
import com.github.shadowsocks.widget.StatsBar
import com.google.android.material.navigation.NavigationView
import com.google.android.material.snackbar.Snackbar
import kotlin.math.roundToInt
class MainActivity : AppCompatActivity(), ShadowsocksConnection.Interface, OnPreferenceDataStoreChangeListener,
NavigationView.OnNavigationItemSelectedListener {
......@@ -76,9 +74,7 @@ class MainActivity : AppCompatActivity(), ShadowsocksConnection.Interface, OnPre
val snackbar by lazy { findViewById<CoordinatorLayout>(R.id.snackbar) }
fun snackbar(text: CharSequence = "") = Snackbar.make(snackbar, text, Snackbar.LENGTH_LONG).apply {
view.updateLayoutParams<CoordinatorLayout.LayoutParams> {
bottomMargin += snackbar.measuredHeight - fab.top - fab.translationY.roundToInt()
}
view.translationY += fab.top + fab.translationY - snackbar.measuredHeight
}
private val customTabsIntent by lazy {
......
......@@ -25,7 +25,7 @@ android {
dependencies {
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"
testImplementation "junit:junit:$junitVersion"
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