Skip to content

Commit 08a4022

Browse files
dbrantWilliamrai
andauthored
Follow-up to navigationAwareSnackbar. (#5858)
Co-authored-by: William Rai <[email protected]>
1 parent 1915f60 commit 08a4022

File tree

1 file changed

+2
-25
lines changed

1 file changed

+2
-25
lines changed

app/src/main/java/org/wikipedia/util/FeedbackUtil.kt

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import android.content.Context
55
import android.content.Intent
66
import android.graphics.Rect
77
import android.net.Uri
8-
import android.provider.Settings
98
import android.view.Gravity
109
import android.view.LayoutInflater
1110
import 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

Comments
 (0)