forked from eden-emu/eden
style: format code and remove unused imports in GamesFragment
This commit is contained in:
parent
f71872d937
commit
9838ebaef9
1 changed files with 10 additions and 11 deletions
|
@ -7,20 +7,13 @@ import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.Gravity
|
|
||||||
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.ViewTreeObserver
|
|
||||||
import android.view.inputmethod.InputMethodManager
|
import android.view.inputmethod.InputMethodManager
|
||||||
import android.widget.ImageButton
|
|
||||||
import android.widget.PopupMenu
|
import android.widget.PopupMenu
|
||||||
import android.widget.TextView
|
|
||||||
import androidx.activity.result.contract.ActivityResultContracts
|
import androidx.activity.result.contract.ActivityResultContracts
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.compose.ui.graphics.Color
|
|
||||||
import androidx.compose.ui.graphics.toArgb
|
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
import androidx.core.view.ViewCompat
|
import androidx.core.view.ViewCompat
|
||||||
import androidx.core.view.WindowInsetsCompat
|
import androidx.core.view.WindowInsetsCompat
|
||||||
import androidx.core.view.updatePadding
|
import androidx.core.view.updatePadding
|
||||||
|
@ -111,7 +104,7 @@ class GamesFragment : Fragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
gameAdapter = GameAdapter(
|
gameAdapter = GameAdapter(
|
||||||
requireActivity() as AppCompatActivity,
|
requireActivity() as AppCompatActivity
|
||||||
)
|
)
|
||||||
|
|
||||||
applyGridGamesBinding()
|
applyGridGamesBinding()
|
||||||
|
@ -238,7 +231,9 @@ class GamesFragment : Fragment() {
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
if (getCurrentViewType() == GameAdapter.VIEW_TYPE_CAROUSEL) {
|
if (getCurrentViewType() == GameAdapter.VIEW_TYPE_CAROUSEL) {
|
||||||
(binding.gridGames as? CarouselRecyclerView)?.restoreScrollState(gamesViewModel.lastScrollPosition)
|
(binding.gridGames as? CarouselRecyclerView)?.restoreScrollState(
|
||||||
|
gamesViewModel.lastScrollPosition
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -389,7 +384,9 @@ class GamesFragment : Fragment() {
|
||||||
|
|
||||||
val searchTerm = binding.searchText.text.toString().lowercase(Locale.getDefault())
|
val searchTerm = binding.searchText.text.toString().lowercase(Locale.getDefault())
|
||||||
if (searchTerm.isEmpty()) {
|
if (searchTerm.isEmpty()) {
|
||||||
((binding.gridGames as? RecyclerView)?.adapter as? GameAdapter)?.submitList(filteredList)
|
((binding.gridGames as? RecyclerView)?.adapter as? GameAdapter)?.submitList(
|
||||||
|
filteredList
|
||||||
|
)
|
||||||
gamesViewModel.setFilteredGames(filteredList)
|
gamesViewModel.setFilteredGames(filteredList)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -464,7 +461,9 @@ class GamesFragment : Fragment() {
|
||||||
// Always set margin as original + insets
|
// Always set margin as original + insets
|
||||||
mlpHeader.leftMargin = (originalHeaderLeftMargin ?: 0) + leftInset
|
mlpHeader.leftMargin = (originalHeaderLeftMargin ?: 0) + leftInset
|
||||||
mlpHeader.rightMargin = (originalHeaderRightMargin ?: 0) + rightInset
|
mlpHeader.rightMargin = (originalHeaderRightMargin ?: 0) + rightInset
|
||||||
mlpHeader.topMargin = (originalHeaderTopMargin ?: 0) + topInset + resources.getDimensionPixelSize(R.dimen.spacing_med)
|
mlpHeader.topMargin = (originalHeaderTopMargin ?: 0) + topInset + resources.getDimensionPixelSize(
|
||||||
|
R.dimen.spacing_med
|
||||||
|
)
|
||||||
binding.header.layoutParams = mlpHeader
|
binding.header.layoutParams = mlpHeader
|
||||||
|
|
||||||
binding.noticeText.updatePadding(bottom = spacingNavigation)
|
binding.noticeText.updatePadding(bottom = spacingNavigation)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue