Updated on 2026-08-14

This commit is contained in:
Tangem 2018-07-17 11:24:29 +03:00
parent efd9666829
commit 302f9e6e22
7 changed files with 65 additions and 58 deletions

2
.gitignore vendored
View file

@ -10,6 +10,6 @@
.externalNativeBuild
app/libs/
.idea/vcs.xml
.idea/caches
.idea/caches/build_file_checksums.ser
.idea/dictionaries
.idea/runConfigurations.xml

Binary file not shown.

View file

@ -15,7 +15,7 @@ android {
applicationId "com.tangem.wallet"
minSdkVersion 21
targetSdkVersion 27
versionCode 37
versionCode 39
versionName "0.85.5." + generateVersionName()
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

View file

@ -57,12 +57,7 @@ public class ETHRequestTask extends InfuraTask {
BigInteger l = new BigInteger(balanceCap, 16);
Long balance = l.longValue();
// Log.i(TAG, " dvddvdv BigInteger.ZERO");
if (l.compareTo(BigInteger.ZERO) == 0) {
// Log.i(TAG, "BigInteger.ZERO");
loadedWallet.mCard.setBlockchainID(Blockchain.Ethereum.getID());
loadedWallet.mCard.addTokenToBlockchainName();
loadedWallet.mSwipeRefreshLayout.setRefreshing(false);
@ -133,7 +128,7 @@ public class ETHRequestTask extends InfuraTask {
}
}
if (loadedWallet.updateTasks.size() == 0)
// if (loadedWallet.updateTasks.size() == 0)
loadedWallet.mSwipeRefreshLayout.setRefreshing(false);
}
}

View file

@ -1,7 +1,6 @@
package com.tangem.data.network.task.loaded_wallet;
import android.os.AsyncTask;
import android.util.Log;
import com.tangem.data.network.request.ElectrumRequest;
import com.tangem.data.network.task.ElectrumTask;
@ -32,7 +31,6 @@ public class UpdateWalletInfoTask extends ElectrumTask {
reference = new WeakReference<>(context);
}
public UpdateWalletInfoTask(LoadedWallet context, String host, int port, SharedData sharedData) {
super(host, port, sharedData);
reference = new WeakReference<>(context);
@ -43,21 +41,21 @@ public class UpdateWalletInfoTask extends ElectrumTask {
super.onProgressUpdate(values);
}
@Override
protected void onCancelled() {
super.onCancelled();
LoadedWallet loadedWallet = reference.get();
loadedWallet.updateTasks.remove(this);
if (loadedWallet.updateTasks.size() == 0) loadedWallet.mSwipeRefreshLayout.setRefreshing(false);
}
// @Override
// protected void onCancelled() {
// super.onCancelled();
// LoadedWallet loadedWallet = reference.get();
//
// loadedWallet.updateTasks.remove(this);
// if (loadedWallet.updateTasks.size() == 0) loadedWallet.mSwipeRefreshLayout.setRefreshing(false);
// }
@Override
protected void onPostExecute(List<ElectrumRequest> requests) {
super.onPostExecute(requests);
LoadedWallet loadedWallet = reference.get();
Log.i("RequestWalletInfoTask", "onPostExecute[" + String.valueOf(loadedWallet.updateTasks.size()) + "]");
// Log.i("RequestWalletInfoTask", "onPostExecute[" + String.valueOf(loadedWallet.updateTasks.size()) + "]");
loadedWallet.updateTasks.remove(this);
CoinEngine engine = CoinEngineFactory.Create(loadedWallet.mCard.getBlockchain());
@ -115,7 +113,7 @@ public class UpdateWalletInfoTask extends ElectrumTask {
BigInteger bigInt = new BigInteger(hashTX, 16); //TODO: очень плохой способ
LastSignStorage.setTxWasSend(loadedWallet.mCard.getWallet());
LastSignStorage.setLastMessage(loadedWallet.mCard.getWallet(), "");
Log.e("TX_RESULT", hashTX);
// Log.e("TX_RESULT", hashTX);
} catch (Exception e) {
engine.SwitchNode(loadedWallet.mCard);
@ -265,7 +263,7 @@ public class UpdateWalletInfoTask extends ElectrumTask {
e.printStackTrace();
loadedWallet.errorOnUpdate(e.toString());
}
Log.e("TX", raw);
// Log.e("TX", raw);
}
}
@ -306,7 +304,9 @@ public class UpdateWalletInfoTask extends ElectrumTask {
}
}
}
if (loadedWallet.updateTasks.size() == 0) loadedWallet.mSwipeRefreshLayout.setRefreshing(false);
// if (loadedWallet.updateTasks.size() == 0)
loadedWallet.mSwipeRefreshLayout.setRefreshing(false);
}
}

View file

@ -3,7 +3,6 @@ package com.tangem.presentation.activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.res.AssetManager;
import android.nfc.NfcAdapter;
import android.nfc.Tag;
import android.os.Bundle;
@ -49,6 +48,9 @@ public class MainActivity extends AppCompatActivity implements PopupMenu.OnMenuI
private NfcAdapter.ReaderCallback onNFCReaderCallback;
private OnCardsClean onCardsClean;
private LinearLayout llTapPrompt;
private DeviceNFCAntennaLocation antenna;
private LinearLayout nfc;
private LinearLayout llHand;
public interface OnCardsClean {
void doClean();
@ -80,10 +82,10 @@ public class MainActivity extends AppCompatActivity implements PopupMenu.OnMenuI
TextView tvNFCHint = findViewById(R.id.tvNFCHint);
llTapPrompt = findViewById(R.id.llTapPrompt);
LinearLayout hand = findViewById(R.id.llHand);
llHand = findViewById(R.id.llHand);
ImageView ivHandCardHorizontal = findViewById(R.id.ivHandCardHorizontal);
ImageView ivHandCardVertical = findViewById(R.id.ivHandCardVertical);
LinearLayout nfc = findViewById(R.id.llNFC);
nfc = findViewById(R.id.llNFC);
RippleBackground rippleBackground = findViewById(R.id.imNFC);
FloatingActionButton fab = findViewById(R.id.fab);
@ -93,7 +95,7 @@ public class MainActivity extends AppCompatActivity implements PopupMenu.OnMenuI
rippleBackground.startRippleAnimation();
DeviceNFCAntennaLocation antenna = new DeviceNFCAntennaLocation();
antenna = new DeviceNFCAntennaLocation();
antenna.getAntennaLocation();
// set card orientation
@ -112,11 +114,11 @@ public class MainActivity extends AppCompatActivity implements PopupMenu.OnMenuI
// set card z position
switch (antenna.getZ()) {
case DeviceNFCAntennaLocation.CARD_ON_BACK:
hand.setElevation(0.0f);
llHand.setElevation(0.0f);
break;
case DeviceNFCAntennaLocation.CARD_ON_FRONT:
hand.setElevation(30.0f);
llHand.setElevation(30.0f);
break;
}
@ -126,27 +128,7 @@ public class MainActivity extends AppCompatActivity implements PopupMenu.OnMenuI
else
tvNFCHint.setText(String.format(getString(R.string.scan_banknote), getString(R.string.phone)));
// animate
final RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) hand.getLayoutParams();
final RelativeLayout.LayoutParams lp2 = (RelativeLayout.LayoutParams) nfc.getLayoutParams();
final float dp = getResources().getDisplayMetrics().density;
final float lm = dp * (69 + antenna.getX() * 75);
lp.topMargin = (int) (dp * (-100 + antenna.getY() * 250));
lp2.topMargin = (int) (dp * (-125 + antenna.getY() * 250));
nfc.setLayoutParams(lp2);
Animation a = new Animation() {
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
lp.leftMargin = (int) (lm * interpolatedTime);
hand.setLayoutParams(lp);
}
};
a.setDuration(2000);
a.setInterpolator(new DecelerateInterpolator());
hand.startAnimation(a);
// set listeners
fab.setOnClickListener(this::showMenu);
animate();
// add fragment
Main main = (Main) getSupportFragmentManager().findFragmentById(R.id.fragmentMain);
@ -168,6 +150,15 @@ public class MainActivity extends AppCompatActivity implements PopupMenu.OnMenuI
RootBeer rootBeer = new RootBeer(this);
if (rootBeer.isRootedWithoutBusyBoxCheck() && !BuildConfig.DEBUG)
new RootFoundDialog().show(getFragmentManager(), RootFoundDialog.TAG);
// set listeners
fab.setOnClickListener(this::showMenu);
}
@Override
protected void onResume() {
super.onResume();
animate();
}
@Override
@ -247,8 +238,8 @@ public class MainActivity extends AppCompatActivity implements PopupMenu.OnMenuI
if (LastSignStorage.needInit()) {
LastSignStorage.Init(context);
}
if( Issuer.needInit() ) Issuer.Init(context);
if( FW.needInit() ) FW.Init(context);
if (Issuer.needInit()) Issuer.Init(context);
if (FW.needInit()) FW.Init(context);
}
public void showCleanButton() {
@ -266,6 +257,27 @@ public class MainActivity extends AppCompatActivity implements PopupMenu.OnMenuI
startActivity(intent);
}
private void animate() {
final RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) llHand.getLayoutParams();
final RelativeLayout.LayoutParams lp2 = (RelativeLayout.LayoutParams) nfc.getLayoutParams();
final float dp = getResources().getDisplayMetrics().density;
final float lm = dp * (69 + antenna.getX() * 75);
lp.topMargin = (int) (dp * (-100 + antenna.getY() * 250));
lp2.topMargin = (int) (dp * (-125 + antenna.getY() * 250));
nfc.setLayoutParams(lp2);
Animation a = new Animation() {
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
lp.leftMargin = (int) (lm * interpolatedTime);
llHand.setLayoutParams(lp);
}
};
a.setDuration(2000);
a.setInterpolator(new DecelerateInterpolator());
llHand.startAnimation(a);
}
private void showSavePinActivity() {
Intent intent = new Intent(getBaseContext(), SavePINActivity.class);
intent.putExtra("PIN2", false);

View file

@ -113,13 +113,13 @@ public class LoadedWallet extends Fragment implements SwipeRefreshLayout.OnRefre
private class OnlineVerifyTask extends VerificationServerTask {
@Override
protected void onCancelled() {
super.onCancelled();
updateTasks.remove(this);
onlineVerifyTask=null;
if (updateTasks.size() == 0) mSwipeRefreshLayout.setRefreshing(false);
}
// @Override
// protected void onCancelled() {
// super.onCancelled();
// updateTasks.remove(this);
// onlineVerifyTask=null;
// if (updateTasks.size() == 0) mSwipeRefreshLayout.setRefreshing(false);
// }
@Override
protected void onPostExecute(List<VerificationServerProtocol.Request> requests) {