瀏覽代碼

## [1.1.19] version 38 - 2020-08-05
### Fixed
- 修复信号强度显示
- 修复多个界面的刷新与加载更多问题
### Changed
- 优化loading图片展现

allen 3 年之前
父節點
當前提交
7940aa8f62

+ 2 - 2
build.gradle

@@ -47,12 +47,12 @@ buildscript {
     /**
      * APP版本码
      */
-    ext.app_version_code = 37
+    ext.app_version_code = 38
 
     /**
      * APP版本号
      */
-    ext.app_version = "1.1.18"
+    ext.app_version = "1.1.19"
 
     /**
      * 项目依赖库

二進制
common/src/main/res/drawable/loading.png


+ 1 - 1
common/src/main/res/layout/custom_loading.xml

@@ -15,7 +15,7 @@
             android:id="@+id/loadding_image"
             android:layout_width="150.0dip"
             android:layout_height="150.0dip"
-            android:src="@drawable/load" />
+            android:src="@drawable/loading" />
 
         <TextView
             android:layout_width="150.0dip"

+ 3 - 0
home/src/main/code/com/wdkl/ncs/android/component/home/activity/TakeoverActivity.kt

@@ -1,6 +1,7 @@
 package com.wdkl.ncs.android.component.home.activity
 
 import android.util.Log
+import android.view.View
 import com.alibaba.android.vlayout.DelegateAdapter
 import com.alibaba.android.vlayout.VirtualLayoutManager
 import com.enation.javashop.net.engine.model.NetState
@@ -88,6 +89,8 @@ class TakeoverActivity: BaseActivity<TakeoverPresenter, ActivityTakeoverBinding>
             }
             adapter.data.addAll(listData)
             adapter.notifyDataSetChanged()
+        } else {
+            tv_empty_takeover.visibility = View.VISIBLE
         }
     }
 

+ 23 - 5
home/src/main/code/com/wdkl/ncs/android/component/home/activity/WatchCallRecordsActivity.kt

@@ -31,6 +31,7 @@ import com.wdkl.ncs.android.middleware.tcp.enums.TcpType
 import com.wdkl.ncs.android.middleware.utils.MessageEvent
 import kotlinx.android.synthetic.main.watch_activity_call_records.*
 import kotlinx.android.synthetic.main.watch_activity_call_records.refresh
+import kotlinx.android.synthetic.main.watch_contacts_lay.*
 import org.greenrobot.eventbus.EventBus
 import org.greenrobot.eventbus.Subscribe
 import org.greenrobot.eventbus.ThreadMode
@@ -109,6 +110,7 @@ class WatchCallRecordsActivity : BaseActivity<WatchCallRecordsFragmentPresenter,
                     presenter.loadPage(all, page, 30, Constants.deviceId, 0, 0)
                 }
                 refresh.setOnRefreshListener {
+                    page = 1
                     presenter.loadPage(all, 1, 30, Constants.deviceId, 0, 0)
                 }
             }
@@ -121,6 +123,7 @@ class WatchCallRecordsActivity : BaseActivity<WatchCallRecordsFragmentPresenter,
                     presenter.loadPage(all, page, 30, Constants.deviceId, 0, 1)
                 }
                 refresh.setOnRefreshListener {
+                    page = 1
                     presenter.loadPage(all, 1, 30, Constants.deviceId, 0, 1)
                 }
             }
@@ -141,6 +144,7 @@ class WatchCallRecordsActivity : BaseActivity<WatchCallRecordsFragmentPresenter,
                     presenter.loadPage(customerRecords, page, 30, Constants.deviceId, customerId.toInt(), -1)
                 }
                 refresh.setOnRefreshListener {
+                    page = 1
                     presenter.loadPage(customerRecords, 1, 30, Constants.deviceId, customerId.toInt(), -1)
                 }
             }
@@ -185,12 +189,26 @@ class WatchCallRecordsActivity : BaseActivity<WatchCallRecordsFragmentPresenter,
         }
 
         refresh.finishRefresh()
-        if (data.size > 0) {
-            watchCallRecordsItemAdapter.data.clear()
-            watchCallRecordsItemAdapter.data.addAll(data)
-            watchCallRecordsItemAdapter.notifyDataSetChanged()
+        if (page == 1) {
+            refresh.resetNoMoreData()
+            if (data.size > 0) {
+                watchCallRecordsItemAdapter.data.clear()
+                watchCallRecordsItemAdapter.data.addAll(data)
+                Log.i("abc1", " " + data.size);
+                watchCallRecordsItemAdapter.notifyDataSetChanged()
+            } else {
+                tv_empty_contacts.visibility = View.VISIBLE
+            }
+            refresh.finishLoadMore()
+        } else {
+            if (data.size > 0) {
+                watchCallRecordsItemAdapter.data.addAll(data)
+                watchCallRecordsItemAdapter.notifyDataSetChanged()
+                refresh.finishLoadMore()
+            } else {
+                refresh.finishLoadMoreWithNoMoreData()
+            }
         }
-        refresh.finishLoadMore()
     }
 
     /**

+ 4 - 0
home/src/main/code/com/wdkl/ncs/android/component/home/activity/WatchContactsActivity.kt

@@ -2,6 +2,7 @@ package com.wdkl.ncs.android.component.home.activity
 
 import android.content.Intent
 import android.util.Log
+import android.view.View
 import com.alibaba.android.vlayout.DelegateAdapter
 import com.alibaba.android.vlayout.VirtualLayoutManager
 import com.enation.javashop.android.jrouter.external.annotation.Router
@@ -87,6 +88,7 @@ class WatchContactsActivity : BaseActivity<WatchActivityPresenter, WatchContacts
             presenter.loadData(page, Constants.deviceId)
         }
         refresh.setOnRefreshListener {
+            page = 1
             presenter.loadData(1, Constants.deviceId)
         }
 
@@ -123,6 +125,8 @@ class WatchContactsActivity : BaseActivity<WatchActivityPresenter, WatchContacts
                 adapter.data.addAll(data)
                 Log.i("abc1", " " + data.size);
                 adapter.notifyDataSetChanged()
+            } else {
+                tv_empty_contacts.visibility = View.VISIBLE
             }
             refresh.finishLoadMore()
         } else {

+ 6 - 3
home/src/main/code/com/wdkl/ncs/android/component/home/activity/WatchEventDetailActivity.kt

@@ -55,7 +55,7 @@ class WatchEventDetailActivity : BaseActivity<WatchHomeActivityPresenter, WatchA
 
     var interactionVO: InteractionVO? = null
     var tcpModel: TcpModel? = null
-    private var CALL_TIMEOUT = 5 //多久可以再次点击
+    private var CALL_TIMEOUT = 2 //多久可以再次点击
 
 
     lateinit var countDownTimer: CountDownTimer
@@ -97,7 +97,7 @@ class WatchEventDetailActivity : BaseActivity<WatchHomeActivityPresenter, WatchA
         call_relyout.setOnClickListener {
             loadingDialog.show()
             call_relyout.isEnabled = false
-            Log.i(TAG, "tcpModel 发送的 " + tcpModel?.toJson())
+            Log.i(TAG, "当前界面 tcpModel " + this.tcpModel?.toJson())
             var tcpModel: TcpModel? = null
             if (interactionVO?.fromDeviceMemberId==null){
                 tcpModel = VoiceUtil.voiceCall(Constants.deviceId, interactionVO?.fromDeviceId)
@@ -114,7 +114,8 @@ class WatchEventDetailActivity : BaseActivity<WatchHomeActivityPresenter, WatchA
         }
 
         event_status_img.setOnClickListener {
-            //event_status_img.isEnabled = false
+            event_status_img.isEnabled = false
+            countDownTimer.start()
             if (tcpModel?.type == TcpType.EVENT) {
                 loadingDialog.show()
                 var tcpModel = EventUtil.eventResponse(Constants.deviceId, interactionVO!!.fromDeviceId, interactionVO!!.id)
@@ -235,6 +236,8 @@ class WatchEventDetailActivity : BaseActivity<WatchHomeActivityPresenter, WatchA
             override fun onFinish() {
                 loadingDialog.dismiss()
                 call_relyout.isEnabled = true
+                event_status_img.isEnabled = true
+
             }
         }
     }

+ 25 - 13
home/src/main/code/com/wdkl/ncs/android/component/home/activity/WatchHome2Activity.kt

@@ -1,20 +1,12 @@
 package com.wdkl.ncs.android.component.home.activity
 
 import android.Manifest
-import android.content.BroadcastReceiver
 import android.content.Context
 import android.content.Intent
 import android.content.IntentFilter
-import android.content.pm.PackageManager
 import android.graphics.Color
-import android.media.session.MediaSession
-import android.net.wifi.WifiManager
 import android.os.Bundle
 import android.os.CountDownTimer
-import android.provider.Settings
-import android.support.v4.app.ActivityCompat
-import android.support.v4.content.ContextCompat
-import android.support.v4.media.session.MediaSessionCompat
 import android.telephony.PhoneStateListener
 import android.telephony.SignalStrength
 import android.telephony.TelephonyManager
@@ -59,7 +51,6 @@ import com.wdkl.ncs.android.middleware.utils.MessageEvent
 import com.wdkl.ncs.keepbackground.utils.SpManager
 import com.wdkl.ncs.keepbackground.work.DaemonEnv
 import io.reactivex.Observable
-import kotlinx.android.synthetic.main.watch_activity_call_records.*
 import kotlinx.android.synthetic.main.watch_activity_home2.*
 import kotlinx.android.synthetic.main.watch_activity_register.*
 import org.greenrobot.eventbus.Subscribe
@@ -118,14 +109,34 @@ class WatchHome2Activity : BaseActivity<WatchHomeActivityPresenter, WatchActivit
         teleManager = (applicationContext.getSystemService(Context.TELEPHONY_SERVICE)) as TelephonyManager
         netType = NetHelper.getInstance().getNetworkState(applicationContext)
         Log.i(TAG, "网络类型:" + netType)
-        if (netType == NetHelper.NETWORK_2G || netType == NetHelper.NETWORK_3G || netType == NetHelper.NETWORK_4G) {
+        /*
+-50 to -79 dBm, then it's generally considered great signal (4 to 5 bars).
+-80 to -89 dBm, then it's generally considered good signal (3 to 4 bars).
+-90 to -99 dBm, then it's generally considered average signal (2 to 3 bars).
+-100 to -109 dBm, then it's generally considered poor signal (1 to 2 bars).
+-110 to -120 dBm, then it's generally considered very poor signal (0 to 1 bar)
+         */
+        if (netType == NetHelper.NETWORK_4G) {
             if (teleManager != null) {
                 teleManager.listen(object : PhoneStateListener() {
                     override fun onSignalStrengthsChanged(signalStrength: SignalStrength) {
+                        val signalinfo = signalStrength.toString()
+                        val parts = signalinfo.split(" ".toRegex()).toTypedArray()
+                        val ltedbm = parts[9].toInt()
+                        if (ltedbm>=-79){
+                            tv_signal_strength.text = "网络极好"
+                        } else if (ltedbm>=-89 && ltedbm<=-80){
+                            tv_signal_strength.text = "网络好"
+                        } else if (ltedbm>=-99 && ltedbm<=-90){
+                            tv_signal_strength.text = "网络正常"
+                        } else if (ltedbm>=-109 && ltedbm<=-100){
+                            tv_signal_strength.text = "网络较差"
+                        } else if (ltedbm>=-120 && ltedbm<=-110){
+                            tv_signal_strength.text = "网络极差"
+                        }
+                        Log.i(TAG, "网络:LTE 信号强度:$ltedbm======Detail:$signalinfo")
+
                         super.onSignalStrengthsChanged(signalStrength)
-                        val asu = signalStrength.gsmSignalStrength
-                        val lastSignal = -113 + 2 * asu;
-                        tv_signal_strength.text = "" + lastSignal
                     }
                 }, PhoneStateListener.LISTEN_SIGNAL_STRENGTHS);
             }
@@ -141,6 +152,7 @@ class WatchHome2Activity : BaseActivity<WatchHomeActivityPresenter, WatchActivit
                 startActivity(intent)
             }
             DaemonEnv.startServiceSafelyWithData(this, WdKeepAliveService::class.java)
+            presenter.getDeviceVO(Constants.imei)
         } else {
             requestPermissions()
 

+ 1 - 0
home/src/main/code/com/wdkl/ncs/android/component/home/service/WdKeepAliveService.kt

@@ -102,6 +102,7 @@ class WdKeepAliveService : AbsWorkService() {
                     val intent = Intent()
 
                     if (tcpModel.action == TcpAction.VoiceAction.SUCCESS){  //拨出成功
+                        Log.i(TAG,"拨出成功 ${interactionVO.fromMemberName} ${interactionVO.id}")
                         DeviceChannel.calling = true;
                         intent.setClass(this, WebRTCVoipAudioActivity::class.java)
                         intent.putExtra("targetId", interactionVO?.toSipId)

+ 11 - 0
home/src/main/res/layout/activity_takeover.xml

@@ -5,6 +5,17 @@
         android:layout_height="match_parent"
         android:background="#FFBDC3">
 
+        <TextView
+            android:id="@+id/tv_empty_takeover"
+            android:textAlignment="center"
+            android:layout_marginTop="50dp"
+            android:textSize="20sp"
+            android:visibility="gone"
+            android:textColor="@color/warn_orange"
+            android:text="@string/data_empty"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"/>
+
         <com.scwang.smartrefresh.layout.SmartRefreshLayout
             android:id="@+id/refresh"
             android:layout_width="match_parent"

+ 10 - 0
home/src/main/res/layout/watch_activity_call_records.xml

@@ -6,6 +6,16 @@
         android:layout_height="match_parent"
         android:background="#FFBDC3">
 
+        <TextView
+            android:id="@+id/tv_empty_records"
+            android:textAlignment="center"
+            android:layout_marginTop="50dp"
+            android:textSize="20sp"
+            android:textColor="@color/warn_orange"
+            android:text="@string/data_empty"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"/>
+
         <com.scwang.smartrefresh.layout.SmartRefreshLayout
             android:id="@+id/refresh"
             android:layout_width="match_parent"

+ 1 - 1
home/src/main/res/layout/watch_activity_home2.xml

@@ -160,7 +160,7 @@
                                 android:layout_width="wrap_content"
                                 android:layout_height="wrap_content"
                                 android:textColor="#ffffff"
-                                android:textSize="16dp" />
+                                android:textSize="12sp" />
                         </LinearLayout>
 
 

+ 11 - 0
home/src/main/res/layout/watch_contacts_lay.xml

@@ -7,6 +7,17 @@
         android:layout_height="match_parent"
         android:background="#FFBDC3">
 
+        <TextView
+            android:id="@+id/tv_empty_contacts"
+            android:textAlignment="center"
+            android:layout_marginTop="50dp"
+            android:textSize="20sp"
+            android:visibility="gone"
+            android:textColor="@color/warn_orange"
+            android:text="@string/data_empty"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"/>
+
         <com.scwang.smartrefresh.layout.SmartRefreshLayout
             android:id="@+id/refresh"
             android:layout_width="match_parent"

+ 9 - 0
readme.md

@@ -26,6 +26,15 @@
 
 ---
 
+## [1.1.19] version 38 - 2020-08-05
+### Fixed
+- 修复信号强度显示
+- 修复多个界面的刷新与加载更多问题
+### Changed
+- 优化loading图片展现
+
+---
+
 ## [1.1.18] version 37 - 2020-08-04
 ### Fixed
 - 解决若干个问题

二進制
resource/src/main/res/drawable/loading.png


+ 2 - 0
resource/src/main/res/values/colors.xml

@@ -80,4 +80,6 @@
     <color name="javashop_color_post_comment_right_tc">#FA511F</color>
     <color name="javashop_color_coupon_a">#4d91ce</color>
     <color name="javashop_color_coupon_b">#ffffff</color>
+
+    <color name="warn_orange">#F07928</color>
 </resources>

+ 2 - 0
resource/src/main/res/values/strings.xml

@@ -47,4 +47,6 @@
     <string name="javashop_send_message">发送验证码</string>
     <string name="javashop_use">立即使用</string>
     <string name="javashop_get">立即领取</string>
+
+    <string name="data_empty">没有数据</string>
 </resources>