Skip to content
This repository has been archived by the owner on Oct 10, 2020. It is now read-only.

App crash on orientation change #208 #209

Merged
merged 3 commits into from
Apr 14, 2020

Conversation

subinsv
Copy link

@subinsv subinsv commented Apr 14, 2020

No description provided.

@@ -17,7 +17,6 @@ class BarcodeScannerActivity : Activity(), ZXingScannerView.ResultHandler {

private lateinit var config: Protos.Configuration
lateinit var scannerView: ZXingScannerView
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it's better to change the scannerView to a nullable private var (just to prevent further problems like this one):

private var scannerView: ZXingScannerView? = null

@@ -49,7 +48,7 @@ class BarcodeScannerActivity : Activity(), ZXingScannerView.ResultHandler {
}

private fun setupScannerView() {
if (scannerViewInitialized) {
if (this::scannerView.isInitialized) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (scannerView != null) {
    return
}

}

// region AppBar menu
override fun onCreateOptionsMenu(menu: Menu): Boolean {
var buttonText = config.stringsMap["flash_on"]
if (scannerView.flash) {
if (this::scannerView.isInitialized && scannerView.flash) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (scannerView?.flash == true) {
    buttonText = config.stringsMap["flash_off"]
}

@devtronic
Copy link
Member

devtronic commented Apr 14, 2020

Thanks for contributing. I added a few comments to your changes 🙂

@subinsv
Copy link
Author

subinsv commented Apr 14, 2020

Updated the code based on your feedback :)

@devtronic devtronic merged commit 7ce99fe into mintware-de:3.x Apr 14, 2020
@devtronic
Copy link
Member

Thanks 🙂

@devtronic devtronic mentioned this pull request Apr 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants