Updated on 2026-08-14
This commit is contained in:
parent
c336d452ab
commit
a28e440a73
11 changed files with 183 additions and 136 deletions
|
|
@ -10,6 +10,7 @@ import android.support.v7.app.AppCompatActivity;
|
|||
import com.tangem.presentation.fragment.LoadedWalletFragment;
|
||||
import com.tangem.wallet.R;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class LoadedWalletActivity extends AppCompatActivity {
|
||||
|
||||
|
|
@ -19,11 +20,10 @@ public class LoadedWalletActivity extends AppCompatActivity {
|
|||
setContentView(R.layout.activity_loaded_wallet);
|
||||
MainActivity.commonInit(getApplicationContext());
|
||||
|
||||
if( getIntent().getExtras().containsKey(NfcAdapter.EXTRA_TAG) )
|
||||
{
|
||||
Tag tag=getIntent().getParcelableExtra(NfcAdapter.EXTRA_TAG);
|
||||
if (tag != null ) {
|
||||
LoadedWalletFragment fragment=(LoadedWalletFragment)(getSupportFragmentManager().findFragmentById(R.id.loaded_wallet_fragment));
|
||||
if (Objects.requireNonNull(getIntent().getExtras()).containsKey(NfcAdapter.EXTRA_TAG)) {
|
||||
Tag tag = getIntent().getParcelableExtra(NfcAdapter.EXTRA_TAG);
|
||||
if (tag != null) {
|
||||
LoadedWalletFragment fragment = (LoadedWalletFragment) (getSupportFragmentManager().findFragmentById(R.id.loaded_wallet_fragment));
|
||||
fragment.onTagDiscovered(tag);
|
||||
}
|
||||
}
|
||||
|
|
@ -31,10 +31,11 @@ public class LoadedWalletActivity extends AppCompatActivity {
|
|||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
LoadedWalletFragment loadedWalletFragment =(LoadedWalletFragment) getSupportFragmentManager().findFragmentById(R.id.loaded_wallet_fragment);
|
||||
Intent data= loadedWalletFragment.prepareResultIntent();
|
||||
LoadedWalletFragment loadedWalletFragment = (LoadedWalletFragment) getSupportFragmentManager().findFragmentById(R.id.loaded_wallet_fragment);
|
||||
Intent data = loadedWalletFragment.prepareResultIntent();
|
||||
data.putExtra("modification", "update");
|
||||
setResult(Activity.RESULT_OK, data);
|
||||
finish();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import com.tangem.wallet.R;
|
|||
* status bar and navigation/system bar) with user interaction.
|
||||
*/
|
||||
public class LogoActivity extends AppCompatActivity {
|
||||
public static final String TAG = LogoActivity.class.getSimpleName();
|
||||
|
||||
private final Runnable mHideRunnable = new Runnable() {
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -72,7 +72,6 @@ public class MainActivity extends AppCompatActivity implements PopupMenu.OnMenuI
|
|||
// OnCreateNFCDialog onCreateNFCDialog;
|
||||
|
||||
|
||||
|
||||
public void setOnCardsClean(OnCardsClean onCardsClean) {
|
||||
this.onCardsClean = onCardsClean;
|
||||
}
|
||||
|
|
@ -126,7 +125,6 @@ public class MainActivity extends AppCompatActivity implements PopupMenu.OnMenuI
|
|||
new RootFoundDialog().show(getFragmentManager(), "RootFoundDialog");
|
||||
}
|
||||
|
||||
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);
|
||||
|
||||
commonInit(getApplicationContext());
|
||||
|
|
@ -207,7 +205,6 @@ public class MainActivity extends AppCompatActivity implements PopupMenu.OnMenuI
|
|||
showMenu(fab);
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.onKeyDown(keycode, e);
|
||||
}
|
||||
|
||||
|
|
@ -260,7 +257,6 @@ public class MainActivity extends AppCompatActivity implements PopupMenu.OnMenuI
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -281,9 +277,6 @@ public class MainActivity extends AppCompatActivity implements PopupMenu.OnMenuI
|
|||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Handle action bar item clicks here. The action bar will
|
||||
// automatically handle clicks on the Home/Up button, so long
|
||||
// as you specify a parent activity in AndroidManifest.xml.
|
||||
int id = item.getItemId();
|
||||
|
||||
//noinspection SimplifiableIfStatement
|
||||
|
|
@ -338,7 +331,7 @@ public class MainActivity extends AppCompatActivity implements PopupMenu.OnMenuI
|
|||
|
||||
private void showLogoActivity() {
|
||||
Intent intent = new Intent(getBaseContext(), LogoActivity.class);
|
||||
intent.putExtra("skipAutoHide", true);
|
||||
intent.putExtra(LogoActivity.TAG, true);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
|
|
@ -358,10 +351,13 @@ public class MainActivity extends AppCompatActivity implements PopupMenu.OnMenuI
|
|||
PopupMenu popup = new PopupMenu(this, v);
|
||||
MenuInflater inflater = popup.getMenuInflater();
|
||||
inflater.inflate(R.menu.menu_main, popup.getMenu());
|
||||
|
||||
if (BuildConfig.DEBUG) {
|
||||
for (int i = 0; i < popup.getMenu().size(); i++)
|
||||
popup.getMenu().getItem(i).setVisible(true);
|
||||
popup.getMenu().findItem(R.id.managePIN).setEnabled(true);
|
||||
popup.getMenu().findItem(R.id.managePIN2).setEnabled(true);
|
||||
popup.getMenu().findItem(R.id.sendLogs).setVisible(true);
|
||||
}
|
||||
|
||||
popup.setOnMenuItemClickListener(this);
|
||||
popup.show();
|
||||
}
|
||||
|
|
@ -402,4 +398,5 @@ public class MainActivity extends AppCompatActivity implements PopupMenu.OnMenuI
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -55,7 +55,7 @@ public class SavePINActivity extends AppCompatActivity implements FingerprintHel
|
|||
private FingerprintManager.CryptoObject cryptoObject;
|
||||
private FingerprintHelper fingerprintHelper;
|
||||
|
||||
private boolean UsePIN2=false;
|
||||
private boolean UsePIN2 = false;
|
||||
|
||||
|
||||
@Override
|
||||
|
|
@ -65,28 +65,28 @@ public class SavePINActivity extends AppCompatActivity implements FingerprintHel
|
|||
|
||||
MainActivity.commonInit(getApplicationContext());
|
||||
|
||||
UsePIN2=getIntent().getBooleanExtra("PIN2", false);
|
||||
UsePIN2 = getIntent().getBooleanExtra("PIN2", false);
|
||||
|
||||
tvPIN = findViewById(R.id.pin);
|
||||
OnClickListener onButtonNClick = new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
tvPIN.setText(String.format("%s%s", tvPIN.getText(),((Button) view).getText()));
|
||||
tvPIN.setText(String.format("%s%s", tvPIN.getText(), ((Button) view).getText()));
|
||||
}
|
||||
};
|
||||
|
||||
if( UsePIN2 ) {
|
||||
if (UsePIN2) {
|
||||
((TextView) findViewById(R.id.pin_prompt)).setText(R.string.enter_pin2_and_use_fingerprint_to_save_it);
|
||||
}else{
|
||||
} else {
|
||||
((TextView) findViewById(R.id.pin_prompt)).setText(R.string.enter_pin_and_use_fingerprint_to_save_it);
|
||||
}
|
||||
|
||||
chkUseFingerprint = (CheckBox) findViewById(R.id.chkUseFingerprint);
|
||||
|
||||
if( UsePIN2 ) {
|
||||
if (UsePIN2) {
|
||||
chkUseFingerprint.setChecked(true);
|
||||
chkUseFingerprint.setEnabled(false);
|
||||
}else{
|
||||
} else {
|
||||
chkUseFingerprint.setChecked(PINStorage.haveEncryptedPIN());
|
||||
chkUseFingerprint.setEnabled(true);
|
||||
}
|
||||
|
|
@ -164,6 +164,7 @@ public class SavePINActivity extends AppCompatActivity implements FingerprintHel
|
|||
|
||||
|
||||
private enum OnConfirmAction {Save, DeleteEncryptedAndSave, Delete}
|
||||
|
||||
OnConfirmAction onConfirmAction;
|
||||
|
||||
private void doSavePIN() {
|
||||
|
|
@ -188,8 +189,7 @@ public class SavePINActivity extends AppCompatActivity implements FingerprintHel
|
|||
focusView.requestFocus();
|
||||
} else {
|
||||
|
||||
if( UsePIN2 )
|
||||
{
|
||||
if (UsePIN2) {
|
||||
if (!testFingerPrintSettings()) {
|
||||
tvPIN.postDelayed(new Runnable() {
|
||||
@Override
|
||||
|
|
@ -204,7 +204,7 @@ public class SavePINActivity extends AppCompatActivity implements FingerprintHel
|
|||
|
||||
mConfirmWithFingerprintTask = new ConfirmWithFingerprintTask();
|
||||
mConfirmWithFingerprintTask.execute((Void) null);
|
||||
}else {
|
||||
} else {
|
||||
if (chkUseFingerprint.isChecked() || PINStorage.haveEncryptedPIN()) {
|
||||
if (!testFingerPrintSettings()) {
|
||||
tvPIN.postDelayed(new Runnable() {
|
||||
|
|
@ -236,8 +236,7 @@ public class SavePINActivity extends AppCompatActivity implements FingerprintHel
|
|||
}
|
||||
|
||||
private void doDeletePIN() {
|
||||
if( UsePIN2 )
|
||||
{
|
||||
if (UsePIN2) {
|
||||
if (PINStorage.haveEncryptedPIN2()) {
|
||||
if (!testFingerPrintSettings()) {
|
||||
tvPIN.postDelayed(new Runnable() {
|
||||
|
|
@ -255,7 +254,7 @@ public class SavePINActivity extends AppCompatActivity implements FingerprintHel
|
|||
tvPIN.setText("");
|
||||
finish();
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
if (chkUseFingerprint.isChecked() || PINStorage.haveEncryptedPIN()) {
|
||||
if (!testFingerPrintSettings()) {
|
||||
tvPIN.postDelayed(new Runnable() {
|
||||
|
|
@ -292,30 +291,27 @@ public class SavePINActivity extends AppCompatActivity implements FingerprintHel
|
|||
switch (onConfirmAction) {
|
||||
case Save:
|
||||
String textToEncrypt = tvPIN.getText().toString();
|
||||
if( UsePIN2 )
|
||||
{
|
||||
if (UsePIN2) {
|
||||
PINStorage.saveEncryptedPIN2(cipher, textToEncrypt);
|
||||
}else {
|
||||
} else {
|
||||
PINStorage.saveEncryptedPIN(cipher, textToEncrypt);
|
||||
}
|
||||
print(R.string.pin_save_success);
|
||||
break;
|
||||
case Delete:
|
||||
if( UsePIN2 )
|
||||
{
|
||||
if (UsePIN2) {
|
||||
PINStorage.deleteEncryptedPIN2();
|
||||
}else {
|
||||
} else {
|
||||
PINStorage.deleteEncryptedPIN();
|
||||
PINStorage.deletePIN();
|
||||
}
|
||||
tvPIN.setText("");
|
||||
break;
|
||||
case DeleteEncryptedAndSave:
|
||||
if( UsePIN2 )
|
||||
{
|
||||
if (UsePIN2) {
|
||||
PINStorage.deleteEncryptedPIN2();
|
||||
PINStorage.saveEncryptedPIN2(cipher, tvPIN.getText().toString());
|
||||
}else {
|
||||
} else {
|
||||
PINStorage.deleteEncryptedPIN();
|
||||
PINStorage.savePIN(tvPIN.getText().toString());
|
||||
}
|
||||
|
|
@ -382,11 +378,11 @@ public class SavePINActivity extends AppCompatActivity implements FingerprintHel
|
|||
KeyguardManager keyguardManager = (KeyguardManager) getSystemService(KEYGUARD_SERVICE);
|
||||
fingerprintManager = (FingerprintManager) getSystemService(FINGERPRINT_SERVICE);
|
||||
|
||||
if (!keyguardManager.isKeyguardSecure()) {
|
||||
print("User hasn't enabled Lock Screen");
|
||||
Toast.makeText(getBaseContext(), "User hasn't enabled Lock Screen", Toast.LENGTH_LONG).show();
|
||||
return false;
|
||||
}
|
||||
if (!keyguardManager.isKeyguardSecure()) {
|
||||
print("User hasn't enabled Lock Screen");
|
||||
Toast.makeText(getBaseContext(), "User hasn't enabled Lock Screen", Toast.LENGTH_LONG).show();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.USE_FINGERPRINT) != PackageManager.PERMISSION_GRANTED) {
|
||||
print("User hasn't granted permission to use Fingerprint");
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ import static com.tangem.domain.wallet.TangemCard.CountOurTx;
|
|||
|
||||
public class CardListAdapter extends RecyclerView.Adapter<CardListAdapter.CardViewHolder> {
|
||||
|
||||
|
||||
public static class CardViewHolder extends RecyclerView.ViewHolder {
|
||||
CardView cv;
|
||||
TextView tvBalance, tvOffline, tvBalanceEquivalent, tvWallet, tvInputs, tvStatusInBlockchain, tvCardID, tvLastInput, lbLastInput, lbLastOutput, tvLastOutput, tvBlockchain;
|
||||
|
|
@ -92,7 +91,7 @@ public class CardListAdapter extends RecyclerView.Adapter<CardListAdapter.CardVi
|
|||
|
||||
ArrayList<String> UIDs = instate.getStringArrayList("card_UID");
|
||||
|
||||
if( UIDs!=null ) {
|
||||
if (UIDs != null) {
|
||||
for (String UID : UIDs) {
|
||||
TangemCard card = new TangemCard(UID);
|
||||
card.LoadFromBundle(instate.getBundle(String.format("card_%s", UID)));
|
||||
|
|
@ -133,7 +132,7 @@ public class CardListAdapter extends RecyclerView.Adapter<CardListAdapter.CardVi
|
|||
}
|
||||
|
||||
public void addCard(TangemCard card) {
|
||||
mCards.add(0,card);
|
||||
mCards.add(0, card);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
|
|
@ -416,10 +415,10 @@ public class CardListAdapter extends RecyclerView.Adapter<CardListAdapter.CardVi
|
|||
|
||||
holder.tvType.setVisibility(View.VISIBLE);
|
||||
holder.tvTypeBg.setVisibility(View.VISIBLE);
|
||||
if( card.isReusable() ) {
|
||||
if (card.isReusable()) {
|
||||
holder.tvType.setText(" REUSABLE REUSABLE ");
|
||||
holder.tvTypeBg.setBackgroundColor(mContext.getResources().getColor(R.color.type_wallet, mContext.getTheme()));
|
||||
}else{
|
||||
} else {
|
||||
holder.tvType.setText(" BANKNOTE BANKNOTE");
|
||||
holder.tvTypeBg.setBackgroundColor(mContext.getResources().getColor(R.color.type_banknote, mContext.getTheme()));
|
||||
}
|
||||
|
|
@ -487,7 +486,7 @@ public class CardListAdapter extends RecyclerView.Adapter<CardListAdapter.CardVi
|
|||
}
|
||||
}
|
||||
|
||||
if ( engine.HasBalanceInfo(card) || card.getOfflineBalance() == null) {
|
||||
if (engine.HasBalanceInfo(card) || card.getOfflineBalance() == null) {
|
||||
String balance = engine.GetBalance(card);
|
||||
holder.tvBalance.setText(balance);
|
||||
holder.tvBalanceEquivalent.setText(engine.GetBalanceEquivalent(card));
|
||||
|
|
@ -549,17 +548,17 @@ public class CardListAdapter extends RecyclerView.Adapter<CardListAdapter.CardVi
|
|||
|
||||
holder.tvType.setVisibility(View.VISIBLE);
|
||||
holder.tvTypeBg.setVisibility(View.VISIBLE);
|
||||
if( card.isReusable() ) {
|
||||
if (card.isReusable()) {
|
||||
holder.tvType.setText(" REUSABLE REUSABLE ");
|
||||
holder.tvTypeBg.setBackgroundColor(mContext.getResources().getColor(R.color.type_wallet, mContext.getTheme()));
|
||||
holder.tvVoid.setVisibility(View.INVISIBLE);
|
||||
}else{
|
||||
} else {
|
||||
holder.tvType.setText(" BANKNOTE BANKNOTE");
|
||||
|
||||
if( card.getRemainingSignatures()!=card.getMaxSignatures() ) {
|
||||
if (card.getRemainingSignatures() != card.getMaxSignatures()) {
|
||||
holder.tvVoid.setVisibility(View.VISIBLE);
|
||||
holder.tvTypeBg.setBackgroundColor(mContext.getResources().getColor(R.color.msg_err, mContext.getTheme()));
|
||||
}else{
|
||||
} else {
|
||||
holder.tvVoid.setVisibility(View.INVISIBLE);
|
||||
holder.tvTypeBg.setBackgroundColor(mContext.getResources().getColor(R.color.type_banknote, mContext.getTheme()));
|
||||
}
|
||||
|
|
@ -568,7 +567,7 @@ public class CardListAdapter extends RecyclerView.Adapter<CardListAdapter.CardVi
|
|||
break;
|
||||
}
|
||||
|
||||
if(card.useDevelopersFirmware()) {
|
||||
if (card.useDevelopersFirmware()) {
|
||||
holder.tvType.setText(" DEVELOPER KIT ");
|
||||
holder.tvTypeBg.setBackgroundColor(mContext.getResources().getColor(R.color.fab, mContext.getTheme()));
|
||||
holder.tvVoid.setVisibility(View.INVISIBLE);
|
||||
|
|
@ -588,7 +587,7 @@ public class CardListAdapter extends RecyclerView.Adapter<CardListAdapter.CardVi
|
|||
|
||||
CardClickListener(int position) {
|
||||
card = mCards.get(position);
|
||||
pos=position;
|
||||
pos = position;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -171,8 +171,7 @@ public class LoadedWalletFragment extends Fragment implements SwipeRefreshLayout
|
|||
taskRate.execute(rate);
|
||||
|
||||
|
||||
}
|
||||
else if (mCard.getBlockchain() == Blockchain.Ethereum || mCard.getBlockchain() == Blockchain.EthereumTestNet) {
|
||||
} else if (mCard.getBlockchain() == Blockchain.Ethereum || mCard.getBlockchain() == Blockchain.EthereumTestNet) {
|
||||
ETHRequestTask updateETH = new ETHRequestTask(mCard.getBlockchain());
|
||||
InfuraRequest reqETH = InfuraRequest.GetBalance(mCard.getWallet());
|
||||
reqETH.setID(67);
|
||||
|
|
@ -450,33 +449,36 @@ public class LoadedWalletFragment extends Fragment implements SwipeRefreshLayout
|
|||
popup.getMenu().findItem(R.id.action_reset_PIN2).setVisible(mCard.allowSwapPIN2() && !mCard.useDefaultPIN2());
|
||||
popup.getMenu().findItem(R.id.action_reset_PINs).setVisible(mCard.allowSwapPIN() && mCard.allowSwapPIN2() && !mCard.useDefaultPIN1() && !mCard.useDefaultPIN2());
|
||||
|
||||
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
popup.setOnMenuItemClickListener(item -> {
|
||||
|
||||
int id = item.getItemId();
|
||||
switch (id) {
|
||||
case R.id.action_set_PIN1:
|
||||
doSetPin();
|
||||
return true;
|
||||
case R.id.action_reset_PIN1:
|
||||
doResetPin();
|
||||
return true;
|
||||
case R.id.action_set_PIN2:
|
||||
doSetPin2();
|
||||
return true;
|
||||
case R.id.action_reset_PIN2:
|
||||
doResetPin2();
|
||||
return true;
|
||||
case R.id.action_reset_PINs:
|
||||
doResetPins();
|
||||
return true;
|
||||
case R.id.action_purge:
|
||||
doPurge();
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
int id = item.getItemId();
|
||||
switch (id) {
|
||||
case R.id.action_set_PIN1:
|
||||
doSetPin();
|
||||
return true;
|
||||
|
||||
case R.id.action_reset_PIN1:
|
||||
doResetPin();
|
||||
return true;
|
||||
|
||||
case R.id.action_set_PIN2:
|
||||
doSetPin2();
|
||||
return true;
|
||||
|
||||
case R.id.action_reset_PIN2:
|
||||
doResetPin2();
|
||||
return true;
|
||||
|
||||
case R.id.action_reset_PINs:
|
||||
doResetPins();
|
||||
return true;
|
||||
|
||||
case R.id.action_purge:
|
||||
doPurge();
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
});
|
||||
popup.show();
|
||||
|
|
@ -779,14 +781,13 @@ public class LoadedWalletFragment extends Fragment implements SwipeRefreshLayout
|
|||
req.setID(67);
|
||||
req.setBlockchain(mCard.getBlockchain());
|
||||
task.execute(req);
|
||||
} else if (mCard.getBlockchain() == Blockchain.Bitcoin ||mCard.getBlockchain() == Blockchain.BitcoinTestNet) {
|
||||
} else if (mCard.getBlockchain() == Blockchain.Bitcoin || mCard.getBlockchain() == Blockchain.BitcoinTestNet) {
|
||||
String nodeAddress = engine.GetNode(mCard);
|
||||
int nodePort = engine.GetNodePort(mCard);
|
||||
|
||||
UpdateWalletInfoTask connectTask = new UpdateWalletInfoTask(nodeAddress, nodePort);
|
||||
connectTask.execute(ElectrumRequest.Broadcast(mCard.getWallet(), tx));
|
||||
}
|
||||
else if (mCard.getBlockchain() == Blockchain.BitcoinCash ||mCard.getBlockchain() == Blockchain.BitcoinCashTestNet) {
|
||||
} else if (mCard.getBlockchain() == Blockchain.BitcoinCash || mCard.getBlockchain() == Blockchain.BitcoinCashTestNet) {
|
||||
String nodeAddress = engine.GetNode(mCard);
|
||||
int nodePort = engine.GetNodePort(mCard);
|
||||
|
||||
|
|
@ -1372,7 +1373,7 @@ public class LoadedWalletFragment extends Fragment implements SwipeRefreshLayout
|
|||
e.printStackTrace();
|
||||
ErrorOnUpdate(e.toString());
|
||||
engine.SwitchNode(mCard);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
e.printStackTrace();
|
||||
ErrorOnUpdate(e.toString());
|
||||
|
|
@ -1422,7 +1423,7 @@ public class LoadedWalletFragment extends Fragment implements SwipeRefreshLayout
|
|||
e.printStackTrace();
|
||||
ErrorOnUpdate(e.toString());
|
||||
engine.SwitchNode(mCard);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < jsUnspentArray.length(); i++) {
|
||||
JSONObject jsUnspent = jsUnspentArray.getJSONObject(i);
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ public class MainFragment extends Fragment implements NfcAdapter.ReaderCallback,
|
|||
// SwipeRefreshLayout
|
||||
mSwipeRefreshLayout = result.findViewById(R.id.swipe_container); //TODO: tmp
|
||||
|
||||
if( mSwipeRefreshLayout!=null ) {
|
||||
if (mSwipeRefreshLayout != null) {
|
||||
SwipeRefreshLayout.OnRefreshListener onRefreshListener = new SwipeRefreshLayout.OnRefreshListener() {
|
||||
|
||||
@Override
|
||||
|
|
@ -127,7 +127,7 @@ public class MainFragment extends Fragment implements NfcAdapter.ReaderCallback,
|
|||
}
|
||||
}
|
||||
};
|
||||
mSwipeRefreshLayout.setOnRefreshListener(onRefreshListener); //TODO: tmp
|
||||
mSwipeRefreshLayout.setOnRefreshListener(onRefreshListener); //TODO: tmp
|
||||
}
|
||||
|
||||
ItemTouchHelper itemTouchHelper = new ItemTouchHelper(new ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT) {
|
||||
|
|
@ -267,15 +267,14 @@ public class MainFragment extends Fragment implements NfcAdapter.ReaderCallback,
|
|||
String nodeAddress = engine.GetNode(card);
|
||||
int nodePort = engine.GetNodePort(card);
|
||||
RequestWalletInfoTask task = new RequestWalletInfoTask(nodeAddress, nodePort);
|
||||
if( mSwipeRefreshLayout!=null ) mSwipeRefreshLayout.setRefreshing(true); //TODO: tmp
|
||||
if (mSwipeRefreshLayout != null) mSwipeRefreshLayout.setRefreshing(true); //TODO: tmp
|
||||
requestTasks.add(task);
|
||||
task.execute(ElectrumRequest.ListUnspent(card.getWallet()), ElectrumRequest.ListHistory(card.getWallet()));
|
||||
RateInfoTask taskRate = new RateInfoTask();
|
||||
ExchangeRequest rate = ExchangeRequest.GetRate(card.getWallet(), "bitcoin", "bitcoin");
|
||||
taskRate.execute(rate);
|
||||
|
||||
}
|
||||
else if (card.getBlockchain() == Blockchain.BitcoinCashTestNet || card.getBlockchain() == Blockchain.BitcoinCash) {
|
||||
} else if (card.getBlockchain() == Blockchain.BitcoinCashTestNet || card.getBlockchain() == Blockchain.BitcoinCash) {
|
||||
SharedData data = new SharedData(SharedData.COUNT_REQUEST);
|
||||
for (int i = 0; i < data.allRequest; ++i) {
|
||||
|
||||
|
|
@ -288,14 +287,14 @@ public class MainFragment extends Fragment implements NfcAdapter.ReaderCallback,
|
|||
String nodeAddress = engine.GetNode(card);
|
||||
int nodePort = engine.GetNodePort(card);
|
||||
RequestWalletInfoTask task = new RequestWalletInfoTask(nodeAddress, nodePort);
|
||||
if( mSwipeRefreshLayout!=null ) mSwipeRefreshLayout.setRefreshing(true); //TODO: tmp
|
||||
if (mSwipeRefreshLayout != null) mSwipeRefreshLayout.setRefreshing(true); //TODO: tmp
|
||||
requestTasks.add(task);
|
||||
task.execute(ElectrumRequest.ListUnspent(card.getWallet()), ElectrumRequest.ListHistory(card.getWallet()));
|
||||
RateInfoTask taskRate = new RateInfoTask();
|
||||
ExchangeRequest rate = ExchangeRequest.GetRate(card.getWallet(), "bitcoin-cash", "bitcoin-cash");
|
||||
taskRate.execute(rate);
|
||||
|
||||
}else if (card.getBlockchain() == Blockchain.Token) {
|
||||
} else if (card.getBlockchain() == Blockchain.Token) {
|
||||
ETHRequestTask updateETH = new ETHRequestTask(card.getBlockchain());
|
||||
InfuraRequest reqETH = InfuraRequest.GetTokenBalance(card.getWallet(), engine.GetContractAddress(card), engine.GetTokenDecimals(card));
|
||||
reqETH.setID(67);
|
||||
|
|
@ -362,7 +361,8 @@ public class MainFragment extends Fragment implements NfcAdapter.ReaderCallback,
|
|||
int nodePort = engine.GetNodePort(card);
|
||||
|
||||
RequestWalletInfoTask task = new RequestWalletInfoTask(nodeAddress, nodePort);
|
||||
if( mSwipeRefreshLayout!=null ) mSwipeRefreshLayout.setRefreshing(true); //TODO: tmp
|
||||
if (mSwipeRefreshLayout != null)
|
||||
mSwipeRefreshLayout.setRefreshing(true); //TODO: tmp
|
||||
|
||||
requestTasks.add(task);
|
||||
task.execute(ElectrumRequest.ListUnspent(card.getWallet()), ElectrumRequest.ListHistory(card.getWallet()));
|
||||
|
|
@ -370,7 +370,7 @@ public class MainFragment extends Fragment implements NfcAdapter.ReaderCallback,
|
|||
ExchangeRequest rate = ExchangeRequest.GetRate(card.getWallet(), "bitcoin", "bitcoin");
|
||||
taskRate.execute(rate);
|
||||
|
||||
}else if (card.getBlockchain() == Blockchain.BitcoinCashTestNet || card.getBlockchain() == Blockchain.BitcoinCash) {
|
||||
} else if (card.getBlockchain() == Blockchain.BitcoinCashTestNet || card.getBlockchain() == Blockchain.BitcoinCash) {
|
||||
SharedData data = new SharedData(SharedData.COUNT_REQUEST);
|
||||
|
||||
for (int i = 0; i < data.allRequest; ++i) {
|
||||
|
|
@ -385,7 +385,8 @@ public class MainFragment extends Fragment implements NfcAdapter.ReaderCallback,
|
|||
int nodePort = engine.GetNodePort(card);
|
||||
|
||||
RequestWalletInfoTask task = new RequestWalletInfoTask(nodeAddress, nodePort);
|
||||
if( mSwipeRefreshLayout!=null ) mSwipeRefreshLayout.setRefreshing(true); //TODO: tmp
|
||||
if (mSwipeRefreshLayout != null)
|
||||
mSwipeRefreshLayout.setRefreshing(true); //TODO: tmp
|
||||
|
||||
requestTasks.add(task);
|
||||
task.execute(ElectrumRequest.ListUnspent(card.getWallet()), ElectrumRequest.ListHistory(card.getWallet()));
|
||||
|
|
@ -393,8 +394,7 @@ public class MainFragment extends Fragment implements NfcAdapter.ReaderCallback,
|
|||
ExchangeRequest rate = ExchangeRequest.GetRate(card.getWallet(), "bitcoin-cash", "bitcoin-cash");
|
||||
taskRate.execute(rate);
|
||||
|
||||
}
|
||||
else if (card.getBlockchain() == Blockchain.Token) {
|
||||
} else if (card.getBlockchain() == Blockchain.Token) {
|
||||
ETHRequestTask updateETH = new ETHRequestTask(card.getBlockchain());
|
||||
InfuraRequest reqETH = InfuraRequest.GetTokenBalance(card.getWallet(), engine.GetContractAddress(card), engine.GetTokenDecimals(card));
|
||||
reqETH.setID(67);
|
||||
|
|
@ -428,23 +428,32 @@ public class MainFragment extends Fragment implements NfcAdapter.ReaderCallback,
|
|||
@Override
|
||||
public void onViewCard(Bundle cardInfo) {
|
||||
|
||||
if( mSwipeRefreshLayout!=null ) mSwipeRefreshLayout.setRefreshing(false); //TODO: tmp
|
||||
if (mSwipeRefreshLayout != null)
|
||||
mSwipeRefreshLayout.setRefreshing(false); //TODO: tmp
|
||||
|
||||
String UID = cardInfo.getString("UID");
|
||||
TangemCard card = new TangemCard(UID);
|
||||
card.LoadFromBundle(cardInfo.getBundle("Card"));
|
||||
|
||||
|
||||
Intent intent;
|
||||
|
||||
if (card.getStatus() == TangemCard.Status.Empty) {
|
||||
intent = new Intent(getActivity(), EmptyWalletActivity.class);
|
||||
} else if (card.getStatus() == TangemCard.Status.Loaded) {
|
||||
// Toast.makeText(getContext(), "1", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
else if (card.getStatus() == TangemCard.Status.Loaded) {
|
||||
intent = new Intent(getActivity(), LoadedWalletActivity.class);
|
||||
} else if (card.getStatus() == TangemCard.Status.NotPersonalized || card.getStatus() == TangemCard.Status.Purged) {
|
||||
// Toast.makeText(getContext(), "2", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
else if (card.getStatus() == TangemCard.Status.NotPersonalized || card.getStatus() == TangemCard.Status.Purged) {
|
||||
// Toast.makeText(getContext(), "3", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
}
|
||||
|
||||
else {
|
||||
intent = new Intent(getActivity(), LoadedWalletActivity.class);
|
||||
// Toast.makeText(getContext(), "4", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
intent.putExtras(cardInfo);
|
||||
|
|
@ -771,7 +780,8 @@ public class MainFragment extends Fragment implements NfcAdapter.ReaderCallback,
|
|||
protected void onCancelled() {
|
||||
super.onCancelled();
|
||||
requestTasks.remove(this);
|
||||
if ( mSwipeRefreshLayout!=null && requestTasks.size() == 0) mSwipeRefreshLayout.setRefreshing(false); //TODO: tmp
|
||||
if (mSwipeRefreshLayout != null && requestTasks.size() == 0)
|
||||
mSwipeRefreshLayout.setRefreshing(false); //TODO: tmp
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -921,7 +931,8 @@ public class MainFragment extends Fragment implements NfcAdapter.ReaderCallback,
|
|||
}
|
||||
}
|
||||
|
||||
if ( mSwipeRefreshLayout!=null && requestTasks.size() == 0) mSwipeRefreshLayout.setRefreshing(false); //TODO: tmp
|
||||
if (mSwipeRefreshLayout != null && requestTasks.size() == 0)
|
||||
mSwipeRefreshLayout.setRefreshing(false); //TODO: tmp
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,41 +1,49 @@
|
|||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<menu
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context="com.bitex.Wallet.LoadedWalletActivity">
|
||||
tools:context="com.tangem.presentation.activity.LoadedWalletActivity">
|
||||
|
||||
<item
|
||||
android:id="@+id/action_set_PIN1"
|
||||
android:orderInCategory="100"
|
||||
android:title="Set PIN1"
|
||||
android:enabled="false"
|
||||
app:showAsAction="never" />
|
||||
android:orderInCategory="100"
|
||||
android:title="@string/set_pin_1"
|
||||
app:showAsAction="never"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_set_PIN2"
|
||||
android:orderInCategory="100"
|
||||
android:title="Set PIN2"
|
||||
android:enabled="false"
|
||||
app:showAsAction="never" />
|
||||
android:orderInCategory="200"
|
||||
android:title="@string/set_pin_2"
|
||||
app:showAsAction="never"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_reset_PIN1"
|
||||
android:orderInCategory="100"
|
||||
android:title="Reset PIN1 to default"
|
||||
android:enabled="false"
|
||||
app:showAsAction="never" />
|
||||
android:orderInCategory="300"
|
||||
android:title="@string/reset_pin_1_to_default"
|
||||
app:showAsAction="never"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_reset_PIN2"
|
||||
android:orderInCategory="100"
|
||||
android:title="Reset PIN2 to default"
|
||||
android:enabled="false"
|
||||
app:showAsAction="never" />
|
||||
android:orderInCategory="400"
|
||||
android:title="@string/reset_pin_2_to_default"
|
||||
app:showAsAction="never"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_reset_PINs"
|
||||
android:orderInCategory="100"
|
||||
android:title="Reset PINs to default"
|
||||
android:enabled="false"
|
||||
app:showAsAction="never" />
|
||||
android:orderInCategory="500"
|
||||
android:title="@string/reset_pins_to_default"
|
||||
app:showAsAction="never"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_purge"
|
||||
android:orderInCategory="100"
|
||||
android:title="Erase wallet"
|
||||
android:enabled="true"
|
||||
app:showAsAction="never" />
|
||||
android:orderInCategory="600"
|
||||
android:title="@string/erase_wallet"
|
||||
app:showAsAction="never"/>
|
||||
|
||||
</menu>
|
||||
|
|
|
|||
|
|
@ -1,10 +1,28 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
<menu
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:title="Clean up" android:id="@+id/cleanCards"/>
|
||||
<item android:title="Manage user PIN1..." android:id="@+id/managePIN" android:enabled="false"/>
|
||||
<item android:title="Manage user PIN2..." android:id="@+id/managePIN2" android:enabled="false"/>
|
||||
<item android:title="Send logs..." android:id="@+id/sendLogs" android:visible="false"/>
|
||||
<!--<item android:title="Switch to another blockchain host" android:id="@+id/switchToAnotherBitcoinHost" android:visible="false"/>-->
|
||||
<item android:title="About..." android:id="@+id/about"/>
|
||||
<item
|
||||
android:id="@+id/cleanCards"
|
||||
android:title="@string/clean_up"/>
|
||||
<item
|
||||
android:id="@+id/managePIN"
|
||||
android:enabled="false"
|
||||
android:title="@string/manage_user_pin_1"/>
|
||||
<item
|
||||
android:id="@+id/managePIN2"
|
||||
android:enabled="false"
|
||||
android:title="@string/manage_user_pin_2"/>
|
||||
<item
|
||||
android:id="@+id/sendLogs"
|
||||
android:title="@string/send_logs"
|
||||
android:visible="false"/>
|
||||
|
||||
<!--<item-->
|
||||
<!--android:id="@+id/switchToAnotherBitcoinHost"-->
|
||||
<!--android:title="Switch to another blockchain host"-->
|
||||
<!--android:visible="false"/>-->
|
||||
|
||||
<item
|
||||
android:id="@+id/about"
|
||||
android:title="@string/about"/>
|
||||
</menu>
|
||||
|
|
@ -30,6 +30,21 @@
|
|||
<string name="title_activity_loaded_wallet">LoadedWalletActivity</string>
|
||||
<string name="title_activity_settings_feature">Settings</string>
|
||||
|
||||
<!-- menu main -->
|
||||
<string name="clean_up">Clean up</string>
|
||||
<string name="manage_user_pin_1">Manage user PIN1…</string>
|
||||
<string name="manage_user_pin_2">Manage user PIN2…</string>
|
||||
<string name="send_logs">Send logs…</string>
|
||||
<string name="about">About…</string>
|
||||
|
||||
<!-- menu loaded wallet -->
|
||||
<string name="set_pin_1">Set PIN1</string>
|
||||
<string name="set_pin_2">Set PIN2</string>
|
||||
<string name="reset_pin_1_to_default">Reset PIN1 to default</string>
|
||||
<string name="reset_pin_2_to_default">Reset PIN2 to default</string>
|
||||
<string name="reset_pins_to_default">Reset PINs to default</string>
|
||||
<string name="erase_wallet">Erase wallet</string>
|
||||
|
||||
|
||||
<!-- LogoActivity -->
|
||||
<string name="beta">BETA</string>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue