-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1465 from novasamatech/rc/7.11.0
Rc/7.11.0
- Loading branch information
Showing
65 changed files
with
7,598 additions
and
268 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 0 additions & 7 deletions
7
common/src/main/java/io/novafoundation/nova/common/utils/Planks.kt
This file was deleted.
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
common/src/main/java/io/novafoundation/nova/common/utils/Precision.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package io.novafoundation.nova.common.utils | ||
|
||
import java.math.BigDecimal | ||
import java.math.BigInteger | ||
|
||
@JvmInline | ||
value class Precision(val value: Int) | ||
|
||
fun Int.asPrecision() = Precision(this) | ||
|
||
fun BigDecimal.planksFromAmount(precision: Precision) = scaleByPowerOfTen(precision.value).toBigInteger() | ||
|
||
fun BigInteger.amountFromPlanks(precision: Precision) = toBigDecimal(scale = precision.value) |
21 changes: 21 additions & 0 deletions
21
common/src/main/java/io/novafoundation/nova/common/utils/TokenSymbol.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package io.novafoundation.nova.common.utils | ||
|
||
import io.novafoundation.nova.common.utils.formatting.format | ||
import java.math.BigDecimal | ||
import java.math.RoundingMode | ||
|
||
@JvmInline | ||
value class TokenSymbol(val value: String) { | ||
|
||
override fun toString() = value | ||
} | ||
|
||
fun String.asTokenSymbol() = TokenSymbol(this) | ||
|
||
fun BigDecimal.formatTokenAmount(tokenSymbol: TokenSymbol, roundingMode: RoundingMode = RoundingMode.FLOOR): String { | ||
return format(roundingMode).withTokenSymbol(tokenSymbol) | ||
} | ||
|
||
fun String.withTokenSymbol(tokenSymbol: TokenSymbol): String { | ||
return "$this ${tokenSymbol.value}" | ||
} |
33 changes: 33 additions & 0 deletions
33
...src/main/java/io/novafoundation/nova/common/utils/formatting/TermsAndPrivacyFormatting.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package io.novafoundation.nova.common.utils.formatting | ||
|
||
import android.graphics.Color | ||
import android.text.method.LinkMovementMethod | ||
import android.widget.TextView | ||
import io.novafoundation.nova.common.R | ||
import io.novafoundation.nova.common.utils.clickableSpan | ||
import io.novafoundation.nova.common.utils.colorSpan | ||
import io.novafoundation.nova.common.utils.formatting.spannable.SpannableFormatter | ||
import io.novafoundation.nova.common.utils.setFullSpan | ||
import io.novafoundation.nova.common.utils.toSpannable | ||
|
||
fun TextView.applyTermsAndPrivacyPolicy( | ||
containerResId: Int, | ||
termsResId: Int, | ||
privacyResId: Int, | ||
termsClicked: () -> Unit, | ||
privacyClicked: () -> Unit | ||
) { | ||
movementMethod = LinkMovementMethod.getInstance() | ||
highlightColor = Color.TRANSPARENT | ||
val linkColor = context.getColor(R.color.text_primary) | ||
|
||
text = SpannableFormatter.format( | ||
context.getString(containerResId), | ||
context.getString(termsResId) | ||
.toSpannable(clickableSpan(termsClicked)) | ||
.setFullSpan(colorSpan(linkColor)), | ||
context.getString(privacyResId) | ||
.toSpannable(clickableSpan(privacyClicked)) | ||
.setFullSpan(colorSpan(linkColor)) | ||
) | ||
} |
70 changes: 0 additions & 70 deletions
70
...on/src/main/java/io/novafoundation/nova/common/view/parallaxCard/CardGyroscopeListener.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.