Commit 2f4f6b24 authored by pokkst's avatar pokkst

Reformat code

parent 74c01987
......@@ -2,25 +2,19 @@ package app.crescentcash.src
import android.content.Context
import android.content.Intent
import android.content.SharedPreferences
import android.os.Bundle
import android.os.CountDownTimer
import android.provider.ContactsContract
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import app.crescentcash.src.hash.HashHelper
import app.crescentcash.src.manager.AppManager
import app.crescentcash.src.manager.UIManager
import app.crescentcash.src.manager.WalletManager
import app.crescentcash.src.net.NetHelper
import app.crescentcash.src.ui.UIHelper
import app.crescentcash.src.utils.Constants
import app.crescentcash.src.utils.PermissionHelper
import app.crescentcash.src.utils.PrefsUtil
import app.crescentcash.src.wallet.SLPWalletHelper
import app.crescentcash.src.wallet.WalletHelper
import com.google.firebase.FirebaseApp
import com.google.zxing.integration.android.IntentIntegrator
import org.bitcoinj.core.Transaction
import org.bitcoinj.utils.MonetaryFormat
import java.io.File
......
package app.crescentcash.src.activity
import android.content.ClipData
import android.content.ClipboardManager
import android.content.Context
import android.content.Intent
import android.graphics.Color
import android.os.Bundle
import android.text.Editable
import android.text.TextUtils
import android.text.TextWatcher
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.*
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.get
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import app.crescentcash.src.MainActivity
import app.crescentcash.src.R
import app.crescentcash.src.manager.AppManager
import app.crescentcash.src.manager.UIManager
import app.crescentcash.src.manager.WalletManager
import app.crescentcash.src.qr.QRHelper
import app.crescentcash.src.ui.NonScrollListView
import app.crescentcash.src.ui.UIHelper
import app.crescentcash.src.utils.Constants
import app.crescentcash.src.utils.PrefsUtil
import app.crescentcash.src.wallet.WalletHelper
import com.google.android.material.floatingactionbutton.FloatingActionButton
import org.bitcoinj.core.CashAddressFactory
import org.bitcoinj.core.ECKey
import org.bitcoinj.core.TransactionOutput
import org.bitcoinj.utils.MonetaryFormat
import org.bitcoinj.wallet.Wallet
import java.text.DecimalFormat
import java.text.DecimalFormatSymbols
import java.util.*
class AdvancedSettingsActivity : AppCompatActivity() {
lateinit var networkNodeText: EditText
......@@ -100,9 +78,9 @@ class AdvancedSettingsActivity : AppCompatActivity() {
val address = addressToVerify.text.toString()
val signature = verifySignature.text.toString()
if(!TextUtils.isEmpty(message) && !TextUtils.isEmpty(address) && !TextUtils.isEmpty(signature)) {
if(address.contains("#")) {
object: Thread() {
if (!TextUtils.isEmpty(message) && !TextUtils.isEmpty(address) && !TextUtils.isEmpty(signature)) {
if (address.contains("#")) {
object : Thread() {
override fun run() {
WalletManager().verify(this@AdvancedSettingsActivity, address, signature, message)
}
......@@ -115,7 +93,7 @@ class AdvancedSettingsActivity : AppCompatActivity() {
this.btnScanMsgToVerify.setOnClickListener { UIManager.clickScanQR(this, Constants.REQUEST_CODE_SIG_VERIFY_MESSAGE_SCAN) }
this.btnScanAddrToVerify.setOnClickListener { UIManager.clickScanQR(this, Constants.REQUEST_CODE_SIG_VERIFY_ADDRESS_SCAN) }
this.btnScanSigToVerify.setOnClickListener { UIManager.clickScanQR(this, Constants.REQUEST_CODE_SIG_VERIFY_SIGNATURE_SCAN) }
val onTextChangeListener = object: TextWatcher {
val onTextChangeListener = object : TextWatcher {
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {}
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {}
override fun afterTextChanged(s: Editable?) {
......@@ -142,6 +120,5 @@ class AdvancedSettingsActivity : AppCompatActivity() {
}
}
companion object {
}
companion object
}
package app.crescentcash.src.activity
import android.content.Intent
import android.os.Bundle
import android.text.TextUtils
import android.view.View
import android.widget.*
import android.widget.Button
import android.widget.EditText
import androidx.appcompat.app.AppCompatActivity
import app.crescentcash.src.MainActivity
import app.crescentcash.src.R
import app.crescentcash.src.manager.UIManager
import app.crescentcash.src.manager.WalletManager
import app.crescentcash.src.ui.UIHelper
import app.crescentcash.src.wallet.WalletHelper
import org.bitcoinj.crypto.KeyCrypterScrypt
import org.bitcoinj.utils.MonetaryFormat
import java.net.InetSocketAddress
import java.net.Proxy
import java.text.DecimalFormat
import java.text.DecimalFormatSymbols
import java.util.*
class DecryptWalletActivity : AppCompatActivity() {
lateinit var unlockPassword: EditText
......@@ -60,6 +50,5 @@ class DecryptWalletActivity : AppCompatActivity() {
}
}
companion object {
}
companion object
}
package app.crescentcash.src.activity
import android.content.Intent
import android.os.Bundle
import android.text.TextUtils
import android.view.View
import android.widget.*
import android.widget.Button
import android.widget.EditText
import androidx.appcompat.app.AppCompatActivity
import app.crescentcash.src.MainActivity
import app.crescentcash.src.R
import app.crescentcash.src.manager.UIManager
import app.crescentcash.src.manager.WalletManager
import app.crescentcash.src.ui.UIHelper
import app.crescentcash.src.wallet.WalletHelper
import org.bitcoinj.crypto.KeyCrypterScrypt
import org.bitcoinj.utils.MonetaryFormat
import java.net.InetSocketAddress
import java.net.Proxy
import java.text.DecimalFormat
import java.text.DecimalFormatSymbols
import java.util.*
class EncryptWalletActivity : AppCompatActivity() {
lateinit var encryptBtn: Button
......@@ -65,6 +55,5 @@ class EncryptWalletActivity : AppCompatActivity() {
}
}
companion object {
}
companion object
}
......@@ -268,6 +268,5 @@ class HistoryActivity : AppCompatActivity() {
}
}
companion object {
}
companion object
}
......@@ -3,39 +3,29 @@ package app.crescentcash.src.activity
import android.content.ClipData
import android.content.ClipboardManager
import android.content.Context
import android.content.Intent
import android.graphics.Color
import android.os.Bundle
import android.text.Editable
import android.text.TextUtils
import android.text.TextWatcher
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.*
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.get
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import app.crescentcash.src.MainActivity
import app.crescentcash.src.R
import app.crescentcash.src.manager.AppManager
import app.crescentcash.src.manager.UIManager
import app.crescentcash.src.manager.WalletManager
import app.crescentcash.src.qr.QRHelper
import app.crescentcash.src.ui.NonScrollListView
import app.crescentcash.src.ui.UIHelper
import app.crescentcash.src.utils.Constants
import app.crescentcash.src.utils.PrefsUtil
import app.crescentcash.src.wallet.WalletHelper
import com.google.android.material.floatingactionbutton.FloatingActionButton
import org.bitcoinj.core.CashAddressFactory
import org.bitcoinj.core.ECKey
import org.bitcoinj.core.TransactionOutput
import org.bitcoinj.utils.MonetaryFormat
import org.bitcoinj.wallet.Wallet
import java.text.DecimalFormat
import java.text.DecimalFormatSymbols
import java.util.*
import kotlin.collections.isNotEmpty
import kotlin.collections.set
class KeysListActivity : AppCompatActivity() {
private lateinit var srlKeys: SwipeRefreshLayout
......@@ -68,11 +58,12 @@ class KeysListActivity : AppCompatActivity() {
this.srlKeys.setOnRefreshListener { this.refreshKeys() }
this.btnImportKeyScan.setOnClickListener { UIManager.clickScanQR(this, Constants.REQUEST_CODE_IMPORT_SCAN) }
this.keysList.setOnItemClickListener { parent, view, position, id ->
WalletManager.currentEcKey = AppManager.walletManager.issuedKeysArrayList[position]["key"] ?: error("")
WalletManager.currentEcKey = AppManager.walletManager.issuedKeysArrayList[position]["key"]
?: error("")
UIManager.startActivity(this, ManageKeyActivity::class.java)
}
this.btnImportKey.setOnClickListener {
if(!TextUtils.isEmpty(keyToImportText.text.toString())){
if (!TextUtils.isEmpty(keyToImportText.text.toString())) {
WalletManager.importPrivateKey(keyToImportText.text.toString())
keyToImportText.text = null
refreshKeys()
......@@ -97,13 +88,13 @@ class KeysListActivity : AppCompatActivity() {
private fun setKeysList() {
if (WalletManager.wallet.issuedReceiveKeys.isNotEmpty()) {
AppManager.walletManager.issuedKeysArrayList = ArrayList()
for(key in WalletManager.wallet.issuedReceiveKeys) {
for (key in WalletManager.wallet.issuedReceiveKeys) {
val datum = HashMap<String, ECKey>()
datum["key"] = key
AppManager.walletManager.issuedKeysArrayList.add(datum)
}
for(key in WalletManager.wallet.importedKeys) {
for (key in WalletManager.wallet.importedKeys) {
val datum = HashMap<String, ECKey>()
datum["key"] = key
AppManager.walletManager.issuedKeysArrayList.add(datum)
......@@ -113,14 +104,14 @@ class KeysListActivity : AppCompatActivity() {
override fun getView(position: Int, convertView: View?, parent: ViewGroup): View {
val view = LayoutInflater.from(parent.context).inflate(R.layout.key_cell, null)
val ecKey = AppManager.walletManager.issuedKeysArrayList[position]["key"]
if(ecKey != null) {
if (ecKey != null) {
val legacyAddr = ecKey.toAddress(WalletManager.parameters).toString()
val params = WalletManager.parameters
val cashAddr = CashAddressFactory.create().getFromBase58(params, legacyAddr).toString().replace(params.cashAddrPrefix + ":", "")
val cashAcctInternal = PrefsUtil.prefs.getString("cashacct_$legacyAddr", "")
val cashAcctTx = PrefsUtil.prefs.getString("cashacct_tx_$legacyAddr", "")
if(position == 0) {
if (position == 0) {
setCashAcctText(view, "")
} else {
if (cashAcctInternal.toString().endsWith("#???")) {
......@@ -183,6 +174,5 @@ class KeysListActivity : AppCompatActivity() {
}
}
companion object {
}
companion object
}
......@@ -3,38 +3,18 @@ package app.crescentcash.src.activity
import android.content.ClipData
import android.content.ClipboardManager
import android.content.Context
import android.graphics.Color
import android.os.Bundle
import android.text.Editable
import android.text.TextUtils
import android.text.TextWatcher
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.*
import android.widget.Button
import android.widget.EditText
import android.widget.TextView
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.get
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import app.crescentcash.src.MainActivity
import app.crescentcash.src.R
import app.crescentcash.src.manager.AppManager
import app.crescentcash.src.manager.UIManager
import app.crescentcash.src.manager.WalletManager
import app.crescentcash.src.qr.QRHelper
import app.crescentcash.src.ui.NonScrollListView
import app.crescentcash.src.ui.UIHelper
import app.crescentcash.src.utils.Constants
import app.crescentcash.src.utils.PrefsUtil
import app.crescentcash.src.wallet.WalletHelper
import com.google.android.material.floatingactionbutton.FloatingActionButton
import org.bitcoinj.core.CashAddressFactory
import org.bitcoinj.core.ECKey
import org.bitcoinj.core.TransactionOutput
import org.bitcoinj.utils.MonetaryFormat
import org.bitcoinj.wallet.Wallet
import java.text.DecimalFormat
import java.text.DecimalFormatSymbols
import java.util.*
class ManageKeyActivity : AppCompatActivity() {
lateinit var messageToSignText: EditText
......@@ -67,7 +47,7 @@ class ManageKeyActivity : AppCompatActivity() {
private fun initListeners() {
this.signMessageBtn.setOnClickListener {
if(!TextUtils.isEmpty(messageToSignText.text.toString())) {
if (!TextUtils.isEmpty(messageToSignText.text.toString())) {
val signature = WalletManager.signMessageWithKey(WalletManager.currentEcKey, messageToSignText.text.toString())
signatureText.text = signature
}
......@@ -79,7 +59,7 @@ class ManageKeyActivity : AppCompatActivity() {
Toast.makeText(MainActivity.INSTANCE, "Copied private key", Toast.LENGTH_SHORT).show()
}
this.registerCashAcctBtn.setOnClickListener {
if(!TextUtils.isEmpty(newCashAcctName.text.toString())) {
if (!TextUtils.isEmpty(newCashAcctName.text.toString())) {
val key = WalletManager.currentEcKey
val address = key.toAddress(WalletManager.parameters).toBase58()
val txHash = WalletManager.registerCashAccount(key, newCashAcctName.text.toString())
......@@ -93,6 +73,5 @@ class ManageKeyActivity : AppCompatActivity() {
}
}
companion object {
}
companion object
}
......@@ -5,45 +5,25 @@ import android.content.ClipboardManager
import android.content.Context
import android.graphics.Bitmap
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Matrix
import android.graphics.drawable.BitmapDrawable
import android.graphics.drawable.Drawable
import android.os.Bundle
import android.text.Editable
import android.text.TextUtils
import android.text.TextWatcher
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.*
import android.widget.ImageView
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.get
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import app.crescentcash.src.MainActivity
import app.crescentcash.src.R
import app.crescentcash.src.hash.HashHelper
import app.crescentcash.src.manager.AppManager
import app.crescentcash.src.manager.UIManager
import app.crescentcash.src.manager.WalletManager
import app.crescentcash.src.qr.QRHelper
import app.crescentcash.src.ui.NonScrollListView
import app.crescentcash.src.ui.UIHelper
import app.crescentcash.src.utils.Constants
import app.crescentcash.src.utils.PrefsUtil
import app.crescentcash.src.wallet.WalletHelper
import com.google.android.material.floatingactionbutton.FloatingActionButton
import com.google.zxing.BarcodeFormat
import com.google.zxing.WriterException
import com.journeyapps.barcodescanner.BarcodeEncoder
import org.bitcoinj.core.CashAddressFactory
import org.bitcoinj.core.ECKey
import org.bitcoinj.core.TransactionOutput
import org.bitcoinj.utils.MonetaryFormat
import org.bitcoinj.wallet.Wallet
import java.text.DecimalFormat
import java.text.DecimalFormatSymbols
import java.util.*
class ReceiveActivity : AppCompatActivity() {
private lateinit var copyBtcAddr: ImageView
......@@ -113,7 +93,7 @@ class ReceiveActivity : AppCompatActivity() {
fun displayCashAccount(savedInstanceState: Bundle?) {
myCashHandle.text = if (savedInstanceState == null) {
val extras = intent.extras
if(extras == null) {
if (extras == null) {
""
} else {
extras.getString(Constants.INTENT_CASH_ACCOUNT_DATA)
......@@ -239,6 +219,5 @@ class ReceiveActivity : AppCompatActivity() {
}
}
companion object {
}
companion object
}
......@@ -5,44 +5,23 @@ import android.content.ClipboardManager
import android.content.Context
import android.graphics.Bitmap
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Matrix
import android.graphics.drawable.BitmapDrawable
import android.graphics.drawable.Drawable
import android.os.Bundle
import android.text.Editable
import android.text.TextUtils
import android.text.TextWatcher
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.*
import android.widget.ImageButton
import android.widget.ImageView
import android.widget.TextView
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.get
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import app.crescentcash.src.MainActivity
import app.crescentcash.src.R
import app.crescentcash.src.hash.HashHelper
import app.crescentcash.src.manager.AppManager
import app.crescentcash.src.manager.UIManager
import app.crescentcash.src.manager.WalletManager
import app.crescentcash.src.qr.QRHelper
import app.crescentcash.src.ui.NonScrollListView
import app.crescentcash.src.ui.UIHelper
import app.crescentcash.src.utils.Constants
import app.crescentcash.src.wallet.WalletHelper
import com.google.android.material.floatingactionbutton.FloatingActionButton
import com.google.zxing.BarcodeFormat
import com.google.zxing.WriterException
import com.journeyapps.barcodescanner.BarcodeEncoder
import org.bitcoinj.core.CashAddressFactory
import org.bitcoinj.core.ECKey
import org.bitcoinj.core.TransactionOutput
import org.bitcoinj.utils.MonetaryFormat
import org.bitcoinj.wallet.Wallet
import java.text.DecimalFormat
import java.text.DecimalFormatSymbols
import java.util.*
class ReceiveSLPActivity : AppCompatActivity() {
private lateinit var copySlpAddr: ImageView
......@@ -159,6 +138,5 @@ class ReceiveSLPActivity : AppCompatActivity() {
}
}
companion object {
}
companion object
}
package app.crescentcash.src.activity
import android.content.ClipData
import android.content.ClipboardManager
import android.content.Context
import android.content.Intent
import android.graphics.Color
import android.os.Bundle
import android.provider.ContactsContract
import android.text.Editable
import android.text.TextUtils
import android.text.TextWatcher
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.*
import androidx.annotation.UiThread
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.get
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import app.crescentcash.src.MainActivity
import app.crescentcash.src.R
import app.crescentcash.src.listener.RecipientTextListener
import app.crescentcash.src.manager.AppManager
import app.crescentcash.src.manager.UIManager
import app.crescentcash.src.manager.WalletManager
import app.crescentcash.src.qr.QRHelper
import app.crescentcash.src.ui.NonScrollListView
import app.crescentcash.src.ui.RecipientEditText
import app.crescentcash.src.ui.UIHelper
import app.crescentcash.src.uri.URIHelper
import app.crescentcash.src.utils.Constants
import app.crescentcash.src.utils.PrefsUtil
import app.crescentcash.src.wallet.WalletHelper
import com.google.android.material.floatingactionbutton.FloatingActionButton
import com.google.common.util.concurrent.ListenableFuture
import com.ncorti.slidetoact.SlideToActView
import org.bitcoinj.core.CashAddressFactory
import org.bitcoinj.core.ECKey
import org.bitcoinj.core.TransactionOutput
import org.bitcoinj.protocols.payments.PaymentProtocolException
import org.bitcoinj.protocols.payments.PaymentSession
import org.bitcoinj.utils.MonetaryFormat
import org.bitcoinj.wallet.Wallet
import java.text.DecimalFormat
import java.text.DecimalFormatSymbols
import java.util.*
import java.util.concurrent.ExecutionException
class SendActivity : AppCompatActivity() {
private lateinit var tvRecipientAddress_AM: RecipientEditText
......@@ -97,7 +75,7 @@ class SendActivity : AppCompatActivity() {
this.displayMyBalance(WalletManager.getBalance(WalletManager.wallet).toFriendlyString())
balance = if (savedInstanceState == null) {
val extras = intent.extras
if(extras == null) {
if (extras == null) {
""
} else {
extras.getString(Constants.INTENT_BALANCE_DATA)
......@@ -169,7 +147,7 @@ class SendActivity : AppCompatActivity() {
}
}
opReturnBox.visibility = if(WalletManager.addOpReturn) {
opReturnBox.visibility = if (WalletManager.addOpReturn) {
View.VISIBLE
} else {
View.GONE
......@@ -206,7 +184,7 @@ class SendActivity : AppCompatActivity() {
sendTypeSpinner.setSelection(0)
PrefsUtil.prefs.edit().putString("sendType", WalletManager.sendType).apply()
var coins = if(WalletManager.selectedUtxos.size == 0) {
var coins = if (WalletManager.selectedUtxos.size == 0) {
balance
} else {
var balBch: Double = java.lang.Double.parseDouble(WalletManager.getMaxValueOfSelectedUtxos().toPlainString())
......@@ -321,7 +299,7 @@ class SendActivity : AppCompatActivity() {
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode != Constants.REQUEST_CODE_GET_CONTACT) {
if(data != null) {
if (data != null) {
val scanData = data.getStringExtra(Constants.QR_SCAN_RESULT)
if (scanData != null) {
if (requestCode == Constants.REQUEST_CODE_SCAN_PAY_TO) {
......@@ -354,11 +332,10 @@ class SendActivity : AppCompatActivity() {
UIManager.showToastMessage(this, "No contact selected.")
}
} else {
UIManager.showToastMessage(this,"No contact selected.")
UIManager.showToastMessage(this, "No contact selected.")
}
}
}
companion object {
}
companion object
}
package app.crescentcash.src.activity
import android.content.ClipData
import android.content.ClipboardManager
import android.content.Context
import android.content.Intent
import android.graphics.Color
import android.os.Bundle
import android.provider.ContactsContract
import android.text.Editable
import android.text.TextUtils
import android.text.TextWatcher
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.*
import androidx.annotation.UiThread
import android.widget.Button
import android.widget.ImageView
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.get
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import app.crescentcash.src.MainActivity
import app.crescentcash.src.R
import app.crescentcash.src.listener.RecipientTextListener
import app.crescentcash.src.manager.AppManager
import app.crescentcash.src.manager.UIManager
import app.crescentcash.src.manager.WalletManager
import app.crescentcash.src.qr.QRHelper
import app.crescentcash.src.ui.NonScrollListView
import app.crescentcash.src.ui.RecipientEditText
import app.crescentcash.src.ui.UIHelper
import app.crescentcash.src.uri.URIHelper
import app.crescentcash.src.utils.Constants
import app.crescentcash.src.wallet.WalletHelper
import com.google.android.material.floatingactionbutton.FloatingActionButton
import com.google.common.util.concurrent.ListenableFuture
import com.ncorti.slidetoact.SlideToActView
import org.bitcoinj.core.CashAddressFactory
import org.bitcoinj.core.ECKey
import org.bitcoinj.core.TransactionOutput
import org.bitcoinj.protocols.payments.PaymentProtocolException
import org.bitcoinj.protocols.payments.PaymentSession
import org.bitcoinj.utils.MonetaryFormat
import org.bitcoinj.wallet.Wallet
import java.math.BigDecimal
import java.math.RoundingMode
import java.text.DecimalFormat
import java.text.DecimalFormatSymbols
import java.util.*
import java.util.concurrent.ExecutionException
class SendSLPActivity : AppCompatActivity() {
private lateinit var setMaxSLP: Button
......@@ -77,7 +45,7 @@ class SendSLPActivity : AppCompatActivity() {
private fun prepareViews(savedInstanceState: Bundle?) {
this.slpUnit.text = if (savedInstanceState == null) {
val extras = intent.extras
if(extras == null) {
if (extras == null) {
""
} else {
extras.getString(Constants.INTENT_TOKEN_TICKER_DATA)
......@@ -116,7 +84,7 @@ class SendSLPActivity : AppCompatActivity() {
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if(data != null) {
if (data != null) {
val scanData = data.getStringExtra(Constants.QR_SCAN_RESULT)
if (scanData != null) {
if (requestCode == Constants.REQUEST_CODE_SCAN_PAY_SLP_TO) {
......@@ -136,6 +104,5 @@ class SendSLPActivity : AppCompatActivity() {
}
}
companion object {
}
companion object
}
......@@ -15,7 +15,6 @@ import app.crescentcash.src.manager.WalletManager
import app.crescentcash.src.net.NetHelper
import app.crescentcash.src.ui.UIHelper
import app.crescentcash.src.utils.PrefsUtil
import app.crescentcash.src.wallet.WalletHelper
import org.bitcoinj.utils.MonetaryFormat
import java.net.InetSocketAddress
import java.net.Proxy
......@@ -88,27 +87,27 @@ class SettingsActivity : AppCompatActivity() {
}
}
this.encryptWalletSwitch.setOnCheckedChangeListener { buttonView, isChecked ->
if (isChecked) {
val encryptWalletActivity = Intent(this, EncryptWalletActivity::class.java)
startActivity(encryptWalletActivity)
} else {
if (WalletManager.aesKey != null) {
WalletManager.wallet.decrypt(WalletManager.aesKey)
WalletManager.aesKey = null
}
if (isChecked) {
val encryptWalletActivity = Intent(this, EncryptWalletActivity::class.java)
startActivity(encryptWalletActivity)
} else {
if (WalletManager.aesKey != null) {
WalletManager.wallet.decrypt(WalletManager.aesKey)
WalletManager.aesKey = null
}
}
WalletManager.encrypted = isChecked
PrefsUtil.prefs.edit().putBoolean("useEncryption", WalletManager.encrypted).apply()
WalletManager.encrypted = isChecked
PrefsUtil.prefs.edit().putBoolean("useEncryption", WalletManager.encrypted).apply()
}
this.useTorSwitch.setOnCheckedChangeListener { buttonView, isChecked ->
WalletManager.useTor = isChecked
WalletManager.useTor = isChecked
if (isChecked) {
NetHelper.torProxy = Proxy(Proxy.Type.SOCKS, InetSocketAddress("127.0.0.1", 9050))
}
if (isChecked) {
NetHelper.torProxy = Proxy(Proxy.Type.SOCKS, InetSocketAddress("127.0.0.1", 9050))
}
PrefsUtil.prefs.edit().putBoolean("useTor", WalletManager.useTor).apply()
PrefsUtil.prefs.edit().putBoolean("useTor", WalletManager.useTor).apply()
}