diff --git a/app/build.gradle b/app/build.gradle index ab79919..ca23267 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -83,8 +83,8 @@ dependencies { kapt "androidx.room:room-compiler:$room_version" implementation "androidx.room:room-rxjava2:$room_version" // RxJava support for Room // AAC Navigation - implementation "android.arch.navigation:navigation-fragment-ktx:$nav_version" - implementation "android.arch.navigation:navigation-ui-ktx:$nav_version" + implementation "androidx.navigation:navigation-fragment-ktx:$nav_version" + implementation "androidx.navigation:navigation-ui-ktx:$nav_version" // RxBindings implementation "com.jakewharton.rxbinding3:rxbinding:$rx_bindings_version" implementation "com.jakewharton.rxbinding3:rxbinding-material:$rx_bindings_version" // Material Components widgets diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 618526c..6137f1c 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -33,7 +33,7 @@ android:theme="@style/SplashTheme"> - + @@ -41,7 +41,10 @@ android:name=".activities.MainActivity" android:screenOrientation="portrait" android:theme="@style/Theme.Bitsy" - android:windowSoftInputMode="adjustPan"/> + android:windowSoftInputMode="adjustPan"> + + + 0 && args.memo != " ") { + val items = arrayOf(LineItem("transfer", 1, args.amount.toDouble())) + val invoice = Invoice(args.to, "", args.memo, args.asset, items, "", "") + Handler().postDelayed({ + populatePropertiesFromQRCodeString(Invoice.toQrCode(invoice)) + }, 2000) // Wait to let the other elements of the fragment initialize + } } /** Handles the selection of items in the Asset spinner, to keep track of the selectedAssetSymbol and show the @@ -369,11 +377,16 @@ class SendTransactionFragment : ConnectedFragment(), ZXingScannerView.ResultHand cameraPreview.stopCamera() } - /** Handles the result of the QR code read from the camera and tries to populate the Account, Amount and Memo fields - * and the Asset spinner with the obtained information */ + /** Handles the result of the QR code read from the camera **/ override fun handleResult(result: Result?) { + populatePropertiesFromQRCodeString(result!!.text) + } + + /** Tries to populate the Account, Amount and Memo fields + * and the Asset spinner with the obtained information */ + private fun populatePropertiesFromQRCodeString(qrString: String) { try { - val invoice = Invoice.fromQrCode(result!!.text) + val invoice = Invoice.fromQrCode(qrString) Log.d(TAG, "QR Code read: " + invoice.toJsonString()) @@ -422,6 +435,16 @@ class SendTransactionFragment : ConnectedFragment(), ZXingScannerView.ResultHand } } + /** + * Sends a request to the node through the NetworkService to validate that accountName is a valid + * BitShares account. + */ + private fun validateAccount(accountName: String) { + isToAccountCorrect = false + val id = mNetworkService?.sendMessage(GetAccountByName(accountName), GetAccountByName.REQUIRED_API) + if (id != null) responseMap[id] = RESPONSE_GET_ACCOUNT_BY_NAME + } + private fun validateAmount() { val txtAmount = tietAmount.text.toString() diff --git a/app/src/main/res/navigation/mobile_navigation.xml b/app/src/main/res/navigation/mobile_navigation.xml index 0195c99..65ffa16 100644 --- a/app/src/main/res/navigation/mobile_navigation.xml +++ b/app/src/main/res/navigation/mobile_navigation.xml @@ -97,6 +97,25 @@ android:name="openCamera" app:argType="boolean" android:defaultValue="false" /> + + + + + + + + + +