Remove unnecessary JvmField/JvmStatic annotations

This commit is contained in:
pokkst 2023-12-06 18:06:48 -06:00
parent 9de74d54a5
commit 54a0431d97
No known key found for this signature in database
GPG key ID: EC4FAAA66859FAA4
26 changed files with 12 additions and 72 deletions

View file

@ -33,8 +33,6 @@ 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
val selectedUtxos // <public-key, coinsinfo> val selectedUtxos // <public-key, coinsinfo>
: HashMap<String?, CoinsInfo> : HashMap<String?, CoinsInfo>
private var editing = false private var editing = false

View file

@ -25,7 +25,7 @@ import net.mynero.wallet.R
import net.mynero.wallet.model.TransactionInfo import net.mynero.wallet.model.TransactionInfo
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.DateHelper.DATETIME_FORMATTER import net.mynero.wallet.util.DateHelper
import net.mynero.wallet.util.Helper import net.mynero.wallet.util.Helper
import net.mynero.wallet.util.ThemeHelper import net.mynero.wallet.util.ThemeHelper
import java.util.Calendar import java.util.Calendar
@ -89,7 +89,7 @@ class TransactionInfoAdapter(val listener: TxInfoAdapterListener?) :
failedColour = ThemeHelper.getThemedColor(view.context, R.attr.neutralColor) failedColour = ThemeHelper.getThemedColor(view.context, R.attr.neutralColor)
val cal = Calendar.getInstance() val cal = Calendar.getInstance()
val tz = cal.timeZone //get the local time zone. val tz = cal.timeZone //get the local time zone.
DATETIME_FORMATTER.timeZone = tz DateHelper.DATETIME_FORMATTER.timeZone = tz
} }
fun bind(txInfo: TransactionInfo) { fun bind(txInfo: TransactionInfo) {
@ -155,7 +155,7 @@ class TransactionInfoAdapter(val listener: TxInfoAdapterListener?) :
} }
private fun getDateTime(time: Long): String { private fun getDateTime(time: Long): String {
return DATETIME_FORMATTER.format(Date(time * 1000)) return DateHelper.DATETIME_FORMATTER.format(Date(time * 1000))
} }
} }
} }

View file

@ -254,7 +254,6 @@ class Node {
} }
} }
@JvmStatic
fun fromJson(jsonObject: JSONObject?): Node? { fun fromJson(jsonObject: JSONObject?): Node? {
return try { return try {
Node(jsonObject) Node(jsonObject)

View file

@ -20,7 +20,7 @@ import java.util.regex.Pattern
class Subaddress( class Subaddress(
private val accountIndex: Int, private val accountIndex: Int,
val addressIndex: Int, val addressIndex: Int,
@JvmField val address: String, val address: String,
val label: String val label: String
) : Comparable<Subaddress> { ) : Comparable<Subaddress> {
var amount: Long = 0 var amount: Long = 0

View file

@ -21,7 +21,6 @@ import org.json.JSONException
import org.json.JSONObject import org.json.JSONObject
class AddNodeBottomSheetDialog : BottomSheetDialogFragment() { class AddNodeBottomSheetDialog : BottomSheetDialogFragment() {
@JvmField
var listener: AddNodeListener? = null var listener: AddNodeListener? = null
override fun onCreateView( override fun onCreateView(
inflater: LayoutInflater, inflater: LayoutInflater,

View file

@ -19,11 +19,9 @@ import org.json.JSONException
import org.json.JSONObject import org.json.JSONObject
class EditNodeBottomSheetDialog : BottomSheetDialogFragment() { class EditNodeBottomSheetDialog : BottomSheetDialogFragment() {
@JvmField
var listener: EditNodeListener? = null var listener: EditNodeListener? = null
@JvmField
var node: Node? = null var node: Node? = null
override fun onCreateView( override fun onCreateView(
inflater: LayoutInflater, inflater: LayoutInflater,
container: ViewGroup?, container: ViewGroup?,

View file

@ -25,7 +25,6 @@ import org.json.JSONException
import org.json.JSONObject import org.json.JSONObject
class NodeSelectionBottomSheetDialog : BottomSheetDialogFragment(), NodeSelectionAdapterListener { class NodeSelectionBottomSheetDialog : BottomSheetDialogFragment(), NodeSelectionAdapterListener {
@JvmField
var listener: NodeSelectionDialogListener? = null var listener: NodeSelectionDialogListener? = null
private var adapter: NodeSelectionAdapter? = null private var adapter: NodeSelectionAdapter? = null
override fun onCreateView( override fun onCreateView(

View file

@ -15,11 +15,9 @@ import net.mynero.wallet.util.Helper.getClipBoardText
import java.io.File import java.io.File
class PasswordBottomSheetDialog : BottomSheetDialogFragment() { class PasswordBottomSheetDialog : BottomSheetDialogFragment() {
@JvmField
var listener: PasswordListener? = null var listener: PasswordListener? = null
var canCancel = false
@JvmField
var cancelable = false
override fun onCreateView( override fun onCreateView(
inflater: LayoutInflater, inflater: LayoutInflater,
container: ViewGroup?, container: ViewGroup?,
@ -30,7 +28,7 @@ class PasswordBottomSheetDialog : BottomSheetDialogFragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
isCancelable = cancelable isCancelable = canCancel
val walletFile = File(activity?.applicationInfo?.dataDir, Constants.WALLET_NAME) val walletFile = File(activity?.applicationInfo?.dataDir, Constants.WALLET_NAME)
val pastePasswordImageButton = val pastePasswordImageButton =
view.findViewById<ImageButton>(R.id.paste_password_imagebutton) view.findViewById<ImageButton>(R.id.paste_password_imagebutton)

View file

@ -38,13 +38,9 @@ import net.mynero.wallet.util.UriData.Companion.parse
class SendBottomSheetDialog : BottomSheetDialogFragment() { class SendBottomSheetDialog : BottomSheetDialogFragment() {
private val _sendingMax = MutableLiveData(false) private val _sendingMax = MutableLiveData(false)
private val _pendingTransaction = MutableLiveData<PendingTransaction?>(null) private val _pendingTransaction = MutableLiveData<PendingTransaction?>(null)
@JvmField
var selectedUtxos = ArrayList<String>() var selectedUtxos = ArrayList<String>()
private var sendingMax: LiveData<Boolean?> = _sendingMax private var sendingMax: LiveData<Boolean?> = _sendingMax
private var pendingTransaction: LiveData<PendingTransaction?> = _pendingTransaction private var pendingTransaction: LiveData<PendingTransaction?> = _pendingTransaction
@JvmField
var uriData: UriData? = null var uriData: UriData? = null
private val cameraPermissionsLauncher = registerForActivityResult( private val cameraPermissionsLauncher = registerForActivityResult(
ActivityResultContracts.RequestPermission() ActivityResultContracts.RequestPermission()
@ -57,10 +53,7 @@ class SendBottomSheetDialog : BottomSheetDialogFragment() {
} }
} }
@JvmField
var isChurning = false var isChurning = false
@JvmField
var listener: Listener? = null var listener: Listener? = null
var priority: PendingTransaction.Priority = PendingTransaction.Priority.Priority_Low var priority: PendingTransaction.Priority = PendingTransaction.Priority.Priority_Low
private var addressEditText: EditText? = null private var addressEditText: EditText? = null

View file

@ -14,8 +14,8 @@ import net.mynero.wallet.util.Constants
import net.mynero.wallet.util.Helper.clipBoardCopy import net.mynero.wallet.util.Helper.clipBoardCopy
class WalletKeysBottomSheetDialog : BottomSheetDialogFragment() { class WalletKeysBottomSheetDialog : BottomSheetDialogFragment() {
@JvmField
var password = "" var password = ""
override fun onCreateView( override fun onCreateView(
inflater: LayoutInflater, inflater: LayoutInflater,
container: ViewGroup?, container: ViewGroup?,

View file

@ -139,7 +139,7 @@ class SettingsFragment : Fragment(), PasswordListener, NodeSelectionDialogListen
if (usesPassword) { if (usesPassword) {
activity?.supportFragmentManager?.let { fragmentManager -> activity?.supportFragmentManager?.let { fragmentManager ->
val passwordDialog = PasswordBottomSheetDialog() val passwordDialog = PasswordBottomSheetDialog()
passwordDialog.cancelable = true passwordDialog.canCancel = true
passwordDialog.listener = this passwordDialog.listener = this
passwordDialog.show(fragmentManager, "password_dialog") passwordDialog.show(fragmentManager, "password_dialog")
} }

View file

@ -22,43 +22,22 @@ import android.os.Parcelable.Creator
import net.mynero.wallet.data.Subaddress import net.mynero.wallet.data.Subaddress
class TransactionInfo : Parcelable, Comparable<TransactionInfo> { class TransactionInfo : Parcelable, Comparable<TransactionInfo> {
@JvmField
var direction: Direction var direction: Direction
var isPending: Boolean var isPending: Boolean
var isFailed: Boolean var isFailed: Boolean
@JvmField
var amount: Long var amount: Long
var fee: Long var fee: Long
@JvmField
var blockheight: Long var blockheight: Long
@JvmField
var hash: String? var hash: String?
@JvmField
var timestamp: Long var timestamp: Long
var paymentId: String? var paymentId: String?
@JvmField
var accountIndex: Int var accountIndex: Int
@JvmField
var addressIndex: Int var addressIndex: Int
@JvmField
var confirmations: Long var confirmations: Long
var subaddressLabel: String? var subaddressLabel: String?
@JvmField
var transfers: List<Transfer>? = listOf() var transfers: List<Transfer>? = listOf()
@JvmField
var txKey: String? = null var txKey: String? = null
var notes: String? = null var notes: String? = null
@JvmField
var address: String? = null var address: String? = null
constructor( constructor(

View file

@ -21,8 +21,6 @@ import android.os.Parcelable.Creator
class Transfer : Parcelable { class Transfer : Parcelable {
var amount: Long var amount: Long
@JvmField
var address: String? var address: String?
constructor(amount: Long, address: String?) { constructor(amount: Long, address: String?) {

View file

@ -428,7 +428,7 @@ class Wallet {
ConnectionStatus_Disconnected, ConnectionStatus_Connected, ConnectionStatus_WrongVersion ConnectionStatus_Disconnected, ConnectionStatus_Connected, ConnectionStatus_WrongVersion
} }
class Status internal constructor(status: Int, @JvmField val errorString: String) { class Status internal constructor(status: Int, val errorString: String) {
val status: StatusEnum val status: StatusEnum
var connectionStatus: ConnectionStatus? = null // optional var connectionStatus: ConnectionStatus? = null // optional

View file

@ -328,7 +328,6 @@ class WalletManager {
// no need to keep a reference to the REAL WalletManager (we get it every tvTime we need it) // no need to keep a reference to the REAL WalletManager (we get it every tvTime we need it)
@get:Synchronized @get:Synchronized
@JvmStatic
var instance: WalletManager? = null var instance: WalletManager? = null
get() { get() {
if (field == null) { if (field == null) {

View file

@ -33,7 +33,6 @@ class AddressService(thread: MoneroHandlerThread) : ServiceBase(thread) {
} }
companion object { companion object {
@JvmField
var instance: AddressService? = null var instance: AddressService? = null
} }
} }

View file

@ -50,7 +50,6 @@ class BalanceService(thread: MoneroHandlerThread) : ServiceBase(thread) {
get() = totalBalanceRaw - unlockedBalanceRaw get() = totalBalanceRaw - unlockedBalanceRaw
companion object { companion object {
@JvmField
var instance: BalanceService? = null var instance: BalanceService? = null
} }
} }

View file

@ -9,8 +9,6 @@ class BlockchainService(thread: MoneroHandlerThread) : ServiceBase(thread) {
private val _currentHeight = MutableLiveData(0L) private val _currentHeight = MutableLiveData(0L)
private val _connectionStatus = MutableLiveData(ConnectionStatus.ConnectionStatus_Disconnected) private val _connectionStatus = MutableLiveData(ConnectionStatus.ConnectionStatus_Disconnected)
var height: LiveData<Long> = _currentHeight var height: LiveData<Long> = _currentHeight
@JvmField
var connectionStatus: LiveData<ConnectionStatus> = _connectionStatus var connectionStatus: LiveData<ConnectionStatus> = _connectionStatus
var daemonHeight: Long = 0 var daemonHeight: Long = 0
set(height) { set(height) {
@ -43,7 +41,6 @@ class BlockchainService(thread: MoneroHandlerThread) : ServiceBase(thread) {
} }
companion object { companion object {
@JvmField
var instance: BlockchainService? = null var instance: BlockchainService? = null
} }
} }

View file

@ -7,8 +7,6 @@ import net.mynero.wallet.model.WalletManager
class HistoryService(thread: MoneroHandlerThread) : ServiceBase(thread) { class HistoryService(thread: MoneroHandlerThread) : ServiceBase(thread) {
private val _history = MutableLiveData<List<TransactionInfo>>() private val _history = MutableLiveData<List<TransactionInfo>>()
@JvmField
var history: LiveData<List<TransactionInfo>> = _history var history: LiveData<List<TransactionInfo>> = _history
init { init {
@ -24,7 +22,6 @@ class HistoryService(thread: MoneroHandlerThread) : ServiceBase(thread) {
} }
companion object { companion object {
@JvmStatic
var instance: HistoryService? = null var instance: HistoryService? = null
private set private set
} }

View file

@ -111,7 +111,6 @@ class PrefService(application: MoneroApplication) : ServiceBase(null) {
companion object { companion object {
private var preferences: SharedPreferences? = null private var preferences: SharedPreferences? = null
@JvmStatic
var instance: PrefService? = null var instance: PrefService? = null
private set private set
} }

View file

@ -14,8 +14,6 @@ import java.util.Collections
class UTXOService(thread: MoneroHandlerThread?) : ServiceBase(thread) { class UTXOService(thread: MoneroHandlerThread?) : ServiceBase(thread) {
private val _utxos = MutableLiveData<List<CoinsInfo>>() private val _utxos = MutableLiveData<List<CoinsInfo>>()
@JvmField
var utxos: LiveData<List<CoinsInfo>> = _utxos var utxos: LiveData<List<CoinsInfo>> = _utxos
private var internalCachedUtxos: List<CoinsInfo> = ArrayList() private var internalCachedUtxos: List<CoinsInfo> = ArrayList()
private var frozenCoins = ArrayList<String?>() private var frozenCoins = ArrayList<String?>()
@ -137,7 +135,6 @@ class UTXOService(thread: MoneroHandlerThread?) : ServiceBase(thread) {
} }
companion object { companion object {
@JvmStatic
var instance: UTXOService? = null var instance: UTXOService? = null
} }
} }

View file

@ -20,7 +20,6 @@ import java.text.SimpleDateFormat
import java.util.Date import java.util.Date
object DateHelper { object DateHelper {
@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)

View file

@ -160,7 +160,6 @@ object Helper {
return getDisplayAmount(amount, XMR_DECIMALS) return getDisplayAmount(amount, XMR_DECIMALS)
} }
@JvmStatic
fun getDisplayAmount(amount: Long, maxDecimals: Int): String { fun getDisplayAmount(amount: Long, maxDecimals: Int): String {
// a Java bug does not strip zeros properly if the value is 0 // a Java bug does not strip zeros properly if the value is 0
if (amount == 0L) return "0.00" if (amount == 0L) return "0.00"
@ -173,8 +172,7 @@ object Helper {
fun getFormattedAmount(amount: Double, isCrypto: Boolean): String? { fun getFormattedAmount(amount: Double, isCrypto: Boolean): String? {
// at this point selection is XMR in case of error // at this point selection is XMR in case of error
val displayB: String? val displayB: String? = if (isCrypto) {
displayB = if (isCrypto) {
if (amount >= 0 || amount == 0.0) { if (amount >= 0 || amount == 0.0) {
String.format(Locale.US, "%,.5f", amount) String.format(Locale.US, "%,.5f", amount)
} else { } else {
@ -186,7 +184,6 @@ object Helper {
return displayB return displayB
} }
@JvmStatic
fun getDisplayAmount(amount: Double): String { fun getDisplayAmount(amount: Double): String {
// a Java bug does not strip zeros properly if the value is 0 // a Java bug does not strip zeros properly if the value is 0
var d = BigDecimal(amount) var d = BigDecimal(amount)
@ -244,7 +241,6 @@ object Helper {
return null return null
} }
@JvmStatic
fun clipBoardCopy(context: Context?, label: String?, text: String?) { fun clipBoardCopy(context: Context?, label: String?, text: String?) {
if (context != null) { if (context != null) {
val clipboardManager = val clipboardManager =

View file

@ -25,7 +25,6 @@ import java.util.concurrent.TimeUnit
import java.util.concurrent.atomic.AtomicInteger import java.util.concurrent.atomic.AtomicInteger
object MoneroThreadPoolExecutor { object MoneroThreadPoolExecutor {
@JvmField
var MONERO_THREAD_POOL_EXECUTOR: Executor? = null var MONERO_THREAD_POOL_EXECUTOR: Executor? = null
private val CPU_COUNT = Runtime.getRuntime().availableProcessors() private val CPU_COUNT = Runtime.getRuntime().availableProcessors()
private val CORE_POOL_SIZE = Math.max(2, Math.min(CPU_COUNT - 1, 4)) private val CORE_POOL_SIZE = Math.max(2, Math.min(CPU_COUNT - 1, 4))

View file

@ -195,7 +195,6 @@ class RestoreHeight internal constructor() {
const val DIFFICULTY_TARGET = 120 // seconds const val DIFFICULTY_TARGET = 120 // seconds
private var Singleton: RestoreHeight? = null private var Singleton: RestoreHeight? = null
@JvmStatic
val instance: RestoreHeight? val instance: RestoreHeight?
get() { get() {
if (Singleton == null) { if (Singleton == null) {

View file

@ -4,7 +4,7 @@ import net.mynero.wallet.model.Wallet.Companion.getPaymentIdFromAddress
import net.mynero.wallet.model.Wallet.Companion.isAddressValid import net.mynero.wallet.model.Wallet.Companion.isAddressValid
import net.mynero.wallet.model.WalletManager.Companion.instance import net.mynero.wallet.model.WalletManager.Companion.instance
class UriData(@JvmField val address: String, val params: HashMap<String, String>) { class UriData(val address: String, val params: HashMap<String, String>) {
fun hasPaymentId(): Boolean { fun hasPaymentId(): Boolean {
return instance?.wallet?.nettype()?.let { getPaymentIdFromAddress(address, it) } return instance?.wallet?.nettype()?.let { getPaymentIdFromAddress(address, it) }
@ -20,7 +20,6 @@ class UriData(@JvmField val address: String, val params: HashMap<String, String>
} }
companion object { companion object {
@JvmStatic
fun parse(uri: String): UriData? { fun parse(uri: String): UriData? {
if (uri.isEmpty()) return null if (uri.isEmpty()) return null
val params = HashMap<String, String>() val params = HashMap<String, String>()