Procházet zdrojové kódy

1.修改提示弹框。

石慧云 před 4 roky
rodič
revize
c405cd2a2a

+ 3 - 1
app/src/main/AndroidManifest.xml

@@ -86,7 +86,9 @@
         <activity android:name=".activity.CollectionActivity" />
         <activity android:name=".activity.AddressAddActivity"/>
         <activity android:name=".activity.AreaSelectActivity"/>
-        <activity android:name=".activity.SourceDetailsActivity"/>
+        <activity android:name=".activity.SourceDetailsActivity"
+            android:windowSoftInputMode="adjustPan"
+            />
         <activity android:name=".activity.WaybillDetailsActivity"/>
         <activity android:name=".activity.AllCarActivity"/>
         <activity android:name=".activity.InvoiceActivity"/>

+ 5 - 5
app/src/main/java/com/quansu/heifengwuliu/App.java

@@ -32,11 +32,11 @@ public class App extends BApp  {
                 .init()
                 .subscribe();
 
-        CCRetrofit.instance()
-                .with(this)
-                .create(IJpush.class)
-                .initPush()
-                .subscribe();
+//        CCRetrofit.instance()
+//                .with(this)
+//                .create(IJpush.class)
+//                .initPush()
+//                .subscribe();
 
 
         //注册微信

+ 1 - 1
app/src/main/java/com/quansu/heifengwuliu/activity/AddressAddActivity.kt

@@ -45,7 +45,7 @@ class AddressAddActivity : MBActivity<AddressAddVModel, ActivityAddressaddBindin
 
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
-
+         vm.ll=binding.ll
 
         if(!TextUtils.isEmpty(type)){
            vm.inData(type)

+ 16 - 4
app/src/main/java/com/quansu/heifengwuliu/activity/SettingsActivity.kt

@@ -9,6 +9,8 @@ import com.quansu.heifengwuliu.R
 import com.quansu.heifengwuliu.base.MBActivity
 import com.quansu.heifengwuliu.config.ConfigRx
 import com.quansu.heifengwuliu.databinding.ActivitySettingsBinding
+import com.quansu.heifengwuliu.inte.ChoiceData
+import com.quansu.heifengwuliu.utils.PopuTipsUtils
 import com.quansu.heifengwuliu.vmodel.SettingsVModel
 import com.ysnows.base.ccretrofit.CCRetrofit
 import com.ysnows.base.ext.message
@@ -38,11 +40,21 @@ class SettingsActivity : MBActivity<SettingsVModel, ActivitySettingsBinding>() {
 
 
         binding.flLogout.onClick {
-            message(R.string.enture_logout, negativeEnable = true, positiveAction = { dialog, _ ->
-                MMKVManager.instance().clearAll()
-                dialog.dismiss()
-                UiSwitch.single_new_task_with_clear_task(context(), OneLoginActivity::class.java)
+
+            PopuTipsUtils.show(context(),getString(R.string.enture_logout), binding.flLogout,object: ChoiceData {
+                override fun onRestuse(id: String?) {
+                    MMKVManager.instance().clearAll()
+                    UiSwitch.single_new_task_with_clear_task(context(), OneLoginActivity::class.java)
+                }
+
             })
+
+
+//            message(R.string.enture_logout, negativeEnable = true, positiveAction = { dialog, _ ->
+//                MMKVManager.instance().clearAll()
+//                dialog.dismiss()
+//                UiSwitch.single_new_task_with_clear_task(context(), OneLoginActivity::class.java)
+//            })
         }
     }
 

+ 67 - 0
app/src/main/java/com/quansu/heifengwuliu/utils/PopuTipsUtils.kt

@@ -0,0 +1,67 @@
+package com.quansu.heifengwuliu.utils
+
+import android.content.Context
+import android.view.LayoutInflater
+import android.view.View
+import android.widget.*
+import com.qmuiteam.qmui.kotlin.onClick
+import com.qmuiteam.qmui.layout.QMUIFrameLayout
+import com.qmuiteam.qmui.skin.QMUISkinValueBuilder
+import com.qmuiteam.qmui.util.QMUIDisplayHelper
+import com.qmuiteam.qmui.widget.popup.QMUIPopup
+import com.qmuiteam.qmui.widget.popup.QMUIPopups
+import com.quansu.heifengwuliu.R
+import com.quansu.heifengwuliu.inte.ChoiceData
+
+/**
+ *Created by shihuiyun
+ *on 2020/9/21
+ */
+object  PopuTipsUtils {
+
+    fun show(context:Context, text:String,view: View, choiceData: ChoiceData ){
+
+        var mNormalPopup = QMUIPopups.fullScreenPopup(context)
+        val builder: QMUISkinValueBuilder = QMUISkinValueBuilder.acquire()
+        val frameLayout = QMUIFrameLayout(context)
+        //自定义布局
+        val layoutInflater = context?.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
+        var layout = layoutInflater.inflate(R.layout.item_tips, null)
+
+        val tvContent:TextView=layout.findViewById(R.id.tv_content)
+        val tvCancel:TextView=layout.findViewById(R.id.tv_cancel)
+        val tvSure:TextView=layout.findViewById(R.id.tv_sure)
+        tvContent.text=text
+
+        tvCancel.onClick {
+            mNormalPopup.dismiss()
+        }
+
+        tvSure.onClick {
+
+            choiceData?.onRestuse("")
+
+            mNormalPopup.dismiss()
+        }
+
+
+        builder.release();
+
+        val size= QMUIDisplayHelper.getScreenWidth(context)
+
+
+        val lp: FrameLayout.LayoutParams = FrameLayout.LayoutParams(size,
+                FrameLayout.LayoutParams.WRAP_CONTENT)
+        frameLayout.addView(layout, lp)
+
+        mNormalPopup.addView(frameLayout)
+        mNormalPopup.onDismiss() {
+        }
+
+        mNormalPopup.dismissIfOutsideTouch(false)
+        mNormalPopup.animStyle(QMUIPopup.ANIM_GROW_FROM_CENTER)
+        mNormalPopup.show(view)
+
+
+    }
+}

+ 26 - 13
app/src/main/java/com/quansu/heifengwuliu/vmodel/AddressAddVModel.kt

@@ -6,6 +6,7 @@ import android.app.Application
 import android.content.Intent
 import android.text.TextUtils
 import android.util.Log
+import android.widget.LinearLayout
 import androidx.databinding.Bindable
 import androidx.lifecycle.MutableLiveData
 import com.qmuiteam.qmui.widget.dialog.QMUIDialog
@@ -14,7 +15,9 @@ import com.quansu.heifengwuliu.BR
 import com.quansu.heifengwuliu.activity.AddressAddActivity
 import com.quansu.heifengwuliu.activity.AreaSelectActivity
 import com.quansu.heifengwuliu.config.MIntentAction
+import com.quansu.heifengwuliu.inte.ChoiceData
 import com.quansu.heifengwuliu.model.AddressDetailsBean
+import com.quansu.heifengwuliu.utils.PopuTipsUtils
 import com.quansu.heifengwuliu.utils.net.NetEngine
 import com.yanzhenjie.permission.AndPermission
 import com.yanzhenjie.permission.runtime.Permission
@@ -37,6 +40,8 @@ open class AddressAddVModel(application: Application) : BViewModel<BRepository>(
     var type = "1"//默认发货
     private var addr_id="0"////默认添加
 
+    var ll: LinearLayout? =null
+
     init {
         checked.value = 1//默认选中
 
@@ -202,21 +207,29 @@ open class AddressAddVModel(application: Application) : BViewModel<BRepository>(
     }
 
     fun setAddressDel(addr_id: String) {
+
         //删除
 
-        QMUIDialog.MessageDialogBuilder(repository().context)
-                .setTitle("提示")
-                .setMessage("确定要删除该地址么")
-                .addAction("取消",QMUIDialogAction.ActionListener(){
-                    dialog, index ->
-                    dialog.dismiss()
-                })
-                .addAction("确定",QMUIDialogAction.ActionListener(){
-                    dialog, index ->
-                    setSureDel(addr_id)
-                    dialog.dismiss()
-                })
-                .show()
+        PopuTipsUtils.show(repository().context!!,"确定要删除该地址么", ll!!,object:ChoiceData{
+            override fun onRestuse(id: String?) {
+                setSureDel(addr_id)
+            }
+
+        })
+
+//        QMUIDialog.MessageDialogBuilder(repository().context)
+//                .setTitle("提示")
+//                .setMessage("确定要删除该地址么")
+//                .addAction("取消",QMUIDialogAction.ActionListener(){
+//                    dialog, index ->
+//                    dialog.dismiss()
+//                })
+//                .addAction("确定",QMUIDialogAction.ActionListener(){
+//                    dialog, index ->
+//                    setSureDel(addr_id)
+//                    dialog.dismiss()
+//                })
+//                .show()
 
     }
 

+ 2 - 0
app/src/main/java/com/quansu/heifengwuliu/vmodel/SourceDetailsVModel.kt

@@ -92,6 +92,8 @@ open class SourceDetailsVModel(application: Application) : BViewModel<BRepositor
         val builder: QMUISkinValueBuilder = QMUISkinValueBuilder.acquire()
         val frameLayout = QMUIFrameLayout(repository().context)
 
+        frameLayout.fitsSystemWindows=true
+
         //自定义布局
         val layoutInflater = repository().context?.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
         var layout = layoutInflater.inflate(R.layout.item_apy, null)

+ 1 - 0
app/src/main/java/com/quansu/heifengwuliu/vmodel/WaybillDetailsVModel.kt

@@ -333,6 +333,7 @@ open class WaybillDetailsVModel(application: Application) : BViewModel<BReposito
 
                             order_state = 30//变成待结算
                             tvTitle.value = ""
+                            isButShow.value=false
                             isDialogShow.value = false
                         }
                     }

+ 1 - 0
app/src/main/res/layout/activity_addressadd.xml

@@ -9,6 +9,7 @@
     </data >
 
     <LinearLayout
+        android:id="@+id/ll"
         android:layout_width="match_parent"
         android:orientation="vertical"
         android:background="@color/color_bg"

+ 94 - 0
app/src/main/res/layout/item_tips.xml

@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:gravity="center"
+    android:orientation="vertical">
+
+
+    <com.qmuiteam.qmui.widget.roundwidget.QMUIRoundLinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:gravity="center"
+        android:layout_marginStart="27dp"
+        android:layout_marginEnd="27dp"
+        android:background="@color/white"
+        app:qmui_radius="8dp"
+        app:qmui_backgroundColor="@color/white"
+        android:orientation="vertical">
+
+
+        <TextView
+            android:id="@+id/tv_title"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_centerHorizontal="true"
+            android:layout_marginTop="22dp"
+            android:text="提示"
+            android:textColor="@color/text_title"
+            android:textSize="17sp" />
+
+
+        <TextView
+            android:id="@+id/tv_content"
+            android:layout_width="match_parent"
+            android:textColor="@color/text_title"
+            android:textSize="16sp"
+            android:layout_marginStart="16dp"
+            android:gravity="center"
+            android:layout_marginEnd="16dp"
+            android:layout_marginTop="20dp"
+            android:layout_marginBottom="20dp"
+            android:layout_height="wrap_content"/>
+
+
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="1dp"
+            android:background="#E3E4E5" />
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="horizontal">
+
+            <TextView
+                android:id="@+id/tv_cancel"
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_weight="1"
+                android:layout_marginTop="15dp"
+                android:layout_marginBottom="17dp"
+                android:gravity="center"
+                android:text="取消"
+                android:textColor="#26292F"
+                android:textSize="17sp" />
+
+            <View
+                android:layout_width="1dp"
+                android:layout_height="match_parent"
+                android:background="#E3E4E5" />
+
+            <TextView
+                android:id="@+id/tv_sure"
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_marginTop="15dp"
+                android:layout_marginBottom="17dp"
+                android:layout_weight="1"
+                android:gravity="center"
+                android:text="确定"
+                android:textColor="#FFBC00"
+                android:textSize="17sp" />
+
+
+        </LinearLayout>
+
+
+
+
+    </com.qmuiteam.qmui.widget.roundwidget.QMUIRoundLinearLayout>
+
+
+</LinearLayout>

+ 2 - 1
gradle.properties

@@ -15,4 +15,5 @@ org.gradle.jvmargs=-Xmx2536m
  org.gradle.parallel=true
 
 #android.useAndroidX = true
-#android.enableJetifier = false
+#android.enableJetifier = false
+android.useDeprecatedNdk=true

+ 11 - 0
jpush/proguard-rules.pro

@@ -34,3 +34,14 @@
 -keep class cn.com.chinatelecom.** { *; }
 -dontwarn com.sdk.**
 -keep class com.sdk.** { *; }
+
+-dontwarn cn.jpush.**
+-keep class cn.jpush.** { *; }
+-keep class * extends cn.jpush.android.helpers.JPushMessageReceiver { *; }
+
+-dontwarn cn.jiguang.**
+-keep class cn.jiguang.** { *; }
+-dontwarn com.google.**
+-keep class com.google.gson.** {*;}
+-keep class com.google.protobuf.** {*;}
+

+ 1 - 6
jpush/src/main/AndroidManifest.xml

@@ -22,11 +22,6 @@
     <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
     <uses-permission android:name="android.permission.GET_TASKS" />
 
-    <permission
-        android:name="${applicationId}.permission.JPUSH_MESSAGE"
-        android:protectionLevel="signature" />
-    <!-- 这里com.xiaomi.mipushdemo改成app的包名 -->
-    <uses-permission android:name="${applicationId}.permission.JPUSH_MESSAGE" />
 
 
     <application
@@ -43,7 +38,7 @@
             tools:node="replace">
             <intent-filter>
                 <action android:name="cn.jpush.android.intent.RECEIVE_MESSAGE" />
-                <category android:name="com.example.jpushdemo" /> <!--JPush上注册的包名 -->
+                <category android:name="com.quansu.heifengwuliu" /> <!--JPush上注册的包名 -->
             </intent-filter>
         </receiver>
 

+ 7 - 2
jpush/src/main/java/com/quansu/jpush/componnent/CpJpush.kt

@@ -1,5 +1,6 @@
 package com.quansu.jpush.componnent
 
+import android.content.Context
 import android.util.Log
 import cn.jiguang.verifysdk.api.*
 import cn.jpush.android.api.JPushInterface
@@ -15,7 +16,7 @@ import com.ysnows.base.route.IApp
  *Created by shihuiyun
  *on 2020/9/9
  */
-class CpJpush : BIComponent() , IComponent  {
+class CpJpush : BIComponent(), IComponent {
 
 
     fun init(cc: CC): Boolean {
@@ -25,9 +26,12 @@ class CpJpush : BIComponent() , IComponent  {
         JVerificationInterface.init(cc.getContext().getApplicationContext(),
                 RequestCallback { code, msg -> Log.d("shy", "code = $code msg = $msg") })
         JVerificationInterface.setDebugMode(true)
+
+
         CC.sendCCResult(cc.callId, CCResult.success())
         return false
     }
+
     fun isLogin(cc: CC): Boolean {
 
         Log.d("jpush", "一键登录开始")
@@ -97,12 +101,13 @@ class CpJpush : BIComponent() , IComponent  {
 
     fun initPush(cc: CC): Boolean {//初始化极光推送
 
-        JPushInterface.setDebugMode(true) //打印log
 
+        JPushInterface.setDebugMode(true) //打印log
         JPushInterface.init(cc.getContext().getApplicationContext())
 
         CC.sendCCResult(cc.callId, CCResult.success())
         return false
     }
 
+
 }