android: Fix alignment of SwipeRefreshLayout

This commit is contained in:
Charles Lombardo 2023-04-26 03:41:23 -04:00 committed by bunnei
parent 388dc0757f
commit 986f858e6f
1 changed files with 9 additions and 5 deletions

View File

@ -7,6 +7,7 @@ import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.view.ViewGroup.MarginLayoutParams
import androidx.activity.OnBackPressedCallback import androidx.activity.OnBackPressedCallback
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat import androidx.core.view.ViewCompat
@ -194,11 +195,9 @@ class GamesFragment : Fragment() {
val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars()) val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars())
val extraListSpacing = resources.getDimensionPixelSize(R.dimen.spacing_med) val extraListSpacing = resources.getDimensionPixelSize(R.dimen.spacing_med)
view.setPadding( view.updatePadding(
insets.left, top = insets.top + resources.getDimensionPixelSize(R.dimen.spacing_search),
insets.top + resources.getDimensionPixelSize(R.dimen.spacing_search), bottom = insets.bottom + resources.getDimensionPixelSize(R.dimen.spacing_navigation) + extraListSpacing
insets.right,
insets.bottom + resources.getDimensionPixelSize(R.dimen.spacing_navigation) + extraListSpacing
) )
binding.gridSearch.updatePadding( binding.gridSearch.updatePadding(
left = insets.left, left = insets.left,
@ -216,6 +215,11 @@ class GamesFragment : Fragment() {
insets.top + resources.getDimensionPixelSize(R.dimen.spacing_refresh_end) insets.top + resources.getDimensionPixelSize(R.dimen.spacing_refresh_end)
) )
val mlpSwipe = binding.swipeRefresh.layoutParams as MarginLayoutParams
mlpSwipe.rightMargin = insets.right
mlpSwipe.leftMargin = insets.left
binding.swipeRefresh.layoutParams = mlpSwipe
windowInsets windowInsets
} }
} }