Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
deBeauvoir
samourai-wallet-android
Commits
873ecb71
Verified
Commit
873ecb71
authored
Dec 02, 2021
by
Sarath
⚔
Browse files
Refactor mix adapter
parent
8676d68d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
15 deletions
+16
-15
app/src/main/java/com/samourai/wallet/whirlpool/adapters/MixTxAdapter.kt
...va/com/samourai/wallet/whirlpool/adapters/MixTxAdapter.kt
+16
-15
No files found.
app/src/main/java/com/samourai/wallet/whirlpool/adapters/MixTxAdapter.kt
View file @
873ecb71
...
@@ -28,6 +28,7 @@ import io.reactivex.schedulers.Schedulers
...
@@ -28,6 +28,7 @@ import io.reactivex.schedulers.Schedulers
import
org.json.JSONObject
import
org.json.JSONObject
import
java.text.SimpleDateFormat
import
java.text.SimpleDateFormat
import
java.util.*
import
java.util.*
import
kotlin.math.abs
class
MixTxAdapter
(
private
val
mContext
:
Context
)
:
class
MixTxAdapter
(
private
val
mContext
:
Context
)
:
RecyclerView
.
Adapter
<
MixTxAdapter
.
TxViewHolder
>()
{
RecyclerView
.
Adapter
<
MixTxAdapter
.
TxViewHolder
>()
{
...
@@ -65,13 +66,13 @@ class MixTxAdapter(private val mContext: Context) :
...
@@ -65,13 +66,13 @@ class MixTxAdapter(private val mContext: Context) :
}
}
override
fun
onBindViewHolder
(
holder
:
TxViewHolder
,
position
:
Int
)
{
override
fun
onBindViewHolder
(
holder
:
TxViewHolder
,
position
:
Int
)
{
val
is
_sat_p
refs
=
PrefsUtil
.
getInstance
(
mContext
).
getValue
(
PrefsUtil
.
IS_SAT
,
false
)
val
is
SatP
refs
=
PrefsUtil
.
getInstance
(
mContext
).
getValue
(
PrefsUtil
.
IS_SAT
,
false
)
val
tx
=
mDiffer
.
currentList
[
position
]
val
tx
=
mDiffer
.
currentList
[
position
]
val
isPremix
=
this
.
preMixTxs
.
contains
(
tx
)
val
isPremix
=
this
.
preMixTxs
.
contains
(
tx
)
if
(
tx
!!
.
section
==
null
)
{
if
(
tx
!!
.
section
==
null
)
{
var
_amount
=
0L
var
_amount
=
0L
_amount
=
if
(
tx
.
amount
<
0.0
)
{
_amount
=
if
(
tx
.
amount
<
0.0
)
{
Math
.
abs
(
tx
.
amount
.
toLong
())
abs
(
tx
.
amount
.
toLong
())
}
else
{
}
else
{
tx
.
amount
.
toLong
()
tx
.
amount
.
toLong
()
}
}
...
@@ -98,8 +99,8 @@ class MixTxAdapter(private val mContext: Context) :
...
@@ -98,8 +99,8 @@ class MixTxAdapter(private val mContext: Context) :
R
.
drawable
.
out_going_tx_whtie_arrow
R
.
drawable
.
out_going_tx_whtie_arrow
)
)
)
)
holder
.
tvAmount
!!
.
setTextColor
(
ContextCompat
.
getColor
(
mContext
,
R
.
color
.
white
))
holder
.
tvAmount
?
.
setTextColor
(
ContextCompat
.
getColor
(
mContext
,
R
.
color
.
white
))
holder
.
tvAmount
!!
.
text
=
"-"
+
if
(
is
_sat_p
refs
)
FormatsUtil
.
formatSats
(
_amount
)
else
FormatsUtil
.
formatBTC
(
holder
.
tvAmount
?
.
text
=
"-"
+
if
(
is
SatP
refs
)
FormatsUtil
.
formatSats
(
_amount
)
else
FormatsUtil
.
formatBTC
(
_amount
_amount
)
)
holder
.
txSubText
!!
.
visibility
=
View
.
VISIBLE
holder
.
txSubText
!!
.
visibility
=
View
.
VISIBLE
...
@@ -107,7 +108,7 @@ class MixTxAdapter(private val mContext: Context) :
...
@@ -107,7 +108,7 @@ class MixTxAdapter(private val mContext: Context) :
}
else
{
}
else
{
TransitionManager
.
beginDelayedTransition
(
TransitionManager
.
beginDelayedTransition
(
holder
.
tvAmount
!!
.
rootView
as
ViewGroup
,
holder
.
tvAmount
?
.
rootView
as
ViewGroup
,
ChangeBounds
()
ChangeBounds
()
)
)
holder
.
tvDirection
!!
.
setImageDrawable
(
holder
.
tvDirection
!!
.
setImageDrawable
(
...
@@ -117,22 +118,22 @@ class MixTxAdapter(private val mContext: Context) :
...
@@ -117,22 +118,22 @@ class MixTxAdapter(private val mContext: Context) :
)
)
)
)
val
amount
=
val
amount
=
if
(
is
_sat_p
refs
)
FormatsUtil
.
formatSats
(
_amount
)
else
FormatsUtil
.
formatBTC
(
if
(
is
SatP
refs
)
FormatsUtil
.
formatSats
(
_amount
)
else
FormatsUtil
.
formatBTC
(
_amount
_amount
)
)
holder
.
tvAmount
!!
.
text
=
amount
holder
.
tvAmount
?
.
text
=
amount
holder
.
tvAmount
!!
.
setTextColor
(
ContextCompat
.
getColor
(
mContext
,
R
.
color
.
green_ui_2
))
holder
.
tvAmount
?
.
setTextColor
(
ContextCompat
.
getColor
(
mContext
,
R
.
color
.
green_ui_2
))
if
(
_amount
==
0L
)
{
if
(
_amount
==
0L
)
{
holder
.
txSubText
!!
.
visibility
=
View
.
VISIBLE
holder
.
txSubText
?
.
visibility
=
View
.
VISIBLE
holder
.
txSubText
!!
.
setText
(
R
.
string
.
remix_note_tag
)
holder
.
txSubText
?
.
setText
(
R
.
string
.
remix_note_tag
)
}
else
if
(
BlockedUTXO
.
BLOCKED_UTXO_THRESHOLD
>=
_amount
)
{
}
else
if
(
BlockedUTXO
.
BLOCKED_UTXO_THRESHOLD
>=
_amount
)
{
holder
.
txSubText
!!
.
visibility
=
View
.
VISIBLE
holder
.
txSubText
?
.
visibility
=
View
.
VISIBLE
holder
.
txSubText
!!
.
setText
(
R
.
string
.
dust
)
holder
.
txSubText
?
.
setText
(
R
.
string
.
dust
)
}
else
{
}
else
{
if
(!
isPremix
)
{
if
(!
isPremix
)
{
holder
.
txSubText
!!
.
visibility
=
View
.
VISIBLE
holder
.
txSubText
?
.
visibility
=
View
.
VISIBLE
holder
.
txSubText
!!
.
setText
(
R
.
string
.
mixed
)
holder
.
txSubText
?
.
setText
(
R
.
string
.
mixed
)
holder
.
tvDirection
!!
.
setImageDrawable
(
holder
.
tvDirection
?
.
setImageDrawable
(
ContextCompat
.
getDrawable
(
ContextCompat
.
getDrawable
(
mContext
,
mContext
,
R
.
drawable
.
ic_whirlpool
R
.
drawable
.
ic_whirlpool
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment