Sfoglia il codice sorgente

Merge branch 'master' of http://139.59.124.127:9000/dola/SBC_Main_Android

 Conflicts:
	app/src/main/java/com/khmer9/sbcmain/screen/main/MainFragment.kt
Dola TENG 2 anni fa
parent
commit
037d362228

+ 1 - 0
.idea/misc.xml

@@ -9,6 +9,7 @@
         <entry key="..\:/3-Work/Android/SBC_Main_Android/app/src/main/res/layout/fragment_report.xml" value="0.18802083333333333" />
         <entry key="..\:/3-Work/Android/SBC_Main_Android/app/src/main/res/layout/layout_fragment_main_yuki.xml" value="0.36666666666666664" />
         <entry key="..\:/3-Work/Android/SBC_Main_Android/app/src/main/res/layout/layout_main_module.xml" value="0.36666666666666664" />
+        <entry key="..\:/3-Work/Android/SBC_Main_Android/app/src/main/res/layout/layout_sub_module.xml" value="0.36666666666666664" />
         <entry key="..\:/3-Work/Android/Yuki-Mobile/app/src/main/res/layout/bet_detail_item.xml" value="0.33" />
         <entry key="..\:/3-Work/Android/Yuki-Mobile/app/src/main/res/layout/betting_detail.xml" value="0.36666666666666664" />
         <entry key="..\:/3-Work/Android/Yuki-Mobile/app/src/main/res/layout/fragment_play.xml" value="0.2807971014492754" />

+ 1 - 1
app/src/dev/java/com/khmer9/yuki/config/Config.kt

@@ -1,4 +1,4 @@
-package com.khmer9.yuki.config
+package com.khmer9.sbcmain.config
 
 object Config {
     const val BASE_URL = "http://playerapi.cf2888.net"

+ 2 - 2
app/src/main/java/com/khmer9/sbcmain/screen/main/MainFragment.kt

@@ -44,7 +44,7 @@ class MainFragment : BaseFragment(R.layout.layout_fragment_main_yuki) {
     private val LOTTO_PLUS_PACKAGE = "com.sambath.lottoplus"
 
     private val COCK_FIGHT_APP_ID = "631c17831da02749e7e23f35"
-    private val COCK_FIGHT_DOWNLOAD = ""
+    private val COCK_FIGHT_DOWNLOAD = "https://www.dropbox.com/s/5hvduce4mgzi6bs/SBC-Mobile_devDebug_1.1.2-dev.apk?dl=1"
     private val COCK_FIGHT_PACKAGE = "com.sambath.sbc"
 
     private val APONG_APP_ID = "631c1d1a0d213229fc5fd11a"
@@ -187,7 +187,7 @@ class MainFragment : BaseFragment(R.layout.layout_fragment_main_yuki) {
                                         putString("module_id", id)
                                     }
                                 })
-                                .addToBackStack(null)
+                                .addToBackStack("MainFragment")
                                 .commit()
                         }
                     } else {

+ 42 - 8
app/src/main/java/com/khmer9/sbcmain/screen/main/MainModuleViewHolder.kt

@@ -15,6 +15,8 @@ import com.squareup.picasso.Picasso
 
 class MainModuleViewHolder(itemView: View, private val detailButtonListener: ((String, String, Int) -> Unit)? = null) : BaseListViewHolder(itemView) {
     private val picasso = Picasso.get()
+    private val LOTTO_APP_ID = "630780f0f635dd035329f5b7"
+    private val LOTTO_PLUS_APP_ID = "62e397edae71cfa8782aa3a0"
 
     override fun bindView(item: BaseListItem) {
         val imgIcon = itemView.findViewById<ImageView>(R.id.img_icon)
@@ -42,10 +44,26 @@ class MainModuleViewHolder(itemView: View, private val detailButtonListener: ((S
                 imgIcon.layoutParams.height = height.toInt()
                 imgIcon.layoutParams.width = height.toInt()
 
-                picasso
-                    .load(item.smallIcon)
-                    .placeholder(R.drawable.animal_seven)
-                    .into(imgIcon)
+                when (item.appId) {
+                    LOTTO_APP_ID -> {
+                        picasso
+                            .load(R.drawable.ic_lotto_80)
+                            .placeholder(R.drawable.animal_seven)
+                            .into(imgIcon)
+                    }
+                    LOTTO_PLUS_APP_ID -> {
+                        picasso
+                            .load(R.drawable.ic_lotto_plus)
+                            .placeholder(R.drawable.animal_seven)
+                            .into(imgIcon)
+                    }
+                    else -> {
+                        picasso
+                            .load(item.smallIcon)
+                            .placeholder(R.drawable.animal_seven)
+                            .into(imgIcon)
+                    }
+                }
             } catch (e: Exception) {
             }
 
@@ -75,10 +93,26 @@ class MainModuleViewHolder(itemView: View, private val detailButtonListener: ((S
                 imgIcon.layoutParams.height = height.toInt()
                 imgIcon.layoutParams.width = height.toInt()
 
-                picasso
-                    .load(item.smallIcon)
-                    .placeholder(R.drawable.animal_seven)
-                    .into(imgIcon)
+                when (item.appId) {
+                    LOTTO_APP_ID -> {
+                        picasso
+                            .load(R.drawable.ic_lotto_80)
+                            .placeholder(R.drawable.animal_seven)
+                            .into(imgIcon)
+                    }
+                    LOTTO_PLUS_APP_ID -> {
+                        picasso
+                            .load(R.drawable.ic_lotto_plus)
+                            .placeholder(R.drawable.animal_seven)
+                            .into(imgIcon)
+                    }
+                    else -> {
+                        picasso
+                            .load(item.smallIcon)
+                            .placeholder(R.drawable.animal_seven)
+                            .into(imgIcon)
+                    }
+                }
             } catch (e: Exception) {
             }
 

+ 11 - 1
app/src/main/java/com/khmer9/sbcmain/screen/main/SubModuleFragment.kt

@@ -13,7 +13,9 @@ import com.khmer9.sbcmain.app.App
 import com.khmer9.sbcmain.app.DownloadController
 import com.khmer9.sbcmain.app.ShareActivity
 import com.khmer9.sbcmain.base.BaseFragment
+import com.khmer9.sbcmain.extension.btnClick
 import com.khmer9.sbcmain.remote.User
+import kotlinx.android.synthetic.main.layout_sub_module.*
 
 class SubModuleFragment : BaseFragment(R.layout.layout_sub_module) {
     private val shareViewModel = App.injectShareViewModel()
@@ -29,7 +31,7 @@ class SubModuleFragment : BaseFragment(R.layout.layout_sub_module) {
 
     private val LOTTO_PLUS_APP_ID = "62e397edae71cfa8782aa3a0"
     private val LOTTO_PLUS_DOWNLOAD = "https://www.dropbox.com/s/3rz6v50tjn6f2jg/Lottery-Mobile_devDebug_1.0.30-dev.apk?dl=1"
-    private val LOTTO_PLUS_PACKAGE = "com.sambath.sbc"
+    private val LOTTO_PLUS_PACKAGE = "com.sambath.lottoplus"
 
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
@@ -44,6 +46,14 @@ class SubModuleFragment : BaseFragment(R.layout.layout_sub_module) {
         (requireActivity() as ShareActivity).apply {
             recyclerView = view.findViewById(R.id.rv_main)
 
+            close_btn.setOnClickListener {
+                it.btnClick().subscribe() {
+                    (requireActivity() as? ShareActivity)?.apply {
+                        onBackPressed()
+                    }
+                }
+            }
+
             val moduleId = requireArguments().getString(ARG_PARAM1)
             if (!moduleId.isNullOrEmpty()) {
                 shareViewModel.remoteSubModule(moduleId)

BIN
app/src/main/res/drawable/ic_lotto_80.png


BIN
app/src/main/res/drawable/ic_lotto_plus.png


+ 18 - 2
app/src/main/res/layout/layout_sub_module.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android"
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
@@ -13,4 +13,20 @@
         android:layout_width="match_parent"
         android:layout_height="match_parent" />
 
-</androidx.appcompat.widget.LinearLayoutCompat>
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_alignParentBottom="true"
+        android:gravity="center">
+
+        <com.google.android.material.button.MaterialButton
+            android:id="@+id/close_btn"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_margin="5dp"
+            android:padding="5dp"
+            android:text="@string/close"
+            android:textSize="16sp" />
+    </LinearLayout>
+
+</RelativeLayout>