Browse Source

feat: traffic url

tongmengxiao 3 months ago
parent
commit
8688ed8d2a

+ 0 - 15
app/src/main/java/com/swago/app/SplashActivity.kt

@@ -55,11 +55,6 @@ class SplashActivity : AppCompatActivity() {
                             }
                         }
                     } else {
-                        Toast.makeText(
-                            this@SplashActivity,
-                            getString(com.swago.login.R.string.these_permissions_denied)+" $deniedList",
-                            Toast.LENGTH_LONG
-                        ).show()
                         ARouter.getInstance().build(ARouteConstant.Login.login).navigation()
                         finish()
                     }
@@ -79,11 +74,6 @@ class SplashActivity : AppCompatActivity() {
                             }
                         }
                     } else {
-                        Toast.makeText(
-                            this@SplashActivity,
-                            getString(com.swago.login.R.string.these_permissions_denied)+" $deniedList",
-                            Toast.LENGTH_LONG
-                        ).show()
                         ARouter.getInstance().build(ARouteConstant.Login.login).navigation()
                         finish()
                     }
@@ -104,11 +94,6 @@ class SplashActivity : AppCompatActivity() {
                             }
                         }
                     } else {
-                        Toast.makeText(
-                            this@SplashActivity,
-                            getString(com.swago.login.R.string.these_permissions_denied)+" $deniedList",
-                            Toast.LENGTH_LONG
-                        ).show()
                         ARouter.getInstance().build(ARouteConstant.Login.login).navigation()
                         finish()
                     }

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

@@ -39,7 +39,7 @@ class TodayTrafficDialog : BaseXDFragment<DialogTodayTrafficBinding>() {
     override fun initOther() {
         binding.webview.apply {
             settings.javaScriptEnabled = true
-            addJavascriptInterface(jsLoad, "jsLoad")
+            addJavascriptInterface(jsLoad, "melive")
             settings.allowFileAccess = true
             settings.useWideViewPort = true
             settings.loadWithOverviewMode = true
@@ -49,7 +49,7 @@ class TodayTrafficDialog : BaseXDFragment<DialogTodayTrafficBinding>() {
             isVerticalScrollBarEnabled = true
             setBackgroundColor(Color.TRANSPARENT)
             webViewClient = WebViewClient()
-            loadUrl("https://www.baidu.com")
+            loadUrl("http://test-h5.swago.cn/checkIn")
         }
     }
 
@@ -58,7 +58,7 @@ class TodayTrafficDialog : BaseXDFragment<DialogTodayTrafficBinding>() {
     }
     inner class JSLoad {
         @JavascriptInterface
-        fun closeDialog() {
+        fun HtmlcallNative(s:String) {
             dismissAllowingStateLoss()
         }
     }

+ 5 - 5
baseswago/src/main/java/com/swago/baseswago/model/MomentModel.java

@@ -37,7 +37,7 @@ public class MomentModel implements Parcelable {
     private String badge_special;
     private String join_special;
     private String chat_special;
-    private int is_pk;
+    private boolean is_pk;
 
     public MomentModel(){
 
@@ -64,7 +64,7 @@ public class MomentModel implements Parcelable {
         badge_special = in.readString();
         join_special = in.readString();
         chat_special = in.readString();
-        is_pk = in.readInt();
+        is_pk = in.readInt() != 0;
     }
 
     @Override
@@ -89,7 +89,7 @@ public class MomentModel implements Parcelable {
         dest.writeString(badge_special);
         dest.writeString(join_special);
         dest.writeString(chat_special);
-        dest.writeInt(is_pk);
+        dest.writeInt(is_pk ? 1: 0);
     }
 
     @Override
@@ -285,11 +285,11 @@ public class MomentModel implements Parcelable {
         this.chat_special = chat_special;
     }
 
-    public int getIs_pk() {
+    public boolean getIs_pk() {
         return is_pk;
     }
 
-    public void setIs_pk(int is_pk) {
+    public void setIs_pk(boolean is_pk) {
         this.is_pk = is_pk;
     }
 }

+ 1 - 1
baseswago/src/main/res/layout/dialog_today_traffic.xml

@@ -1,12 +1,12 @@
 <?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: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"/>
 

+ 11 - 0
home/src/main/java/com/swago/home/MineFragment.kt

@@ -15,6 +15,7 @@ import com.swago.baseswago.UserVm
 import com.swago.baseswago.constant.ARouteConstant
 import com.swago.baseswago.constant.UrlConstant
 import com.swago.baseswago.dialog.BenefitBagDialog
+import com.swago.baseswago.dialog.TodayTrafficDialog
 import com.swago.baseswago.fragment.BaseXFragment
 import com.swago.baseswago.util.*
 import com.swago.home.databinding.FragmentMineBinding
@@ -174,6 +175,16 @@ 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")
+                    }
+                }
+            }
+        })
+
         payVm.getBenefit()
     }
 

+ 1 - 1
home/src/main/java/com/swago/home/innerhome/HomeAdapter.kt

@@ -49,7 +49,7 @@ class HomeAdapter  : BaseQuickAdapter<MomentModel, BaseViewHolder>(R.layout.item
 
                 setVisible(R.id.ivPassword , false)
             }
-            if (item.is_pk == 1){
+            if (item.is_pk){
                 setVisible(R.id.ivPk , true)
             } else {
                 setVisible(R.id.ivPk , false)

+ 9 - 1
home/src/main/res/layout/fragment_mine.xml

@@ -491,6 +491,14 @@
         </LinearLayout>
     </ScrollView>
 
-
+    <ImageView
+        android:id="@+id/ivTraffic"
+        android:layout_width="54dp"
+        android:layout_height="54dp"
+        android:src="@mipmap/ic_traffic"
+        android:layout_marginEnd="12dp"
+        android:layout_marginBottom="12dp"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintBottom_toBottomOf="parent"/>
 
 </androidx.constraintlayout.widget.ConstraintLayout>

BIN
home/src/main/res/mipmap-xxhdpi/ic_traffic.png


+ 0 - 45
login/src/main/java/com/swago/login/LoginActivity.kt

@@ -69,11 +69,6 @@ class LoginActivity : BaseXActivity<ActivityLoginBinding>() {
                                     FBLogin.login(this@LoginActivity)
                                 } else {
                                     FBLogin.login(this@LoginActivity)
-                                    Toast.makeText(
-                                        this@LoginActivity,
-                                        getString(R.string.these_permissions_denied)+ "$deniedList",
-                                        Toast.LENGTH_LONG
-                                    ).show()
                                 }
                             }
                     }else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU){
@@ -86,11 +81,6 @@ class LoginActivity : BaseXActivity<ActivityLoginBinding>() {
                                     FBLogin.login(this@LoginActivity)
                                 } else {
                                     FBLogin.login(this@LoginActivity)
-                                    Toast.makeText(
-                                        this@LoginActivity,
-                                        getString(R.string.these_permissions_denied)+ "$deniedList",
-                                        Toast.LENGTH_LONG
-                                    ).show()
                                 }
                             }
                     }else{
@@ -103,11 +93,6 @@ class LoginActivity : BaseXActivity<ActivityLoginBinding>() {
                                     FBLogin.login(this@LoginActivity)
                                 } else {
                                     FBLogin.login(this@LoginActivity)
-                                    Toast.makeText(
-                                        this@LoginActivity,
-                                        getString(R.string.these_permissions_denied)+ "$deniedList",
-                                        Toast.LENGTH_LONG
-                                    ).show()
                                 }
                             }
                     }
@@ -131,11 +116,6 @@ class LoginActivity : BaseXActivity<ActivityLoginBinding>() {
                                     GoogleLogin.login(this@LoginActivity)
                                 } else {
                                     GoogleLogin.login(this@LoginActivity)
-                                    Toast.makeText(
-                                        this@LoginActivity,
-                                        getString(R.string.these_permissions_denied)+"$deniedList",
-                                        Toast.LENGTH_LONG
-                                    ).show()
                                 }
                             }
                     }else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU){
@@ -148,11 +128,6 @@ class LoginActivity : BaseXActivity<ActivityLoginBinding>() {
                                     GoogleLogin.login(this@LoginActivity)
                                 } else {
                                     GoogleLogin.login(this@LoginActivity)
-                                    Toast.makeText(
-                                        this@LoginActivity,
-                                        getString(R.string.these_permissions_denied)+"$deniedList",
-                                        Toast.LENGTH_LONG
-                                    ).show()
                                 }
                             }
                     }else{
@@ -165,11 +140,6 @@ class LoginActivity : BaseXActivity<ActivityLoginBinding>() {
                                     GoogleLogin.login(this@LoginActivity)
                                 } else {
                                     GoogleLogin.login(this@LoginActivity)
-                                    Toast.makeText(
-                                        this@LoginActivity,
-                                        getString(R.string.these_permissions_denied)+"$deniedList",
-                                        Toast.LENGTH_LONG
-                                    ).show()
                                 }
                             }
                     }
@@ -236,11 +206,6 @@ class LoginActivity : BaseXActivity<ActivityLoginBinding>() {
                                 val account = binding.etAccount.text.toString()
                                 val secret = binding.etSecret.text.toString()
                                 loginVm.loginByAccount(account, secret)
-                                Toast.makeText(
-                                    this@LoginActivity,
-                                    getString(R.string.these_permissions_denied)+" $deniedList",
-                                    Toast.LENGTH_LONG
-                                ).show()
                             }
                         }
                 }else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU){
@@ -259,11 +224,6 @@ class LoginActivity : BaseXActivity<ActivityLoginBinding>() {
                                 val account = binding.etAccount.text.toString()
                                 val secret = binding.etSecret.text.toString()
                                 loginVm.loginByAccount(account, secret)
-                                Toast.makeText(
-                                    this@LoginActivity,
-                                    getString(R.string.these_permissions_denied)+" $deniedList",
-                                    Toast.LENGTH_LONG
-                                ).show()
                             }
                         }
                 }else{
@@ -282,11 +242,6 @@ class LoginActivity : BaseXActivity<ActivityLoginBinding>() {
                                 val account = binding.etAccount.text.toString()
                                 val secret = binding.etSecret.text.toString()
                                 loginVm.loginByAccount(account, secret)
-                                Toast.makeText(
-                                    this@LoginActivity,
-                                    getString(R.string.these_permissions_denied)+" $deniedList",
-                                    Toast.LENGTH_LONG
-                                ).show()
                             }
                         }
                 }