Updated on 2026-08-14

This commit is contained in:
Tangem 2018-07-19 15:59:07 +03:00
parent 2ba265a420
commit 201d3b5a72
7 changed files with 106 additions and 117 deletions

View file

@ -1,41 +0,0 @@
package com.tangem.presentation.activity;
import android.app.Activity;
import android.content.Intent;
import android.nfc.NfcAdapter;
import android.nfc.Tag;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import com.tangem.presentation.fragment.LoadedWallet;
import com.tangem.wallet.R;
import java.util.Objects;
public class LoadedWalletActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_loaded_wallet);
MainActivity.commonInit(getApplicationContext());
if (Objects.requireNonNull(getIntent().getExtras()).containsKey(NfcAdapter.EXTRA_TAG)) {
Tag tag = getIntent().getParcelableExtra(NfcAdapter.EXTRA_TAG);
if (tag != null) {
LoadedWallet fragment = (LoadedWallet) (getSupportFragmentManager().findFragmentById(R.id.loaded_wallet_fragment));
fragment.onTagDiscovered(tag);
}
}
}
@Override
public void onBackPressed() {
LoadedWallet loadedWallet = (LoadedWallet) getSupportFragmentManager().findFragmentById(R.id.loaded_wallet_fragment);
Intent data = loadedWallet.prepareResultIntent();
data.putExtra("modification", "update");
setResult(Activity.RESULT_OK, data);
finish();
}
}

View file

@ -0,0 +1,40 @@
package com.tangem.presentation.activity
import android.app.Activity
import android.nfc.NfcAdapter
import android.nfc.Tag
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import com.tangem.presentation.fragment.LoadedWallet
import com.tangem.wallet.R
class LoadedWalletActivity : AppCompatActivity() {
companion object {
const val EXTRA_MODIFICATION = "modification"
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_loaded_wallet)
MainActivity.commonInit(applicationContext)
if (intent.extras!!.containsKey(NfcAdapter.EXTRA_TAG)) {
val tag = intent.getParcelableExtra<Tag>(NfcAdapter.EXTRA_TAG)
if (tag != null) {
val fragment = supportFragmentManager.findFragmentById(R.id.loaded_wallet_fragment) as LoadedWallet
fragment.onTagDiscovered(tag)
}
}
}
override fun onBackPressed() {
val loadedWallet = supportFragmentManager.findFragmentById(R.id.loaded_wallet_fragment) as LoadedWallet
val data = loadedWallet.prepareResultIntent()
data.putExtra(EXTRA_MODIFICATION, "update")
setResult(Activity.RESULT_OK, data)
finish()
}
}

View file

@ -1,67 +0,0 @@
package com.tangem.presentation.activity;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.ImageView;
import android.widget.TextView;
import com.tangem.wallet.BuildConfig;
import com.tangem.wallet.R;
/**
* An example full-screen activity that shows and hides the system UI (i.e.
* status bar and navigation/system bar) with user interaction.
*/
public class LogoActivity extends AppCompatActivity {
public static final String TAG = LogoActivity.class.getSimpleName();
public static final String EXTRA_AUTO_HIDE = "extra_auto_hide";
public static final int MILLIS_AUTO_HIDE = 1000;
private final Runnable mHideRunnable = this::hide;
private ImageView imgLogo;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_logo);
imgLogo = findViewById(R.id.imgLogo);
// set up the user interaction to manually show or hide the system UI.
imgLogo.setOnClickListener(view -> hide());
}
@SuppressLint("SetTextI18n")
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
// trigger the initial hide() shortly after the activity has been created, to briefly hint to the user that UI controls are available.
TextView AppVersion = findViewById(R.id.AppVersion);
if (BuildConfig.DEBUG)
AppVersion.setText("BETA v." + BuildConfig.VERSION_NAME + "\n" + "dev" + "\n" + "build " + BuildConfig.VERSION_CODE);
else
AppVersion.setText("BETA v." + BuildConfig.VERSION_NAME);
if (getIntent().getBooleanExtra(EXTRA_AUTO_HIDE, true))
delayedHide();
}
private void hide() {
Intent intent = new Intent(getBaseContext(), MainActivity.class);
startActivity(intent);
finish();
}
private void delayedHide() {
// imgLogo.removeCallbacks(mHideRunnable);
imgLogo.postDelayed(mHideRunnable, MILLIS_AUTO_HIDE);
}
}

View file

@ -0,0 +1,48 @@
package com.tangem.presentation.activity
import android.annotation.SuppressLint
import android.content.Intent
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import com.tangem.wallet.BuildConfig
import com.tangem.wallet.R
import kotlinx.android.synthetic.main.activity_logo.*
class LogoActivity : AppCompatActivity() {
companion object {
val TAG: String = LogoActivity::class.java.simpleName
const val EXTRA_AUTO_HIDE = "extra_auto_hide"
const val MILLIS_AUTO_HIDE = 1000
}
private val hideRunnable = Runnable { this.hide() }
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_logo)
ivLogo.setOnClickListener { hide() }
}
@SuppressLint("SetTextI18n")
override fun onPostCreate(savedInstanceState: Bundle?) {
super.onPostCreate(savedInstanceState)
if (BuildConfig.DEBUG)
tvAppVersion.text = "BETA v." + BuildConfig.VERSION_NAME + "\n" + "dev" + "\n" + "build " + BuildConfig.VERSION_CODE
else
tvAppVersion.text = "BETA v." + BuildConfig.VERSION_NAME
if (intent.getBooleanExtra(EXTRA_AUTO_HIDE, true))
ivLogo.postDelayed(hideRunnable, MILLIS_AUTO_HIDE.toLong())
}
private fun hide() {
val intent = Intent(baseContext, MainActivity::class.java)
startActivity(intent)
finish()
}
}

View file

@ -1,5 +1,6 @@
package com.tangem.presentation.activity;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
@ -9,7 +10,6 @@ import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.PopupMenu;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
@ -98,6 +98,13 @@ public class MainActivity extends AppCompatActivity implements PopupMenu.OnMenuI
antenna = new DeviceNFCAntennaLocation();
antenna.getAntennaLocation();
try {
} catch (ActivityNotFoundException e) {
e.printStackTrace();
}
// set card orientation
switch (antenna.getOrientation()) {
case DeviceNFCAntennaLocation.CARD_ORIENTATION_HORIZONTAL:
@ -197,10 +204,10 @@ public class MainActivity extends AppCompatActivity implements PopupMenu.OnMenuI
try {
f = Logger.collectLogs(this);
if (f != null) {
Log.e(TAG, String.format("Collect %d log bytes", f.length()));
// Log.e(TAG, String.format("Collect %d log bytes", f.length()));
CommonUtil.sendEmail(this, zipFile, TAG, "Logs", PhoneUtility.getDeviceInfo(), new File[]{f});
} else {
Log.e(TAG, "Can't create temporaly log file");
// Log.e(TAG, "Can't create temporaly log file");
}
} catch (Exception e) {
e.printStackTrace();
@ -252,7 +259,7 @@ public class MainActivity extends AppCompatActivity implements PopupMenu.OnMenuI
private void showLogoActivity() {
Intent intent = new Intent(getBaseContext(), LogoActivity.class);
intent.putExtra(LogoActivity.TAG, true);
intent.putExtra(LogoActivity.Companion.getTAG(), true);
intent.putExtra(LogoActivity.EXTRA_AUTO_HIDE, false);
startActivity(intent);
}

View file

@ -167,10 +167,12 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
srlLoadedWallet!!.setOnRefreshListener { this.refresh() }
ivLookup.setOnClickListener {
if (mCard!!.hasBalanceInfo()) {
try {
val engineClick = CoinEngineFactory.Create(mCard!!.blockchain)
val browserIntent = Intent(Intent.ACTION_VIEW, engineClick!!.getShareWalletURIExplorer(mCard))
startActivity(browserIntent)
} catch (e: ActivityNotFoundException) {
e.printStackTrace()
}
}

View file

@ -6,10 +6,11 @@
android:background="#FFFFFF"
android:gravity="bottom"
android:orientation="vertical"
tools:context="com.tangem.presentation.activity.LogoActivity">
tools:context="com.tangem.presentation.activity.LogoActivity"
tools:ignore="contentDescription">
<ImageView
android:id="@+id/imgLogo"
android:id="@+id/ivLogo"
android:layout_width="match_parent"
android:layout_height="70dp"
android:layout_gravity="center_vertical"
@ -17,7 +18,7 @@
android:src="@drawable/tangem_logo_full_new"/>
<TextView
android:id="@+id/AppVersion"
android:id="@+id/tvAppVersion"
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_gravity="bottom"
@ -30,7 +31,6 @@
android:textSize="@dimen/text_size_small"/>
<TextView
android:id="@+id/textView9"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"