@@ -5,7 +5,6 @@ import android.content.Context
55import android.content.Intent
66import android.graphics.Rect
77import android.net.Uri
8- import android.provider.Settings
98import android.view.Gravity
109import android.view.LayoutInflater
1110import android.view.View
@@ -156,30 +155,8 @@ object FeedbackUtil {
156155 val snackbar = makeSnackbar(rootView, text, LENGTH_DEFAULT , wikiSite)
157156 val view = snackbar.view
158157 val params = view.layoutParams as ViewGroup .MarginLayoutParams
159- // Navigation types:
160- // 0: 3-button navigation
161- // 1: 2-button navigation
162- // 2: Gesture navigation
163- val navigationType = Settings .Secure .getInt(activity.contentResolver, " navigation_mode" , 0 )
164- val windowInsets = ViewCompat .getRootWindowInsets(rootView)
165-
166- val marginForNavbar = if (windowInsets != null ) {
167- when (navigationType) {
168- 0 , 1 -> {
169- windowInsets.getInsets(WindowInsetsCompat .Type .navigationBars())
170- }
171- else -> {
172- windowInsets.getInsets(WindowInsetsCompat .Type .systemGestures())
173- }
174- }
175- } else null
176-
177- params.setMargins(
178- params.leftMargin,
179- params.topMargin,
180- params.rightMargin,
181- params.bottomMargin + (marginForNavbar?.bottom ? : 0 )
182- )
158+ val marginForNavbar = ViewCompat .getRootWindowInsets(rootView)?.getInsets(WindowInsetsCompat .Type .navigationBars())
159+ params.bottomMargin + = (marginForNavbar?.bottom ? : 0 )
183160 view.layoutParams = params
184161 return snackbar
185162 }
0 commit comments