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
get() = if (isLandscape) {
activity!!.resources.getInteger(R.integer.default_list_columns_land)
} else activity!!.resources.getInteger(R.integer.default_list_columns)
resources.getInteger(R.integer.default_list_columns_land)
} else resources.getInteger(R.integer.default_list_columns)
fun getGridSize(): Int {
if (gridSize == 0) {

View file

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

View file

@ -37,7 +37,7 @@ class NowPlayingSettingsFragment : AbsSettingsFragment(),
val carouselEffect: TwoStatePreference = findPreference("carousel_effect")!!
carouselEffect.setOnPreferenceChangeListener { _, newValue ->
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 true