Просмотр исходного кода

+ WA888 change UI Main in progress

Dola TENG 2 лет назад
Родитель
Сommit
15ead3ee34

+ 2 - 0
.idea/misc.xml

@@ -66,6 +66,8 @@
         <entry key="..\:/PartTimeProject/Yuki/Yuki-Mobile/app/src/main/res/layout/layout_fragment_main_yuki.xml" value="0.4013683010262258" />
         <entry key="..\:/PartTimeProject/Yuki/Yuki-Mobile/app/src/main/res/layout/view_square.xml" value="0.18802083333333333" />
         <entry key="..\:/PartTimeProject/Yuki/Yuki-Mobile/app/src/main/res/mipmap-anydpi-v26/ic_logo.xml" value="0.196" />
+        <entry key="..\:/android/SBC_Main_Android/app/src/main/res/layout/bet_detail_item.xml" value="0.25416666666666665" />
+        <entry key="..\:/android/SBC_Main_Android/app/src/main/res/layout/betting_detail.xml" value="0.25416666666666665" />
         <entry key="..\:/android/SBC_Main_Android/app/src/main/res/layout/fragment_report.xml" value="0.25416666666666665" />
         <entry key="..\:/android/SBC_Main_Android/app/src/main/res/layout/layout_betting_header.xml" value="0.25416666666666665" />
         <entry key="..\:/android/SBC_Main_Android/app/src/main/res/layout/layout_betting_statement.xml" value="0.25416666666666665" />

+ 2 - 2
app/src/main/java/com/khmer9/yuki/remote/service/ApiService.kt

@@ -1,8 +1,8 @@
 package com.khmer9.yuki.remote.service
 
 import com.khmer9.yuki.remote.*
+import com.khmer9.yuki.screen.detail.BettingDetailLottoPlusResponse
 import com.khmer9.yuki.screen.detail.BettingDetailResponse
-import com.khmer9.yuki.screen.detail.BettingDetailYukiData
 import com.khmer9.yuki.screen.detail.BettingDetailYukiResponse
 import io.reactivex.Single
 import retrofit2.http.*
@@ -59,7 +59,7 @@ interface ApiService {
     fun updatePassword(@Field(value = "old_password") userName: String, @Field(value = "new_password") password: String): Single<UpdatePwdResponse>
 
     @GET("/v1/api/report/lotto_plus/invoice_detail")
-    fun getLottPlusInvoiceDetail(@Query("module_bet_id") invoiceNum: String): Single<BettingDetailResponse>
+    fun getLottPlusInvoiceDetail(@Query("module_bet_id") invoiceNum: String): Single<BettingDetailLottoPlusResponse>
 
     @GET("/v1/api/report/lotto/invoice")
     fun getLott80Invoice(@Query("module_bet_id") invoiceNum: String): Single<BettingDetailResponse>

+ 44 - 7
app/src/main/java/com/khmer9/yuki/screen/detail/BetsDetailListViewHolder.kt

@@ -15,8 +15,9 @@ class BetsDetailListViewHolder(itemView: View, private val printButtonListener:
                 val txtTime: TextView = itemView.findViewById(R.id.txt_time)
                 val txtAmount: TextView = itemView.findViewById(R.id.txt_amount)
                 val txtType: TextView = itemView.findViewById(R.id.txt_type)
+                val txtTotalCast: TextView = itemView.findViewById(R.id.txt_totalcast)
 
-                /*val fightNo = "#" + item.no.toString()
+                val fightNo = "#" + item.no.toString()
                 try {
                     var datetime = item.time.split(" ")
                     var time = datetime[1]
@@ -27,19 +28,18 @@ class BetsDetailListViewHolder(itemView: View, private val printButtonListener:
                 }
 
                 txtFightBet.text = fightNo
-                txtAmount.text = item.amount
+                txtAmount.text = "${item.totalAmount}"
 
                 try {
-                    val amount = item.amount.split("=")
-                    val winLose = amount[1].trim().toInt()
-                    if (winLose == 0) {
+                    if (item.totalAmountWin < 0) {
                         txtAmount.setTextColor(Color.RED)
                     } else {
                         txtAmount.setTextColor(Color.rgb(48, 63, 159))
                     }
                 } catch (e: Exception) {
                 }
-                txtType.text = item.betting*/
+                txtType.text = item.betType.name
+                txtTotalCast.text = "${item.totalCast}"
             }
 
             is BettingDetailYukiData -> {
@@ -47,6 +47,7 @@ class BetsDetailListViewHolder(itemView: View, private val printButtonListener:
                 val txtTime: TextView = itemView.findViewById(R.id.txt_time)
                 val txtAmount: TextView = itemView.findViewById(R.id.txt_amount)
                 val txtType: TextView = itemView.findViewById(R.id.txt_type)
+                val txtTotalCast: TextView = itemView.findViewById(R.id.txt_totalcast)
 
                 val fightNo = "#" + item.no.toString()
                 try {
@@ -71,8 +72,44 @@ class BetsDetailListViewHolder(itemView: View, private val printButtonListener:
                     }
                 } catch (e: Exception) {
                 }
-                
+
                 txtType.text = item.betType.name
+                txtTotalCast.text = "-"
+            }
+
+            is BettingDetailLottoPlusData -> {
+                val txtFightBet: TextView = itemView.findViewById(R.id.txt_fight_no)
+                val txtTime: TextView = itemView.findViewById(R.id.txt_time)
+                val txtAmount: TextView = itemView.findViewById(R.id.txt_amount)
+                val txtType: TextView = itemView.findViewById(R.id.txt_type)
+                val txtTotalCast: TextView = itemView.findViewById(R.id.txt_totalcast)
+
+                val fightNo = "#" + item.no.toString()
+                try {
+                    var datetime = item.time.split(" ")
+                    var time = datetime[1]
+                    var date = datetime[0]
+                    txtTime.text = date + System.getProperty("line.separator") + time
+                } catch (e: Exception) {
+                    txtTime.text = item.time
+                }
+
+                txtFightBet.text = fightNo
+                txtAmount.text = item.amount
+
+                try {
+                    val amount = item.amount.split("=")
+                    val winLose = amount[1].trim().toInt()
+                    if (winLose == 0) {
+                        txtAmount.setTextColor(Color.RED)
+                    } else {
+                        txtAmount.setTextColor(Color.rgb(48, 63, 159))
+                    }
+                } catch (e: Exception) {
+                }
+
+                txtType.text = item.betting
+                txtTotalCast.text = "-"
             }
         }
     }

+ 1 - 1
app/src/main/java/com/khmer9/yuki/screen/detail/BetsDetailViewModel.kt

@@ -27,7 +27,7 @@ class BetsDetailViewModel(val apiService: ApiService, val prefHelper: PrefHelper
                         _state.value = prev().copy(
                             isProgress = false,
                             error = null,
-                            betDetailData = it.data
+                            betDetailLottoPlus = it.data
                         )
                     } else {
                         _state.value =

+ 2 - 1
app/src/main/java/com/khmer9/yuki/screen/detail/BetsDetailViewState.kt

@@ -5,5 +5,6 @@ data class BetsDetailViewState(
     val isProgress: Boolean = false,
     val error: String? = null,
     var betDetailData: List<BettingDetailData>? = null,
-    var betDetailYukiData: List<BettingDetailYukiData>? = null
+    var betDetailYukiData: List<BettingDetailYukiData>? = null,
+    var betDetailLottoPlus: List<BettingDetailLottoPlusData>? = null
 )

+ 40 - 0
app/src/main/java/com/khmer9/yuki/screen/detail/BettingDetailDataModel.kt

@@ -111,6 +111,46 @@ data class BettingDetailYukiData(
     @Json(name = "bet_result")
     val betResult: BetResult,
 
+    @Json(name = "time")
+    val time: String,
+) : BaseListItem() {
+    override fun getUnique(): String = id
+}
+
+////////////// LOTTO PLUS
+
+@JsonClass(generateAdapter = true)
+data class BettingDetailLottoPlusResponse(
+    @Json(name = "code")
+    val resultCode: String,
+
+    @Json(name = "message")
+    val message: BetDetailMessage,
+
+    @Json(name = "data")
+    val data: List<BettingDetailLottoPlusData>
+)
+
+@JsonClass(generateAdapter = true)
+data class BettingDetailLottoPlusData(
+    @Json(name = "_id")
+    val id: String,
+
+    @Json(name = "no")
+    val no: Int,
+
+    @Json(name = "betting")
+    val betting: String,
+
+    @Json(name = "bet_color")
+    val betColor: String,
+
+    @Json(name = "bet_type")
+    val betType: String,
+
+    @Json(name = "amount")
+    val amount: String,
+
     @Json(name = "time")
     val time: String,
 ) : BaseListItem() {

+ 4 - 0
app/src/main/java/com/khmer9/yuki/screen/detail/BettingDetailFragment.kt

@@ -152,6 +152,10 @@ class BettingDetailFragment : BaseFragment(R.layout.betting_detail) {
             adapter.submitList(it.betDetailYukiData as MutableList<BaseListItem>)
         }
 
+        if (it.betDetailLottoPlus != null) {
+            adapter.submitList(it.betDetailLottoPlus as MutableList<BaseListItem>)
+        }
+
         adapter.notifyDataSetChanged()
     }
 

+ 11 - 1
app/src/main/res/layout/bet_detail_item.xml

@@ -1,6 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:layout_weight="5"
@@ -58,4 +57,15 @@
         android:textSize="14sp"
         android:textStyle="bold" />
 
+    <TextView
+        android:id="@+id/txt_totalcast"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_weight="1"
+        android:gravity="center"
+        android:text="-1"
+        android:textColor="@color/text_black"
+        android:textSize="12sp"
+        android:textStyle="bold" />
+
 </LinearLayout>

+ 13 - 2
app/src/main/res/layout/betting_detail.xml

@@ -42,7 +42,8 @@
         android:layout_height="wrap_content"
         android:layout_marginTop="5dp"
         android:layout_marginBottom="5dp"
-        android:orientation="horizontal">
+        android:orientation="horizontal"
+        android:visibility="visible">
 
         <LinearLayout
             android:layout_width="match_parent"
@@ -110,7 +111,7 @@
         android:layout_width="match_parent"
         android:layout_height="48dp"
         android:orientation="horizontal"
-        android:weightSum="4"
+        android:weightSum="5"
         app:layout_constraintTop_toBottomOf="@+id/materialTextView3">
 
         <TextView
@@ -165,6 +166,16 @@
             android:textSize="14sp"
             android:textStyle="bold" />
 
+        <TextView
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:gravity="center"
+            android:text="@string/total_cast"
+            android:textColor="@color/text_black"
+            android:textSize="12sp"
+            android:textStyle="bold" />
+
     </androidx.appcompat.widget.LinearLayoutCompat>
 
     <View