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>() {
private var localDataSet // <public-key, coinsinfo>
: List<CoinsInfo>
@JvmField
val selectedUtxos // <public-key, coinsinfo>
: HashMap<String?, CoinsInfo>
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.service.PrefService
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.ThemeHelper
import java.util.Calendar
@ -89,7 +89,7 @@ class TransactionInfoAdapter(val listener: TxInfoAdapterListener?) :
failedColour = ThemeHelper.getThemedColor(view.context, R.attr.neutralColor)
val cal = Calendar.getInstance()
val tz = cal.timeZone //get the local time zone.
DATETIME_FORMATTER.timeZone = tz
DateHelper.DATETIME_FORMATTER.timeZone = tz
}
fun bind(txInfo: TransactionInfo) {
@ -155,7 +155,7 @@ class TransactionInfoAdapter(val listener: TxInfoAdapterListener?) :
}
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? {
return try {
Node(jsonObject)

View file

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

View file

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

View file

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

View file

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

View file

@ -15,11 +15,9 @@ import net.mynero.wallet.util.Helper.getClipBoardText
import java.io.File
class PasswordBottomSheetDialog : BottomSheetDialogFragment() {
@JvmField
var listener: PasswordListener? = null
var canCancel = false
@JvmField
var cancelable = false
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
@ -30,7 +28,7 @@ class PasswordBottomSheetDialog : BottomSheetDialogFragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
isCancelable = cancelable
isCancelable = canCancel
val walletFile = File(activity?.applicationInfo?.dataDir, Constants.WALLET_NAME)
val pastePasswordImageButton =
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() {
private val _sendingMax = MutableLiveData(false)
private val _pendingTransaction = MutableLiveData<PendingTransaction?>(null)
@JvmField
var selectedUtxos = ArrayList<String>()
private var sendingMax: LiveData<Boolean?> = _sendingMax
private var pendingTransaction: LiveData<PendingTransaction?> = _pendingTransaction
@JvmField
var uriData: UriData? = null
private val cameraPermissionsLauncher = registerForActivityResult(
ActivityResultContracts.RequestPermission()
@ -57,10 +53,7 @@ class SendBottomSheetDialog : BottomSheetDialogFragment() {
}
}
@JvmField
var isChurning = false
@JvmField
var listener: Listener? = null
var priority: PendingTransaction.Priority = PendingTransaction.Priority.Priority_Low
private var addressEditText: EditText? = null

View file

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

View file

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

View file

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

View file

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

View file

@ -428,7 +428,7 @@ class Wallet {
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
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)
@get:Synchronized
@JvmStatic
var instance: WalletManager? = null
get() {
if (field == null) {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -20,7 +20,6 @@ import java.text.SimpleDateFormat
import java.util.Date
object DateHelper {
@JvmField
val DATETIME_FORMATTER = SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
@Throws(ParseException::class)

View file

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

View file

@ -25,7 +25,6 @@ import java.util.concurrent.TimeUnit
import java.util.concurrent.atomic.AtomicInteger
object MoneroThreadPoolExecutor {
@JvmField
var MONERO_THREAD_POOL_EXECUTOR: Executor? = null
private val CPU_COUNT = Runtime.getRuntime().availableProcessors()
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
private var Singleton: RestoreHeight? = null
@JvmStatic
val instance: RestoreHeight?
get() {
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.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 {
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 {
@JvmStatic
fun parse(uri: String): UriData? {
if (uri.isEmpty()) return null
val params = HashMap<String, String>()