Reduce amount of code#443
Conversation
|
Hi @GeorgCantor ! Thanks for the PR. Since Kotlin Android Extensions are deprecated, we don't want to use Kotlin synthetics here. If you were able to migrate these to use view binding, then I'd be able to accept the PR. |
|
Ok |
nic0lette
left a comment
There was a problem hiding this comment.
Thanks for the update! Just a few small things but otherwise looks good =D
|
|
||
| override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
| super.onViewCreated(view, savedInstanceState) | ||
| binding = QrSignInBinding.bind(view) |
There was a problem hiding this comment.
If you make binding a local variable then it wouldn't be nullable (so you could get rid of many of the ?s) and you wouldn't need to clear it in onDestroy()
| */ | ||
| private fun setQrCode(url: String) { | ||
| Glide.with(this).load(url).into(qr_code) | ||
| binding?.qrCode?.let { Glide.with(this).load(url).into(it) } |
There was a problem hiding this comment.
Could you just pass the view in with the url (or, perhaps even better, just move it into onViewCreated())?
| */ | ||
| class SettingsActivity : AppCompatActivity() { | ||
|
|
||
| private lateinit var binding: ActivitySettingsBinding |
There was a problem hiding this comment.
Does this need to be a member? It looks like everything is set in onCreate?
Reduced the amount of code using Kotlin Synthetic