-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for translator not initializing in time on ScanBarcodeScreen for …
…when the scanned barcode arrives hence leading to an incorrect state: When we start the ScanBarcodeScreen we immediately launch the Google ML Lib’s camera app. Which moves focus away from our app and also this camera app consumes a lot of the CPU. Because of that the ‘init translators’ code that happens in parallel, which involves a bunch of back-n-forth with WebView where translator JS is running sometimes doesn’t have enough time to finish hence the translator is not actually ready when you scan barcode. It happens intermittently because some devices are fast enough to init the translators and some are too slow, also it depends on how quick you are at pointing the camera at the barcode. So the fix is to queue up all of the scanned barcodes until the translators are initialized and then pass them to the translator. Upping versionCode to 69.
- Loading branch information
1 parent
3f50597
commit e588b78
Showing
8 changed files
with
69 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
.../main/java/org/zotero/android/uicomponents/addbyidentifier/TranslatorLoadedEventStream.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.zotero.android.uicomponents.addbyidentifier | ||
|
||
import org.zotero.android.architecture.core.StateEventStream | ||
import org.zotero.android.architecture.coroutines.ApplicationScope | ||
import javax.inject.Inject | ||
import javax.inject.Singleton | ||
|
||
@Singleton | ||
class TranslatorLoadedEventStream @Inject constructor(applicationScope: ApplicationScope) : | ||
StateEventStream<Boolean>(applicationScope = applicationScope, initValue = false) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters