diff --git a/notification/src/main/java/com/remax/notification/builder/NotificationDataFactory.kt b/notification/src/main/java/com/remax/notification/builder/NotificationDataFactory.kt
index 7173a7c..c4a5c2f 100644
--- a/notification/src/main/java/com/remax/notification/builder/NotificationDataFactory.kt
+++ b/notification/src/main/java/com/remax/notification/builder/NotificationDataFactory.kt
@@ -366,13 +366,15 @@ class FixTimeModelManager() {
class ResidentModelManger {
fun getModel(context: Context): GeneralNotificationData {
+ val cashNum = NotificationDatas.getResidentDatas().getCashNumber()
+ var cashStr = if (hasDecimalPart(cashNum)) String.format("%.2f", cashNum) else cashNum.toString()
val contentView = NotificationRemoteViewsBuilder(
context.packageName,
R.layout.layout_notification_resident_12,
R.layout.layout_notification_resident
).setTextViewText(R.id.tv_resident_gold, NotificationDatas.getResidentDatas().getGoldNumber().toString())
- .setTextViewText(R.id.tv_resident_cash, String.format("%.2f", NotificationDatas.getResidentDatas().getCashNumber()))
+ .setTextViewText(R.id.tv_resident_cash, "R$" + cashStr)
.setTextViewText(R.id.tv_resident_box, NotificationDatas.getResidentDatas().getBoxRestTimeStr())
.setOnClickPendingIntent(
R.id.resident_gold, entryPointPendingIntent(context,
@@ -414,4 +416,8 @@ class ResidentModelManger {
bigContentView = null
)
}
+
+ fun hasDecimalPart(number: Double): Boolean {
+ return Math.abs(number % 1) > 1e-10
+ }
}
diff --git a/notification/src/main/res/layout/layout_notification_resident_12.xml b/notification/src/main/res/layout/layout_notification_resident_12.xml
index 3ac7eb7..3841dc0 100644
--- a/notification/src/main/res/layout/layout_notification_resident_12.xml
+++ b/notification/src/main/res/layout/layout_notification_resident_12.xml
@@ -71,7 +71,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_gravity="center">
-
+ />-->