1
0

7 Commits 5a689c2234 ... cdd5d8acb8

Autor SHA1 Mensagem Data
  tongmengxiao cdd5d8acb8 fix: NullPointerException há 2 meses atrás
  tongmengxiao 9738e7d471 feat: get本地化 há 2 meses atrás
  tongmengxiao ac85d6c843 feat: 转盘isAnimating há 2 meses atrás
  tongmengxiao b312a236a2 feat: lottery本地化 há 3 meses atrás
  tongmengxiao 126209a953 fix: lottery há 3 meses atrás
  tongmengxiao 1b3890c27f feat: 转盘本地化 há 3 meses atrás
  tongmengxiao f446da82b1 feat: remove traffic há 3 meses atrás
37 ficheiros alterados com 665 adições e 110 exclusões
  1. 32 0
      baseswago/src/main/java/com/swago/baseswago/LotteryVm.kt
  2. 0 10
      baseswago/src/main/java/com/swago/baseswago/constant/UrlConstant.kt
  3. 133 0
      baseswago/src/main/java/com/swago/baseswago/cusview/LotteryView.kt
  4. 29 75
      baseswago/src/main/java/com/swago/baseswago/dialog/TodayTrafficDialog.kt
  5. 58 0
      baseswago/src/main/java/com/swago/baseswago/dialog/TrafficResultDialog.kt
  6. 13 0
      baseswago/src/main/java/com/swago/baseswago/inter/UserApi.kt
  7. 1 1
      baseswago/src/main/java/com/swago/baseswago/model/live/OnlineRewardsModel.kt
  8. 8 0
      baseswago/src/main/java/com/swago/baseswago/model/mine/LotteryListModel.kt
  9. 7 1
      baseswago/src/main/java/com/swago/baseswago/util/BitmapUtils.kt
  10. 30 0
      baseswago/src/main/java/com/swago/glide.kt
  11. 5 0
      baseswago/src/main/res/drawable/shape_ffffff_12.xml
  12. 77 0
      baseswago/src/main/res/layout/dialog_result_traffic.xml
  13. 12 4
      baseswago/src/main/res/layout/dialog_today_traffic.xml
  14. 38 0
      baseswago/src/main/res/layout/item_lottery.xml
  15. 186 0
      baseswago/src/main/res/layout/view_lottery.xml
  16. BIN
      baseswago/src/main/res/mipmap-xxhdpi/bg_lottery.png
  17. BIN
      baseswago/src/main/res/mipmap-xxhdpi/bg_lottery_purple.png
  18. BIN
      baseswago/src/main/res/mipmap-xxhdpi/bg_result_lottery.png
  19. BIN
      baseswago/src/main/res/mipmap-xxhdpi/bg_start_traffic.png
  20. BIN
      baseswago/src/main/res/mipmap-xxhdpi/bg_traffic.png
  21. BIN
      baseswago/src/main/res/mipmap-xxhdpi/bt_result_traffic.png
  22. BIN
      baseswago/src/main/res/mipmap-xxhdpi/footer_traffic.png
  23. BIN
      baseswago/src/main/res/mipmap-xxhdpi/head_traffic.png
  24. BIN
      baseswago/src/main/res/mipmap-xxhdpi/ic_coin.png
  25. BIN
      baseswago/src/main/res/mipmap-xxhdpi/ic_exp.png
  26. BIN
      baseswago/src/main/res/mipmap-xxhdpi/ic_start_traffic.png
  27. BIN
      baseswago/src/main/res/mipmap-xxhdpi/icon_exp.png
  28. 5 0
      baseswago/src/main/res/values-ar/strings.xml
  29. 6 1
      baseswago/src/main/res/values-in/strings.xml
  30. 6 1
      baseswago/src/main/res/values-ms/strings.xml
  31. 5 0
      baseswago/src/main/res/values-zh/strings.xml
  32. 5 0
      baseswago/src/main/res/values/strings.xml
  33. 3 7
      home/src/main/java/com/swago/home/HomeFragment.kt
  34. 1 5
      home/src/main/java/com/swago/home/MineFragment.kt
  35. 2 2
      room/src/main/java/com/swago/room/reward/RewardView.kt
  36. 1 1
      room/src/main/res/layout/dialog_get_rewards.xml
  37. 2 2
      user/src/main/res/layout/item_black_room.xml

+ 32 - 0
baseswago/src/main/java/com/swago/baseswago/LotteryVm.kt

@@ -0,0 +1,32 @@
+package com.swago.baseswago
+
+import android.app.Application
+import androidx.lifecycle.MutableLiveData
+import com.swago.baseswago.inter.ApiManager
+import com.swago.baseswago.model.mine.LotteryListModel
+import com.swago.baseswago.util.BaseViewModel
+
+class LotteryVm(application: Application) : BaseViewModel(application) {
+
+    val resultLottery  by lazy {
+        MutableLiveData<LotteryListModel>()
+    }
+
+    fun getResultLottery(){
+        requestData {
+            resultLottery.value = ApiManager.userApi.resultLottery()
+        }
+    }
+    val lotteryListData  by lazy {
+        MutableLiveData<List<LotteryListModel>>()
+    }
+
+    fun getLotteryList(){
+        requestData2 {
+            requestData{
+                lotteryListData.value = ApiManager.userApi.getLotteryList()
+            }
+        }
+    }
+
+}

+ 0 - 10
baseswago/src/main/java/com/swago/baseswago/constant/UrlConstant.kt

@@ -29,14 +29,6 @@ object UrlConstant {
         }
     }
 
-    private val TRAFFIC_URL by lazy {
-        if (BuildConfig.DEBUG) {
-            "http://test-h5.swago.cn"
-        } else {
-            "https://web-view.me-live.cn"
-        }
-    }
-
     private val gson by lazy {
         Gson()
     }
@@ -92,8 +84,6 @@ object UrlConstant {
     val WITHDRAW_CUSTOMER = "${BASE_WEB_URL}/withdrawal/customer"//所有用户都跳跳这个 1.2.0版本改的
     //排行榜
     val RANKING = "${BASE_WEB_URL}/goldCoinRank"
-    //转盘
-    val TRAFFIC = "${TRAFFIC_URL}/checkIn"
     var appGameRootPath =
         AppContext.getContext().getExternalFilesDir("")?.absolutePath + File.separator + "gameFile"
 

+ 133 - 0
baseswago/src/main/java/com/swago/baseswago/cusview/LotteryView.kt

@@ -0,0 +1,133 @@
+package com.swago.baseswago.cusview
+
+import android.animation.Animator
+import android.animation.ValueAnimator
+import android.content.Context
+import android.util.AttributeSet
+import android.view.LayoutInflater
+import android.view.animation.DecelerateInterpolator
+import android.widget.FrameLayout
+import com.swago.baseswago.R
+import com.swago.baseswago.databinding.ItemLotteryBinding
+import com.swago.baseswago.databinding.ViewLotteryBinding
+import com.swago.baseswago.model.mine.LotteryListModel
+import com.swago.loadNoPlaceUrl
+
+class LotteryView : FrameLayout {
+    private var binding:ViewLotteryBinding? = null
+
+    private var isAnimating = false // 判断是否正在执行动画
+    private var isCancel = false // 判断动画是否是被取消的
+    private var totalRounds = 3  // 旋转的圈数
+    private var items = mutableListOf<ItemLotteryBinding>() // 保存12个格子
+    private var lotteryData = mutableListOf<LotteryListModel>() // 保存12个格子
+    private var mResult : LotteryListModel ?= null
+    private var mValueAnimator:ValueAnimator ?= null
+
+    var startGetResultFun: (() -> Unit)?= null
+    var imageLoadSuccessFun: ((success:Boolean) -> Unit)?= null
+    var showGetResultFun: ((result:LotteryListModel?) -> Unit)?= null
+    constructor(context: Context) : this(context, null)
+    constructor(context: Context, attrs: AttributeSet?) : this(context, attrs, 0)
+
+    constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(
+        context,
+        attrs,
+        defStyleAttr
+    ){
+        initView()
+    }
+
+    private fun initView() {
+        binding = ViewLotteryBinding.inflate(LayoutInflater.from(context),this,true)
+        binding?.apply {
+            items.add(view1)
+            items.add(view2)
+            items.add(view3)
+            items.add(view4)
+            items.add(view5)
+            items.add(view6)
+            items.add(view7)
+            items.add(view8)
+            items.add(view9)
+            items.add(view10)
+            items.add(view11)
+            items.add(view12)
+        }
+        binding?.ivStart?.setOnClickListener {
+            if (isAnimating) return@setOnClickListener  // 防止重复启动
+            startGetResultFun?.invoke()
+        }
+    }
+
+    fun setLotteryData(list:List<LotteryListModel>){
+        if (list.size < 12)
+            return
+        lotteryData.clear()
+        lotteryData.addAll(list)
+        items.forEachIndexed { index, view ->
+            if (list[index].number.startsWith("EXP")){
+                view.ivIcon.setBackgroundResource(R.mipmap.ic_exp)
+            } else {
+                view.ivIcon.loadNoPlaceUrl(context,list[index].icon){
+                    imageLoadSuccessFun?.invoke(it)
+                }
+            }
+
+            view.tvName.text = list[index].number
+            if (index %2 ==1){
+                view.clItem.setBackgroundResource(R.mipmap.bg_lottery)
+            } else {
+                view.clItem.setBackgroundResource(R.mipmap.bg_lottery_purple)
+            }
+        }
+    }
+
+    fun startLotteryAnimation(result : LotteryListModel) {
+        if (isAnimating) return  // 防止重复启动
+        mResult = result
+        isAnimating = true
+        isCancel = false
+        mValueAnimator = ValueAnimator.ofInt(0, items.size * totalRounds + result.id )
+        mValueAnimator?.duration = 3000  // 动画总时长 3 秒
+        mValueAnimator?.interpolator = DecelerateInterpolator()  // 动画减速效果
+        mValueAnimator?.addUpdateListener { animation ->
+            val position = animation.animatedValue as Int % items.size
+            highlightItem(position)
+        }
+        mValueAnimator?.addListener(object : Animator.AnimatorListener {
+            override fun onAnimationEnd(animation: Animator) {
+                // 动画结束后的处理,显示中奖结果
+                if (!isCancel){
+                    isAnimating = false
+                    showGetResultFun?.invoke(mResult)
+                }
+            }
+
+            override fun onAnimationStart(animation: Animator) {}
+            override fun onAnimationCancel(animation: Animator) {
+                isCancel = true
+            }
+            override fun onAnimationRepeat(animation: Animator) {}
+        })
+
+        mValueAnimator?.start()
+    }
+
+    // 高亮显示某个格子
+    private fun highlightItem(index: Int) {
+        // 清除所有格子的高亮效果
+        for (i in items.indices) {
+            items[i].clChoose.background = null
+        }
+        // 设置当前格子为高亮
+        items[index].clChoose.setBackgroundResource(R.drawable.shape_ffffff_12)
+    }
+
+    fun onDestroy(){
+        if (isAnimating){
+            mValueAnimator?.cancel()
+        }
+
+    }
+}

+ 29 - 75
baseswago/src/main/java/com/swago/baseswago/dialog/TodayTrafficDialog.kt

@@ -1,31 +1,14 @@
 package com.swago.baseswago.dialog
 
-import android.graphics.Bitmap
-import android.graphics.Color
-import android.os.Build
 import android.os.Bundle
 import android.view.Gravity
-import android.view.ViewGroup
-import android.webkit.JavascriptInterface
-import android.webkit.WebChromeClient
-import android.webkit.WebSettings
-import android.webkit.WebView
-import android.webkit.WebViewClient
-import androidx.constraintlayout.widget.ConstraintLayout
-import androidx.transition.Visibility
-import com.google.firebase.firestore.core.View
-import com.swago.baseswago.constant.UrlConstant
+import androidx.fragment.app.viewModels
+import com.swago.baseswago.LotteryVm
 import com.swago.baseswago.databinding.DialogTodayTrafficBinding
-import com.swago.baseswago.util.DpPxUtil
-import com.swago.baseswago.util.SwagoInfo
-import com.swago.baseswago.util.UserInfo
-import org.json.JSONObject
 
 class TodayTrafficDialog : BaseStoreDFragment<DialogTodayTrafficBinding>() {
-    private var showDialog:Boolean = true
-    private val jsLoad by lazy {
-        JSLoad()
-    }
+    private val lotteryVm by viewModels<LotteryVm>()
+
     init {
         setGravity(Gravity.CENTER)
         setDimAmount(0.6f)
@@ -43,70 +26,41 @@ class TodayTrafficDialog : BaseStoreDFragment<DialogTodayTrafficBinding>() {
     }
 
     override fun initOther() {
-        binding?.loadingProgress?.visibility = android.view.View.VISIBLE
-        binding?.webview?.apply {
-            //设置大小
-            val params = ConstraintLayout.LayoutParams(
-                ViewGroup.LayoutParams.MATCH_PARENT,
-                ViewGroup.LayoutParams.MATCH_PARENT
-            )
-            params.topMargin =  DpPxUtil.getScreenHeight()/6
-            this.layoutParams = params
-            try {
-                val jsonObject = JSONObject()
-                jsonObject.put("TokenParam", UserInfo.getLoginModel()?.token?:"")
-                jsonObject.put("UserIdParam", UserInfo.getUserInfo()?.id?:"")
-                jsonObject.put("LocaleParam", SwagoInfo.getLanguageCode())
-                jsonObject.put("AppVersionParam", SwagoInfo.getVersionCode())
-                jsonObject.put("ClientParam", SwagoInfo.getAppClient())
-                jsonObject.put("ChannelParam", SwagoInfo.getChannel())
-                jsonObject.put("DeviceParam", SwagoInfo.getDeviceInfo())
-                settings.userAgentString = settings.userAgentString + jsonObject.toString()
-            } catch (e: Exception) {
-                e.printStackTrace()
+        binding?.lotteryView?.apply {
+            imageLoadSuccessFun = {
+                binding?.loadingProgress?.visibility = android.view.View.GONE
             }
-
-            if (Build.VERSION.SDK_INT >= 21) {
-                settings.mixedContentMode = WebSettings.MIXED_CONTENT_ALWAYS_ALLOW
+            startGetResultFun = {
+                lotteryVm.getResultLottery()
             }
-            settings.javaScriptEnabled = true
-            addJavascriptInterface(jsLoad, "melive")
-            settings.allowUniversalAccessFromFileURLs = true
-            settings.allowFileAccess = true
-            settings.allowFileAccessFromFileURLs = true
-            settings.useWideViewPort = true
-            settings.loadWithOverviewMode = true
-            settings.javaScriptCanOpenWindowsAutomatically = true//设置允许JS弹窗
-            settings.domStorageEnabled = true
-            settings.cacheMode = WebSettings.LOAD_CACHE_ELSE_NETWORK
-            settings.domStorageEnabled = true
-            isHorizontalScrollBarEnabled = true
-            isVerticalScrollBarEnabled = true
-            settings.databaseEnabled = true
-            setBackgroundColor(Color.TRANSPARENT)
-            webViewClient = object : WebViewClient(){
-                override fun onPageFinished(view: WebView?, url: String?) {
-                    super.onPageFinished(view, url)
-                    binding?.loadingProgress?.visibility = android.view.View.GONE
-
+            showGetResultFun = {
+                it?.let { model ->
+                    this@TodayTrafficDialog.dismissAllowingStateLoss()
+                    TrafficResultDialog.newInstance(model.number , model.icon , model.number).show(parentFragmentManager,"TrafficResultDialog")
                 }
             }
-            loadUrl(UrlConstant.TRAFFIC)
+        }
+
+        binding?.finish?.setOnClickListener {
+            dismissAllowingStateLoss()
+        }
+        lotteryVm.resultLottery.observe(this){
+            binding?.lotteryView?.startLotteryAnimation(it)
+        }
+
+        lotteryVm.getLotteryList()
+
+        lotteryVm.lotteryListData.observe(this){
+            binding?.lotteryView?.setLotteryData(it)
         }
     }
 
     override fun initLiveData() {
 
     }
-    inner class JSLoad {
-        @JavascriptInterface
-        fun HtmlcallNative(s:String) {
-            dismissAllowingStateLoss()
-        }
-    }
 
-    override fun dismiss() {
-        super.dismiss()
-        showDialog = true
+    override fun onDestroyView() {
+        binding?.lotteryView?.onDestroy()
+        super.onDestroyView()
     }
 }

+ 58 - 0
baseswago/src/main/java/com/swago/baseswago/dialog/TrafficResultDialog.kt

@@ -0,0 +1,58 @@
+package com.swago.baseswago.dialog
+
+
+import android.os.Bundle
+import android.view.Gravity
+import com.swago.baseswago.R
+import com.swago.baseswago.databinding.DialogResultTrafficBinding
+import com.swago.loadNoPlaceUrl
+
+class TrafficResultDialog : BaseStoreDFragment<DialogResultTrafficBinding>() {
+
+    init {
+        setGravity(Gravity.CENTER)
+        setDimAmount(0.6f)
+        setCanCancel(true)
+        setHeightMatchParent()
+    }
+
+    companion object {
+        fun newInstance(name:String,icon:String,number:String): TrafficResultDialog {
+            val args = Bundle()
+            val fragment = TrafficResultDialog()
+            args.putString("name",name)
+            args.putString("icon",icon)
+            args.putString("number",number)
+            fragment.arguments = args
+            return fragment
+        }
+    }
+
+    override fun initOther() {
+        arguments?.let{
+            val name = it.getString("name")
+            val icon = it.getString("icon","")
+            val number = it.getString("number","")
+            binding?.tvName?.text= name
+            activity?.let {activity ->
+                if (number.startsWith("EXP")){
+                    binding?.ivIcon?.setBackgroundResource(R.mipmap.ic_exp)
+                } else {
+                    binding?.ivIcon?.loadNoPlaceUrl(activity,icon){}
+                }
+            }
+
+        }
+        binding?.ivGet?.setOnClickListener {
+            dismissAllowingStateLoss()
+        }
+
+    }
+
+    override fun initLiveData() {
+
+    }
+    override fun dismiss() {
+        super.dismiss()
+    }
+}

+ 13 - 0
baseswago/src/main/java/com/swago/baseswago/inter/UserApi.kt

@@ -179,4 +179,17 @@ interface UserApi {
     @FormUrlEncoded
     @POST("/v1/user/exist/product/chose")
     suspend fun choseProduct(@Field("product_id") product_id: Long):Any
+
+
+    /**
+     * 转盘抽奖
+     * */
+    @POST("/v1/app/zhuanpan/everyday/sign")
+    suspend fun resultLottery():LotteryListModel
+
+    /**
+     * 转盘商品列表
+     * */
+    @POST("/v1/zhuanpan/everyday/goods/get")
+    suspend fun getLotteryList():List<LotteryListModel>
 }

+ 1 - 1
baseswago/src/main/java/com/swago/baseswago/model/live/OnlineRewardsModel.kt

@@ -5,7 +5,7 @@ data class OnlineRewardsModel (
     var ten:Boolean,
     var fifteen:Boolean,
     var thirty:Boolean,
-    var onlineDuration:Int,
+    var onlineDuration:Long,
     val coin:CoinOnlineBean,
     )
 

+ 8 - 0
baseswago/src/main/java/com/swago/baseswago/model/mine/LotteryListModel.kt

@@ -0,0 +1,8 @@
+package com.swago.baseswago.model.mine
+
+data class LotteryListModel(
+    val id:Int,
+    val name:String="",
+    val number:String="",
+    val icon:String=""
+)

+ 7 - 1
baseswago/src/main/java/com/swago/baseswago/util/BitmapUtils.kt

@@ -74,7 +74,13 @@ object BitmapUtils {
                     } finally {
                         outputStream?.close()
                     }
-                    response?.invoke(resource.apply { density = 480 })
+                    try {
+                        response?.invoke(resource.apply { density = 480 })
+                    } catch (e: NullPointerException){
+                        LogUtil.d("BitmapUtils", "NullPointerException in onResourceReady: ${e.message}")
+                        e.printStackTrace()
+                    }
+
                 }
 
                 override fun onLoadCleared(placeholder: Drawable?) {

+ 30 - 0
baseswago/src/main/java/com/swago/glide.kt

@@ -92,6 +92,36 @@ fun ImageView.loadNoPlaceUrl(context: Context,url:String,call: (success:Boolean)
         })
 }
 
+fun ImageView.loadNoPlaceUrlSrc(context: Context,url:String,call: (success:Boolean) -> Unit){
+    Glide.with(context)
+        .load(url)
+        .centerCrop()
+        .listener(object :RequestListener<Drawable>{
+            override fun onLoadFailed(
+                e: GlideException?,
+                model: Any?,
+                target: Target<Drawable>?,
+                isFirstResource: Boolean
+            ): Boolean {
+                call.invoke(false)
+                return false
+            }
+
+            override fun onResourceReady(
+                resource: Drawable?,
+                model: Any?,
+                target: Target<Drawable>?,
+                dataSource: DataSource?,
+                isFirstResource: Boolean
+            ): Boolean {
+                call.invoke(true)
+                return false
+            }
+
+        })
+        .into(this)
+}
+
 fun ImageView.loadUrlCache(context: Context,url:String){
     Glide.with(context)
         .load(url)

+ 5 - 0
baseswago/src/main/res/drawable/shape_ffffff_12.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <solid android:color="#FFFFFF"/>
+    <corners android:radius="12dp"/>
+</shape>

+ 77 - 0
baseswago/src/main/res/layout/dialog_result_traffic.xml

@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/cl"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    xmlns:tools="http://schemas.android.com/tools"
+    xmlns:app="http://schemas.android.com/apk/res-auto">
+
+    <androidx.constraintlayout.widget.ConstraintLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintTop_toTopOf="parent"
+        android:layout_marginStart="30dp"
+        android:layout_marginEnd="30dp"
+        android:paddingBottom="32dp"
+        android:background="@mipmap/bg_result_lottery"
+        app:layout_constraintBottom_toBottomOf="parent">
+        <TextView
+            android:id="@+id/tvGet"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:textColor="@color/_ffffff"
+            android:textSize="@dimen/sp_16"
+            android:text="You get"
+            android:layout_marginTop="60dp"
+            android:textStyle="bold"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintTop_toTopOf="parent"/>
+
+        <ImageView
+            android:id="@+id/ivIcon"
+            android:layout_width="100dp"
+            android:layout_height="100dp"
+            android:layout_marginTop="14dp"
+            android:background="@mipmap/ic_coin"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/tvGet"/>
+        <TextView
+            android:id="@+id/tvName"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:textColor="@color/_ffffff"
+            android:textSize="@dimen/sp_16"
+            tools:text="×10000 Coins"
+            android:textStyle="bold"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/ivIcon"/>
+        <TextView
+            android:id="@+id/tvHint"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:textColor="#99ffffff"
+            android:textSize="14sp"
+            android:layout_marginTop="@dimen/dp_10"
+            android:text="@string/come_play_tomorrow"
+            android:textStyle="bold"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/tvName"/>
+
+        <ImageView
+            android:id="@+id/ivGet"
+            android:layout_width="183dp"
+            android:layout_height="47dp"
+            android:src="@mipmap/bt_result_traffic"
+            android:layout_marginTop="@dimen/dp_40"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/tvHint"/>
+    </androidx.constraintlayout.widget.ConstraintLayout>
+
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 12 - 4
baseswago/src/main/res/layout/dialog_today_traffic.xml

@@ -5,11 +5,10 @@
     android:layout_height="match_parent"
     xmlns:app="http://schemas.android.com/apk/res-auto">
 
-    <WebView
-        android:id="@+id/webview"
+    <com.swago.baseswago.cusview.LotteryView
+        android:id="@+id/lotteryView"
         android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:layout_marginTop="80dp"/>
+        android:layout_height="match_parent"/>
 
     <ProgressBar
         app:layout_constraintStart_toStartOf="parent"
@@ -24,5 +23,14 @@
         android:padding="6dp"
         android:background="@drawable/shape_80000000_20"/>
 
+    <ImageView
+        android:id="@+id/finish"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:src="@mipmap/benefit_close"
+        android:layout_marginBottom="60dp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"/>
 
 </androidx.constraintlayout.widget.ConstraintLayout>

+ 38 - 0
baseswago/src/main/res/layout/item_lottery.xml

@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:id="@+id/clChoose"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    xmlns:app="http://schemas.android.com/apk/res-auto">
+    <androidx.constraintlayout.widget.ConstraintLayout
+        android:id="@+id/clItem"
+        android:layout_margin="2dp"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:background="@mipmap/bg_lottery">
+        <ImageView
+            android:id="@+id/iv_icon"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintTop_toTopOf="parent"
+            app:layout_constraintBottom_toBottomOf="parent"
+            android:layout_marginBottom="@dimen/dp_10"
+            android:background="@mipmap/ic_coin"
+            android:layout_width="50dp"
+            android:layout_height="50dp"/>
+
+        <TextView
+            android:id="@+id/tvName"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintBottom_toBottomOf="parent"
+            tools:text="×3 Days"
+            android:textSize="11sp"
+            android:textColor="@color/_ffffff"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginBottom="@dimen/dp_4"/>
+    </androidx.constraintlayout.widget.ConstraintLayout>
+
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 186 - 0
baseswago/src/main/res/layout/view_lottery.xml

@@ -0,0 +1,186 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+    <ImageView
+        android:layout_width="match_parent"
+        android:layout_height="132dp"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintBottom_toBottomOf="parent"
+        android:layout_marginBottom="360dp"
+        android:background="@mipmap/head_traffic"/>
+
+    <ImageView
+        android:layout_width="match_parent"
+        android:layout_height="132dp"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintBottom_toBottomOf="parent"
+        android:layout_marginTop="320dp"
+        android:background="@mipmap/footer_traffic"/>
+
+    <androidx.constraintlayout.widget.ConstraintLayout
+        android:id="@+id/cl_content"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:paddingStart="40dp"
+        android:paddingEnd="42dp"
+        android:paddingTop="12dp"
+        android:paddingBottom="14dp"
+        android:background="@mipmap/bg_traffic"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintBottom_toBottomOf="parent">
+        <LinearLayout
+            android:id="@+id/layout_1"
+            android:layout_width="match_parent"
+            android:layout_height="80dp"
+            android:orientation="horizontal"
+            android:weightSum="4"
+            app:layout_constraintTop_toTopOf="parent">
+
+            <include
+                android:id="@+id/view_1"
+                layout="@layout/item_lottery"
+                android:layout_width="0dp"
+                android:layout_height="match_parent"
+                android:layout_weight="1" />
+
+            <include
+                android:id="@+id/view_2"
+                layout="@layout/item_lottery"
+                android:layout_width="0dp"
+                android:layout_height="match_parent"
+                android:layout_weight="1" />
+
+            <include
+                android:id="@+id/view_3"
+                layout="@layout/item_lottery"
+                android:layout_width="0dp"
+                android:layout_height="match_parent"
+                android:layout_weight="1" />
+
+            <include
+                android:id="@+id/view_4"
+                layout="@layout/item_lottery"
+                android:layout_width="0dp"
+                android:layout_height="match_parent"
+                android:layout_weight="1" />
+
+        </LinearLayout>
+        <LinearLayout
+            android:id="@+id/layout_2"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="horizontal"
+            android:weightSum="4"
+            app:layout_constraintTop_toBottomOf="@+id/layout_1">
+            <LinearLayout
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:orientation="vertical"
+                android:layout_weight="1">
+                <include
+                    android:id="@+id/view_12"
+                    layout="@layout/item_lottery"
+                    android:layout_width="match_parent"
+                    android:layout_height="80dp" />
+                <include
+                    android:id="@+id/view_11"
+                    layout="@layout/item_lottery"
+                    android:layout_width="match_parent"
+                    android:layout_height="80dp"/>
+            </LinearLayout>
+            <androidx.constraintlayout.widget.ConstraintLayout
+                android:layout_width="0dp"
+                android:layout_height="match_parent"
+                android:layout_weight="2">
+                <ImageView
+                    android:id="@+id/ivStart"
+                    android:layout_marginBottom="38dp"
+                    android:layout_marginTop="10dp"
+                    android:layout_marginStart="@dimen/dp_10"
+                    android:layout_marginEnd="@dimen/dp_10"
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent"
+                    android:background="@mipmap/bg_start_traffic"/>
+                <ImageView
+                    android:layout_marginBottom="38dp"
+                    android:layout_marginTop="45dp"
+                    app:layout_constraintStart_toStartOf="parent"
+                    app:layout_constraintEnd_toEndOf="parent"
+                    app:layout_constraintTop_toTopOf="parent"
+                    android:layout_width="96dp"
+                    android:layout_height="41dp"
+                    android:background="@mipmap/ic_start_traffic"/>
+                <TextView
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    app:layout_constraintBottom_toBottomOf="parent"
+                    android:text="@string/login_daily_spin_one"
+                    android:textColor="@color/_ffffff"
+                    android:gravity="center"
+                    android:textSize="11sp"
+                    android:textStyle="bold"
+                    android:layout_marginBottom="@dimen/dp_10"/>
+            </androidx.constraintlayout.widget.ConstraintLayout>
+
+            <LinearLayout
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:orientation="vertical"
+                android:layout_weight="1">
+                <include
+                    android:id="@+id/view_5"
+                    layout="@layout/item_lottery"
+                    android:layout_width="match_parent"
+                    android:layout_height="80dp"/>
+                <include
+                    android:id="@+id/view_6"
+                    layout="@layout/item_lottery"
+                    android:layout_width="match_parent"
+                    android:layout_height="80dp" />
+            </LinearLayout>
+
+        </LinearLayout>
+        <LinearLayout
+            android:id="@+id/layout_3"
+            android:layout_width="match_parent"
+            android:layout_height="80dp"
+            android:orientation="horizontal"
+            android:weightSum="4"
+            app:layout_constraintTop_toBottomOf="@+id/layout_2">
+
+            <include
+                android:id="@+id/view_10"
+                layout="@layout/item_lottery"
+                android:layout_width="0dp"
+                android:layout_height="match_parent"
+                android:layout_weight="1" />
+
+            <include
+                android:id="@+id/view_9"
+                layout="@layout/item_lottery"
+                android:layout_width="0dp"
+                android:layout_height="match_parent"
+                android:layout_weight="1" />
+
+            <include
+                android:id="@+id/view_8"
+                layout="@layout/item_lottery"
+                android:layout_width="0dp"
+                android:layout_height="match_parent"
+                android:layout_weight="1" />
+
+            <include
+                android:id="@+id/view_7"
+                layout="@layout/item_lottery"
+                android:layout_width="0dp"
+                android:layout_height="match_parent"
+                android:layout_weight="1" />
+
+        </LinearLayout>
+    </androidx.constraintlayout.widget.ConstraintLayout>
+
+</androidx.constraintlayout.widget.ConstraintLayout>

BIN
baseswago/src/main/res/mipmap-xxhdpi/bg_lottery.png


BIN
baseswago/src/main/res/mipmap-xxhdpi/bg_lottery_purple.png


BIN
baseswago/src/main/res/mipmap-xxhdpi/bg_result_lottery.png


BIN
baseswago/src/main/res/mipmap-xxhdpi/bg_start_traffic.png


BIN
baseswago/src/main/res/mipmap-xxhdpi/bg_traffic.png


BIN
baseswago/src/main/res/mipmap-xxhdpi/bt_result_traffic.png


BIN
baseswago/src/main/res/mipmap-xxhdpi/footer_traffic.png


BIN
baseswago/src/main/res/mipmap-xxhdpi/head_traffic.png


BIN
baseswago/src/main/res/mipmap-xxhdpi/ic_coin.png


BIN
baseswago/src/main/res/mipmap-xxhdpi/ic_exp.png


BIN
baseswago/src/main/res/mipmap-xxhdpi/ic_start_traffic.png


BIN
baseswago/src/main/res/mipmap-xxhdpi/icon_exp.png


+ 5 - 0
baseswago/src/main/res/values-ar/strings.xml

@@ -367,8 +367,13 @@
     <string name="pk_now_wait">المرساة الحالية هي PK، يرجى الانتظار </string>
     <string name="congratulations">تهانينا!</string>
     <string name="you_get">تحصل</string>
+    <string name="get">Get</string>
     <string name="continue_in_room_earn_coins">ابق في الغرفة لمدة %s دقيقة لتربح عملات %s أخرى.</string>
     <string name="please_setting_camera_microphone">رجى الانتقال إلى الإعدادات لتمكين أذونات الكاميرا </string>
     <string name="successful_collection">تم الاستلام بنجاح</string>
     <string name="pk_failed_re_pk">الشبكة غير مستقرة، وفشل اتصال pk. يرجى المحاولة مرة أخرى.</string>
+    <string name="ban_my_live_room">Ban this user from my live stream</string>
+    <string name="block_message_live_room">Block messages in the user\'s live room</string>
+    <string name="come_play_tomorrow">Come and play again tomorrow.</string>
+    <string name="login_daily_spin_one">Login daily to get Spin×1</string>
 </resources>

+ 6 - 1
baseswago/src/main/res/values-in/strings.xml

@@ -378,9 +378,14 @@
     <string name="user_above_level_10">Pengguna di atas level 10 dapat menerimanya</string>
     <string name="pk_now_wait">Host sedang PK, harap tunggu ya</string>
     <string name="congratulations">Selamat!</string>
-    <string name="you_get">You get</string>
+    <string name="you_get">Anda mendapat</string>
+    <string name="get">Diterima</string>
     <string name="continue_in_room_earn_coins">Lanjutkan di ruangan host selama %s menit untuk mendapatkan %s koin lagi.</string>
     <string name="please_setting_camera_microphone">Silakan mengaktifkan izin kamera dan mikrofon di pengaturan.</string>
     <string name="successful_collection">Berhasil diterima</string>
     <string name="pk_failed_re_pk">Jaringan tidak stabil dan koneksi PK gagal, silakan coba lagi</string>
+    <string name="ban_my_live_room">Melarang pengguna ini memasuki ruang siaran saya</string>
+    <string name="block_message_live_room">Blokir pesan pengguna ini di ruang siaran</string>
+    <string name="come_play_tomorrow">Datang dan bermain lagi besok</string>
+    <string name="login_daily_spin_one">Login setiap hari untuk Spin×1</string>
 </resources>

+ 6 - 1
baseswago/src/main/res/values-ms/strings.xml

@@ -378,9 +378,14 @@
     <string name="user_above_level_10">Pengguna di atas level 10 dapat menerimanya</string>
     <string name="pk_now_wait">Host sedang PK, harap tunggu ya</string>
     <string name="congratulations">Selamat!</string>
-    <string name="you_get">You get</string>
+    <string name="you_get">Anda mendapat</string>
+    <string name="get">Diterima</string>
     <string name="continue_in_room_earn_coins">Lanjutkan di ruangan host selama %s menit untuk mendapatkan %s koin lagi.</string>
     <string name="please_setting_camera_microphone">Silakan mengaktifkan izin kamera dan mikrofon di pengaturan.</string>
     <string name="successful_collection">Berhasil diterima</string>
     <string name="pk_failed_re_pk">Jaringan tidak stabil dan koneksi PK gagal, silakan coba lagi</string>
+    <string name="ban_my_live_room">Melarang pengguna ini memasuki ruang siaran saya</string>
+    <string name="block_message_live_room">Blokir pesan pengguna ini di ruang siaran</string>
+    <string name="come_play_tomorrow">Datang dan bermain lagi besok</string>
+    <string name="login_daily_spin_one">Login setiap hari untuk Spin×1</string>
 </resources>

+ 5 - 0
baseswago/src/main/res/values-zh/strings.xml

@@ -367,8 +367,13 @@
     <string name="pk_now_wait">当前主播正在PK,请稍后</string>
     <string name="congratulations">Congratulations!</string>
     <string name="you_get">You get</string>
+    <string name="get">Get</string>
     <string name="continue_in_room_earn_coins">Continue in the room for %s mins to earn another %s coins.</string>
     <string name="please_setting_camera_microphone">请到设置里开启相机和麦克风权限</string>
     <string name="successful_collection">领取成功</string>
     <string name="pk_failed_re_pk">网络不稳定,PK连接失败,请重新PK</string>
+    <string name="ban_my_live_room">禁止该用户进入我的直播间</string>
+    <string name="block_message_live_room">屏蔽该用户直播间内的消息</string>
+    <string name="come_play_tomorrow">Come and play again tomorrow.</string>
+    <string name="login_daily_spin_one">Login daily to get Spin×1</string>
 </resources>

+ 5 - 0
baseswago/src/main/res/values/strings.xml

@@ -399,8 +399,13 @@
     <string name="pk_now_wait">Host on pk now , pls wait and try again </string>
     <string name="congratulations">Congratulations!</string>
     <string name="you_get">You get</string>
+    <string name="get">Get</string>
     <string name="continue_in_room_earn_coins">Continue in the room for %s mins to earn another %s coins.</string>
     <string name="please_setting_camera_microphone">Please go to settings to enable camera and microphone permissions</string>
     <string name="successful_collection">Successful collection</string>
     <string name="pk_failed_re_pk">Network instability, PK connection failed, please re-PK</string>
+    <string name="ban_my_live_room">Ban this user from my live stream</string>
+    <string name="block_message_live_room">Block messages in the user\'s live room</string>
+    <string name="come_play_tomorrow">Come and play again tomorrow.</string>
+    <string name="login_daily_spin_one">Login daily to get Spin×1</string>
 </resources>

+ 3 - 7
home/src/main/java/com/swago/home/HomeFragment.kt

@@ -57,13 +57,9 @@ class HomeFragment : BaseXFragment<FragmentHomeBinding>() {
 
 
     override fun loadData() {
-//        UserInfo.getUserInfo()?.let{
-//            if (!it.is_zhuanpan_every_day){
-//                TodayTrafficDialog.newInstance().show(childFragmentManager,"TodayTrafficDialog")
-//            }
-//        }.also {
-//            TodayTrafficDialog.newInstance().show(childFragmentManager,"TodayTrafficDialog")
-//        }
+        if (UserInfo.getUserInfo() == null ||UserInfo.getUserInfo()?.is_zhuanpan_every_day == false){
+            TodayTrafficDialog.newInstance().show(childFragmentManager,"TodayTrafficDialog")
+        }
     }
 
     override fun initOther() {

+ 1 - 5
home/src/main/java/com/swago/home/MineFragment.kt

@@ -177,11 +177,7 @@ class MineFragment : BaseXFragment<FragmentMineBinding>() {
 
         binding.ivTraffic.setOnClickListener(object :NoDoubleClickListener(){
             override fun onClick() {
-                UserInfo.getUserInfo()?.let{
-                    if (!it.is_zhuanpan_every_day){
-                        TodayTrafficDialog.newInstance().show(childFragmentManager,"TodayTrafficDialog")
-                    }
-                }
+                TodayTrafficDialog.newInstance().show(childFragmentManager,"TodayTrafficDialog")
             }
         })
 

+ 2 - 2
room/src/main/java/com/swago/room/reward/RewardView.kt

@@ -65,7 +65,7 @@ class RewardView : FrameLayout, IRoomActiveListener, RoomTimer.TimeTickListener
                     ).show()
                     return
                 }
-                if (scaleXAnimator?.isRunning == true && countdownOver){
+                if (scaleXAnimator?.isRunning == true){
                     openGetCoins?.invoke(duration, coins, nextCoins, nextTime)
                 }
             }
@@ -140,7 +140,7 @@ class RewardView : FrameLayout, IRoomActiveListener, RoomTimer.TimeTickListener
         }
         rewardsModel = model
         visibility = View.VISIBLE
-        totalTime = model.onlineDuration * 60L
+        totalTime = model.onlineDuration
         nextReward()
     }
 

+ 1 - 1
room/src/main/res/layout/dialog_get_rewards.xml

@@ -83,7 +83,7 @@
             android:id="@+id/tvSure"
             android:textSize="18sp"
             android:textColor="#704200"
-            android:text="Get"
+            android:text="@string/get"
             android:gravity="center"
             android:layout_marginStart="24dp"
             android:layout_marginEnd="24dp"

+ 2 - 2
user/src/main/res/layout/item_black_room.xml

@@ -48,7 +48,7 @@
         android:layout_marginStart="20dp"
         android:textSize="14dp"
         android:textColor="#5c5c5c"
-        android:text="屏蔽该用户直播间内的消息"
+        android:text="@string/block_message_live_room"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"/>
 
@@ -61,7 +61,7 @@
         app:layout_constraintTop_toTopOf="@+id/switch2"
         app:layout_constraintBottom_toBottomOf="@+id/switch2"
         android:layout_marginStart="20dp"
-        android:text="禁止该用户进入我的直播间"
+        android:text="@string/ban_my_live_room"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"/>