Fix kotlin nullable errors in Settings

Fix kotlin nullable errors that were exposed by setting the retention
of android.annotation.NonNull and android.annotation.Nullable to
class retention.

Bug: 294110802
Test: builds
Change-Id: I6aa0516fa4f6443b6d4dff873baf3b08ff9189f0
This commit is contained in:
Colin Cross
2023-08-14 12:29:02 -07:00
parent beea9e488d
commit 87b870a090
12 changed files with 25 additions and 23 deletions

View File

@@ -65,7 +65,7 @@ abstract class RemoteAuthEnrollBase(
abstract fun initializeSecondaryFooterButton(): FooterButton?
private fun initializeFooterbarMixin(view: View) {
val footerBarMixin = getGlifLayout(view).getMixin(FooterBarMixin::class.java)
val footerBarMixin = checkNotNull(getGlifLayout(view)).getMixin(FooterBarMixin::class.java)
primaryFooterButton.also { footerBarMixin.primaryButton = it }
secondaryFooterButton?.also { footerBarMixin.secondaryButton = it }
footerBarMixin.getButtonContainer().setBackgroundColor(getBackgroundColor())
@@ -80,4 +80,4 @@ abstract class RemoteAuthEnrollBase(
private companion object{
const val TAG = "RemoteAuthEnrollBase"
}
}
}

View File

@@ -38,13 +38,15 @@ import com.android.settings.R
import com.android.settingslib.widget.LottieColorUtils
class IntroductionImageCarousel : ConstraintLayout {
private val carousel: ViewPager2 by lazy { findViewById<ViewPager2>(R.id.image_carousel) }
private val carousel: ViewPager2 by lazy { requireViewById<ViewPager2>(R.id.image_carousel) }
private val progressIndicator: RecyclerView by lazy {
findViewById<RecyclerView>(R.id.carousel_progress_indicator)
requireViewById<RecyclerView>(R.id.carousel_progress_indicator)
}
private val backArrow: ImageView by lazy {
requireViewById<ImageView>(R.id.carousel_back_arrow)
}
private val backArrow: ImageView by lazy { findViewById<ImageView>(R.id.carousel_back_arrow) }
private val forwardArrow: ImageView by lazy {
findViewById<ImageView>(R.id.carousel_forward_arrow)
requireViewById<ImageView>(R.id.carousel_forward_arrow)
}
private val progressIndicatorAdapter = ProgressIndicatorAdapter()
// The index of the current animation we are on
@@ -156,4 +158,4 @@ class IntroductionImageCarousel : ConstraintLayout {
)
const val TAG = "RemoteAuthCarousel"
}
}
}

View File

@@ -71,7 +71,7 @@ class RemoteAuthEnrollIntroduction :
}
private fun initializeRequireScrollMixin(view: View) {
val layout = getGlifLayout(view)
val layout = checkNotNull(getGlifLayout(view))
secondaryFooterButton?.visibility = View.INVISIBLE
val requireScrollMixin = layout.getMixin(RequireScrollMixin::class.java)
requireScrollMixin.requireScrollWithButton(requireContext(), primaryFooterButton,
@@ -89,4 +89,4 @@ class RemoteAuthEnrollIntroduction :
private companion object {
const val TAG = "RemoteAuthEnrollIntro"
}
}
}