Added QR scanner to wallet send card
This commit is contained in:
parent
a6869eb2e6
commit
6e3e16e647
9 changed files with 75 additions and 15 deletions
|
@ -134,6 +134,9 @@ dependencies {
|
||||||
|
|
||||||
__32bitImplementation 'io.lbry:lbrysdk32:0.94.1'
|
__32bitImplementation 'io.lbry:lbrysdk32:0.94.1'
|
||||||
__64bitImplementation 'io.lbry:lbrysdk64: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'
|
apply plugin: 'com.google.gms.google-services'
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
package="io.lbry.browser"
|
package="io.lbry.browser"
|
||||||
android:installLocation="auto">
|
android:installLocation="auto">
|
||||||
|
|
||||||
|
@ -13,6 +14,8 @@
|
||||||
<uses-permission android:name="com.android.vending.BILLING" />
|
<uses-permission android:name="com.android.vending.BILLING" />
|
||||||
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
||||||
|
|
||||||
|
<uses-sdk tools:overrideLibrary="com.google.zxing.client.android" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
|
|
@ -3,6 +3,7 @@ package io.lbry.browser.ui.wallet;
|
||||||
import android.content.ClipData;
|
import android.content.ClipData;
|
||||||
import android.content.ClipboardManager;
|
import android.content.ClipboardManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
@ -60,6 +61,9 @@ import java.util.concurrent.Future;
|
||||||
import javax.crypto.Mac;
|
import javax.crypto.Mac;
|
||||||
import javax.crypto.spec.SecretKeySpec;
|
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.MainActivity;
|
||||||
import io.lbry.browser.R;
|
import io.lbry.browser.R;
|
||||||
import io.lbry.browser.adapter.TransactionListAdapter;
|
import io.lbry.browser.adapter.TransactionListAdapter;
|
||||||
|
@ -117,6 +121,7 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W
|
||||||
private ImageButton buttonCopyReceiveAddress;
|
private ImageButton buttonCopyReceiveAddress;
|
||||||
private MaterialButton buttonGetNewAddress;
|
private MaterialButton buttonGetNewAddress;
|
||||||
private TextInputEditText inputSendAddress;
|
private TextInputEditText inputSendAddress;
|
||||||
|
private ImageButton buttonQRScanAddress;
|
||||||
private TextInputEditText inputSendAmount;
|
private TextInputEditText inputSendAmount;
|
||||||
private MaterialButton buttonSend;
|
private MaterialButton buttonSend;
|
||||||
private TextView textConnectedEmail;
|
private TextView textConnectedEmail;
|
||||||
|
@ -162,6 +167,7 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W
|
||||||
buttonCopyReceiveAddress = root.findViewById(R.id.wallet_copy_receive_address);
|
buttonCopyReceiveAddress = root.findViewById(R.id.wallet_copy_receive_address);
|
||||||
buttonGetNewAddress = root.findViewById(R.id.wallet_get_new_address);
|
buttonGetNewAddress = root.findViewById(R.id.wallet_get_new_address);
|
||||||
inputSendAddress = root.findViewById(R.id.wallet_input_send_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);
|
inputSendAmount = root.findViewById(R.id.wallet_input_amount);
|
||||||
buttonSend = root.findViewById(R.id.wallet_send);
|
buttonSend = root.findViewById(R.id.wallet_send);
|
||||||
textConnectedEmail = root.findViewById(R.id.wallet_connected_email);
|
textConnectedEmail = root.findViewById(R.id.wallet_connected_email);
|
||||||
|
@ -368,6 +374,12 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W
|
||||||
copyReceiveAddress();
|
copyReceiveAddress();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
buttonQRScanAddress.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
IntentIntegrator.forSupportFragment(WalletFragment.this).initiateScan();
|
||||||
|
}
|
||||||
|
});
|
||||||
buttonSend.setOnClickListener(new View.OnClickListener() {
|
buttonSend.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
@ -800,4 +812,13 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W
|
||||||
checkRewardsDriverCard(rewardsDriverText, 0);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
10
app/src/main/res/drawable-anydpi/ic_qr_scanner.xml
Executable file
10
app/src/main/res/drawable-anydpi/ic_qr_scanner.xml
Executable file
|
@ -0,0 +1,10 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24"
|
||||||
|
android:tint="?attr/colorControlNormal">
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/white"
|
||||||
|
android:pathData="M9.5,6.5v3h-3v-3H9.5M11,5H5v6h6V5L11,5zM9.5,14.5v3h-3v-3H9.5M11,13H5v6h6V13L11,13zM17.5,6.5v3h-3v-3H17.5M19,5h-6v6h6V5L19,5zM13,13h1.5v1.5H13V13zM14.5,14.5H16V16h-1.5V14.5zM16,13h1.5v1.5H16V13zM13,16h1.5v1.5H13V16zM14.5,17.5H16V19h-1.5V17.5zM16,16h1.5v1.5H16V16zM17.5,14.5H19V16h-1.5V14.5zM17.5,17.5H19V19h-1.5V17.5zM22,7h-2V4h-3V2h5V7zM22,22v-5h-2v3h-3v2H22zM2,22h5v-2H4v-3H2V22zM2,2v5h2V4h3V2H2z"/>
|
||||||
|
</vector>
|
BIN
app/src/main/res/drawable-hdpi/ic_qr_scanner.png
Executable file
BIN
app/src/main/res/drawable-hdpi/ic_qr_scanner.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 217 B |
BIN
app/src/main/res/drawable-mdpi/ic_qr_scanner.png
Executable file
BIN
app/src/main/res/drawable-mdpi/ic_qr_scanner.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 145 B |
BIN
app/src/main/res/drawable-xhdpi/ic_qr_scanner.png
Executable file
BIN
app/src/main/res/drawable-xhdpi/ic_qr_scanner.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 159 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_qr_scanner.png
Executable file
BIN
app/src/main/res/drawable-xxhdpi/ic_qr_scanner.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 176 B |
|
@ -19,19 +19,42 @@
|
||||||
android:text="@string/send_credits"
|
android:text="@string/send_credits"
|
||||||
android:textSize="20sp"/>
|
android:textSize="20sp"/>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:layout_centerVertical="true"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:hint="@string/recipient_address">
|
android:layout_weight="1"
|
||||||
|
android:hint="@string/recipient_address"
|
||||||
|
android:layout_toStartOf="@id/wallet_qr_scan_address">
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
android:id="@+id/wallet_input_send_address"
|
android:id="@+id/wallet_input_send_address"
|
||||||
android:fontFamily="@font/inter"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:imeOptions="actionNext" />
|
android:fontFamily="@font/inter"
|
||||||
|
android:imeOptions="actionNext"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/wallet_qr_scan_address"
|
||||||
|
android:layout_width="48dp"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:background="@null"
|
||||||
|
android:src="@drawable/ic_qr_scanner"
|
||||||
|
android:tint="@color/lbryGreen" />
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="16dp"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
Loading…
Reference in a new issue