From 6e3e16e647c7c04eaa3849a7409a4d3f84362a5e Mon Sep 17 00:00:00 2001 From: mint-chime Date: Wed, 26 May 2021 02:38:09 -0500 Subject: [PATCH 1/4] Added QR scanner to wallet send card --- app/build.gradle | 7 ++- app/src/main/AndroidManifest.xml | 5 ++- .../browser/ui/wallet/WalletFragment.java | 27 ++++++++++-- .../res/drawable-anydpi/ic_qr_scanner.xml | 10 +++++ .../main/res/drawable-hdpi/ic_qr_scanner.png | Bin 0 -> 217 bytes .../main/res/drawable-mdpi/ic_qr_scanner.png | Bin 0 -> 145 bytes .../main/res/drawable-xhdpi/ic_qr_scanner.png | Bin 0 -> 159 bytes .../res/drawable-xxhdpi/ic_qr_scanner.png | Bin 0 -> 176 bytes .../res/layout/card_wallet_send_credits.xml | 41 ++++++++++++++---- 9 files changed, 75 insertions(+), 15 deletions(-) create mode 100755 app/src/main/res/drawable-anydpi/ic_qr_scanner.xml create mode 100755 app/src/main/res/drawable-hdpi/ic_qr_scanner.png create mode 100755 app/src/main/res/drawable-mdpi/ic_qr_scanner.png create mode 100755 app/src/main/res/drawable-xhdpi/ic_qr_scanner.png create mode 100755 app/src/main/res/drawable-xxhdpi/ic_qr_scanner.png diff --git a/app/build.gradle b/app/build.gradle index 0d9a362b..6870adc5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -21,7 +21,7 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } - packagingOptions { + packagingOptions { exclude 'META-INF/DEPENDENCIES' exclude 'lib/x86_64/darwin/libscrypt.dylib' } @@ -134,7 +134,10 @@ dependencies { __32bitImplementation 'io.lbry:lbrysdk32:0.94.1' __64bitImplementation 'io.lbry:lbrysdk64:0.94.1' + + implementation ('com.journeyapps:zxing-android-embedded:4.1.0') { transitive = false } + implementation 'com.google.zxing:core:3.3.0' } apply plugin: 'com.google.gms.google-services' -GoogleServicesPlugin.config.disableVersionCheck = true +GoogleServicesPlugin.config.disableVersionCheck = true \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d5aacbb8..da4b5252 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,5 +1,6 @@ @@ -13,6 +14,8 @@ + + - \ No newline at end of file + diff --git a/app/src/main/java/io/lbry/browser/ui/wallet/WalletFragment.java b/app/src/main/java/io/lbry/browser/ui/wallet/WalletFragment.java index 089977ca..bcb07f14 100644 --- a/app/src/main/java/io/lbry/browser/ui/wallet/WalletFragment.java +++ b/app/src/main/java/io/lbry/browser/ui/wallet/WalletFragment.java @@ -3,6 +3,7 @@ package io.lbry.browser.ui.wallet; import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; +import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Color; import android.net.Uri; @@ -60,6 +61,9 @@ import java.util.concurrent.Future; import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; +import com.google.zxing.integration.android.IntentIntegrator; +import com.google.zxing.integration.android.IntentResult; + import io.lbry.browser.MainActivity; import io.lbry.browser.R; import io.lbry.browser.adapter.TransactionListAdapter; @@ -117,6 +121,7 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W private ImageButton buttonCopyReceiveAddress; private MaterialButton buttonGetNewAddress; private TextInputEditText inputSendAddress; + private ImageButton buttonQRScanAddress; private TextInputEditText inputSendAmount; private MaterialButton buttonSend; private TextView textConnectedEmail; @@ -162,6 +167,7 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W buttonCopyReceiveAddress = root.findViewById(R.id.wallet_copy_receive_address); buttonGetNewAddress = root.findViewById(R.id.wallet_get_new_address); inputSendAddress = root.findViewById(R.id.wallet_input_send_address); + buttonQRScanAddress = root.findViewById(R.id.wallet_qr_scan_address); inputSendAmount = root.findViewById(R.id.wallet_input_amount); buttonSend = root.findViewById(R.id.wallet_send); textConnectedEmail = root.findViewById(R.id.wallet_connected_email); @@ -368,6 +374,12 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W copyReceiveAddress(); } }); + buttonQRScanAddress.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + IntentIntegrator.forSupportFragment(WalletFragment.this).initiateScan(); + } + }); buttonSend.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { @@ -715,8 +727,8 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W } else { firstDatasetNotification = false; if (!detailRows.get(0).detailAmount.equals(earnedBalance.detailAmount) - || detailRows.get(0).isInProgress != earnedBalance.isInProgress - || detailRows.get(0).isUnlockable != earnedBalance.isUnlockable) { + || detailRows.get(0).isInProgress != earnedBalance.isInProgress + || detailRows.get(0).isUnlockable != earnedBalance.isUnlockable) { detailRows.set(0, earnedBalance); needNotifyAdapter = true; } @@ -800,4 +812,13 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W checkRewardsDriverCard(rewardsDriverText, 0); } } -} + + public void onActivityResult(int requestCode, int resultCode, Intent data) { + if (requestCode == IntentIntegrator.REQUEST_CODE) { + IntentResult intentResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, data); + String code = intentResult.getContents(); + inputSendAddress.setText(code); + } + } + +} \ No newline at end of file diff --git a/app/src/main/res/drawable-anydpi/ic_qr_scanner.xml b/app/src/main/res/drawable-anydpi/ic_qr_scanner.xml new file mode 100755 index 00000000..597e8d7b --- /dev/null +++ b/app/src/main/res/drawable-anydpi/ic_qr_scanner.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/drawable-hdpi/ic_qr_scanner.png b/app/src/main/res/drawable-hdpi/ic_qr_scanner.png new file mode 100755 index 0000000000000000000000000000000000000000..fa734a63edf5adde98fea17ddd7c42d4782aa475 GIT binary patch literal 217 zcmeAS@N?(olHy`uVBq!ia0vp^9w5xb3?wz0qptudo&cW^S0Mc#1}qL(uK@B{N`m}? z8UF9DU-zbGEs$T~>Eakt!FY5EBijK39@qaN@24vB{Hxk@clq=imAkTfL;_}hdHC4z zl1DRd%A}@)j-Pr040KjD%Uy?Sf3iG65;yW1+JHB4rjx3xq*EA)3AHw!%QD$Huy z6{}JyMWO0{i?=*#I<+M$$}+b!%4hA1fO+|%^^A)u8DqKDMBdr)<}A<+44$rjF6*2U FngIIjS6Ki6 literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-mdpi/ic_qr_scanner.png b/app/src/main/res/drawable-mdpi/ic_qr_scanner.png new file mode 100755 index 0000000000000000000000000000000000000000..e04904a7a01c4bfaaf5ceabf1bf5cf160b7ef416 GIT binary patch literal 145 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZA`BpB)|k7xlYrjj7PUE|`U7oIfF6*2UngGZ8Ed>Ao literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xhdpi/ic_qr_scanner.png b/app/src/main/res/drawable-xhdpi/ic_qr_scanner.png new file mode 100755 index 0000000000000000000000000000000000000000..495e3da3828955d36b13be52b2852f65fb311a5d GIT binary patch literal 159 zcmeAS@N?(olHy`uVBq!ia0vp^2_Vb}Bp6OT_L>T$m`Z~Df*BafCZDwc@*+H4978G? zk6vbEV^H8>y>OAyDk%KDhpa+ftrW+U`@ekT)<|yNz|iZ@CU-c@Z$divG!9eKYiz|g z%zrFkaye?hHkMUy@tH}DYxx=2%?bjxi9L8EcIcgn7Bj26pU36H+&@4zd%F6$taD0e F0swz@F~tA? literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxhdpi/ic_qr_scanner.png b/app/src/main/res/drawable-xxhdpi/ic_qr_scanner.png new file mode 100755 index 0000000000000000000000000000000000000000..b5e5d7fa900c4cba630a1b078a3ddd1ecdba8fbe GIT binary patch literal 176 zcmeAS@N?(olHy`uVBq!ia0vp^6F`^|NHCnYy)O!+m`Z~Df*BafCZDwc@-jVL978G? z-(F*6J7B=m`q13gp?{C;TK89+zs{#{I4s<>hTp$dVXe|HSFH$kz}e^&hJ+g>HM?2;m=M+ XbP0l+XkKUgtnb literal 0 HcmV?d00001 diff --git a/app/src/main/res/layout/card_wallet_send_credits.xml b/app/src/main/res/layout/card_wallet_send_credits.xml index 9cbd3f5d..82210fed 100644 --- a/app/src/main/res/layout/card_wallet_send_credits.xml +++ b/app/src/main/res/layout/card_wallet_send_credits.xml @@ -19,18 +19,41 @@ android:text="@string/send_credits" android:textSize="20sp"/> - - + + - + android:layout_weight="1" + android:hint="@string/recipient_address" + android:layout_toStartOf="@id/wallet_qr_scan_address"> + + + + + + + Date: Fri, 18 Jun 2021 22:39:56 -0500 Subject: [PATCH 2/4] * app/src/main/java/io/lbry/browser/ui/wallet/WalletFragment.java: Changed orientation of QR scanner, along with some style corrections --- app/build.gradle | 6 +++--- app/src/main/AndroidManifest.xml | 7 ++++++- .../java/io/lbry/browser/ui/wallet/WalletFragment.java | 9 ++++----- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 6870adc5..8f084e69 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -122,6 +122,9 @@ dependencies { implementation 'org.bitcoinj:bitcoinj-tools:0.14.7' implementation 'org.java-websocket:Java-WebSocket:1.5.1' + implementation ('com.journeyapps:zxing-android-embedded:4.1.0') { transitive = false } + implementation 'com.google.zxing:core:3.3.0' + compileOnly 'org.projectlombok:lombok:1.18.10' annotationProcessor 'org.projectlombok:lombok:1.18.10' annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0' @@ -134,9 +137,6 @@ dependencies { __32bitImplementation 'io.lbry:lbrysdk32:0.94.1' __64bitImplementation 'io.lbry:lbrysdk64:0.94.1' - - implementation ('com.journeyapps:zxing-android-embedded:4.1.0') { transitive = false } - implementation 'com.google.zxing:core:3.3.0' } apply plugin: 'com.google.gms.google-services' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index da4b5252..3f958fdd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -101,6 +101,11 @@ android:theme="@style/AppTheme.NoActionBarTranslucent" android:windowSoftInputMode="adjustResize" /> + + @@ -119,4 +124,4 @@ android:resource="@xml/filepaths" /> - + \ No newline at end of file diff --git a/app/src/main/java/io/lbry/browser/ui/wallet/WalletFragment.java b/app/src/main/java/io/lbry/browser/ui/wallet/WalletFragment.java index bcb07f14..b9a70f93 100644 --- a/app/src/main/java/io/lbry/browser/ui/wallet/WalletFragment.java +++ b/app/src/main/java/io/lbry/browser/ui/wallet/WalletFragment.java @@ -377,7 +377,7 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W buttonQRScanAddress.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - IntentIntegrator.forSupportFragment(WalletFragment.this).initiateScan(); + IntentIntegrator.forSupportFragment(WalletFragment.this).setOrientationLocked(false).initiateScan(); } }); buttonSend.setOnClickListener(new View.OnClickListener() { @@ -727,8 +727,8 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W } else { firstDatasetNotification = false; if (!detailRows.get(0).detailAmount.equals(earnedBalance.detailAmount) - || detailRows.get(0).isInProgress != earnedBalance.isInProgress - || detailRows.get(0).isUnlockable != earnedBalance.isUnlockable) { + || detailRows.get(0).isInProgress != earnedBalance.isInProgress + || detailRows.get(0).isUnlockable != earnedBalance.isUnlockable) { detailRows.set(0, earnedBalance); needNotifyAdapter = true; } @@ -820,5 +820,4 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W inputSendAddress.setText(code); } } - -} \ No newline at end of file +} -- 2.45.2 From 9357b35cf95df95c7b6fb0baa5358899d0d380a7 Mon Sep 17 00:00:00 2001 From: mint-chime Date: Fri, 18 Jun 2021 22:45:07 -0500 Subject: [PATCH 3/4] Revert "* app/src/main/java/io/lbry/browser/ui/wallet/WalletFragment.java:" This reverts commit 519c45ae0dfaee556de909bf65cea8c3b38c34ab. --- app/build.gradle | 6 +++--- app/src/main/AndroidManifest.xml | 7 +------ .../java/io/lbry/browser/ui/wallet/WalletFragment.java | 9 +++++---- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 8f084e69..6870adc5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -122,9 +122,6 @@ dependencies { implementation 'org.bitcoinj:bitcoinj-tools:0.14.7' implementation 'org.java-websocket:Java-WebSocket:1.5.1' - implementation ('com.journeyapps:zxing-android-embedded:4.1.0') { transitive = false } - implementation 'com.google.zxing:core:3.3.0' - compileOnly 'org.projectlombok:lombok:1.18.10' annotationProcessor 'org.projectlombok:lombok:1.18.10' annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0' @@ -137,6 +134,9 @@ dependencies { __32bitImplementation 'io.lbry:lbrysdk32:0.94.1' __64bitImplementation 'io.lbry:lbrysdk64:0.94.1' + + implementation ('com.journeyapps:zxing-android-embedded:4.1.0') { transitive = false } + implementation 'com.google.zxing:core:3.3.0' } apply plugin: 'com.google.gms.google-services' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3f958fdd..da4b5252 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -101,11 +101,6 @@ android:theme="@style/AppTheme.NoActionBarTranslucent" android:windowSoftInputMode="adjustResize" /> - - @@ -124,4 +119,4 @@ android:resource="@xml/filepaths" /> - \ No newline at end of file + diff --git a/app/src/main/java/io/lbry/browser/ui/wallet/WalletFragment.java b/app/src/main/java/io/lbry/browser/ui/wallet/WalletFragment.java index b9a70f93..bcb07f14 100644 --- a/app/src/main/java/io/lbry/browser/ui/wallet/WalletFragment.java +++ b/app/src/main/java/io/lbry/browser/ui/wallet/WalletFragment.java @@ -377,7 +377,7 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W buttonQRScanAddress.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - IntentIntegrator.forSupportFragment(WalletFragment.this).setOrientationLocked(false).initiateScan(); + IntentIntegrator.forSupportFragment(WalletFragment.this).initiateScan(); } }); buttonSend.setOnClickListener(new View.OnClickListener() { @@ -727,8 +727,8 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W } else { firstDatasetNotification = false; if (!detailRows.get(0).detailAmount.equals(earnedBalance.detailAmount) - || detailRows.get(0).isInProgress != earnedBalance.isInProgress - || detailRows.get(0).isUnlockable != earnedBalance.isUnlockable) { + || detailRows.get(0).isInProgress != earnedBalance.isInProgress + || detailRows.get(0).isUnlockable != earnedBalance.isUnlockable) { detailRows.set(0, earnedBalance); needNotifyAdapter = true; } @@ -820,4 +820,5 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W inputSendAddress.setText(code); } } -} + +} \ No newline at end of file -- 2.45.2 From 7049e491b7e8c9b8572db4ed8f17219ae5626dbc Mon Sep 17 00:00:00 2001 From: mint-chime Date: Fri, 18 Jun 2021 23:04:57 -0500 Subject: [PATCH 4/4] Fixed orientation of QR scanner activity, plus style corrections --- app/build.gradle | 8 ++++---- app/src/main/AndroidManifest.xml | 7 ++++++- .../java/io/lbry/browser/ui/wallet/WalletFragment.java | 10 +++++----- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 6870adc5..e6a86c76 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -122,6 +122,9 @@ dependencies { implementation 'org.bitcoinj:bitcoinj-tools:0.14.7' implementation 'org.java-websocket:Java-WebSocket:1.5.1' + implementation ('com.journeyapps:zxing-android-embedded:4.1.0') { transitive = false } + implementation 'com.google.zxing:core:3.3.0' + compileOnly 'org.projectlombok:lombok:1.18.10' annotationProcessor 'org.projectlombok:lombok:1.18.10' annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0' @@ -134,10 +137,7 @@ dependencies { __32bitImplementation 'io.lbry:lbrysdk32:0.94.1' __64bitImplementation 'io.lbry:lbrysdk64:0.94.1' - - implementation ('com.journeyapps:zxing-android-embedded:4.1.0') { transitive = false } - implementation 'com.google.zxing:core:3.3.0' } apply plugin: 'com.google.gms.google-services' -GoogleServicesPlugin.config.disableVersionCheck = true \ No newline at end of file +GoogleServicesPlugin.config.disableVersionCheck = true diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index da4b5252..3f958fdd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -101,6 +101,11 @@ android:theme="@style/AppTheme.NoActionBarTranslucent" android:windowSoftInputMode="adjustResize" /> + + @@ -119,4 +124,4 @@ android:resource="@xml/filepaths" /> - + \ No newline at end of file diff --git a/app/src/main/java/io/lbry/browser/ui/wallet/WalletFragment.java b/app/src/main/java/io/lbry/browser/ui/wallet/WalletFragment.java index bcb07f14..af8cf93e 100644 --- a/app/src/main/java/io/lbry/browser/ui/wallet/WalletFragment.java +++ b/app/src/main/java/io/lbry/browser/ui/wallet/WalletFragment.java @@ -377,7 +377,8 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W buttonQRScanAddress.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - IntentIntegrator.forSupportFragment(WalletFragment.this).initiateScan(); + IntentIntegrator intentIntegrator = IntentIntegrator.forSupportFragment(WalletFragment.this); + intentIntegrator.setOrientationLocked(false).initiateScan(); } }); buttonSend.setOnClickListener(new View.OnClickListener() { @@ -727,8 +728,8 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W } else { firstDatasetNotification = false; if (!detailRows.get(0).detailAmount.equals(earnedBalance.detailAmount) - || detailRows.get(0).isInProgress != earnedBalance.isInProgress - || detailRows.get(0).isUnlockable != earnedBalance.isUnlockable) { + || detailRows.get(0).isInProgress != earnedBalance.isInProgress + || detailRows.get(0).isUnlockable != earnedBalance.isUnlockable) { detailRows.set(0, earnedBalance); needNotifyAdapter = true; } @@ -820,5 +821,4 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W inputSendAddress.setText(code); } } - -} \ No newline at end of file +} -- 2.45.2