Skip to content

Commit

Permalink
make prop nullable (#6073)
Browse files Browse the repository at this point in the history
Signed-off-by: parneet-guraya <[email protected]>
  • Loading branch information
parneet-guraya authored Dec 24, 2024
1 parent e7864ac commit 86cdf96
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import fr.free.nrw.commons.di.CommonsDaggerSupportFragment
* The base fragment of the fragments in upload
*/
abstract class UploadBaseFragment : CommonsDaggerSupportFragment() {
lateinit var callback: Callback
var callback: Callback? = null

protected open fun onBecameVisible() = Unit

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ class UploadCategoriesFragment : UploadBaseFragment(), CategoriesContract.View {
if (media == null) {
if (callback != null) {
binding!!.tvTitle.text = getString(
R.string.step_count, callback.getIndexInViewFlipper(
R.string.step_count, callback!!.getIndexInViewFlipper(
this
) + 1,
callback.totalNumberOfSteps, getString(R.string.categories_activity_title)
callback!!.totalNumberOfSteps, getString(R.string.categories_activity_title)
)
}
} else {
Expand Down Expand Up @@ -220,7 +220,7 @@ class UploadCategoriesFragment : UploadBaseFragment(), CategoriesContract.View {
}

override fun goToNextScreen() {
callback.onNextButtonClicked(callback.getIndexInViewFlipper(this))
callback!!.onNextButtonClicked(callback!!.getIndexInViewFlipper(this))
}

override fun showNoCategorySelected() {
Expand Down Expand Up @@ -322,7 +322,7 @@ class UploadCategoriesFragment : UploadBaseFragment(), CategoriesContract.View {
mediaDetailFragment.onResume()
goBackToPreviousScreen()
} else {
callback.onPreviousButtonClicked(callback.getIndexInViewFlipper(this))
callback!!.onPreviousButtonClicked(callback!!.getIndexInViewFlipper(this))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ class DepictsFragment : UploadBaseFragment(), DepictsContract.View {
if (media == null) {
binding.depictsTitle.text =
String.format(
getString(R.string.step_count), callback.getIndexInViewFlipper(
getString(R.string.step_count), callback!!.getIndexInViewFlipper(
this
) + 1,
callback.totalNumberOfSteps, getString(R.string.depicts_step_title)
callback!!.totalNumberOfSteps, getString(R.string.depicts_step_title)
)
} else {
binding.depictsTitle.setText(R.string.edit_depictions)
Expand Down Expand Up @@ -173,11 +173,11 @@ class DepictsFragment : UploadBaseFragment(), DepictsContract.View {
}

override fun goToNextScreen() {
callback.onNextButtonClicked(callback.getIndexInViewFlipper(this))
callback!!.onNextButtonClicked(callback!!.getIndexInViewFlipper(this))
}

override fun goToPreviousScreen() {
callback.onPreviousButtonClicked(callback.getIndexInViewFlipper(this))
callback!!.onPreviousButtonClicked(callback!!.getIndexInViewFlipper(this))
}

override fun noDepictionSelected() {
Expand Down Expand Up @@ -338,7 +338,7 @@ class DepictsFragment : UploadBaseFragment(), DepictsContract.View {
updateDepicts()
goBackToPreviousScreen()
} else {
callback.onPreviousButtonClicked(callback.getIndexInViewFlipper(this))
callback!!.onPreviousButtonClicked(callback!!.getIndexInViewFlipper(this))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,20 @@ class MediaLicenseFragment : UploadBaseFragment(), MediaLicenseContract.View {

binding.tvTitle.text = getString(
R.string.step_count,
callback.getIndexInViewFlipper(this) + 1,
callback.totalNumberOfSteps,
callback!!.getIndexInViewFlipper(this) + 1,
callback!!.totalNumberOfSteps,
getString(R.string.license_step_title)
)
setTvSubTitle()
binding.btnPrevious.setOnClickListener {
callback.onPreviousButtonClicked(
callback.getIndexInViewFlipper(this)
callback!!.onPreviousButtonClicked(
callback!!.getIndexInViewFlipper(this)
)
}

binding.btnSubmit.setOnClickListener {
callback.onNextButtonClicked(
callback.getIndexInViewFlipper(this)
callback!!.onNextButtonClicked(
callback!!.getIndexInViewFlipper(this)
)
}

Expand Down Expand Up @@ -201,6 +201,6 @@ class MediaLicenseFragment : UploadBaseFragment(), MediaLicenseContract.View {
* Show the wlm info message if the upload is a WLM upload
*/
binding.llInfoMonumentUpload.visibility =
if (callback.isWLMUpload && presenter.isWLMSupportedForThisPlace()) View.VISIBLE else View.GONE
if (callback!!.isWLMUpload && presenter.isWLMSupportedForThisPlace()) View.VISIBLE else View.GONE
}
}

0 comments on commit 86cdf96

Please sign in to comment.