Ver Fonte

feat: 转盘dialog

tongmengxiao há 4 meses atrás
pai
commit
1a75f2a186

+ 44 - 0
baseswago/src/main/java/com/swago/baseswago/dialog/TodayTrafficDialog.kt

@@ -0,0 +1,44 @@
+package com.swago.baseswago.dialog
+
+import android.content.Intent
+import android.os.Bundle
+import android.view.Gravity
+import android.view.View
+import android.view.View.OnClickListener
+import android.webkit.WebViewClient
+import com.alibaba.android.arouter.launcher.ARouter
+import com.swago.baseswago.constant.ARouteConstant
+import com.swago.baseswago.databinding.DialogCloseAccountBinding
+import com.swago.baseswago.databinding.DialogInviteBindingBinding
+import com.swago.baseswago.databinding.DialogTodayTrafficBinding
+import com.swago.baseswago.dialog.BaseXDFragment
+import com.swago.baseswago.util.SpUtil
+import com.swago.baseswago.util.UserInfo
+
+class TodayTrafficDialog : BaseXDFragment<DialogTodayTrafficBinding>() {
+
+    init {
+        setGravity(Gravity.CENTER)
+        setDimAmount(0.5f)
+        setCanCancel(false)
+    }
+
+    companion object {
+        fun newInstance(): TodayTrafficDialog {
+            val args = Bundle()
+            val fragment = TodayTrafficDialog()
+            fragment.arguments = args
+            return fragment
+        }
+    }
+
+    override fun initOther() {
+        binding.webview.settings.javaScriptEnabled = true
+        binding.webview.webViewClient = WebViewClient()
+        binding.webview.loadUrl("https://www.baidu.com")
+    }
+
+    override fun initLiveData() {
+
+    }
+}

+ 14 - 0
baseswago/src/main/java/com/swago/baseswago/model/UserInfoModel.java

@@ -103,6 +103,12 @@ public class UserInfoModel {
      * 是否充值用户
      */
     private int is_recharge;
+
+    /**
+     * 今天转盘是否抽奖
+     * */
+    private boolean is_zhuanpan_every_day;
+
     private String android_join_special;
     private String android_head_special;
     private String android_badge_special;
@@ -413,6 +419,14 @@ public class UserInfoModel {
         this.is_recharge = is_recharge;
     }
 
+    public boolean getIs_zhuanpan_every_day() {
+        return is_zhuanpan_every_day;
+    }
+
+    public void setIs_zhuanpan_every_day(boolean is_zhuanpan_every_day) {
+        this.is_zhuanpan_every_day = is_zhuanpan_every_day;
+    }
+
     public String getAndroid_join_special() {
         return android_join_special;
     }

+ 13 - 0
baseswago/src/main/res/layout/dialog_today_traffic.xml

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    xmlns:app="http://schemas.android.com/apk/res-auto">
+
+    <WebView
+        android:id="@+id/webview"
+        android:background="@color/_ff9300"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"/>
+
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 6 - 1
home/src/main/java/com/swago/home/HomeActivity.kt

@@ -18,6 +18,7 @@ import com.swago.baseswago.constant.UrlConstant
 import com.swago.baseswago.dialog.CloseAccountDialog
 import com.swago.baseswago.dialog.InviteBindingDialog
 import com.swago.baseswago.dialog.OrderLostDialog
+import com.swago.baseswago.dialog.TodayTrafficDialog
 import com.swago.baseswago.im.GroupMsgParser
 import com.swago.baseswago.im.IMMessageManager
 import com.swago.baseswago.inter.ApiManager
@@ -58,7 +59,11 @@ class HomeActivity : BaseXActivity<ActivityHomeBinding>(), IPayCallback {
         arrayListOf(HomeFragment(), MessageFragment(), MineFragment())
 
     override fun loadData() {
-
+        UserInfo.getUserInfo()?.let{
+            if (!it.is_zhuanpan_every_day){
+                TodayTrafficDialog.newInstance().show(supportFragmentManager,"TodayTrafficDialog")
+            }
+        }
     }
 
     override fun initOther() {