mirror of
https://codeberg.org/r4v3r23/mysu.git
synced 2024-09-19 19:06:18 +02:00
Cleanup/reformat code
This commit is contained in:
parent
68dfd3797c
commit
83c26a0ea3
@ -1,7 +1,6 @@
|
|||||||
package net.mynero.wallet
|
package net.mynero.wallet
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.PersistableBundle
|
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.fragment.app.FragmentActivity
|
import androidx.fragment.app.FragmentActivity
|
||||||
|
@ -33,6 +33,7 @@ class CoinsInfoAdapter(val listener: CoinsInfoAdapterListener?) :
|
|||||||
RecyclerView.Adapter<CoinsInfoAdapter.ViewHolder>() {
|
RecyclerView.Adapter<CoinsInfoAdapter.ViewHolder>() {
|
||||||
private var localDataSet // <public-key, coinsinfo>
|
private var localDataSet // <public-key, coinsinfo>
|
||||||
: List<CoinsInfo>
|
: List<CoinsInfo>
|
||||||
|
|
||||||
@JvmField
|
@JvmField
|
||||||
val selectedUtxos // <public-key, coinsinfo>
|
val selectedUtxos // <public-key, coinsinfo>
|
||||||
: HashMap<String?, CoinsInfo>
|
: HashMap<String?, CoinsInfo>
|
||||||
|
@ -71,7 +71,8 @@ class SubaddressAdapter(val listener: SubaddressAdapterListener?) :
|
|||||||
* Provide a reference to the type of views that you are using
|
* Provide a reference to the type of views that you are using
|
||||||
* (custom ViewHolder).
|
* (custom ViewHolder).
|
||||||
*/
|
*/
|
||||||
class ViewHolder(view: View, val listener: SubaddressAdapterListener?) : RecyclerView.ViewHolder(
|
class ViewHolder(view: View, val listener: SubaddressAdapterListener?) :
|
||||||
|
RecyclerView.ViewHolder(
|
||||||
view
|
view
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
@ -75,7 +75,8 @@ class TransactionInfoAdapter(val listener: TxInfoAdapterListener?) :
|
|||||||
* Provide a reference to the type of views that you are using
|
* Provide a reference to the type of views that you are using
|
||||||
* (custom ViewHolder).
|
* (custom ViewHolder).
|
||||||
*/
|
*/
|
||||||
class ViewHolder(val listener: TxInfoAdapterListener?, view: View) : RecyclerView.ViewHolder(view) {
|
class ViewHolder(val listener: TxInfoAdapterListener?, view: View) :
|
||||||
|
RecyclerView.ViewHolder(view) {
|
||||||
private val outboundColour: Int
|
private val outboundColour: Int
|
||||||
private val inboundColour: Int
|
private val inboundColour: Int
|
||||||
private val pendingColour: Int
|
private val pendingColour: Int
|
||||||
|
@ -19,8 +19,84 @@ import org.json.JSONException
|
|||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
|
|
||||||
// Nodes stolen from https://moneroworld.com/#nodes
|
// Nodes stolen from https://moneroworld.com/#nodes
|
||||||
enum class DefaultNodes(val address: String, private val port: Int, private val network: String, private val nodeName: String) {
|
enum class DefaultNodes(
|
||||||
SAMOURAI("163.172.56.213", 18089, "mainnet", "SamouraiWallet"), MONERUJO("nodex.monerujo.io", 18081, "mainnet", "monerujo"), SUPPORTXMR("node.supportxmr.com", 18081, "mainnet", "SupportXMR"), HASHVAULT("nodes.hashvault.pro", 18081, "mainnet", "Hashvault"), MONEROWORLD("node.moneroworld.com", 18089, "mainnet", "MoneroWorld"), XMRTW("opennode.xmr-tw.org", 18089, "mainnet", "XMRTW"), MYNERO_I2P("ynk3hrwte23asonojqeskoulek2g2cd6tqg4neghnenfyljrvhga.b32.i2p", 0, "mainnet", "node.mysu.i2p"), MYNERO_ONION("tiopyrxseconw73thwlv2pf5hebfcqxj5zdolym7z6pbq6gl4z7xz4ad.onion", 18081, "mainnet", "node.mysu.onion"), SAMOURAI_ONION("446unwib5vc7pfbzflosy6m6vtyuhddnalr3hutyavwe4esfuu5g6ryd.onion", 18089, "mainnet", "SamouraiWallet.onion"), MONERUJO_ONION("monerujods7mbghwe6cobdr6ujih6c22zu5rl7zshmizz2udf7v7fsad.onion", 18081, "mainnet", "monerujo.onion"), Criminales78("56wl7y2ebhamkkiza4b7il4mrzwtyvpdym7bm2bkg3jrei2je646k3qd.onion", 18089, "mainnet", "Criminales78.onion"), xmrfail("mxcd4577fldb3ppzy7obmmhnu3tf57gbcbd4qhwr2kxyjj2qi3dnbfqd.onion", 18081, "mainnet", "xmrfail.onion"), boldsuck("6dsdenp6vjkvqzy4wzsnzn6wixkdzihx3khiumyzieauxuxslmcaeiad.onion", 18081, "mainnet", "boldsuck.onion");
|
val address: String,
|
||||||
|
private val port: Int,
|
||||||
|
private val network: String,
|
||||||
|
private val nodeName: String
|
||||||
|
) {
|
||||||
|
SAMOURAI("163.172.56.213", 18089, "mainnet", "SamouraiWallet"), MONERUJO(
|
||||||
|
"nodex.monerujo.io",
|
||||||
|
18081,
|
||||||
|
"mainnet",
|
||||||
|
"monerujo"
|
||||||
|
),
|
||||||
|
SUPPORTXMR(
|
||||||
|
"node.supportxmr.com",
|
||||||
|
18081,
|
||||||
|
"mainnet",
|
||||||
|
"SupportXMR"
|
||||||
|
),
|
||||||
|
HASHVAULT(
|
||||||
|
"nodes.hashvault.pro",
|
||||||
|
18081,
|
||||||
|
"mainnet",
|
||||||
|
"Hashvault"
|
||||||
|
),
|
||||||
|
MONEROWORLD(
|
||||||
|
"node.moneroworld.com",
|
||||||
|
18089,
|
||||||
|
"mainnet",
|
||||||
|
"MoneroWorld"
|
||||||
|
),
|
||||||
|
XMRTW(
|
||||||
|
"opennode.xmr-tw.org",
|
||||||
|
18089,
|
||||||
|
"mainnet",
|
||||||
|
"XMRTW"
|
||||||
|
),
|
||||||
|
MYNERO_I2P(
|
||||||
|
"ynk3hrwte23asonojqeskoulek2g2cd6tqg4neghnenfyljrvhga.b32.i2p",
|
||||||
|
0,
|
||||||
|
"mainnet",
|
||||||
|
"node.mysu.i2p"
|
||||||
|
),
|
||||||
|
MYNERO_ONION(
|
||||||
|
"tiopyrxseconw73thwlv2pf5hebfcqxj5zdolym7z6pbq6gl4z7xz4ad.onion",
|
||||||
|
18081,
|
||||||
|
"mainnet",
|
||||||
|
"node.mysu.onion"
|
||||||
|
),
|
||||||
|
SAMOURAI_ONION(
|
||||||
|
"446unwib5vc7pfbzflosy6m6vtyuhddnalr3hutyavwe4esfuu5g6ryd.onion",
|
||||||
|
18089,
|
||||||
|
"mainnet",
|
||||||
|
"SamouraiWallet.onion"
|
||||||
|
),
|
||||||
|
MONERUJO_ONION(
|
||||||
|
"monerujods7mbghwe6cobdr6ujih6c22zu5rl7zshmizz2udf7v7fsad.onion",
|
||||||
|
18081,
|
||||||
|
"mainnet",
|
||||||
|
"monerujo.onion"
|
||||||
|
),
|
||||||
|
Criminales78(
|
||||||
|
"56wl7y2ebhamkkiza4b7il4mrzwtyvpdym7bm2bkg3jrei2je646k3qd.onion",
|
||||||
|
18089,
|
||||||
|
"mainnet",
|
||||||
|
"Criminales78.onion"
|
||||||
|
),
|
||||||
|
xmrfail(
|
||||||
|
"mxcd4577fldb3ppzy7obmmhnu3tf57gbcbd4qhwr2kxyjj2qi3dnbfqd.onion",
|
||||||
|
18081,
|
||||||
|
"mainnet",
|
||||||
|
"xmrfail.onion"
|
||||||
|
),
|
||||||
|
boldsuck(
|
||||||
|
"6dsdenp6vjkvqzy4wzsnzn6wixkdzihx3khiumyzieauxuxslmcaeiad.onion",
|
||||||
|
18081,
|
||||||
|
"mainnet",
|
||||||
|
"boldsuck.onion"
|
||||||
|
);
|
||||||
|
|
||||||
val nodeString: String
|
val nodeString: String
|
||||||
get() = "$address:$port/$network/$nodeName"
|
get() = "$address:$port/$network/$nodeName"
|
||||||
|
@ -51,8 +51,10 @@ class Node {
|
|||||||
this.username = ""
|
this.username = ""
|
||||||
this.password = ""
|
this.password = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
2 -> { // credentials
|
2 -> { // credentials
|
||||||
val userPassword = a[0].split(":".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()
|
val userPassword =
|
||||||
|
a[0].split(":".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()
|
||||||
require(userPassword.size == 2) { "User:Password invalid" }
|
require(userPassword.size == 2) { "User:Password invalid" }
|
||||||
this.username = userPassword[0]
|
this.username = userPassword[0]
|
||||||
this.password = if (this.username.isNotEmpty()) {
|
this.password = if (this.username.isNotEmpty()) {
|
||||||
@ -62,11 +64,13 @@ class Node {
|
|||||||
}
|
}
|
||||||
daemonAddress = a[1]
|
daemonAddress = a[1]
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
throw IllegalArgumentException("Too many @")
|
throw IllegalArgumentException("Too many @")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val daParts = daemonAddress.split("/".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()
|
val daParts =
|
||||||
|
daemonAddress.split("/".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()
|
||||||
require(!(daParts.size > 3 || daParts.isEmpty())) { "Too many '/' or too few" }
|
require(!(daParts.size > 3 || daParts.isEmpty())) { "Too many '/' or too few" }
|
||||||
daemonAddress = daParts[0]
|
daemonAddress = daParts[0]
|
||||||
val da = daemonAddress.split(":".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()
|
val da = daemonAddress.split(":".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()
|
||||||
@ -240,6 +244,7 @@ class Node {
|
|||||||
const val TESTNET = "testnet"
|
const val TESTNET = "testnet"
|
||||||
private var DEFAULT_LEVIN_PORT = 0
|
private var DEFAULT_LEVIN_PORT = 0
|
||||||
private var DEFAULT_RPC_PORT = 0
|
private var DEFAULT_RPC_PORT = 0
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun fromString(nodeString: String?): Node? {
|
fun fromString(nodeString: String?): Node? {
|
||||||
return try {
|
return try {
|
||||||
|
@ -17,7 +17,12 @@ package net.mynero.wallet.data
|
|||||||
|
|
||||||
import java.util.regex.Pattern
|
import java.util.regex.Pattern
|
||||||
|
|
||||||
class Subaddress(private val accountIndex: Int, @JvmField val addressIndex: Int, @JvmField val address: String, val label: String) : Comparable<Subaddress> {
|
class Subaddress(
|
||||||
|
private val accountIndex: Int,
|
||||||
|
@JvmField val addressIndex: Int,
|
||||||
|
@JvmField val address: String,
|
||||||
|
val label: String
|
||||||
|
) : Comparable<Subaddress> {
|
||||||
@JvmField
|
@JvmField
|
||||||
var amount: Long = 0
|
var amount: Long = 0
|
||||||
|
|
||||||
@ -29,10 +34,13 @@ class Subaddress(private val accountIndex: Int, @JvmField val addressIndex: Int,
|
|||||||
val squashedAddress: String
|
val squashedAddress: String
|
||||||
get() = address.substring(0, 8) + "…" + address.substring(address.length - 8)
|
get() = address.substring(0, 8) + "…" + address.substring(address.length - 8)
|
||||||
val displayLabel: String
|
val displayLabel: String
|
||||||
get() = if (label.isEmpty() || DEFAULT_LABEL_FORMATTER.matcher(label).matches()) "#$addressIndex" else label
|
get() = if (label.isEmpty() || DEFAULT_LABEL_FORMATTER.matcher(label)
|
||||||
|
.matches()
|
||||||
|
) "#$addressIndex" else label
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@JvmField
|
@JvmField
|
||||||
val DEFAULT_LABEL_FORMATTER: Pattern = Pattern.compile("^[0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]{2}:[0-9]{2}:[0-9]{2}$")
|
val DEFAULT_LABEL_FORMATTER: Pattern =
|
||||||
|
Pattern.compile("^[0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]{2}:[0-9]{2}:[0-9]{2}$")
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -41,11 +41,13 @@ class TxData : Parcelable {
|
|||||||
preferredInputs = txData.preferredInputs
|
preferredInputs = txData.preferredInputs
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(dstAddr: String?,
|
constructor(
|
||||||
|
dstAddr: String?,
|
||||||
amount: Long,
|
amount: Long,
|
||||||
mixin: Int,
|
mixin: Int,
|
||||||
priority: PendingTransaction.Priority?,
|
priority: PendingTransaction.Priority?,
|
||||||
preferredInputs: ArrayList<String>?) {
|
preferredInputs: ArrayList<String>?
|
||||||
|
) {
|
||||||
destinationAddress = dstAddr
|
destinationAddress = dstAddr
|
||||||
this.amount = amount
|
this.amount = amount
|
||||||
this.mixin = mixin
|
this.mixin = mixin
|
||||||
|
@ -19,15 +19,20 @@ import java.util.regex.Pattern
|
|||||||
|
|
||||||
class UserNotes(txNotes: String?) {
|
class UserNotes(txNotes: String?) {
|
||||||
var txNotes: String? = ""
|
var txNotes: String? = ""
|
||||||
|
|
||||||
@JvmField
|
@JvmField
|
||||||
var note: String? = ""
|
var note: String? = ""
|
||||||
|
|
||||||
@JvmField
|
@JvmField
|
||||||
var xmrtoTag: String? = null
|
var xmrtoTag: String? = null
|
||||||
|
|
||||||
@JvmField
|
@JvmField
|
||||||
var xmrtoKey: String? = null
|
var xmrtoKey: String? = null
|
||||||
|
|
||||||
@JvmField
|
@JvmField
|
||||||
var xmrtoAmount: String? = null // could be a double - but we are not doing any calculations
|
var xmrtoAmount: String? = null // could be a double - but we are not doing any calculations
|
||||||
var xmrtoCurrency: String? = null
|
var xmrtoCurrency: String? = null
|
||||||
|
|
||||||
@JvmField
|
@JvmField
|
||||||
var xmrtoDestination: String? = null
|
var xmrtoDestination: String? = null
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@ import android.content.Context;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.util.Patterns;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@ -48,8 +47,14 @@ public class AddNodeBottomSheetDialog extends BottomSheetDialogFragment {
|
|||||||
ImageButton pastePasswordImageButton = view.findViewById(R.id.paste_password_imagebutton);
|
ImageButton pastePasswordImageButton = view.findViewById(R.id.paste_password_imagebutton);
|
||||||
|
|
||||||
usernameEditText.addTextChangedListener(new TextWatcher() {
|
usernameEditText.addTextChangedListener(new TextWatcher() {
|
||||||
@Override public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {}
|
@Override
|
||||||
@Override public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {}
|
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterTextChanged(Editable editable) {
|
public void afterTextChanged(Editable editable) {
|
||||||
if (editable.toString().isEmpty()) {
|
if (editable.toString().isEmpty()) {
|
||||||
|
@ -19,10 +19,8 @@ import net.mynero.wallet.model.WalletManager;
|
|||||||
import net.mynero.wallet.service.AddressService;
|
import net.mynero.wallet.service.AddressService;
|
||||||
import net.mynero.wallet.util.Helper;
|
import net.mynero.wallet.util.Helper;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
public class EditAddressLabelBottomSheetDialog extends BottomSheetDialogFragment {
|
public class EditAddressLabelBottomSheetDialog extends BottomSheetDialogFragment {
|
||||||
@ -47,7 +45,8 @@ public class EditAddressLabelBottomSheetDialog extends BottomSheetDialogFragment
|
|||||||
try {
|
try {
|
||||||
new SimpleDateFormat("yyyy-MM-dd-HH:mm:ss", Locale.US).parse(wallet.getSubaddressLabel(addressIndex));
|
new SimpleDateFormat("yyyy-MM-dd-HH:mm:ss", Locale.US).parse(wallet.getSubaddressLabel(addressIndex));
|
||||||
isDate = true;
|
isDate = true;
|
||||||
} catch (ParseException ignored) { }
|
} catch (ParseException ignored) {
|
||||||
|
}
|
||||||
|
|
||||||
labelEditText.setText(isDate ? null : wallet.getSubaddressLabel(addressIndex));
|
labelEditText.setText(isDate ? null : wallet.getSubaddressLabel(addressIndex));
|
||||||
pasteButton.setOnClickListener(view1 -> labelEditText.setText(Helper.getClipBoardText(view.getContext())));
|
pasteButton.setOnClickListener(view1 -> labelEditText.setText(Helper.getClipBoardText(view.getContext())));
|
||||||
|
@ -4,7 +4,6 @@ import android.content.Context;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.util.Patterns;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@ -20,19 +19,11 @@ import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
|||||||
|
|
||||||
import net.mynero.wallet.R;
|
import net.mynero.wallet.R;
|
||||||
import net.mynero.wallet.data.Node;
|
import net.mynero.wallet.data.Node;
|
||||||
import net.mynero.wallet.service.PrefService;
|
|
||||||
import net.mynero.wallet.util.Constants;
|
|
||||||
import net.mynero.wallet.util.Helper;
|
import net.mynero.wallet.util.Helper;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.net.URLEncoder;
|
|
||||||
|
|
||||||
import timber.log.Timber;
|
|
||||||
|
|
||||||
public class EditNodeBottomSheetDialog extends BottomSheetDialogFragment {
|
public class EditNodeBottomSheetDialog extends BottomSheetDialogFragment {
|
||||||
public EditNodeListener listener = null;
|
public EditNodeListener listener = null;
|
||||||
public Node node = null;
|
public Node node = null;
|
||||||
@ -66,8 +57,14 @@ public class EditNodeBottomSheetDialog extends BottomSheetDialogFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
usernameEditText.addTextChangedListener(new TextWatcher() {
|
usernameEditText.addTextChangedListener(new TextWatcher() {
|
||||||
@Override public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {}
|
@Override
|
||||||
@Override public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {}
|
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterTextChanged(Editable editable) {
|
public void afterTextChanged(Editable editable) {
|
||||||
if (editable.toString().isEmpty()) {
|
if (editable.toString().isEmpty()) {
|
||||||
@ -141,6 +138,7 @@ public class EditNodeBottomSheetDialog extends BottomSheetDialogFragment {
|
|||||||
|
|
||||||
public interface EditNodeListener {
|
public interface EditNodeListener {
|
||||||
void onNodeDeleted(Node node);
|
void onNodeDeleted(Node node);
|
||||||
|
|
||||||
void onNodeEdited(Node oldNode, Node newNode);
|
void onNodeEdited(Node oldNode, Node newNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -60,7 +60,9 @@ public class NodeSelectionBottomSheetDialog extends BottomSheetDialogFragment im
|
|||||||
JSONArray jsonArray = null;
|
JSONArray jsonArray = null;
|
||||||
try {
|
try {
|
||||||
jsonArray = new JSONArray(nodesArray);
|
jsonArray = new JSONArray(nodesArray);
|
||||||
} catch (JSONException e) { throw new RuntimeException(e); }
|
} catch (JSONException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < jsonArray.length(); i++) {
|
for (int i = 0; i < jsonArray.length(); i++) {
|
||||||
JSONObject nodeJsonObject = null;
|
JSONObject nodeJsonObject = null;
|
||||||
@ -122,7 +124,9 @@ public class NodeSelectionBottomSheetDialog extends BottomSheetDialogFragment im
|
|||||||
|
|
||||||
public interface NodeSelectionDialogListener {
|
public interface NodeSelectionDialogListener {
|
||||||
void onNodeSelected();
|
void onNodeSelected();
|
||||||
|
|
||||||
void onClickedEditNode(Node node);
|
void onClickedEditNode(Node node);
|
||||||
|
|
||||||
void onClickedAddNode();
|
void onClickedAddNode();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -46,7 +46,7 @@ public class SendBottomSheetDialog extends BottomSheetDialogFragment {
|
|||||||
private final MutableLiveData<PendingTransaction> _pendingTransaction = new MutableLiveData<>(null);
|
private final MutableLiveData<PendingTransaction> _pendingTransaction = new MutableLiveData<>(null);
|
||||||
public ArrayList<String> selectedUtxos = new ArrayList<>();
|
public ArrayList<String> selectedUtxos = new ArrayList<>();
|
||||||
public LiveData<Boolean> sendingMax = _sendingMax;
|
public LiveData<Boolean> sendingMax = _sendingMax;
|
||||||
private final ActivityResultLauncher<String> cameraPermissionsLauncher = registerForActivityResult(new ActivityResultContracts.RequestPermission(),
|
public LiveData<PendingTransaction> pendingTransaction = _pendingTransaction; private final ActivityResultLauncher<String> cameraPermissionsLauncher = registerForActivityResult(new ActivityResultContracts.RequestPermission(),
|
||||||
granted -> {
|
granted -> {
|
||||||
if (granted) {
|
if (granted) {
|
||||||
onScan();
|
onScan();
|
||||||
@ -54,7 +54,6 @@ public class SendBottomSheetDialog extends BottomSheetDialogFragment {
|
|||||||
Toast.makeText(getActivity(), getString(R.string.no_camera_permission), Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), getString(R.string.no_camera_permission), Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
public LiveData<PendingTransaction> pendingTransaction = _pendingTransaction;
|
|
||||||
public UriData uriData = null;
|
public UriData uriData = null;
|
||||||
public boolean isChurning = false;
|
public boolean isChurning = false;
|
||||||
public Listener listener = null;
|
public Listener listener = null;
|
||||||
@ -350,4 +349,6 @@ public class SendBottomSheetDialog extends BottomSheetDialogFragment {
|
|||||||
public interface Listener {
|
public interface Listener {
|
||||||
void onSentTransaction();
|
void onSentTransaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -11,7 +11,6 @@ import android.widget.TextView;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
@ -24,7 +23,6 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||||||
import net.mynero.wallet.MainActivity;
|
import net.mynero.wallet.MainActivity;
|
||||||
import net.mynero.wallet.R;
|
import net.mynero.wallet.R;
|
||||||
import net.mynero.wallet.adapter.TransactionInfoAdapter;
|
import net.mynero.wallet.adapter.TransactionInfoAdapter;
|
||||||
import net.mynero.wallet.fragment.dialog.SendBottomSheetDialog;
|
|
||||||
import net.mynero.wallet.model.TransactionInfo;
|
import net.mynero.wallet.model.TransactionInfo;
|
||||||
import net.mynero.wallet.model.Wallet;
|
import net.mynero.wallet.model.Wallet;
|
||||||
import net.mynero.wallet.model.WalletManager;
|
import net.mynero.wallet.model.WalletManager;
|
||||||
|
@ -151,7 +151,11 @@ public class OnboardingFragment extends Fragment implements NodeSelectionBottomS
|
|||||||
private void bindListeners() {
|
private void bindListeners() {
|
||||||
seedOffsetCheckbox.setChecked(useOffset);
|
seedOffsetCheckbox.setChecked(useOffset);
|
||||||
// Disable onBack click
|
// Disable onBack click
|
||||||
OnBackPressedCallback onBackPressedCallback = new OnBackPressedCallback(true) { @Override public void handleOnBackPressed() { } };
|
OnBackPressedCallback onBackPressedCallback = new OnBackPressedCallback(true) {
|
||||||
|
@Override
|
||||||
|
public void handleOnBackPressed() {
|
||||||
|
}
|
||||||
|
};
|
||||||
FragmentActivity activity = getActivity();
|
FragmentActivity activity = getActivity();
|
||||||
if (activity != null)
|
if (activity != null)
|
||||||
activity.getOnBackPressedDispatcher().addCallback(getViewLifecycleOwner(), onBackPressedCallback);
|
activity.getOnBackPressedDispatcher().addCallback(getViewLifecycleOwner(), onBackPressedCallback);
|
||||||
@ -303,7 +307,8 @@ public class OnboardingFragment extends Fragment implements NodeSelectionBottomS
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClickedEditNode(Node node) { }
|
public void onClickedEditNode(Node node) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClickedAddNode() {
|
public void onClickedAddNode() {
|
||||||
|
@ -22,10 +22,10 @@ import java.util.Calendar;
|
|||||||
|
|
||||||
public class OnboardingViewModel extends ViewModel {
|
public class OnboardingViewModel extends ViewModel {
|
||||||
private final MutableLiveData<Boolean> _showMoreOptions = new MutableLiveData<>(false);
|
private final MutableLiveData<Boolean> _showMoreOptions = new MutableLiveData<>(false);
|
||||||
public LiveData<Boolean> showMoreOptions = _showMoreOptions;
|
|
||||||
private final MutableLiveData<Boolean> _enableCreateButton = new MutableLiveData<>(true);
|
private final MutableLiveData<Boolean> _enableCreateButton = new MutableLiveData<>(true);
|
||||||
public LiveData<Boolean> enableCreateButton = _enableCreateButton;
|
|
||||||
private final MutableLiveData<SeedType> _seedType = new MutableLiveData<>(SeedType.POLYSEED);
|
private final MutableLiveData<SeedType> _seedType = new MutableLiveData<>(SeedType.POLYSEED);
|
||||||
|
public LiveData<Boolean> showMoreOptions = _showMoreOptions;
|
||||||
|
public LiveData<Boolean> enableCreateButton = _enableCreateButton;
|
||||||
public LiveData<SeedType> seedType = _seedType;
|
public LiveData<SeedType> seedType = _seedType;
|
||||||
private String proxyAddress = "";
|
private String proxyAddress = "";
|
||||||
private String proxyPort = "";
|
private String proxyPort = "";
|
||||||
@ -166,7 +166,7 @@ public class OnboardingViewModel extends ViewModel {
|
|||||||
POLYSEED(R.string.seed_desc_polyseed),
|
POLYSEED(R.string.seed_desc_polyseed),
|
||||||
UNKNOWN(0);
|
UNKNOWN(0);
|
||||||
|
|
||||||
private int descResId;
|
private final int descResId;
|
||||||
|
|
||||||
SeedType(int descResId) {
|
SeedType(int descResId) {
|
||||||
this.descResId = descResId;
|
this.descResId = descResId;
|
||||||
|
@ -27,9 +27,7 @@ import net.mynero.wallet.R;
|
|||||||
import net.mynero.wallet.adapter.SubaddressAdapter;
|
import net.mynero.wallet.adapter.SubaddressAdapter;
|
||||||
import net.mynero.wallet.data.Subaddress;
|
import net.mynero.wallet.data.Subaddress;
|
||||||
import net.mynero.wallet.fragment.dialog.EditAddressLabelBottomSheetDialog;
|
import net.mynero.wallet.fragment.dialog.EditAddressLabelBottomSheetDialog;
|
||||||
import net.mynero.wallet.util.DayNightMode;
|
|
||||||
import net.mynero.wallet.util.Helper;
|
import net.mynero.wallet.util.Helper;
|
||||||
import net.mynero.wallet.util.NightmodeHelper;
|
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -15,8 +15,8 @@ import java.util.List;
|
|||||||
|
|
||||||
public class ReceiveViewModel extends ViewModel {
|
public class ReceiveViewModel extends ViewModel {
|
||||||
private final MutableLiveData<Subaddress> _address = new MutableLiveData<>();
|
private final MutableLiveData<Subaddress> _address = new MutableLiveData<>();
|
||||||
public LiveData<Subaddress> address = _address;
|
|
||||||
private final MutableLiveData<List<Subaddress>> _addresses = new MutableLiveData<>();
|
private final MutableLiveData<List<Subaddress>> _addresses = new MutableLiveData<>();
|
||||||
|
public LiveData<Subaddress> address = _address;
|
||||||
public LiveData<List<Subaddress>> addresses = _addresses;
|
public LiveData<List<Subaddress>> addresses = _addresses;
|
||||||
|
|
||||||
public void init() {
|
public void init() {
|
||||||
|
@ -2,7 +2,6 @@ package net.mynero.wallet.fragment.send;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
@ -25,8 +24,6 @@ import androidx.constraintlayout.widget.ConstraintLayout;
|
|||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
|
||||||
|
|
||||||
import com.google.zxing.client.android.Intents;
|
import com.google.zxing.client.android.Intents;
|
||||||
import com.journeyapps.barcodescanner.ScanContract;
|
import com.journeyapps.barcodescanner.ScanContract;
|
||||||
@ -48,6 +45,7 @@ import java.util.List;
|
|||||||
import kotlin.Pair;
|
import kotlin.Pair;
|
||||||
|
|
||||||
public class SendFragment extends Fragment {
|
public class SendFragment extends Fragment {
|
||||||
|
public PendingTransaction.Priority priority;
|
||||||
private SendViewModel mViewModel;
|
private SendViewModel mViewModel;
|
||||||
private Button sendMaxButton;
|
private Button sendMaxButton;
|
||||||
private ImageButton addOutputImageView;
|
private ImageButton addOutputImageView;
|
||||||
@ -57,12 +55,9 @@ public class SendFragment extends Fragment {
|
|||||||
private SlideToActView sendTxSlider;
|
private SlideToActView sendTxSlider;
|
||||||
private RadioGroup feeRadioGroup;
|
private RadioGroup feeRadioGroup;
|
||||||
private TextView feeRadioGroupLabelTextView;
|
private TextView feeRadioGroupLabelTextView;
|
||||||
|
|
||||||
private TextView feeTextView;
|
private TextView feeTextView;
|
||||||
private TextView addressTextView;
|
private TextView addressTextView;
|
||||||
private TextView amountTextView;
|
private TextView amountTextView;
|
||||||
|
|
||||||
public PendingTransaction.Priority priority;
|
|
||||||
private int currentEntryIndex = -1;
|
private int currentEntryIndex = -1;
|
||||||
private final ActivityResultLauncher<ScanOptions> qrCodeLauncher = registerForActivityResult(new ScanContract(), result -> {
|
private final ActivityResultLauncher<ScanOptions> qrCodeLauncher = registerForActivityResult(new ScanContract(), result -> {
|
||||||
if (result.getContents() != null) {
|
if (result.getContents() != null) {
|
||||||
@ -72,7 +67,12 @@ public class SendFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
private final ActivityResultLauncher<String> cameraPermissionsLauncher = registerForActivityResult(new ActivityResultContracts.RequestPermission(),
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||||
|
@Nullable Bundle savedInstanceState) {
|
||||||
|
return inflater.inflate(R.layout.fragment_send, container, false);
|
||||||
|
} private final ActivityResultLauncher<String> cameraPermissionsLauncher = registerForActivityResult(new ActivityResultContracts.RequestPermission(),
|
||||||
granted -> {
|
granted -> {
|
||||||
if (granted) {
|
if (granted) {
|
||||||
onScan(currentEntryIndex);
|
onScan(currentEntryIndex);
|
||||||
@ -82,12 +82,6 @@ public class SendFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@Override
|
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
|
||||||
@Nullable Bundle savedInstanceState) {
|
|
||||||
return inflater.inflate(R.layout.fragment_send, container, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
@ -249,8 +243,14 @@ public class SendFragment extends Fragment {
|
|||||||
ImageButton removeOutputImageButton = entryView.findViewById(R.id.remove_output_imagebutton);
|
ImageButton removeOutputImageButton = entryView.findViewById(R.id.remove_output_imagebutton);
|
||||||
EditText addressField = entryView.findViewById(R.id.address_edittext);
|
EditText addressField = entryView.findViewById(R.id.address_edittext);
|
||||||
addressField.addTextChangedListener(new TextWatcher() {
|
addressField.addTextChangedListener(new TextWatcher() {
|
||||||
@Override public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {}
|
@Override
|
||||||
@Override public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {}
|
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterTextChanged(Editable editable) {
|
public void afterTextChanged(Editable editable) {
|
||||||
int currentOutputs = getDestCount();
|
int currentOutputs = getDestCount();
|
||||||
@ -478,4 +478,6 @@ public class SendFragment extends Fragment {
|
|||||||
private void setAddOutputButtonVisibility(int visibility) {
|
private void setAddOutputButtonVisibility(int visibility) {
|
||||||
addOutputImageView.setVisibility(visibility);
|
addOutputImageView.setVisibility(visibility);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -8,10 +8,10 @@ import net.mynero.wallet.model.PendingTransaction;
|
|||||||
|
|
||||||
public class SendViewModel extends ViewModel {
|
public class SendViewModel extends ViewModel {
|
||||||
private final MutableLiveData<Boolean> _sendingMax = new MutableLiveData<>(false);
|
private final MutableLiveData<Boolean> _sendingMax = new MutableLiveData<>(false);
|
||||||
public LiveData<Boolean> sendingMax = _sendingMax;
|
|
||||||
private final MutableLiveData<Boolean> _showAddOutputButton = new MutableLiveData<>(true);
|
private final MutableLiveData<Boolean> _showAddOutputButton = new MutableLiveData<>(true);
|
||||||
public LiveData<Boolean> showAddOutputButton = _showAddOutputButton;
|
|
||||||
private final MutableLiveData<PendingTransaction> _pendingTransaction = new MutableLiveData<>(null);
|
private final MutableLiveData<PendingTransaction> _pendingTransaction = new MutableLiveData<>(null);
|
||||||
|
public LiveData<Boolean> sendingMax = _sendingMax;
|
||||||
|
public LiveData<Boolean> showAddOutputButton = _showAddOutputButton;
|
||||||
public LiveData<PendingTransaction> pendingTransaction = _pendingTransaction;
|
public LiveData<PendingTransaction> pendingTransaction = _pendingTransaction;
|
||||||
|
|
||||||
public void setSendingMax(boolean value) {
|
public void setSendingMax(boolean value) {
|
||||||
|
@ -24,13 +24,12 @@ import androidx.navigation.fragment.NavHostFragment;
|
|||||||
|
|
||||||
import net.mynero.wallet.MoneroApplication;
|
import net.mynero.wallet.MoneroApplication;
|
||||||
import net.mynero.wallet.R;
|
import net.mynero.wallet.R;
|
||||||
import net.mynero.wallet.data.DefaultNodes;
|
|
||||||
import net.mynero.wallet.data.Node;
|
import net.mynero.wallet.data.Node;
|
||||||
import net.mynero.wallet.fragment.dialog.AddNodeBottomSheetDialog;
|
import net.mynero.wallet.fragment.dialog.AddNodeBottomSheetDialog;
|
||||||
import net.mynero.wallet.fragment.dialog.EditNodeBottomSheetDialog;
|
import net.mynero.wallet.fragment.dialog.EditNodeBottomSheetDialog;
|
||||||
import net.mynero.wallet.fragment.dialog.WalletKeysBottomSheetDialog;
|
|
||||||
import net.mynero.wallet.fragment.dialog.NodeSelectionBottomSheetDialog;
|
import net.mynero.wallet.fragment.dialog.NodeSelectionBottomSheetDialog;
|
||||||
import net.mynero.wallet.fragment.dialog.PasswordBottomSheetDialog;
|
import net.mynero.wallet.fragment.dialog.PasswordBottomSheetDialog;
|
||||||
|
import net.mynero.wallet.fragment.dialog.WalletKeysBottomSheetDialog;
|
||||||
import net.mynero.wallet.model.Wallet;
|
import net.mynero.wallet.model.Wallet;
|
||||||
import net.mynero.wallet.model.WalletManager;
|
import net.mynero.wallet.model.WalletManager;
|
||||||
import net.mynero.wallet.service.BalanceService;
|
import net.mynero.wallet.service.BalanceService;
|
||||||
@ -38,8 +37,6 @@ import net.mynero.wallet.service.BlockchainService;
|
|||||||
import net.mynero.wallet.service.HistoryService;
|
import net.mynero.wallet.service.HistoryService;
|
||||||
import net.mynero.wallet.service.PrefService;
|
import net.mynero.wallet.service.PrefService;
|
||||||
import net.mynero.wallet.util.Constants;
|
import net.mynero.wallet.util.Constants;
|
||||||
import net.mynero.wallet.util.DayNightMode;
|
|
||||||
import net.mynero.wallet.util.NightmodeHelper;
|
|
||||||
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
@ -5,7 +5,6 @@ import android.util.Patterns;
|
|||||||
import androidx.lifecycle.ViewModel;
|
import androidx.lifecycle.ViewModel;
|
||||||
|
|
||||||
import net.mynero.wallet.MoneroApplication;
|
import net.mynero.wallet.MoneroApplication;
|
||||||
import net.mynero.wallet.data.DefaultNodes;
|
|
||||||
import net.mynero.wallet.data.Node;
|
import net.mynero.wallet.data.Node;
|
||||||
import net.mynero.wallet.model.WalletManager;
|
import net.mynero.wallet.model.WalletManager;
|
||||||
import net.mynero.wallet.service.PrefService;
|
import net.mynero.wallet.service.PrefService;
|
||||||
|
@ -1,12 +1,6 @@
|
|||||||
package net.mynero.wallet.fragment.transaction;
|
package net.mynero.wallet.fragment.transaction;
|
||||||
|
|
||||||
import androidx.lifecycle.LiveData;
|
|
||||||
import androidx.lifecycle.MutableLiveData;
|
|
||||||
import androidx.lifecycle.ViewModel;
|
import androidx.lifecycle.ViewModel;
|
||||||
|
|
||||||
import net.mynero.wallet.model.TransactionInfo;
|
|
||||||
import net.mynero.wallet.model.Wallet;
|
|
||||||
import net.mynero.wallet.model.WalletManager;
|
|
||||||
|
|
||||||
public class TransactionViewModel extends ViewModel {
|
public class TransactionViewModel extends ViewModel {
|
||||||
}
|
}
|
@ -24,14 +24,12 @@ import net.mynero.wallet.util.MoneroThreadPoolExecutor;
|
|||||||
import net.mynero.wallet.util.UriData;
|
import net.mynero.wallet.util.UriData;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class UtxosFragment extends Fragment implements CoinsInfoAdapter.CoinsInfoAdapterListener, SendBottomSheetDialog.Listener {
|
public class UtxosFragment extends Fragment implements CoinsInfoAdapter.CoinsInfoAdapterListener, SendBottomSheetDialog.Listener {
|
||||||
|
|
||||||
private UtxosViewModel mViewModel;
|
|
||||||
private final CoinsInfoAdapter adapter = new CoinsInfoAdapter(this);
|
private final CoinsInfoAdapter adapter = new CoinsInfoAdapter(this);
|
||||||
|
private UtxosViewModel mViewModel;
|
||||||
private Button sendUtxosButton;
|
private Button sendUtxosButton;
|
||||||
private Button churnUtxosButton;
|
private Button churnUtxosButton;
|
||||||
private Button freezeUtxosButton;
|
private Button freezeUtxosButton;
|
||||||
|
@ -36,6 +36,7 @@ import java.util.concurrent.atomic.AtomicBoolean
|
|||||||
*/
|
*/
|
||||||
class SingleLiveEvent<T> : MutableLiveData<T>() {
|
class SingleLiveEvent<T> : MutableLiveData<T>() {
|
||||||
private val mPending = AtomicBoolean(false)
|
private val mPending = AtomicBoolean(false)
|
||||||
|
|
||||||
@MainThread
|
@MainThread
|
||||||
override fun observe(owner: LifecycleOwner, observer: Observer<in T>) {
|
override fun observe(owner: LifecycleOwner, observer: Observer<in T>) {
|
||||||
if (hasActiveObservers()) {
|
if (hasActiveObservers()) {
|
||||||
|
@ -23,18 +23,24 @@ class CoinsInfo : Parcelable, Comparable<CoinsInfo> {
|
|||||||
@JvmField
|
@JvmField
|
||||||
var globalOutputIndex: Long
|
var globalOutputIndex: Long
|
||||||
var isSpent = false
|
var isSpent = false
|
||||||
|
|
||||||
@JvmField
|
@JvmField
|
||||||
var keyImage: String? = null
|
var keyImage: String? = null
|
||||||
|
|
||||||
@JvmField
|
@JvmField
|
||||||
var amount: Long = 0
|
var amount: Long = 0
|
||||||
|
|
||||||
@JvmField
|
@JvmField
|
||||||
var hash: String? = null
|
var hash: String? = null
|
||||||
|
|
||||||
@JvmField
|
@JvmField
|
||||||
var pubKey: String? = null
|
var pubKey: String? = null
|
||||||
var isUnlocked = false
|
var isUnlocked = false
|
||||||
|
|
||||||
@JvmField
|
@JvmField
|
||||||
var localOutputIndex: Long = 0
|
var localOutputIndex: Long = 0
|
||||||
var isFrozen = false
|
var isFrozen = false
|
||||||
|
|
||||||
@JvmField
|
@JvmField
|
||||||
var address: String? = null
|
var address: String? = null
|
||||||
|
|
||||||
@ -89,7 +95,7 @@ class CoinsInfo : Parcelable, Comparable<CoinsInfo> {
|
|||||||
companion object {
|
companion object {
|
||||||
@JvmField
|
@JvmField
|
||||||
val CREATOR: Creator<CoinsInfo?> = object : Creator<CoinsInfo?> {
|
val CREATOR: Creator<CoinsInfo?> = object : Creator<CoinsInfo?> {
|
||||||
override fun createFromParcel(`in`: Parcel): CoinsInfo? {
|
override fun createFromParcel(`in`: Parcel): CoinsInfo {
|
||||||
return CoinsInfo(`in`)
|
return CoinsInfo(`in`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ package net.mynero.wallet.model
|
|||||||
class PendingTransaction internal constructor(var handle: Long) {
|
class PendingTransaction internal constructor(var handle: Long) {
|
||||||
val status: Status
|
val status: Status
|
||||||
get() = Status.values()[getStatusJ()]
|
get() = Status.values()[getStatusJ()]
|
||||||
|
|
||||||
external fun getStatusJ(): Int
|
external fun getStatusJ(): Int
|
||||||
external fun getErrorString(): String?
|
external fun getErrorString(): String?
|
||||||
|
|
||||||
@ -29,6 +30,7 @@ class PendingTransaction internal constructor(var handle: Long) {
|
|||||||
external fun getFee(): Long
|
external fun getFee(): Long
|
||||||
val firstTxId: String
|
val firstTxId: String
|
||||||
get() = getFirstTxIdJ() ?: throw IndexOutOfBoundsException()
|
get() = getFirstTxIdJ() ?: throw IndexOutOfBoundsException()
|
||||||
|
|
||||||
external fun getFirstTxIdJ(): String?
|
external fun getFirstTxIdJ(): String?
|
||||||
external fun getTxCount(): Long
|
external fun getTxCount(): Long
|
||||||
|
|
||||||
|
@ -170,10 +170,6 @@ public class TransactionInfo implements Parcelable, Comparable<TransactionInfo>
|
|||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Direction fromInteger(int n) {
|
public static Direction fromInteger(int n) {
|
||||||
switch (n) {
|
switch (n) {
|
||||||
case 0:
|
case 0:
|
||||||
@ -183,5 +179,9 @@ public class TransactionInfo implements Parcelable, Comparable<TransactionInfo>
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -21,6 +21,7 @@ import android.os.Parcelable.Creator
|
|||||||
|
|
||||||
class Transfer : Parcelable {
|
class Transfer : Parcelable {
|
||||||
var amount: Long
|
var amount: Long
|
||||||
|
|
||||||
@JvmField
|
@JvmField
|
||||||
var address: String?
|
var address: String?
|
||||||
|
|
||||||
|
@ -85,6 +85,7 @@ class Wallet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private external fun statusWithErrorString(): Status
|
private external fun statusWithErrorString(): Status
|
||||||
|
|
||||||
@Synchronized
|
@Synchronized
|
||||||
external fun setPassword(password: String?): Boolean
|
external fun setPassword(password: String?): Boolean
|
||||||
val address: String
|
val address: String
|
||||||
@ -126,6 +127,7 @@ class Wallet {
|
|||||||
subaddress.amount = amount
|
subaddress.amount = amount
|
||||||
return subaddress
|
return subaddress
|
||||||
}
|
}
|
||||||
|
|
||||||
external fun getPath(): String?
|
external fun getPath(): String?
|
||||||
val networkType: NetworkType?
|
val networkType: NetworkType?
|
||||||
get() = fromInteger(nettype())
|
get() = fromInteger(nettype())
|
||||||
@ -217,6 +219,7 @@ class Wallet {
|
|||||||
external fun getBalanceAll(): Long
|
external fun getBalanceAll(): Long
|
||||||
val unlockedBalance: Long
|
val unlockedBalance: Long
|
||||||
get() = getUnlockedBalance(accountIndex)
|
get() = getUnlockedBalance(accountIndex)
|
||||||
|
|
||||||
external fun getUnlockedBalanceAll(): Long
|
external fun getUnlockedBalanceAll(): Long
|
||||||
|
|
||||||
external fun getUnlockedBalance(accountIndex: Int): Long
|
external fun getUnlockedBalance(accountIndex: Int): Long
|
||||||
@ -349,6 +352,7 @@ class Wallet {
|
|||||||
external fun setUserNote(txid: String?, note: String?): Boolean
|
external fun setUserNote(txid: String?, note: String?): Boolean
|
||||||
external fun getUserNote(txid: String?): String?
|
external fun getUserNote(txid: String?): String?
|
||||||
external fun getTxKey(txid: String?): String?
|
external fun getTxKey(txid: String?): String?
|
||||||
|
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
external fun addAccount(label: String? = NEW_ACCOUNT_NAME)
|
external fun addAccount(label: String? = NEW_ACCOUNT_NAME)
|
||||||
var accountLabel: String?
|
var accountLabel: String?
|
||||||
@ -428,6 +432,7 @@ class Wallet {
|
|||||||
|
|
||||||
class Status internal constructor(status: Int, @JvmField val errorString: String) {
|
class Status internal constructor(status: Int, @JvmField val errorString: String) {
|
||||||
val status: StatusEnum
|
val status: StatusEnum
|
||||||
|
|
||||||
@JvmField
|
@JvmField
|
||||||
var connectionStatus: ConnectionStatus? = null // optional
|
var connectionStatus: ConnectionStatus? = null // optional
|
||||||
|
|
||||||
@ -454,22 +459,30 @@ class Wallet {
|
|||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
external fun getDisplayAmount(amount: Long): String
|
external fun getDisplayAmount(amount: Long): String
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
external fun getAmountFromString(amount: String?): Long
|
external fun getAmountFromString(amount: String?): Long
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
external fun getAmountFromDouble(amount: Double): Long
|
external fun getAmountFromDouble(amount: Double): Long
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
external fun generatePaymentId(): String
|
external fun generatePaymentId(): String
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
external fun isPaymentIdValid(payment_id: String): Boolean
|
external fun isPaymentIdValid(payment_id: String): Boolean
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun isAddressValid(address: String): Boolean {
|
fun isAddressValid(address: String): Boolean {
|
||||||
return instance?.networkType?.value?.let { isAddressValid(address, it) } == true
|
return instance?.networkType?.value?.let { isAddressValid(address, it) } == true
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
external fun isAddressValid(address: String?, networkType: Int): Boolean
|
external fun isAddressValid(address: String?, networkType: Int): Boolean
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
external fun getPaymentIdFromAddress(address: String?, networkType: Int): String?
|
external fun getPaymentIdFromAddress(address: String?, networkType: Int): String?
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
external fun getMaximumAllowedAmount(): Long
|
external fun getMaximumAllowedAmount(): Long
|
||||||
}
|
}
|
||||||
|
@ -245,7 +245,8 @@ class WalletManager {
|
|||||||
fun findWallets(path: File): List<WalletInfo> {
|
fun findWallets(path: File): List<WalletInfo> {
|
||||||
val wallets: MutableList<WalletInfo> = ArrayList()
|
val wallets: MutableList<WalletInfo> = ArrayList()
|
||||||
Timber.d("Scanning: %s", path.absolutePath)
|
Timber.d("Scanning: %s", path.absolutePath)
|
||||||
val found = path.listFiles { dir, filename -> filename.endsWith(".keys") } ?: return emptyList()
|
val found =
|
||||||
|
path.listFiles { dir, filename -> filename.endsWith(".keys") } ?: return emptyList()
|
||||||
for (i in found.indices) {
|
for (i in found.indices) {
|
||||||
val filename = found[i].name
|
val filename = found[i].name
|
||||||
val f = File(
|
val f = File(
|
||||||
@ -354,16 +355,22 @@ class WalletManager {
|
|||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
external fun initLogger(argv0: String?, defaultLogBaseName: String?)
|
external fun initLogger(argv0: String?, defaultLogBaseName: String?)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
external fun setLogLevel(level: Int)
|
external fun setLogLevel(level: Int)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
external fun logDebug(category: String?, message: String?)
|
external fun logDebug(category: String?, message: String?)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
external fun logInfo(category: String?, message: String?)
|
external fun logInfo(category: String?, message: String?)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
external fun logWarning(category: String?, message: String?)
|
external fun logWarning(category: String?, message: String?)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
external fun logError(category: String?, message: String?)
|
external fun logError(category: String?, message: String?)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
external fun moneroVersion(): String?
|
external fun moneroVersion(): String?
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,11 @@
|
|||||||
package net.mynero.wallet.service;
|
package net.mynero.wallet.service;
|
||||||
|
|
||||||
import net.mynero.wallet.MoneroApplication;
|
|
||||||
import net.mynero.wallet.data.Subaddress;
|
import net.mynero.wallet.data.Subaddress;
|
||||||
import net.mynero.wallet.model.TransactionInfo;
|
|
||||||
import net.mynero.wallet.model.Wallet;
|
import net.mynero.wallet.model.Wallet;
|
||||||
import net.mynero.wallet.model.WalletManager;
|
import net.mynero.wallet.model.WalletManager;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
public class AddressService extends ServiceBase {
|
public class AddressService extends ServiceBase {
|
||||||
|
@ -5,9 +5,6 @@ import androidx.lifecycle.MutableLiveData;
|
|||||||
|
|
||||||
import net.mynero.wallet.model.BalanceInfo;
|
import net.mynero.wallet.model.BalanceInfo;
|
||||||
import net.mynero.wallet.model.CoinsInfo;
|
import net.mynero.wallet.model.CoinsInfo;
|
||||||
import net.mynero.wallet.model.Wallet;
|
|
||||||
import net.mynero.wallet.model.WalletManager;
|
|
||||||
import net.mynero.wallet.util.Constants;
|
|
||||||
|
|
||||||
public class BalanceService extends ServiceBase {
|
public class BalanceService extends ServiceBase {
|
||||||
public static BalanceService instance = null;
|
public static BalanceService instance = null;
|
||||||
|
@ -232,6 +232,7 @@ public class MoneroHandlerThread extends Thread implements WalletListener {
|
|||||||
|
|
||||||
public interface Listener {
|
public interface Listener {
|
||||||
void onRefresh(boolean walletSynced);
|
void onRefresh(boolean walletSynced);
|
||||||
|
|
||||||
void onConnectionFail();
|
void onConnectionFail();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,6 @@ import net.mynero.wallet.data.DefaultNodes;
|
|||||||
import net.mynero.wallet.data.Node;
|
import net.mynero.wallet.data.Node;
|
||||||
import net.mynero.wallet.util.Constants;
|
import net.mynero.wallet.util.Constants;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
@ -22,6 +21,10 @@ public class PrefService extends ServiceBase {
|
|||||||
instance = this;
|
instance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static PrefService getInstance() {
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
public SharedPreferences.Editor edit() {
|
public SharedPreferences.Editor edit() {
|
||||||
return preferences.edit();
|
return preferences.edit();
|
||||||
}
|
}
|
||||||
@ -104,8 +107,4 @@ public class PrefService extends ServiceBase {
|
|||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PrefService getInstance() {
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -21,9 +21,9 @@ import java.util.List;
|
|||||||
|
|
||||||
public class UTXOService extends ServiceBase {
|
public class UTXOService extends ServiceBase {
|
||||||
public static UTXOService instance = null;
|
public static UTXOService instance = null;
|
||||||
private List<CoinsInfo> internalCachedUtxos = new ArrayList<>();
|
|
||||||
private final MutableLiveData<List<CoinsInfo>> _utxos = new MutableLiveData<>();
|
private final MutableLiveData<List<CoinsInfo>> _utxos = new MutableLiveData<>();
|
||||||
public LiveData<List<CoinsInfo>> utxos = _utxos;
|
public LiveData<List<CoinsInfo>> utxos = _utxos;
|
||||||
|
private List<CoinsInfo> internalCachedUtxos = new ArrayList<>();
|
||||||
private ArrayList<String> frozenCoins = new ArrayList<>();
|
private ArrayList<String> frozenCoins = new ArrayList<>();
|
||||||
|
|
||||||
public UTXOService(MoneroHandlerThread thread) {
|
public UTXOService(MoneroHandlerThread thread) {
|
||||||
|
@ -18,6 +18,7 @@ object Constants {
|
|||||||
const val URI_ARG_AMOUNT2 = "amount"
|
const val URI_ARG_AMOUNT2 = "amount"
|
||||||
const val NAV_ARG_TXINFO = "nav_arg_txinfo"
|
const val NAV_ARG_TXINFO = "nav_arg_txinfo"
|
||||||
const val STREET_MODE_BALANCE = "#.############"
|
const val STREET_MODE_BALANCE = "#.############"
|
||||||
|
|
||||||
@JvmField
|
@JvmField
|
||||||
val DONATION_ADDRESSES = arrayOf(
|
val DONATION_ADDRESSES = arrayOf(
|
||||||
"87BqQYkugEzh6Tuyotm2uc3DzJzKM6MuZaC161e6u1TsQxxPmXVPHpdNRyK47JY4d1hhbe25YVz4e9vTXCLDxvHkRXEAeBC", // primary Mysu Donation address
|
"87BqQYkugEzh6Tuyotm2uc3DzJzKM6MuZaC161e6u1TsQxxPmXVPHpdNRyK47JY4d1hhbe25YVz4e9vTXCLDxvHkRXEAeBC", // primary Mysu Donation address
|
||||||
|
@ -22,6 +22,7 @@ import java.util.Date
|
|||||||
object DateHelper {
|
object DateHelper {
|
||||||
@JvmField
|
@JvmField
|
||||||
val DATETIME_FORMATTER = SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
|
val DATETIME_FORMATTER = SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
|
||||||
|
|
||||||
@Throws(ParseException::class)
|
@Throws(ParseException::class)
|
||||||
fun parse(dateString: String): Date {
|
fun parse(dateString: String): Date {
|
||||||
return DATETIME_FORMATTER.parse(dateString.replace("Z$".toRegex(), "+0000"))
|
return DATETIME_FORMATTER.parse(dateString.replace("Z$".toRegex(), "+0000"))
|
||||||
|
@ -45,7 +45,6 @@ import java.io.File
|
|||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.io.InputStreamReader
|
import java.io.InputStreamReader
|
||||||
import java.math.BigDecimal
|
import java.math.BigDecimal
|
||||||
import java.math.BigInteger
|
|
||||||
import java.net.MalformedURLException
|
import java.net.MalformedURLException
|
||||||
import java.net.SocketTimeoutException
|
import java.net.SocketTimeoutException
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
@ -63,6 +62,7 @@ object Helper {
|
|||||||
private const val MONERO_DIR = "monero"
|
private const val MONERO_DIR = "monero"
|
||||||
private val HexArray = "0123456789ABCDEF".toCharArray()
|
private val HexArray = "0123456789ABCDEF".toCharArray()
|
||||||
var ALLOW_SHIFT = false
|
var ALLOW_SHIFT = false
|
||||||
|
|
||||||
@JvmField
|
@JvmField
|
||||||
var DISPLAY_DIGITS_INFO = 5
|
var DISPLAY_DIGITS_INFO = 5
|
||||||
private var ShakeAnimation: Animation? = null
|
private var ShakeAnimation: Animation? = null
|
||||||
|
@ -194,6 +194,7 @@ class RestoreHeight internal constructor() {
|
|||||||
companion object {
|
companion object {
|
||||||
const val DIFFICULTY_TARGET = 120 // seconds
|
const val DIFFICULTY_TARGET = 120 // seconds
|
||||||
private var Singleton: RestoreHeight? = null
|
private var Singleton: RestoreHeight? = null
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
val instance: RestoreHeight?
|
val instance: RestoreHeight?
|
||||||
get() {
|
get() {
|
||||||
|
@ -7,7 +7,8 @@ import net.mynero.wallet.model.WalletManager.Companion.instance
|
|||||||
class UriData(@JvmField val address: String, val params: HashMap<String, String>) {
|
class UriData(@JvmField val address: String, val params: HashMap<String, String>) {
|
||||||
|
|
||||||
fun hasPaymentId(): Boolean {
|
fun hasPaymentId(): Boolean {
|
||||||
return instance?.wallet?.nettype()?.let { getPaymentIdFromAddress(address, it) }?.isNotEmpty() == true
|
return instance?.wallet?.nettype()?.let { getPaymentIdFromAddress(address, it) }
|
||||||
|
?.isNotEmpty() == true
|
||||||
}
|
}
|
||||||
|
|
||||||
val amount: String?
|
val amount: String?
|
||||||
|
Loading…
Reference in New Issue
Block a user