Added null safety

This commit is contained in:
h4h13 2020-03-01 18:58:51 +05:30
parent 3e655ffc70
commit fdee056ade
3 changed files with 5 additions and 5 deletions

View file

@ -39,8 +39,8 @@ abstract class AbsLibraryPagerRecyclerViewCustomGridSizeFragment<A : RecyclerVie
private val maxGridSizeForList: Int private val maxGridSizeForList: Int
get() = if (isLandscape) { get() = if (isLandscape) {
activity!!.resources.getInteger(R.integer.default_list_columns_land) resources.getInteger(R.integer.default_list_columns_land)
} else activity!!.resources.getInteger(R.integer.default_list_columns) } else resources.getInteger(R.integer.default_list_columns)
fun getGridSize(): Int { fun getGridSize(): Int {
if (gridSize == 0) { if (gridSize == 0) {

View file

@ -152,7 +152,7 @@ class TinyPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Ca
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
title.isSelected = true title.isSelected = true
progressBar.setOnClickListener(PlayPauseButtonOnClickHandler()) progressBar.setOnClickListener(PlayPauseButtonOnClickHandler())
progressBar.setOnTouchListener(MiniPlayerFragment.FlingPlayBackController(activity!!)) progressBar.setOnTouchListener(MiniPlayerFragment.FlingPlayBackController(requireContext()))
setUpPlayerToolbar() setUpPlayerToolbar()
setUpSubFragments() setUpSubFragments()
@ -169,7 +169,7 @@ class TinyPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Ca
private fun setUpPlayerToolbar() { private fun setUpPlayerToolbar() {
playerToolbar.apply { playerToolbar.apply {
inflateMenu(R.menu.menu_player) inflateMenu(R.menu.menu_player)
setNavigationOnClickListener { activity!!.onBackPressed() } setNavigationOnClickListener { requireActivity().onBackPressed() }
setOnMenuItemClickListener(this@TinyPlayerFragment) setOnMenuItemClickListener(this@TinyPlayerFragment)
} }
} }

View file

@ -37,7 +37,7 @@ class NowPlayingSettingsFragment : AbsSettingsFragment(),
val carouselEffect: TwoStatePreference = findPreference("carousel_effect")!! val carouselEffect: TwoStatePreference = findPreference("carousel_effect")!!
carouselEffect.setOnPreferenceChangeListener { _, newValue -> carouselEffect.setOnPreferenceChangeListener { _, newValue ->
if (newValue as Boolean && !App.isProVersion()) { if (newValue as Boolean && !App.isProVersion()) {
showProToastAndNavigate(activity!!.getString(R.string.pref_title_toggle_carousel_effect)) showProToastAndNavigate(getString(R.string.pref_title_toggle_carousel_effect))
return@setOnPreferenceChangeListener false return@setOnPreferenceChangeListener false
} }
return@setOnPreferenceChangeListener true return@setOnPreferenceChangeListener true