Updated on 2026-08-14
This commit is contained in:
parent
03a9f13214
commit
d875971008
6 changed files with 93 additions and 45 deletions
|
|
@ -28,6 +28,7 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
|
@ -112,12 +113,15 @@ public class LoadedWallet extends Fragment implements SwipeRefreshLayout.OnRefre
|
|||
private ImageView ivPIN;
|
||||
private ImageView ivPIN2orSecurityDelay;
|
||||
private ImageView ivDeveloperVersion;
|
||||
private RelativeLayout rlProgressBar;
|
||||
private SwipeRefreshLayout mSwipeRefreshLayout;
|
||||
private List<UpdateWalletInfoTask> updateTasks = new ArrayList<>();
|
||||
private NfcManager mNfcManager;
|
||||
private boolean lastReadSuccess = true;
|
||||
private VerifyCardTask verifyCardTask = null;
|
||||
private int requestPIN2Count = 0;
|
||||
private CardProtocol mCardProtocol;
|
||||
private int scanTimes = 0;
|
||||
|
||||
private Timer timerHideErrorAndMessage = null;
|
||||
private String newPIN = "", newPIN2 = "";
|
||||
|
|
@ -317,7 +321,7 @@ public class LoadedWallet extends Fragment implements SwipeRefreshLayout.OnRefre
|
|||
@Override
|
||||
protected void onPostExecute(List<ElectrumRequest> requests) {
|
||||
super.onPostExecute(requests);
|
||||
Log.i("RequestWalletInfoTask", "onPostExecute[" + String.valueOf(updateTasks.size()) + "]");
|
||||
// Log.i("RequestWalletInfoTask", "onPostExecute[" + String.valueOf(updateTasks.size()) + "]");
|
||||
updateTasks.remove(this);
|
||||
|
||||
CoinEngine engine = CoinEngineFactory.Create(mCard.getBlockchain());
|
||||
|
|
@ -577,13 +581,14 @@ public class LoadedWallet extends Fragment implements SwipeRefreshLayout.OnRefre
|
|||
View v = inflater.inflate(R.layout.fr_loaded_wallet, container, false);
|
||||
|
||||
mSwipeRefreshLayout = v.findViewById(R.id.swipe_container);
|
||||
rlProgressBar = v.findViewById(R.id.rlProgressBar);
|
||||
progressBar = v.findViewById(R.id.progressBar);
|
||||
ivTangemCard = v.findViewById(R.id.ivTangemCard);
|
||||
tvBalance = v.findViewById(R.id.tvBalance);
|
||||
tvOffline = v.findViewById(R.id.tvOffline);
|
||||
tvCardID = v.findViewById(R.id.tvCardID);
|
||||
tvWallet = v.findViewById(R.id.tvWallet);
|
||||
tvInputs = v.findViewById(R.id.tvInputs);
|
||||
// TextView lbInputs = v.findViewById(R.id.lbInputs);
|
||||
tvLastOutput = v.findViewById(R.id.tvLastOutput);
|
||||
tvError = v.findViewById(R.id.tvError);
|
||||
tvMessage = v.findViewById(R.id.tvMessage);
|
||||
|
|
@ -594,7 +599,6 @@ public class LoadedWallet extends Fragment implements SwipeRefreshLayout.OnRefre
|
|||
ImageView imgLookup = v.findViewById(R.id.imgLookup);
|
||||
ImageView ivCopy = v.findViewById(R.id.ivCopy);
|
||||
tvValidationNode = v.findViewById(R.id.tvValidationNode);
|
||||
progressBar = v.findViewById(R.id.progressBar);
|
||||
tvBlockchain = v.findViewById(R.id.tvBlockchain);
|
||||
ivBlockchain = v.findViewById(R.id.imgBlockchain);
|
||||
ivPIN = v.findViewById(R.id.imgPIN);
|
||||
|
|
@ -614,17 +618,11 @@ public class LoadedWallet extends Fragment implements SwipeRefreshLayout.OnRefre
|
|||
|
||||
ivTangemCard.setImageResource(mCard.getCardImageResource());
|
||||
|
||||
// Log.i(TAG, "sxnnnnnnnnnnn " + mCard.getBlockchainID());
|
||||
Log.i(TAG, "sxnnnnnnnnnnn " + mCard.getTokenSymbol());
|
||||
// Log.i(TAG, "getDenomination " + Arrays.toString(mCard.getDenomination()));
|
||||
|
||||
final CoinEngine engine = CoinEngineFactory.Create(mCard.getBlockchain());
|
||||
boolean visibleFlag = engine != null ? engine.InOutPutVisible() : true;
|
||||
int visibleIOPuts = visibleFlag ? View.VISIBLE : View.GONE;
|
||||
|
||||
tvInputs.setVisibility(visibleIOPuts);
|
||||
// lbInputs.setVisibility(visibleIOPuts);
|
||||
// tvLastOutput.setVisibility(visibleIOPuts);
|
||||
|
||||
try {
|
||||
ivQR.setImageBitmap(UtilHelper.INSTANCE.generateQrCode(Objects.requireNonNull(engine).getShareWalletURI(mCard).toString()));
|
||||
|
|
@ -1059,16 +1057,12 @@ public class LoadedWallet extends Fragment implements SwipeRefreshLayout.OnRefre
|
|||
@Override
|
||||
public void OnReadStart(CardProtocol cardProtocol) {
|
||||
progressBar.post(() -> {
|
||||
rlProgressBar.setVisibility(View.VISIBLE);
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
progressBar.setProgress(5);
|
||||
});
|
||||
}
|
||||
|
||||
private CardProtocol mCardProtocol;
|
||||
|
||||
// private boolean needOpenVerify;
|
||||
private int scanTimes = 0;
|
||||
|
||||
@Override
|
||||
public void OnReadFinish(final CardProtocol cardProtocol) {
|
||||
verifyCardTask = null;
|
||||
|
|
@ -1076,6 +1070,7 @@ public class LoadedWallet extends Fragment implements SwipeRefreshLayout.OnRefre
|
|||
if (cardProtocol != null) {
|
||||
if (cardProtocol.getError() == null) {
|
||||
progressBar.post(() -> {
|
||||
rlProgressBar.setVisibility(View.GONE);
|
||||
progressBar.setProgress(100);
|
||||
progressBar.setProgressTintList(ColorStateList.valueOf(Color.GREEN));
|
||||
|
||||
|
|
@ -1109,6 +1104,7 @@ public class LoadedWallet extends Fragment implements SwipeRefreshLayout.OnRefre
|
|||
|
||||
progressBar.postDelayed(() -> {
|
||||
try {
|
||||
rlProgressBar.setVisibility(View.GONE);
|
||||
progressBar.setProgress(0);
|
||||
progressBar.setProgressTintList(ColorStateList.valueOf(Color.DKGRAY));
|
||||
progressBar.setVisibility(View.INVISIBLE);
|
||||
|
|
@ -1128,6 +1124,7 @@ public class LoadedWallet extends Fragment implements SwipeRefreshLayout.OnRefre
|
|||
verifyCardTask = null;
|
||||
progressBar.postDelayed(() -> {
|
||||
try {
|
||||
rlProgressBar.setVisibility(View.GONE);
|
||||
progressBar.setProgress(0);
|
||||
progressBar.setProgressTintList(ColorStateList.valueOf(Color.DKGRAY));
|
||||
progressBar.setVisibility(View.INVISIBLE);
|
||||
|
|
@ -1222,12 +1219,7 @@ public class LoadedWallet extends Fragment implements SwipeRefreshLayout.OnRefre
|
|||
else
|
||||
tvInputs.setTextColor(ContextCompat.getColor(Objects.requireNonNull(getContext()), R.color.confirmed));
|
||||
|
||||
// if (btnSend != null) {
|
||||
// btnSend.setText(mCard.getOutputsDescription());
|
||||
// }
|
||||
|
||||
tvLastInput.setText(mCard.getLastInputDescription());
|
||||
// tvLastOutput.setText(mCard.getLastOutputDescription());
|
||||
|
||||
tvBlockchain.setText(mCard.getBlockchainName());
|
||||
ivBlockchain.setImageResource(mCard.getBlockchain().getImageResource(this.getContext(), mCard.getTokenSymbol()));
|
||||
|
|
@ -1270,12 +1262,6 @@ public class LoadedWallet extends Fragment implements SwipeRefreshLayout.OnRefre
|
|||
else
|
||||
btnExtract.setEnabled(false);
|
||||
|
||||
// if (tvPurge != null)
|
||||
// if (mCard.hasBalanceInfo())
|
||||
// tvPurge.setEnabled(true);
|
||||
// else
|
||||
// tvPurge.setEnabled(false);
|
||||
|
||||
tvIssuer.setText(mCard.getIssuerDescription());
|
||||
|
||||
timerHideErrorAndMessage = new Timer();
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import android.view.LayoutInflater;
|
|||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.tangem.data.network.request.ElectrumRequest;
|
||||
|
|
@ -70,6 +71,7 @@ public class Main extends Fragment implements NfcAdapter.ReaderCallback, CardLis
|
|||
|
||||
private NfcManager mNfcManager;
|
||||
private ArrayList<String> slCardUIDs = new ArrayList<>();
|
||||
private RelativeLayout rlProgressBar;
|
||||
private ProgressBar progressBar;
|
||||
private CardListAdapter mCardListAdapter;
|
||||
private ReadCardInfoTask readCardInfoTask;
|
||||
|
|
@ -382,24 +384,18 @@ public class Main extends Fragment implements NfcAdapter.ReaderCallback, CardLis
|
|||
return mCardListAdapter;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void onSaveInstanceState(Bundle outState) {
|
||||
// super.onSaveInstanceState(outState);
|
||||
// mCardListAdapter.onSaveInstanceState(outState);
|
||||
// outState.putStringArrayList("slCardUIDs", slCardUIDs);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View result = inflater.inflate(R.layout.fr_main, container, false);
|
||||
View v = inflater.inflate(R.layout.fr_main, container, false);
|
||||
|
||||
mNfcManager = new NfcManager(getActivity(), this);
|
||||
|
||||
verifyPermissions();
|
||||
|
||||
progressBar = result.findViewById(R.id.progressBar);
|
||||
rlProgressBar = v.findViewById(R.id.rlProgressBar);
|
||||
progressBar = v.findViewById(R.id.progressBar);
|
||||
progressBar.setProgressTintList(ColorStateList.valueOf(Color.DKGRAY));
|
||||
RecyclerView rvCards = result.findViewById(R.id.lvCards);
|
||||
RecyclerView rvCards = v.findViewById(R.id.lvCards);
|
||||
rvCards.setVisibility(View.GONE);
|
||||
|
||||
rvCards.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
|
|
@ -439,7 +435,7 @@ public class Main extends Fragment implements NfcAdapter.ReaderCallback, CardLis
|
|||
((MainActivity) getActivity()).setNfcAdapterReaderCallback(this);
|
||||
}
|
||||
|
||||
return result;
|
||||
return v;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -577,6 +573,7 @@ public class Main extends Fragment implements NfcAdapter.ReaderCallback, CardLis
|
|||
@Override
|
||||
public void OnReadStart(CardProtocol cardProtocol) {
|
||||
progressBar.post(() -> {
|
||||
rlProgressBar.setVisibility(View.VISIBLE);
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
progressBar.setProgress(5);
|
||||
});
|
||||
|
|
@ -593,6 +590,7 @@ public class Main extends Fragment implements NfcAdapter.ReaderCallback, CardLis
|
|||
if (cardProtocol != null) {
|
||||
if (cardProtocol.getError() == null) {
|
||||
progressBar.post(() -> {
|
||||
rlProgressBar.setVisibility(View.GONE);
|
||||
progressBar.setProgress(100);
|
||||
progressBar.setProgressTintList(ColorStateList.valueOf(Color.GREEN));
|
||||
|
||||
|
|
@ -665,6 +663,7 @@ public class Main extends Fragment implements NfcAdapter.ReaderCallback, CardLis
|
|||
|
||||
progressBar.postDelayed(() -> {
|
||||
try {
|
||||
rlProgressBar.setVisibility(View.GONE);
|
||||
progressBar.setProgress(0);
|
||||
progressBar.setProgressTintList(ColorStateList.valueOf(Color.DKGRAY));
|
||||
progressBar.setVisibility(View.INVISIBLE);
|
||||
|
|
@ -679,6 +678,7 @@ public class Main extends Fragment implements NfcAdapter.ReaderCallback, CardLis
|
|||
readCardInfoTask = null;
|
||||
progressBar.postDelayed(() -> {
|
||||
try {
|
||||
rlProgressBar.setVisibility(View.GONE);
|
||||
progressBar.setProgress(0);
|
||||
progressBar.setProgressTintList(ColorStateList.valueOf(Color.DKGRAY));
|
||||
progressBar.setVisibility(View.INVISIBLE);
|
||||
|
|
|
|||
|
|
@ -12,6 +12,39 @@
|
|||
tools:ignore="contentDescription"
|
||||
tools:showIn="@layout/activity_loaded_wallet">
|
||||
|
||||
<RelativeLayout
|
||||
android:visibility="gone"
|
||||
android:id="@+id/rlProgressBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:elevation="10dp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/include"
|
||||
app:layout_constraintEnd_toEndOf="@+id/swipe_container"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/swipe_container">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:alpha="0.5"
|
||||
android:text="@string/verifying"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<ProgressBar
|
||||
android:layout_width="@dimen/size_progress_bar_big"
|
||||
android:layout_height="@dimen/size_progress_bar_big"
|
||||
android:alpha="0.5"
|
||||
android:elevation="1dp"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<android.support.v4.widget.SwipeRefreshLayout
|
||||
android:id="@+id/swipe_container"
|
||||
android:layout_width="0dp"
|
||||
|
|
@ -55,7 +88,7 @@
|
|||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
tools:src="@drawable/card_btc001"
|
||||
/>
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
|
@ -265,13 +298,13 @@
|
|||
android:visibility="gone">
|
||||
|
||||
<!--<TextView-->
|
||||
<!--android:id="@+id/lbInputs"-->
|
||||
<!--android:layout_width="110dp"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:fontFamily="@font/raleway_r"-->
|
||||
<!--android:text="@string/unspents"-->
|
||||
<!--android:textColor="@color/primary_dark"-->
|
||||
<!--android:textSize="@dimen/text_size_small"/>-->
|
||||
<!--android:id="@+id/lbInputs"-->
|
||||
<!--android:layout_width="110dp"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:fontFamily="@font/raleway_r"-->
|
||||
<!--android:text="@string/unspents"-->
|
||||
<!--android:textColor="@color/primary_dark"-->
|
||||
<!--android:textSize="@dimen/text_size_small"/>-->
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvInputs"
|
||||
|
|
@ -550,7 +583,9 @@
|
|||
</RelativeLayout>
|
||||
|
||||
<include
|
||||
android:id="@+id/include"
|
||||
layout="@layout/layout_progress_horizontal"
|
||||
android:visibility="invisible"/>
|
||||
android:visibility="invisible"
|
||||
tools:layout_editor_absoluteY="495dp"/>
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
|
@ -7,6 +7,30 @@
|
|||
tools:context="com.tangem.presentation.fragment.Main"
|
||||
tools:showIn="@layout/content_main">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rlProgressBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:textStyle="bold"
|
||||
android:alpha="0.5"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:text="@string/reading"/>
|
||||
|
||||
<ProgressBar
|
||||
android:layout_width="@dimen/size_progress_bar_big"
|
||||
android:layout_height="@dimen/size_progress_bar_big"
|
||||
android:alpha="0.5"
|
||||
android:elevation="1dp"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/lvCards"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
|||
|
|
@ -26,5 +26,6 @@
|
|||
|
||||
<dimen name="size_qr_image">220dp</dimen>
|
||||
<dimen name="size_explore_image">30dp</dimen>
|
||||
<dimen name="size_progress_bar_big">135dp</dimen>
|
||||
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@
|
|||
<string name="smart_cash_ag">Smart Cash AG</string>
|
||||
<string name="wallet">Wallet</string>
|
||||
<string name="need_attach_card_again">Need attach card again</string>
|
||||
<string name="reading">READING…</string>
|
||||
<string name="verifying">VERIFYING…</string>
|
||||
|
||||
<!-- dialogs -->
|
||||
<string name="device_is_rooted">Your Android device is rooted. Security at risk!</string>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue