Updated on 2026-08-14
|
|
@ -40,7 +40,7 @@ android {
|
|||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
buildToolsVersion '28.0.2'
|
||||
buildToolsVersion '28.0.3'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,81 @@
|
|||
package com.tangem.presentation.dialog;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.app.DialogFragment;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.tangem.util.UtilHelper;
|
||||
import com.tangem.wallet.R;
|
||||
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
/**
|
||||
* Created by dvol on 06.03.2018.
|
||||
*/
|
||||
public class ShowQRCodeDialog extends DialogFragment {
|
||||
private ImageView ivQR;
|
||||
private TextView tvQRaddress;
|
||||
private Bitmap bmQR;
|
||||
private String addr;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
|
||||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||
|
||||
// Inflate and set the layout for the dialog
|
||||
// Pass null as the parent view because its going in the dialog layout
|
||||
View v = inflater.inflate(R.layout.dialog_show_qr, null);
|
||||
ivQR = v.findViewById(R.id.ivQR);
|
||||
ivQR.setImageBitmap(bmQR);
|
||||
tvQRaddress = v.findViewById(R.id.tvQRaddress);
|
||||
tvQRaddress.setText(addr);
|
||||
|
||||
return new AlertDialog.Builder(getActivity())
|
||||
.setIcon(R.drawable.tangem_logo_small_new)
|
||||
.setTitle(R.string.show_wallet_qr_code)
|
||||
.setView(v)
|
||||
.setPositiveButton(R.string.ok, (dialog,which)->dismiss() )
|
||||
.create();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
super.onCancel(dialog);
|
||||
}
|
||||
|
||||
public void setup(String content) {
|
||||
try {
|
||||
bmQR = UtilHelper.INSTANCE.generateQrCode(content);
|
||||
addr = content;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void show(final Activity activity, final String content) {
|
||||
activity.runOnUiThread(() -> {
|
||||
ShowQRCodeDialog instance = new ShowQRCodeDialog();
|
||||
instance.setup(content);
|
||||
instance.show(activity.getFragmentManager(), "ShowQRCodeDialog");
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -13,11 +13,10 @@ import android.os.Bundle
|
|||
import android.preference.PreferenceManager
|
||||
import android.support.v4.app.Fragment
|
||||
import android.support.v4.content.ContextCompat
|
||||
import android.support.v7.view.ContextThemeWrapper
|
||||
import android.text.Html
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.*
|
||||
import android.widget.Toast
|
||||
import com.google.zxing.WriterException
|
||||
import com.tangem.data.network.ServerApiHelper
|
||||
|
|
@ -31,6 +30,7 @@ import com.tangem.domain.wallet.*
|
|||
import com.tangem.presentation.activity.*
|
||||
import com.tangem.presentation.dialog.NoExtendedLengthSupportDialog
|
||||
import com.tangem.presentation.dialog.PINSwapWarningDialog
|
||||
import com.tangem.presentation.dialog.ShowQRCodeDialog
|
||||
import com.tangem.presentation.dialog.WaitSecurityDelayDialog
|
||||
import com.tangem.util.Util
|
||||
import com.tangem.util.UtilHelper
|
||||
|
|
@ -136,9 +136,11 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
|
|||
tvWallet.setOnClickListener { doShareWallet(false) }
|
||||
ivQR.setOnClickListener { doShareWallet(true) }
|
||||
btnLoad.setOnClickListener {
|
||||
if (BuildConfig.DEBUG) {
|
||||
val items = arrayOf<CharSequence>(getString(R.string.in_app), getString(R.string.via_cryptonit), getString(R.string.via_kraken))
|
||||
val dialog = AlertDialog.Builder(activity).setTitle(getString(R.string.select_loading_method)).setItems(items
|
||||
//if (BuildConfig.DEBUG) {
|
||||
if (true) {
|
||||
val items = arrayOf<CharSequence>(getString(R.string.in_app), getString(R.string.load_via_share_address), getString(R.string.load_via_qr))//, getString(R.string.via_cryptonit), getString(R.string.via_kraken))
|
||||
val cw = android.view.ContextThemeWrapper(activity, R.style.AlertDialogTheme)
|
||||
val dialog = AlertDialog.Builder(cw).setItems(items
|
||||
) { _, which ->
|
||||
when (items[which]) {
|
||||
getString(R.string.in_app) -> {
|
||||
|
|
@ -150,6 +152,12 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
|
|||
showSingleToast(R.string.no_compatible_wallet)
|
||||
}
|
||||
}
|
||||
getString(R.string.load_via_share_address) -> {
|
||||
doShareWallet(true)
|
||||
}
|
||||
getString(R.string.load_via_qr) -> {
|
||||
ShowQRCodeDialog.show(activity, engine.getShareWalletUri(card).toString())
|
||||
}
|
||||
// getString(R.string.via_cryptonit2) -> {
|
||||
// val intent = Intent(context, PrepareCryptonitOtherAPIWithdrawalActivity::class.java)
|
||||
// intent.putExtra("UID", card!!.uid)
|
||||
|
|
@ -173,7 +181,10 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
|
|||
}
|
||||
|
||||
}
|
||||
dialog.show()
|
||||
val dlg = dialog.show()
|
||||
val wlp = dlg.window.attributes
|
||||
wlp.gravity = Gravity.BOTTOM
|
||||
dlg.window.attributes = wlp
|
||||
} else {
|
||||
try {
|
||||
val intent = Intent(Intent.ACTION_VIEW, CoinEngineFactory.create(card!!.blockchain)!!.getShareWalletUri(card))
|
||||
|
|
@ -990,14 +1001,13 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
|
|||
var showTime: Date = Date()
|
||||
|
||||
private fun showSingleToast(text: Int) {
|
||||
// if (singleToast == null || !singleToast!!.view.isShown || showTime.time + 2000 < Date().time) {
|
||||
// if (singleToast != null)
|
||||
// singleToast!!.cancel()
|
||||
// singleToast = Toast.makeText(context, text, Toast.LENGTH_LONG)
|
||||
// singleToast!!.show()
|
||||
// showTime = Date()
|
||||
// }
|
||||
singleToast = Toast.makeText(context, text, Toast.LENGTH_LONG)
|
||||
if (singleToast == null || !singleToast!!.view.isShown || showTime.time + 2000 < Date().time) {
|
||||
if (singleToast != null)
|
||||
singleToast!!.cancel()
|
||||
singleToast = Toast.makeText(context, text, Toast.LENGTH_LONG)
|
||||
singleToast!!.show()
|
||||
showTime = Date()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Before Width: | Height: | Size: 204 KiB After Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 176 KiB After Width: | Height: | Size: 49 KiB |
|
Before Width: | Height: | Size: 177 KiB After Width: | Height: | Size: 49 KiB |
|
Before Width: | Height: | Size: 211 KiB After Width: | Height: | Size: 52 KiB |
|
Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 186 KiB After Width: | Height: | Size: 56 KiB |
|
Before Width: | Height: | Size: 182 KiB After Width: | Height: | Size: 47 KiB |
|
Before Width: | Height: | Size: 122 KiB After Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 174 KiB After Width: | Height: | Size: 52 KiB |
|
Before Width: | Height: | Size: 926 KiB After Width: | Height: | Size: 115 KiB |
|
Before Width: | Height: | Size: 614 KiB After Width: | Height: | Size: 135 KiB |
|
Before Width: | Height: | Size: 158 KiB After Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 163 KiB After Width: | Height: | Size: 48 KiB |
|
|
@ -124,22 +124,21 @@
|
|||
<TextView
|
||||
android:id="@+id/tvNFCHint"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="200dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:background="@color/primary_dark"
|
||||
android:fontFamily="@font/maax"
|
||||
android:gravity="center"
|
||||
android:lineSpacingExtra="8sp"
|
||||
android:minHeight="200dp"
|
||||
android:paddingBottom="20dp"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingRight="20dp"
|
||||
android:paddingTop="20dp"
|
||||
android:paddingRight="20dp"
|
||||
android:paddingBottom="20dp"
|
||||
android:text="@string/tap_tangem_card"
|
||||
android:textAlignment="center"
|
||||
android:textAllCaps="false"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||
android:textColor="@color/white"
|
||||
android:textColor="@color/primary_dark"
|
||||
android:textSize="@dimen/text_size_medium" />
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
|||
25
app/src/main/res/layout/dialog_show_qr.xml
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
tools:ignore="contentDescription">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivQR"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="200dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="16dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvQRaddress"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:fontFamily="@font/maax"
|
||||
android:text="TextView"
|
||||
android:textAlignment="center"
|
||||
android:textSize="@dimen/text_size_2_small" />
|
||||
|
||||
</LinearLayout>
|
||||
|
|
@ -35,10 +35,8 @@
|
|||
android:layout_height="0dp"
|
||||
android:maxHeight="200dp"
|
||||
android:padding="3dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/loBalance"
|
||||
app:layout_constraintHeight_max="200dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0">
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivTangemCard"
|
||||
|
|
@ -89,10 +87,12 @@
|
|||
<LinearLayout
|
||||
android:id="@+id/loBalance"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toTopOf="@+id/loWallet"
|
||||
app:layout_constraintHeight_min="wrap"
|
||||
app:layout_constraintTop_toBottomOf="@+id/loCard"
|
||||
tools:layout_editor_absoluteX="5dp">
|
||||
|
||||
<LinearLayout
|
||||
|
|
@ -142,8 +142,8 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:fontFamily="@font/maax"
|
||||
android:paddingEnd="5dp"
|
||||
android:paddingStart="5dp"
|
||||
android:paddingEnd="5dp"
|
||||
android:text=" "
|
||||
android:textAlignment="center"
|
||||
android:visibility="visible" />
|
||||
|
|
@ -175,8 +175,8 @@
|
|||
android:id="@+id/tvWallet"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:fontFamily="@font/maax"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@android:color/black"
|
||||
|
|
@ -188,8 +188,8 @@
|
|||
style="@style/AppTheme.RoundedCornerMaterialButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="34dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_weight="1"
|
||||
android:backgroundTint="@color/white"
|
||||
android:drawableStart="@drawable/ic_explore_black_24dp"
|
||||
|
|
@ -205,8 +205,8 @@
|
|||
style="@style/AppTheme.RoundedCornerMaterialButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="34dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_weight="1"
|
||||
android:backgroundTint="@color/white"
|
||||
android:drawableStart="@drawable/ic_content_copy_black_24dp"
|
||||
|
|
|
|||
|
|
@ -66,7 +66,10 @@
|
|||
<string name="via_cryptonit">via CRYPTONIT</string>
|
||||
<string name="via_cryptonit2">via CRYPTONIT2</string>
|
||||
<string name="via_kraken">via KRAKEN</string>
|
||||
<string name="in_app">In-App</string>
|
||||
<string name="in_app">Another wallet app</string>
|
||||
<string name="load_via_share_address">Share address</string>
|
||||
<string name="load_via_qr">Show QR-code</string>
|
||||
<string name="show_wallet_qr_code">LOAD</string>
|
||||
<!-- menu main -->
|
||||
<string name="clean_up">Clean up</string>
|
||||
<string name="manage_user_pin_1">Manage user PIN1…</string>
|
||||
|
|
@ -92,7 +95,7 @@
|
|||
|
||||
<!-- LoadedWalletActivity, LoadedWallet -->
|
||||
<string name="wallet_empty">The wallet is empty</string>
|
||||
<string name="no_compatible_wallet">No compatible wallet installed</string>
|
||||
<string name="no_compatible_wallet">No compatible wallets installed</string>
|
||||
<string name="please_wait_while_previous">Please wait while previous transaction is confirmed in blockchain</string>
|
||||
<string name="please_wait_for_confirmation">Could not obtain all inputs. Swipe down to refresh.</string>
|
||||
<string name="card_has_no_remaining_signature">Card has no remaining signature!</string>
|
||||
|
|
|
|||
|
|
@ -72,5 +72,10 @@
|
|||
<item name="android:textSize">@dimen/text_size_pin</item>
|
||||
</style>
|
||||
|
||||
<style name="AlertDialogTheme" parent="android:Theme.Dialog">
|
||||
<item name="android:textSize">@dimen/text_size_medium</item>
|
||||
<item name="android:fontFamily">@font/maax</item>
|
||||
<item name="android:textAlignment">center</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ buildscript {
|
|||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.2.0'
|
||||
classpath 'com.android.tools.build:gradle:3.2.1'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
}
|
||||
|
|
|
|||