improvements for scan behavior

This commit is contained in:
Kevin Gorham 2019-02-19 16:16:30 -05:00 committed by Kevin Gorham
parent c7d457e40e
commit 9a7a02eb48
5 changed files with 9 additions and 10 deletions

View File

@ -15,7 +15,7 @@ android {
minSdkVersion buildConfig.minSdkVersion minSdkVersion buildConfig.minSdkVersion
targetSdkVersion buildConfig.targetSdkVersion targetSdkVersion buildConfig.targetSdkVersion
versionCode 17 // todo: change this to 1_00_04 format, once we graduate beyond zero for the major version number because leading zeros indicate on octal number. versionCode 17 // todo: change this to 1_00_04 format, once we graduate beyond zero for the major version number because leading zeros indicate on octal number.
versionName "0.4.2-alpha" versionName "0.4.5-alpha"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true
multiDexEnabled true multiDexEnabled true

View File

@ -7,6 +7,7 @@ import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.databinding.DataBindingUtil import androidx.databinding.DataBindingUtil
import cash.z.android.wallet.BuildConfig
import cash.z.android.wallet.R import cash.z.android.wallet.R
import cash.z.android.wallet.databinding.FragmentAboutBinding import cash.z.android.wallet.databinding.FragmentAboutBinding
import dagger.Module import dagger.Module
@ -25,6 +26,7 @@ class AboutFragment : BaseFragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
binding.textAboutVersionValue.text = BuildConfig.VERSION_NAME
binding.textAboutLicensingValue.setOnClickListener { binding.textAboutLicensingValue.setOnClickListener {
openUrl("https://z.cash/trademark-policy/") openUrl("https://z.cash/trademark-policy/")
} }

View File

@ -17,7 +17,6 @@ import cash.z.android.cameraview.CameraView
import cash.z.android.wallet.R import cash.z.android.wallet.R
import cash.z.android.wallet.databinding.FragmentScanBinding import cash.z.android.wallet.databinding.FragmentScanBinding
import cash.z.android.wallet.extention.Toaster import cash.z.android.wallet.extention.Toaster
import cash.z.android.wallet.ui.activity.MainActivity
import com.google.firebase.ml.vision.FirebaseVision import com.google.firebase.ml.vision.FirebaseVision
import com.google.firebase.ml.vision.barcode.FirebaseVisionBarcode import com.google.firebase.ml.vision.barcode.FirebaseVisionBarcode
import com.google.firebase.ml.vision.barcode.FirebaseVisionBarcodeDetectorOptions import com.google.firebase.ml.vision.barcode.FirebaseVisionBarcodeDetectorOptions
@ -193,7 +192,9 @@ class ScanFragment : BaseFragment() {
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) { override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults) super.onRequestPermissionsResult(requestCode, permissions, grantResults)
if (allPermissionsGranted()) { if (allPermissionsGranted()) {
onStartCamera() view!!.postDelayed({
onStartCamera()
},2000L) // TODO: remove this temp hack to sidestep crash when permissions were not available
} }
} }
@ -234,8 +235,6 @@ class ScanFragment : BaseFragment() {
if (results.isNotEmpty()) { if (results.isNotEmpty()) {
val barcode = results[0] val barcode = results[0]
val value = barcode.rawValue val value = barcode.rawValue
val message = "found: $value"
Toaster.short(message)
onScanSuccess(value!!) onScanSuccess(value!!)
// TODO: highlight the barcode // TODO: highlight the barcode
var bounds = barcode.boundingBox var bounds = barcode.boundingBox
@ -251,10 +250,8 @@ class ScanFragment : BaseFragment() {
binding.cameraView.stop() binding.cameraView.stop()
if (!pendingSuccess) { if (!pendingSuccess) {
pendingSuccess = true pendingSuccess = true
with(binding.cameraView) { binding.cameraView.post {
postDelayed({ barcodeCallback?.onBarcodeScanned(value)
barcodeCallback?.onBarcodeScanned(value)
}, 3000L)
} }
} }
} }

View File

@ -156,7 +156,6 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="32dp" android:layout_marginEnd="32dp"
android:text="0.4.2-alpha"
android:textColor="@color/zcashGray_dark" android:textColor="@color/zcashGray_dark"
android:textSize="@dimen/text_size_body_2" android:textSize="@dimen/text_size_body_2"
app:layout_constraintBottom_toTopOf="@id/text_about_updated_value" app:layout_constraintBottom_toTopOf="@id/text_about_updated_value"

View File

@ -462,6 +462,7 @@
transition_active_transaction_bg, transition_active_transaction_bg,
text_value_subheader, text_value_subheader,
text_dollar_symbol_subheader, text_dollar_symbol_subheader,
image_zec_symbol_subheader,
image_zec_symbol_header, image_zec_symbol_header,
text_dollar_symbol_header, text_dollar_symbol_header,
text_amount_background, text_amount_background,