Fix more 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: I2923b3552aaee75a2c5b1ebd9c7fbee882fe4cae
This commit is contained in:
@@ -42,11 +42,11 @@ class RemoteAuthEnrollEnrolling :
|
||||
private val viewModel = RemoteAuthEnrollEnrollingViewModel()
|
||||
private val adapter = RemoteAuthEnrollEnrollingRecyclerViewAdapter()
|
||||
private val progressBar by lazy {
|
||||
view!!.findViewById<ProgressBar>(R.id.enrolling_list_progress_bar)
|
||||
view!!.requireViewById<ProgressBar>(R.id.enrolling_list_progress_bar)
|
||||
}
|
||||
private val errorText by lazy { view!!.findViewById<TextView>(R.id.error_text) }
|
||||
private val errorText by lazy { view!!.requireViewById<TextView>(R.id.error_text) }
|
||||
private val recyclerView by lazy {
|
||||
view!!.findViewById<RecyclerView>(R.id.discovered_authenticator_list)
|
||||
view!!.requireViewById<RecyclerView>(R.id.discovered_authenticator_list)
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
@@ -124,4 +124,4 @@ class RemoteAuthEnrollEnrolling :
|
||||
errorText.text = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -46,8 +46,8 @@ class RemoteAuthEnrollEnrollingRecyclerViewAdapter :
|
||||
override fun getItemCount() = uiStates.size
|
||||
|
||||
class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
private val titleTextView: TextView = view.findViewById(R.id.discovered_authenticator_name)
|
||||
private val selectButton: ImageView = view.findViewById(R.id.authenticator_radio_button)
|
||||
private val titleTextView: TextView = view.requireViewById(R.id.discovered_authenticator_name)
|
||||
private val selectButton: ImageView = view.requireViewById(R.id.authenticator_radio_button)
|
||||
private val checkedDrawable =
|
||||
view.context.getDrawable(R.drawable.ic_radio_button_checked_black_24dp)
|
||||
private val uncheckedDrawable =
|
||||
@@ -63,4 +63,4 @@ class RemoteAuthEnrollEnrollingRecyclerViewAdapter :
|
||||
selectButton.setOnClickListener { discoveredAuthenticatorUiState.onSelect() }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -34,11 +34,11 @@ class RemoteAuthSettings : Fragment(R.layout.remote_auth_settings) {
|
||||
val viewModel = RemoteAuthSettingsViewModel()
|
||||
private val adapter = RemoteAuthSettingsRecyclerViewAdapter()
|
||||
private val recyclerView by lazy {
|
||||
view!!.findViewById<RecyclerView>(R.id.registered_authenticator_list)
|
||||
view!!.requireViewById<RecyclerView>(R.id.registered_authenticator_list)
|
||||
}
|
||||
|
||||
private val addAuthenticatorLayout by lazy {
|
||||
view!!.findViewById<ConstraintLayout>(R.id.add_authenticator_layout)
|
||||
view!!.requireViewById<ConstraintLayout>(R.id.add_authenticator_layout)
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
@@ -65,4 +65,4 @@ class RemoteAuthSettings : Fragment(R.layout.remote_auth_settings) {
|
||||
adapter.uiStates = uiState.registeredAuthenticatorUiStates
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -46,12 +46,12 @@ class RemoteAuthSettingsRecyclerViewAdapter() :
|
||||
override fun getItemCount() = uiStates.size
|
||||
|
||||
class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
private val titleTextView: TextView = view.findViewById(R.id.authenticator_name_text)
|
||||
private val unregisterButton: ImageView = view.findViewById(R.id.remove_icon)
|
||||
private val titleTextView: TextView = view.requireViewById(R.id.authenticator_name_text)
|
||||
private val unregisterButton: ImageView = view.requireViewById(R.id.remove_icon)
|
||||
|
||||
fun bind(authenticatorUiState: RemoteAuthAuthenticatorItemUiState) {
|
||||
titleTextView.text = authenticatorUiState.name
|
||||
unregisterButton.setOnClickListener { authenticatorUiState.unregister() }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user