Commit f20f8df8 by Wyh

7.03 1、打debug包時默認為測試環境 2、加入查看錯誤日誌頁面 3、修復部分手機息屏之後心跳斷開問題 4、外賣接單問題修復

parent 2c1f9815
package com.gingersoft.gsa.cloud.constans; package com.gingersoft.gsa.cloud.constans;
import android.content.Context; import android.content.Context;
import android.util.Log;
import com.gingersoft.gsa.cloud.base.BuildConfig; import com.gingersoft.gsa.cloud.base.BuildConfig;
import com.gingersoft.gsa.cloud.base.utils.other.SPUtils; import com.gingersoft.gsa.cloud.base.utils.other.SPUtils;
import com.zhy.autolayout.utils.L;
/** /**
* Created by Wyh on 2019/12/21. * Created by Wyh on 2019/12/21.
...@@ -95,17 +93,13 @@ public class HttpsConstans { ...@@ -95,17 +93,13 @@ public class HttpsConstans {
public static String WECHAR_REPORT_SERVER_ADDRESS;// = (isFormal ? WECHAR_REPORT_FORMAL_ADDRESS : WECHAR_REPORT_TEST_ADDRESS) + WECHAR_REPORT_PATH;//正式:WECHAR_REPORT_FORMAL_ADDRESS 測試:WECHAR_REPORT_TEST_ADDRESS public static String WECHAR_REPORT_SERVER_ADDRESS;// = (isFormal ? WECHAR_REPORT_FORMAL_ADDRESS : WECHAR_REPORT_TEST_ADDRESS) + WECHAR_REPORT_PATH;//正式:WECHAR_REPORT_FORMAL_ADDRESS 測試:WECHAR_REPORT_TEST_ADDRESS
public static void init(Context context) { public static void init(Context context) {
isFormal = (int) SPUtils.get(context, "isFormal", 0); isFormal = (int) SPUtils.get(context, "isFormal", -1);
// if (!isSwitchServer) { if (isFormal == -1 && BuildConfig.DEBUG) {
// } //如果沒有手動配置過服務器,並且是DEBUG模式,默認是測試服務器
// isFormal = 1; isFormal = 1;
} else if (isFormal == -1) {
// _SERVER_ADDRESS = (isFormal == 1 ? HTTP_ADDRESS_URL_FORMAL : "http://a.ricepon.com:61177") + "/member-web/api/"; isFormal = 0;
// ROOT_SETTLEMENT_REPORT_SERVER_ADDRESS_FORMAL = isFormal ==1 ? HTTP_ADDRESS_URL_FORMAL : REPORT_TEST_ADDRESS; }
// ROOT_SERVER_ADDRESS_FORMAL = (isFormal == 1 ? HTTP_ADDRESS_URL_FORMAL : HTTP_ADDRESS_URL_HK) + PATH;
// ROOT_URL = isFormal ==1 ? ROOT_FORMAL_URL : ROOT_HK_TEST_URL;//正式:ROOT_FORMAL_URL 測試:ROOT_HK_TEST_URL
// REPORT_SERVER_ADDRESS = (isFormal ==1 ? REPORT_FORMAL_ADDRESS : REPORT_TEST_ADDRESS) + REPORT_PATH;//測試:REPORT_FORMAL_ADDRESS 正式:REPORT_TEST_ADDRESS
// WECHAR_REPORT_SERVER_ADDRESS = (isFormal == 1 ? WECHAR_REPORT_FORMAL_ADDRESS : WECHAR_REPORT_TEST_ADDRESS) + WECHAR_REPORT_PATH;//正式:WECHAR_REPORT_FORMAL_ADDRESS 測試:WECHAR_REPORT_TEST_ADDRESS
switch (isFormal) { switch (isFormal) {
default: default:
_SERVER_ADDRESS = HTTP_ADDRESS_URL_FORMAL + "/member-web/api/"; _SERVER_ADDRESS = HTTP_ADDRESS_URL_FORMAL + "/member-web/api/";
......
...@@ -81,104 +81,18 @@ public class SwitchServerActivity extends BaseActivity<SwitchServerPresenter> im ...@@ -81,104 +81,18 @@ public class SwitchServerActivity extends BaseActivity<SwitchServerPresenter> im
public void initData(@Nullable Bundle savedInstanceState) { public void initData(@Nullable Bundle savedInstanceState) {
String nowServer = HttpsConstans.ROOT_SERVER_ADDRESS_FORMAL; String nowServer = HttpsConstans.ROOT_SERVER_ADDRESS_FORMAL;
tvNowServer.setText("當前服務器:" + nowServer); tvNowServer.setText("當前服務器:" + nowServer);
((RadioButton) radioGroup.getChildAt(HttpsConstans.isFormal)).setChecked(true);
int defaultSelect = (Integer) SPUtils.get(this, "isFormal", -1);
if (defaultSelect == -1) {
defaultSelect = HttpsConstans.isFormal;
}
((RadioButton) radioGroup.getChildAt(defaultSelect)).setChecked(true);
radioGroup.setOnCheckedChangeListener((group, checkedId) -> { radioGroup.setOnCheckedChangeListener((group, checkedId) -> {
SPUtils.put(mContext, "isFormal", group.indexOfChild(findViewById(checkedId))); SPUtils.put(mContext, "isFormal", group.indexOfChild(findViewById(checkedId)));
ToastUtils.show(mContext, "已切換環境,下次重啟生效"); ToastUtils.show(mContext, "已切換環境,下次重啟生效");
}); });
// rbHK.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
// @Override
// public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
// setChecked(2);
// }
// });
// rbFormal.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
// @Override
// public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
// setChecked(1);
// }
// });
// rb_youchang.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
// @Override
// public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
// setChecked(3);
// }
// });
// rb_shiwei.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
// @Override
// public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
// setChecked(4);
// }
// });
// rb_shishu.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
// @Override
// public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
// setChecked(5);
// }
// });
// });
switchServer.setOnClickListener(v -> { switchServer.setOnClickListener(v -> {
// GsaCloudApplication.initDomainUrl();
GsaCloudApplication.isLogin = false; GsaCloudApplication.isLogin = false;
// CC.obtainBuilder("User.Component.Login")
// .setActionName("showActivityA")
// .build()
// .call();
// finish();
System.exit(0); System.exit(0);
}); });
} }
// private void setChecked(int i) {
// switch (i) {
// case 1:
// rbHK.setChecked(false);
// rb_youchang.setChecked(false);
// rb_shiwei.setChecked(false);
// rb_shishu.setChecked(false);
// rbFormal.setChecked(true);
// break;
// case 2:
// rbFormal.setChecked(false);
// rb_youchang.setChecked(false);
// rb_shiwei.setChecked(false);
// rb_shishu.setChecked(false);
// rbHK.setChecked(true);
// break;
// case 3:
// rbHK.setChecked(false);
// rbFormal.setChecked(false);
// rb_shiwei.setChecked(false);
// rb_shishu.setChecked(false);
// rb_youchang.setChecked(true);
// break;
// case 4:
// rbHK.setChecked(false);
// rbFormal.setChecked(false);
// rb_youchang.setChecked(false);
// rb_shishu.setChecked(false);
// rb_shiwei.setChecked(true);
// break;
// case 5:
// rbHK.setChecked(false);
// rbFormal.setChecked(false);
// rb_youchang.setChecked(false);
// rb_shiwei.setChecked(false);
// rb_shishu.setChecked(true);
// break;
// }
// SPUtils.put(this, "isFormal", i);
// }
@Override @Override
public void initIntent() { public void initIntent() {
......
...@@ -50,6 +50,8 @@ dependencies { ...@@ -50,6 +50,8 @@ dependencies {
api project(':updateApk') api project(':updateApk')
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
annotationProcessor rootProject.ext.dependencies["dagger2-compiler"] annotationProcessor rootProject.ext.dependencies["dagger2-compiler"]
debugImplementation rootProject.ext.dependencies["canary-debug"] debugImplementation rootProject.ext.dependencies["canary-debug"]
releaseImplementation rootProject.ext.dependencies["canary-release"] releaseImplementation rootProject.ext.dependencies["canary-release"]
......
...@@ -4,20 +4,21 @@ ...@@ -4,20 +4,21 @@
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<application> <application>
<activity android:name=".mvp.ui.activity.NewMainActivity"/> <activity android:name=".mvp.ui.activity.NewMainActivity" />
<activity android:name=".mvp.ui.activity.MainActivity"/> <activity android:name=".mvp.ui.activity.MainActivity" />
<activity android:name=".mvp.ui.activity.ReportActivity"/> <activity android:name=".mvp.ui.activity.ReportActivity" />
<activity android:name=".mvp.ui.activity.SettlementActivity" /> <activity android:name=".mvp.ui.activity.SettlementActivity" />
<activity android:name=".mvp.ui.activity.SettlementReportActivity" /> <activity android:name=".mvp.ui.activity.SettlementReportActivity" />
<activity android:name=".mvp.ui.activity.LookLogActivity" />
<!-- arms配置 --> <!-- arms配置 -->
<meta-data <meta-data
android:name="com.gingersoft.gsa.cloud.globalconfig.GlobalConfiguration" android:name="com.gingersoft.gsa.cloud.globalconfig.GlobalConfiguration"
android:value="ConfigModule" /> android:value="ConfigModule" />
<meta-data <meta-data
android:name="design_width_in_dp" android:name="design_width_in_dp"
android:value="360"/> android:value="360" />
<meta-data <meta-data
android:name="design_height_in_dp" android:name="design_height_in_dp"
android:value="640"/> android:value="640" />
</application> </application>
</manifest> </manifest>
...@@ -2,6 +2,13 @@ ...@@ -2,6 +2,13 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.gingersoft.gsa.cloud.main"> package="com.gingersoft.gsa.cloud.main">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
<application <application
android:name="com.gingersoft.gsa.cloud.base.application.GsaCloudApplication" android:name="com.gingersoft.gsa.cloud.base.application.GsaCloudApplication"
android:allowBackup="true" android:allowBackup="true"
...@@ -10,6 +17,7 @@ ...@@ -10,6 +17,7 @@
android:networkSecurityConfig="@xml/network_android" android:networkSecurityConfig="@xml/network_android"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">
<activity android:name=".mvp.ui.activity.LookLogActivity"></activity>
<activity android:name=".mvp.ui.activity.ReportActivity" /> <activity android:name=".mvp.ui.activity.ReportActivity" />
<activity android:name=".mvp.ui.activity.MainActivity" /> <activity android:name=".mvp.ui.activity.MainActivity" />
<activity android:name=".mvp.ui.activity.SettlementActivity" /> <activity android:name=".mvp.ui.activity.SettlementActivity" />
...@@ -30,17 +38,10 @@ ...@@ -30,17 +38,10 @@
android:value="ConfigModule" /> android:value="ConfigModule" />
<meta-data <meta-data
android:name="design_width_in_dp" android:name="design_width_in_dp"
android:value="360"/> android:value="360" />
<meta-data <meta-data
android:name="design_height_in_dp" android:name="design_height_in_dp"
android:value="640"/> android:value="640" />
</application> </application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
</manifest> </manifest>
\ No newline at end of file
package com.gingersoft.gsa.cloud.main.mvp.ui.activity
import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.LinearLayoutManager
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication
import com.gingersoft.gsa.cloud.base.utils.file.FileUtils
import com.gingersoft.gsa.cloud.main.R
import kotlinx.android.synthetic.main.activity_look_log.*
import java.io.BufferedReader
import java.io.File
import java.io.FileInputStream
import java.io.InputStreamReader
class LookLogActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_look_log)
log_top_bar.setTitle(GsaCloudApplication.getRestaurantName(this))
log_top_bar.addLeftImageButton(R.drawable.icon_return, R.id.iv_left_back).setOnClickListener { onBackPressed() }
log_top_bar.setBackgroundColor(ContextCompat.getColor(this, R.color.theme_color))
val file = File(FileUtils.ERRORLOG_PATH)
val files = file.listFiles()
files?.let {
val ml = ArrayList<File>()
for(i in files.size-1 downTo 0){
ml.add(files[i])
}
rv_log.layoutManager = LinearLayoutManager(this)
val logAdapter = LogAdapter(ml)
logAdapter.setOnItemClickListener { adapter, view, position ->
scroll_log.visibility = View.VISIBLE
var x = ml[position]
if (!x.isDirectory) {
val fileInputStream = FileInputStream(x)
val inputStreamReader = InputStreamReader(fileInputStream)
val bufferedReader = BufferedReader(inputStreamReader)
var line: String?
var content = ""
do {
line = bufferedReader.readLine()
if (line != null) {
content += line
} else {
break
}
} while (true)
tv_log_details.text = content
// tv_log_details.movementMethod = ScrollingMovementMethod.getInstance()
fileInputStream.close()
}
}
rv_log.adapter = logAdapter
}
}
class LogAdapter(files: MutableList<File>) : BaseQuickAdapter<File, BaseViewHolder>(R.layout.layout_log_name, files) {
override fun convert(holder: BaseViewHolder, item: File) {
holder.setText(R.id.tv_log_name, item.name)
}
}
override fun onBackPressed() {
if (scroll_log.visibility == View.VISIBLE) {
scroll_log.visibility = View.GONE
} else {
super.onBackPressed()
}
}
}
...@@ -131,6 +131,7 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl ...@@ -131,6 +131,7 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
public int initView(@Nullable Bundle savedInstanceState) { public int initView(@Nullable Bundle savedInstanceState) {
return R.layout.activity_new_main; //如果你不需要框架帮你设置 setContentView(id) 需要自行设置,请返回 0 return R.layout.activity_new_main; //如果你不需要框架帮你设置 setContentView(id) 需要自行设置,请返回 0
} }
@Override @Override
public void initData(@Nullable Bundle savedInstanceState) { public void initData(@Nullable Bundle savedInstanceState) {
// mPresenter.requestExternalStoragePermission(); // mPresenter.requestExternalStoragePermission();
...@@ -167,7 +168,7 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl ...@@ -167,7 +168,7 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
if(((int) SPUtils.get(mContext, "isFormal", 0)) != 0){ if (((int) SPUtils.get(mContext, "isFormal", 0)) != 0) {
tv_version_name.setText("v_" + DeviceUtils.getVersionName(this) + "\u1500Beta"); tv_version_name.setText("v_" + DeviceUtils.getVersionName(this) + "\u1500Beta");
} else { } else {
tv_version_name.setText("v_" + DeviceUtils.getVersionName(this)); tv_version_name.setText("v_" + DeviceUtils.getVersionName(this));
...@@ -183,6 +184,7 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl ...@@ -183,6 +184,7 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
if (BuildConfig.DEBUG) { if (BuildConfig.DEBUG) {
mainSideMenuBeans.add(new MainSideMenuBean(R.drawable.ic_setting, "複製Token")); mainSideMenuBeans.add(new MainSideMenuBean(R.drawable.ic_setting, "複製Token"));
mainSideMenuBeans.add(new MainSideMenuBean(R.drawable.ic_setting, "查看日誌"));
mainSideMenuBeans.add(new MainSideMenuBean(R.drawable.ic_mall_center, "商城中心")); mainSideMenuBeans.add(new MainSideMenuBean(R.drawable.ic_mall_center, "商城中心"));
mainSideMenuBeans.add(new MainSideMenuBean(R.drawable.ic_about_us, "關於我們")); mainSideMenuBeans.add(new MainSideMenuBean(R.drawable.ic_about_us, "關於我們"));
mainSideMenuBeans.add(new MainSideMenuBean(R.drawable.ic_password, "修改密碼")); mainSideMenuBeans.add(new MainSideMenuBean(R.drawable.ic_password, "修改密碼"));
...@@ -219,6 +221,9 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl ...@@ -219,6 +221,9 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
case "清機": case "清機":
launchActivity(new Intent(mContext, SettlementActivity.class)); launchActivity(new Intent(mContext, SettlementActivity.class));
break; break;
case "查看日誌":
launchActivity(new Intent(mContext, LookLogActivity.class));
break;
} }
}); });
} }
......
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:descendantFocusability="afterDescendants"
android:orientation="vertical"
tools:context="com.gingersoft.gsa.cloud.main.mvp.ui.activity.LookLogActivity">
<com.qmuiteam.qmui.widget.QMUITopBar
android:id="@+id/log_top_bar"
android:layout_width="match_parent"
android:layout_height="@dimen/pickerview_topbar_height"
android:fitsSystemWindows="true"
app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color"
app:qmui_topbar_title_color="@color/theme_white_color" />
<ScrollView
android:id="@+id/scroll_log"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone">
<TextView
android:id="@+id/tv_log_details"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:focusableInTouchMode="true"
android:textColor="@color/theme_333_color"
android:textColorHighlight="#CCCCCC"
android:textIsSelectable="true"
android:textSize="@dimen/dp_14" />
</ScrollView>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_log"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/tv_log_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="name"
android:padding="@dimen/dp_10"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_16" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/dp_1"
android:background="@color/color_ccc" />
</LinearLayout>
\ No newline at end of file
...@@ -453,7 +453,10 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -453,7 +453,10 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
} }
} }
} }
launch({
//單獨包起來,哪怕這接口報錯也不要影響到正常的邏輯
repository.addPrj(dataBean.Order_ID.toString(), restaurantId, ids.toString()) repository.addPrj(dataBean.Order_ID.toString(), restaurantId, ids.toString())
},{})
if (this.code == "1") { if (this.code == "1") {
listener.invoke(OrderDelivery, true) listener.invoke(OrderDelivery, true)
// 打印印單 // 打印印單
......
...@@ -16,6 +16,7 @@ import android.media.SoundPool ...@@ -16,6 +16,7 @@ import android.media.SoundPool
import android.os.Binder import android.os.Binder
import android.os.Build import android.os.Build
import android.os.IBinder import android.os.IBinder
import android.os.PowerManager
import android.util.Log import android.util.Log
import android.widget.RemoteViews import android.widget.RemoteViews
import androidx.annotation.RequiresApi import androidx.annotation.RequiresApi
...@@ -49,19 +50,37 @@ class GetInfoUpdateService : Service() { ...@@ -49,19 +50,37 @@ class GetInfoUpdateService : Service() {
var client: OkHttpClient? = null var client: OkHttpClient? = null
var postCallBack: PostCallBack? = null var postCallBack: PostCallBack? = null
private lateinit var mReceiver: ClearHeartBroadcastReceiver
private var newWakeLock: PowerManager.WakeLock? = null
val restaurantId by lazy { val restaurantId by lazy {
GsaCloudApplication.getRestaurantId(this) GsaCloudApplication.getRestaurantId(this)
} }
override fun onBind(intent: Intent?): IBinder? { override fun onBind(intent: Intent?): IBinder? {
return MyBind() return MyBind()
} }
interface PostCallBack {
fun callBack(type: Int) override fun onCreate() {
super.onCreate()
val mFilter = IntentFilter(AppConstans.CLEAR_ORDER_RECEIVING_HEART)
mReceiver = ClearHeartBroadcastReceiver()
registerReceiver(mReceiver, mFilter)
InitSocketThread().start()
isDestroy = false
//讓設備在休眠狀態下保持運行
val pm = getSystemService(Context.POWER_SERVICE) as PowerManager
newWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, this.javaClass.name)
//Value CPU Screen KeyBoard
//PARTIAL_WAKE_LOCK On Off Off
//SCREEN_DIM_WAKE_LOCK On Dim Off
//SCREEN_BRIGHT_WAKE_LOCK On Bright Off
//FULL_WAKE_LOCK On Bright Bright
newWakeLock?.acquire()
} }
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
...@@ -124,18 +143,6 @@ class GetInfoUpdateService : Service() { ...@@ -124,18 +143,6 @@ class GetInfoUpdateService : Service() {
} }
} }
private lateinit var mReceiver: ClearHeartBroadcastReceiver
override fun onCreate() {
super.onCreate()
val mFilter = IntentFilter(AppConstans.CLEAR_ORDER_RECEIVING_HEART)
mReceiver = ClearHeartBroadcastReceiver()
registerReceiver(mReceiver, mFilter)
InitSocketThread().start()
isDestroy = false
}
internal inner class InitSocketThread : Thread() { internal inner class InitSocketThread : Thread() {
override fun run() { override fun run() {
super.run() super.run()
...@@ -199,6 +206,7 @@ class GetInfoUpdateService : Service() { ...@@ -199,6 +206,7 @@ class GetInfoUpdateService : Service() {
//連接斷開, //連接斷開,
Log.e(TAG, "onClosing") Log.e(TAG, "onClosing")
// InitSocketThread().start()//创建一个新的连接 // InitSocketThread().start()//创建一个新的连接
} }
override fun onClosed(webSocket: WebSocket?, code: Int, reason: String?) { override fun onClosed(webSocket: WebSocket?, code: Int, reason: String?) {
...@@ -334,6 +342,9 @@ class GetInfoUpdateService : Service() { ...@@ -334,6 +342,9 @@ class GetInfoUpdateService : Service() {
RxTimerUtil.cancel() RxTimerUtil.cancel()
//停止前台服務 //停止前台服務
stopForeground(true) stopForeground(true)
//清除保持喚醒
newWakeLock?.release()
newWakeLock = null
} }
private fun clearHeart() { private fun clearHeart() {
...@@ -351,5 +362,10 @@ class GetInfoUpdateService : Service() { ...@@ -351,5 +362,10 @@ class GetInfoUpdateService : Service() {
} }
} }
interface PostCallBack {
fun callBack(type: Int)
}
class MsgBean(var type: Int, var token: String) class MsgBean(var type: Int, var token: String)
} }
\ No newline at end of file
...@@ -96,7 +96,6 @@ class OrderDetailsActivity : BaseActivity() { ...@@ -96,7 +96,6 @@ class OrderDetailsActivity : BaseActivity() {
if (orderDetails.order_type == 7) { if (orderDetails.order_type == 7) {
//製作中的自取,應該製作完成、打印、取消訂單 //製作中的自取,應該製作完成、打印、取消訂單
btnList.add(BtnBuilder().getProductionCompletedBtn()) btnList.add(BtnBuilder().getProductionCompletedBtn())
tv_order_state.setTextColor(resources.getColor(R.color.order_state0_color)) tv_order_state.setTextColor(resources.getColor(R.color.order_state0_color))
} else { } else {
//製作中的外賣,應該有打印、取消物流、取消訂單 //製作中的外賣,應該有打印、取消物流、取消訂單
...@@ -211,12 +210,13 @@ class OrderDetailsActivity : BaseActivity() { ...@@ -211,12 +210,13 @@ class OrderDetailsActivity : BaseActivity() {
} }
OrderDelivery -> { OrderDelivery -> {
//已確認訂單,重新刷新當前頁面 //已確認訂單,重新刷新當前頁面
ToastUtils.show(this@OrderDetailsActivity, if (isSuccess) { if(isSuccess){
"訂單已確認" finish()
ToastUtils.show(this@OrderDetailsActivity, "訂單已確認")
} else { } else {
"訂單確認失敗" ToastUtils.show(this@OrderDetailsActivity, "訂單確認失敗")
}) }
getOrderDetails(orderId, binding) // getOrderDetails(orderId, binding)
} }
Closing -> { Closing -> {
ToastUtils.show(this@OrderDetailsActivity, if (isSuccess) { ToastUtils.show(this@OrderDetailsActivity, if (isSuccess) {
...@@ -226,12 +226,15 @@ class OrderDetailsActivity : BaseActivity() { ...@@ -226,12 +226,15 @@ class OrderDetailsActivity : BaseActivity() {
}) })
} }
PageViewModel.ProductionComplete -> { PageViewModel.ProductionComplete -> {
if(isSuccess){
finish()
}
ToastUtils.show(this@OrderDetailsActivity, if (isSuccess) { ToastUtils.show(this@OrderDetailsActivity, if (isSuccess) {
"製作完成" "製作完成"
} else { } else {
"修改訂單狀態失敗" "修改訂單狀態失敗"
}) })
getOrderDetails(orderId, binding) // getOrderDetails(orderId, binding)
} }
else -> { else -> {
cancelDialogForLoading() cancelDialogForLoading()
......
...@@ -43,7 +43,7 @@ class OtherOrdersAdapter(var context: Context) : Adapter<OtherOrdersAdapter.View ...@@ -43,7 +43,7 @@ class OtherOrdersAdapter(var context: Context) : Adapter<OtherOrdersAdapter.View
val data = this.databeans!![position] val data = this.databeans!![position]
holder.binding.data = data holder.binding.data = data
holder.binding.isSelf = data.order_type == 7 holder.binding.isSelf = data.order_type == 7
if (data.isDelete == 0) {
holder.binding.deliveryState = when (data.curStat) { holder.binding.deliveryState = when (data.curStat) {
1 -> "已通知物流" 1 -> "已通知物流"
2 -> "配送員已接單" 2 -> "配送員已接單"
...@@ -57,6 +57,9 @@ class OtherOrdersAdapter(var context: Context) : Adapter<OtherOrdersAdapter.View ...@@ -57,6 +57,9 @@ class OtherOrdersAdapter(var context: Context) : Adapter<OtherOrdersAdapter.View
10 -> "已指派另一位配送員" 10 -> "已指派另一位配送員"
else -> "" else -> ""
} }
} else {
holder.binding.deliveryState = ""
}
var state: String? = null var state: String? = null
val bg = GradientDrawable() val bg = GradientDrawable()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment