in automotive/src/main/java/com/example/android/uamp/automotive/UsernameAndPasswordSignInFragment.kt [56:93]
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
val context = requireContext()
toolbar = view.findViewById(R.id.toolbar)
appIcon = view.findViewById(R.id.app_icon)
primaryTextView = view.findViewById(R.id.primary_message)
passwordContainer = view.findViewById(R.id.password_container)
passwordInput = view.findViewById(R.id.password_input)
submitButton = view.findViewById(R.id.submit_button)
footerTextView = view.findViewById(R.id.footer)
toolbar.setNavigationOnClickListener {
requireActivity().supportFragmentManager.popBackStack()
}
appIcon.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.aural_logo))
primaryTextView.text = getString(R.string.username_and_password_sign_in_primary_text)
passwordContainer.hint = getString(R.string.password_hint)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
passwordInput.setAutofillHints(View.AUTOFILL_HINT_PASSWORD)
}
// Links in footer text should be clickable.
footerTextView.text = HtmlCompat.fromHtml(
context.getString(R.string.sign_in_footer),
HtmlCompat.FROM_HTML_MODE_LEGACY
)
footerTextView.movementMethod = LinkMovementMethod.getInstance()
// Get user identifier from previous screen.
val userId = arguments?.getString(SignInLandingPageFragment.CAR_SIGN_IN_IDENTIFIER_KEY)
submitButton.text = getString(R.string.sign_in_submit_button_label)
submitButton.setOnClickListener {
onSignIn(userId!!, passwordInput.text.toString())
}
}