Skip to content

Commit

Permalink
show GameAboutDialog when long click on game
Browse files Browse the repository at this point in the history
  • Loading branch information
Ishan09811 authored May 4, 2024
1 parent f1414a7 commit 060d6ff
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ class GameAdapter(private val activity: AppCompatActivity) :
.setPositiveButton(android.R.string.ok, null)
.show()
} else {
val action = CheatsFragmentDirections.actionGlobalCheatsFragment(holder.game.titleId)
view.findNavController().navigate(action)
showGameAboutDialog()
}
return true
}
Expand Down Expand Up @@ -185,6 +184,19 @@ class GameAdapter(private val activity: AppCompatActivity) :
}
}

private fun showGameAboutDialog() {
val bottomSheetView = layoutInflater.inflate(R.layout.game_about_dialog, null)

val bottomSheetDialog = BottomSheetDialog(requireContext())
bottomSheetDialog.setContentView(bottomSheetView)

binding.gameTitle.text = game.title
binding.gameAuthor.text = game.company
GameIconUtils.loadGameIcon(activity, game, binding.gameIcon)

bottomSheetDialog.show()
}

private fun isValidGame(extension: String): Boolean {
return Game.badExtensions.stream()
.noneMatch { extension == it.lowercase() }
Expand Down

0 comments on commit 060d6ff

Please sign in to comment.