Explorar o código

+ add logout function

Dola TENG %!s(int64=2) %!d(string=hai) anos
pai
achega
ce127c1fe8

+ 59 - 18
app/src/main/java/com/khmer9/sbcmain/screen/main/MainModuleViewHolder.kt

@@ -48,8 +48,8 @@ class MainModuleViewHolder(itemView: View, private val detailButtonListener: ((S
                 when (item.appId) {
                     Config.LOTTO_APP_ID -> {
                         picasso
-                            .load(R.drawable.ic_lotto_80)
-                            .placeholder(R.drawable.animal_seven)
+                            .load(R.drawable.lotto7777)
+                            .placeholder(R.drawable.lotto7777)
                             .into(imgIcon)
                     }
                     Config.LOTTO_PLUS_APP_ID -> {
@@ -82,6 +82,22 @@ class MainModuleViewHolder(itemView: View, private val detailButtonListener: ((S
 
                         backgroundModule.setBackgroundResource(R.drawable.apongbg)
                     }
+                    Config.CARD_APP_ID -> {
+                        picasso
+                            .load(R.drawable.ic_card)
+                            .placeholder(R.drawable.ic_card)
+                            .into(imgIcon)
+
+                        backgroundModule.setBackgroundResource(R.drawable.bg_card)
+                    }
+                    Config.SNK_APP_ID -> {
+                        picasso
+                            .load(R.drawable.ic_snk)
+                            .placeholder(R.drawable.ic_card)
+                            .into(imgIcon)
+
+                        backgroundModule.setBackgroundResource(R.drawable.bg_snk)
+                    }
                     else -> {
                         picasso
                             .load(R.drawable.ic_lotto_main)
@@ -102,29 +118,29 @@ class MainModuleViewHolder(itemView: View, private val detailButtonListener: ((S
         } else if (item is SubModuleData) {
             tvName.text = item.name
 
-            try {
-                val displayMetrics = itemView.context.resources.displayMetrics
-                val pxWidth = displayMetrics.widthPixels
-                val pxHeight = displayMetrics.heightPixels
-                val dpWidth = pxWidth / displayMetrics.density
-                val dpHeight = pxHeight / displayMetrics.density
+            val displayMetrics = itemView.context.resources.displayMetrics
+            val pxWidth = displayMetrics.widthPixels
+            val pxHeight = displayMetrics.heightPixels
+            val dpWidth = pxWidth / displayMetrics.density
+            val dpHeight = pxHeight / displayMetrics.density
 
-                // high resolution pixel 14400
-                var height = dpHeight * 0.5804f
+            // high resolution pixel 14400
+            var height = dpHeight * 0.5804f
 
-                //low resolution
-                if (pxWidth < 1000) {
-                    height = dpHeight * 0.2804f
-                }
+            //low resolution
+            if (pxWidth < 1000) {
+                height = dpHeight * 0.2804f
+            }
 
-                imgIcon.layoutParams.height = height.toInt()
-                imgIcon.layoutParams.width = height.toInt()
+            imgIcon.layoutParams.height = height.toInt()
+            imgIcon.layoutParams.width = height.toInt()
 
+            try {
                 when (item.appId) {
                     Config.LOTTO_APP_ID -> {
                         picasso
                             .load(R.drawable.ic_lotto_80)
-                            .placeholder(R.drawable.animal_seven)
+                            .placeholder(R.drawable.ic_lotto_80)
                             .into(imgIcon)
 
                         backgroundModule.setBackgroundResource(R.drawable.lottobg)
@@ -132,11 +148,36 @@ class MainModuleViewHolder(itemView: View, private val detailButtonListener: ((S
                     Config.LOTTO_PLUS_APP_ID -> {
                         picasso
                             .load(R.drawable.ic_lotto_plus)
-                            .placeholder(R.drawable.animal_seven)
+                            .placeholder(R.drawable.ic_lotto_plus)
                             .into(imgIcon)
 
                         backgroundModule.setBackgroundResource(R.drawable.lottobg)
                     }
+                    Config.YUKI_APP_ID -> {
+                        picasso
+                            .load(R.drawable.ic_yuki)
+                            .placeholder(R.drawable.ic_yuki)
+                            .into(imgIcon)
+
+                        backgroundModule.setBackgroundResource(R.drawable.yukibg)
+                    }
+                    Config.APONG_APP_ID -> {
+                        picasso
+                            .load(R.drawable.ic_apong)
+                            .placeholder(R.drawable.ic_apong)
+                            .into(imgIcon)
+
+                        backgroundModule.setBackgroundResource(R.drawable.apongbg)
+                    }
+
+                    Config.CARD_APP_ID -> {
+                        picasso
+                            .load(R.drawable.ic_card)
+                            .placeholder(R.drawable.ic_card)
+                            .into(imgIcon)
+
+                        backgroundModule.setBackgroundResource(R.drawable.bg_card)
+                    }
                     else -> {
                         picasso
                             .load(item.smallIcon)

+ 1 - 1
app/src/main/res/layout/activity_login.xml

@@ -4,7 +4,7 @@
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:background="@color/new_background"
+    android:background="@color/colorPrimary"
     tools:context=".screen.login.LoginActivity">
 
 

+ 1 - 1
app/src/main/res/layout/activity_splash.xml

@@ -4,7 +4,7 @@
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:background="@color/new_background"
+    android:background="@color/colorPrimary"
     tools:context=".screen.splash.SplashScreenActivity">
 
     <ImageView

+ 1 - 1
app/src/main/res/layout/app_bar.xml

@@ -12,7 +12,7 @@
         android:layout_width="match_parent"
         android:layout_height="?attr/actionBarSize"
         android:layout_gravity="center_vertical"
-        android:background="@color/colorToolbar"
+        android:background="@color/colorPrimary"
         app:popupTheme="@style/PopupOverlay">
 
         <androidx.constraintlayout.widget.ConstraintLayout

+ 1 - 1
app/src/main/res/layout/layout_fragment_main_yuki.xml

@@ -5,7 +5,7 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:layout_gravity="center_vertical"
-    android:background="@color/new_background"
+    android:background="@color/colorPrimaryDark"
     android:orientation="vertical"
     tools:context=".screen.main.MainFragment">
 

+ 1 - 1
app/src/main/res/layout/layout_sub_module.xml

@@ -4,7 +4,7 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:layout_gravity="center_vertical"
-    android:background="@color/new_background"
+    android:background="@color/colorPrimaryDark"
     android:orientation="vertical"
     tools:context=".screen.main.MainFragment">
 

+ 2 - 2
app/src/main/res/values/colors.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
-    <color name="colorPrimary">#334a9f</color>
-    <color name="colorPrimaryDark">#253e99</color>
+    <color name="colorPrimary">#000000</color>
+    <color name="colorPrimaryDark">#757575</color>
     <color name="colorPrimaryLight">#1776cf</color>
     <color name="colorAccent">#03DAC5</color>
     <color name="black_overlay">#3700B3</color>

+ 8 - 0
app/src/prod/java/com/khmer9/lotto/config/Config.kt

@@ -23,4 +23,12 @@ object Config {
     const val APONG_APP_ID = "631c1d1a0d213229fc5fd11a"
     const val APONG_DOWNLOAD = "https://www.dropbox.com/s/85l9359h44s3hk4/APONG_prodDebug_1.0.12.apk?dl=1"
     const val APONG_PACKAGE = "com.sambath.apong"
+
+    const val CARD_APP_ID = "kd855"
+    const val CARD_DOWNLOAD = ""
+    const val CARD_PACKAGE = ""
+
+    const val SNK_APP_ID = "snk"
+    const val SNK_DOWNLOAD = ""
+    const val SNK_PACKAGE = ""
 }