Updated on 2026-08-14
This commit is contained in:
parent
63043cf8a7
commit
4339490ef1
3 changed files with 69 additions and 72 deletions
|
|
@ -0,0 +1,50 @@
|
|||
package com.tangem.presentation.dialog;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.app.DialogFragment;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.tangem.wallet.R;
|
||||
|
||||
public class PINSwapWarningDialog extends DialogFragment {
|
||||
public static final String TAG = PINSwapWarningDialog.class.getSimpleName();
|
||||
|
||||
public static final String EXTRA_MESSAGE = "message";
|
||||
private String message;
|
||||
private OnPositiveButton mOnPositiveButton;
|
||||
|
||||
public interface OnPositiveButton {
|
||||
void onRefresh();
|
||||
}
|
||||
|
||||
public void setOnRefreshPage(OnPositiveButton listener) {
|
||||
mOnPositiveButton = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
message = getArguments().getString(EXTRA_MESSAGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
|
||||
return new AlertDialog.Builder(getActivity())
|
||||
.setIcon(R.drawable.tangem_logo_small_new)
|
||||
.setTitle(R.string.your_money_is_at_risk)
|
||||
.setMessage(message)
|
||||
.setCancelable(true)
|
||||
.setNegativeButton(R.string.cancel, (dialog, which) -> dismiss())
|
||||
.setPositiveButton(R.string.contin, (dialog, whichButton) -> mOnPositiveButton.onRefresh())
|
||||
.create();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
super.onCancel(dialog);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,12 +1,8 @@
|
|||
package com.tangem.presentation.fragment;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.app.DialogFragment;
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.ColorStateList;
|
||||
|
|
@ -67,6 +63,7 @@ import com.tangem.presentation.activity.RequestPINActivity;
|
|||
import com.tangem.presentation.activity.SwapPINActivity;
|
||||
import com.tangem.presentation.activity.VerifyCardActivity;
|
||||
import com.tangem.presentation.dialog.NoExtendedLengthSupportDialog;
|
||||
import com.tangem.presentation.dialog.PINSwapWarningDialog;
|
||||
import com.tangem.presentation.dialog.WaitSecurityDelayDialog;
|
||||
import com.tangem.util.BTCUtils;
|
||||
import com.tangem.util.Util;
|
||||
|
|
@ -563,36 +560,6 @@ public class LoadedWallet extends Fragment implements SwipeRefreshLayout.OnRefre
|
|||
}
|
||||
}
|
||||
|
||||
public static class PINSwapWarningDialog extends DialogFragment {
|
||||
public static final String TAG = PINSwapWarningDialog.class.getSimpleName();
|
||||
|
||||
LoadedWallet activityFragment = null;
|
||||
String message;
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
|
||||
return new AlertDialog.Builder(getActivity())
|
||||
.setIcon(R.drawable.tangem_logo_small_new)
|
||||
.setTitle(R.string.your_money_is_at_risk)
|
||||
.setMessage(message)
|
||||
.setCancelable(true)
|
||||
.setNegativeButton(R.string.cancel, (dialog, which) -> PINSwapWarningDialog.this.dismiss())
|
||||
.setPositiveButton(R.string.contin,
|
||||
(dialog, whichButton) -> {
|
||||
if (activityFragment != null)
|
||||
activityFragment.startSwapPINActivity();
|
||||
}
|
||||
)
|
||||
.create();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
super.onCancel(dialog);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(@NonNull final LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View v = inflater.inflate(R.layout.fr_loaded_wallet, container, false);
|
||||
|
|
@ -781,19 +748,19 @@ public class LoadedWallet extends Fragment implements SwipeRefreshLayout.OnRefre
|
|||
break;
|
||||
case REQUEST_CODE_REQUEST_PIN2_FOR_SWAP_PIN:
|
||||
if (resultCode == Activity.RESULT_OK) {
|
||||
if (newPIN.equals(""))
|
||||
newPIN = mCard.getPIN();
|
||||
if (newPIN.equals("")) newPIN = mCard.getPIN();
|
||||
|
||||
if (newPIN2.equals(""))
|
||||
newPIN2 = PINStorage.getPIN2();
|
||||
if (newPIN2.equals("")) newPIN2 = PINStorage.getPIN2();
|
||||
|
||||
PINSwapWarningDialog dialog = (new PINSwapWarningDialog());
|
||||
dialog.activityFragment = this;
|
||||
PINSwapWarningDialog pinSwapWarningDialog = new PINSwapWarningDialog();
|
||||
pinSwapWarningDialog.setOnRefreshPage(this::startSwapPINActivity);
|
||||
Bundle bundle = new Bundle();
|
||||
if (!PINStorage.isDefaultPIN(newPIN) || !PINStorage.isDefaultPIN2(newPIN2))
|
||||
dialog.message = getString(R.string.if_you_forget);
|
||||
bundle.putString(PINSwapWarningDialog.EXTRA_MESSAGE, getString(R.string.if_you_forget));
|
||||
else
|
||||
dialog.message = getString(R.string.if_you_use_default);
|
||||
dialog.show(Objects.requireNonNull(getActivity()).getFragmentManager(), PINSwapWarningDialog.TAG);
|
||||
bundle.putString(PINSwapWarningDialog.EXTRA_MESSAGE, getString(R.string.if_you_use_default));
|
||||
pinSwapWarningDialog.setArguments(bundle);
|
||||
pinSwapWarningDialog.show(Objects.requireNonNull(getActivity()).getFragmentManager(), PINSwapWarningDialog.TAG);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -808,7 +775,7 @@ public class LoadedWallet extends Fragment implements SwipeRefreshLayout.OnRefre
|
|||
} else {
|
||||
data.putExtra("modification", "update");
|
||||
}
|
||||
getActivity().setResult(Activity.RESULT_OK, data);
|
||||
Objects.requireNonNull(getActivity()).setResult(Activity.RESULT_OK, data);
|
||||
getActivity().finish();
|
||||
} else {
|
||||
if (data != null && data.getExtras().containsKey("UID") && data.getExtras().containsKey("Card")) {
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:visibility="gone"
|
||||
android:id="@+id/tvCaution"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="20dp"
|
||||
|
|
@ -75,9 +76,9 @@
|
|||
android:id="@+id/tvBalance"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="0.05 BTC (Bitcoin)"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/text_size_large"/>
|
||||
android:textSize="@dimen/text_size_large"
|
||||
tools:text="0.05 BTC (Bitcoin)"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView10"
|
||||
|
|
@ -88,16 +89,6 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<!--<ImageView-->
|
||||
<!--android:visibility="gone"-->
|
||||
<!--android:id="@+id/imgBlockchain"-->
|
||||
<!--android:layout_width="32dp"-->
|
||||
<!--android:layout_height="32dp"-->
|
||||
<!--android:src="@drawable/tangem_logo_small_new"-->
|
||||
<!--app:layout_constraintBottom_toBottomOf="parent"-->
|
||||
<!--app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!--app:layout_constraintTop_toTopOf="parent"/>-->
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvHeader"
|
||||
android:layout_width="match_parent"
|
||||
|
|
@ -133,21 +124,6 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<!--<TextView-->
|
||||
<!--android:id="@+id/tvBalance"-->
|
||||
<!--android:layout_width="0dp"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:layout_marginStart="0dp"-->
|
||||
<!--android:fontFamily="@font/montserrat_light"-->
|
||||
<!--android:lines="1"-->
|
||||
<!--android:maxLines="1"-->
|
||||
<!--android:textColor="@color/black"-->
|
||||
<!--android:textSize="@dimen/text_size_large"-->
|
||||
<!--android:textStyle="normal|bold"-->
|
||||
<!--app:layout_constraintBottom_toBottomOf="parent"-->
|
||||
<!--app:layout_constraintStart_toEndOf="@+id/tvBalanceLabel"-->
|
||||
<!--app:layout_constraintTop_toTopOf="parent"-->
|
||||
<!--tools:text="0 mBTC"/>-->
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
||||
|
|
@ -456,7 +432,6 @@
|
|||
android:id="@+id/rlToolButtons"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:gravity="center"
|
||||
app:layout_constraintBottom_toTopOf="@+id/rlCardIdAndIcons"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
|
|
@ -465,12 +440,14 @@
|
|||
|
||||
<android.support.v7.widget.AppCompatButton
|
||||
android:id="@+id/btnLoad"
|
||||
android:layout_margin="10dp"
|
||||
style="@style/AppTheme.RoundedCornerMaterialButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/load"/>
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/fabPurge"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="5dp"
|
||||
|
|
@ -479,6 +456,8 @@
|
|||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/fabNFC"
|
||||
|
||||
android:layout_margin="10dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
|
|
@ -487,6 +466,7 @@
|
|||
|
||||
<android.support.v7.widget.AppCompatButton
|
||||
android:id="@+id/btnExtract"
|
||||
android:layout_margin="10dp"
|
||||
style="@style/AppTheme.RoundedCornerMaterialButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:width="100dp"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue