|
|
@@ -1,491 +1,491 @@ |
|
|
|
package com.bonait.bnframework.ui.activity; |
|
|
|
|
|
|
|
import static com.bonait.bnframework.MainApplication.getContext; |
|
|
|
|
|
|
|
import android.annotation.SuppressLint; |
|
|
|
import android.content.Intent; |
|
|
|
import android.graphics.drawable.AnimationDrawable; |
|
|
|
import android.os.Bundle; |
|
|
|
import android.os.Handler; |
|
|
|
import android.os.Looper; |
|
|
|
import android.os.Message; |
|
|
|
import android.os.SystemClock; |
|
|
|
import android.view.View; |
|
|
|
|
|
|
|
import androidx.annotation.NonNull; |
|
|
|
import androidx.annotation.Nullable; |
|
|
|
import androidx.constraintlayout.widget.ConstraintLayout; |
|
|
|
|
|
|
|
import com.bonait.bnframework.HBL.Thread.ThreadManager; |
|
|
|
import com.bonait.bnframework.R; |
|
|
|
import com.bonait.bnframework.Service.ModbusHelper; |
|
|
|
import com.bonait.bnframework.ViewModel.Adapter.gongxubuzhou_adapter1; |
|
|
|
import com.bonait.bnframework.ViewModel.Adapter.gongxubuzhou_adapter2; |
|
|
|
import com.bonait.bnframework.business.ExecuteTheRecipe; |
|
|
|
import com.bonait.bnframework.common.base.BaseActivity; |
|
|
|
import com.bonait.bnframework.common.constant.ConfigName; |
|
|
|
import com.bonait.bnframework.common.constant.DataBus; |
|
|
|
import com.bonait.bnframework.common.db.mode.BPA_GOODSRECIPE; |
|
|
|
import com.bonait.bnframework.common.utils.DimensUtil; |
|
|
|
import com.bonait.bnframework.common.utils.DisplayManager; |
|
|
|
import com.bonait.bnframework.databinding.ActivityRecProcessBinding; |
|
|
|
import com.bonait.bnframework.ui.adapter.RecProcessAdapter; |
|
|
|
import com.bonait.bnframework.ui.dialog.DeviceControlDialog; |
|
|
|
import com.bonait.bnframework.ui.widget.NewToastUtil; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Collections; |
|
|
|
|
|
|
|
/** |
|
|
|
* @author: liup |
|
|
|
* @description: 录制工序 |
|
|
|
* @date: 2024/5/25 16:00. |
|
|
|
*/ |
|
|
|
public class RecProcessActivity extends BaseActivity { |
|
|
|
protected ActivityRecProcessBinding viewBinding; |
|
|
|
private DeviceControlDialog deviceControlDialog; |
|
|
|
private boolean isFire = false; |
|
|
|
private boolean isStir = false; |
|
|
|
private boolean isUp = true; |
|
|
|
private final int MSG_STOP_FOOD = 1001; |
|
|
|
private final int MSG_STOP_SILOS = 1002; |
|
|
|
private final int MSG_STOP_STIR = 1003; |
|
|
|
private final int MSG_STOP_UPDOWN = 1004; |
|
|
|
/** |
|
|
|
* 1-6个主料仓名称 |
|
|
|
*/ |
|
|
|
private ArrayList<String> mainFoods = new ArrayList<>(); |
|
|
|
/** |
|
|
|
* 商品id |
|
|
|
*/ |
|
|
|
private String goodId = ""; |
|
|
|
/** |
|
|
|
* 子属性组合id 属性组合名称 |
|
|
|
*/ |
|
|
|
private String subAttributeGroupId = ""; |
|
|
|
private String subAttributeGroupName = ""; |
|
|
|
|
|
|
|
@SuppressLint("HandlerLeak") |
|
|
|
private Handler handler = new Handler(Looper.getMainLooper()){ |
|
|
|
@Override |
|
|
|
public void handleMessage(@NonNull Message msg) { |
|
|
|
super.handleMessage(msg); |
|
|
|
switch (msg.what){ |
|
|
|
case MSG_STOP_FOOD: |
|
|
|
viewBinding.device.btnMainFood.setBackgroundResource(R.drawable.bg_device_position_btn); |
|
|
|
break; |
|
|
|
case MSG_STOP_SILOS: |
|
|
|
viewBinding.device.btnSilos.setBackgroundResource(R.drawable.bg_device_position_btn); |
|
|
|
break; |
|
|
|
case MSG_STOP_STIR: |
|
|
|
viewBinding.device.btnFire.setBackgroundResource(R.drawable.bg_device_position_btn); |
|
|
|
break; |
|
|
|
case MSG_STOP_UPDOWN: |
|
|
|
viewBinding.device.btnUpDown.setBackgroundResource(R.drawable.bg_device_position_btn); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
@Override |
|
|
|
protected void onCreate(@Nullable Bundle savedInstanceState) { |
|
|
|
super.onCreate(savedInstanceState); |
|
|
|
viewBinding = ActivityRecProcessBinding.inflate(getLayoutInflater()); |
|
|
|
setContentView(viewBinding.getRoot()); |
|
|
|
DisplayManager.scaleViewGroup(viewBinding.getRoot()); |
|
|
|
Intent intent = getIntent(); |
|
|
|
if(intent != null){ |
|
|
|
if(intent.getStringArrayListExtra("mainFoods")!=null){ |
|
|
|
mainFoods = intent.getStringArrayListExtra("mainFoods"); |
|
|
|
} |
|
|
|
goodId = intent.getStringExtra("goodId"); |
|
|
|
subAttributeGroupId = intent.getStringExtra("subAttributeGroupId"); |
|
|
|
subAttributeGroupName = intent.getStringExtra("subAttributeGroupName"); |
|
|
|
} |
|
|
|
initView(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private void initView(){ |
|
|
|
viewBinding.device.btnMainFood.setOnClickListener(view->{ |
|
|
|
showControlDialog(3); |
|
|
|
}); |
|
|
|
viewBinding.device.btnSilos.setOnClickListener(view->{ |
|
|
|
showControlDialog(2); |
|
|
|
}); |
|
|
|
viewBinding.device.btnStir.setOnClickListener(view->{ |
|
|
|
showControlDialog(4); |
|
|
|
}); |
|
|
|
viewBinding.device.btnUpDown.setOnClickListener(view->{ |
|
|
|
showControlDialog(4); |
|
|
|
}); |
|
|
|
viewBinding.device.btnFire.setOnClickListener(view->{ |
|
|
|
showControlDialog(1); |
|
|
|
}); |
|
|
|
viewBinding.title.setText(subAttributeGroupName+""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 重置 |
|
|
|
*/ |
|
|
|
private void clear(){ |
|
|
|
viewBinding.device.btnMainFood.setBackgroundResource(R.drawable.bg_device_position_btn); |
|
|
|
viewBinding.device.btnSilos.setBackgroundResource(R.drawable.bg_device_position_btn); |
|
|
|
viewBinding.device.btnFire.setBackgroundResource(R.drawable.bg_device_position_btn); |
|
|
|
viewBinding.device.btnUpDown.setBackgroundResource(R.drawable.bg_device_position_btn); |
|
|
|
viewBinding.device.btnStir.setBackgroundResource(R.drawable.bg_device_position_btn); |
|
|
|
viewBinding.device.fireView.SetLevel(0); |
|
|
|
isFire = false; |
|
|
|
isUp = true; |
|
|
|
isStir = false; |
|
|
|
changeDevicePic(); |
|
|
|
close(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 关闭所有接口 |
|
|
|
*/ |
|
|
|
private void close(){ |
|
|
|
ThreadManager.get().execute(new Thread(() -> ModbusHelper.get().setStirMotor(0,2))); |
|
|
|
ThreadManager.get().execute(new Thread(() -> ModbusHelper.get().setUpdDownMotor(1))); |
|
|
|
ThreadManager.get().execute(new Thread(() -> ModbusHelper.get().Heating(0,false))); |
|
|
|
ThreadManager.get().execute(new Thread(() -> { |
|
|
|
ModbusHelper.get().addWater(0f,true); |
|
|
|
})); |
|
|
|
ThreadManager.get().execute(new Thread(() -> { |
|
|
|
ModbusHelper.get().addThickenWater(0f,true); |
|
|
|
})); |
|
|
|
ThreadManager.get().execute(new Thread(() -> { |
|
|
|
for(int i =1;i<=9;i++){ |
|
|
|
ModbusHelper.get().addMaterial(0f,i,true); |
|
|
|
} |
|
|
|
})); |
|
|
|
} |
|
|
|
|
|
|
|
private DeviceControlDialog.DeviceCallBack deviceCallBack = new DeviceControlDialog.DeviceCallBack() { |
|
|
|
@Override |
|
|
|
public void onClickEvent(int type, String value,long time) { |
|
|
|
switch (type){ |
|
|
|
case 1: |
|
|
|
if(value.contains("启动加热")){ |
|
|
|
isFire = true; |
|
|
|
String[] res = value.split("\\|"); |
|
|
|
if(res[1].equals("0")){ |
|
|
|
isFire=false; |
|
|
|
viewBinding.device.fireView.SetLevel(0); |
|
|
|
}else { |
|
|
|
viewBinding.device.fireView.SetLevel(Integer.parseInt(res[1])); |
|
|
|
} |
|
|
|
}else if(value.contains("停止加热")){ |
|
|
|
isFire=false; |
|
|
|
viewBinding.device.fireView.SetLevel(0); |
|
|
|
} |
|
|
|
changeDevicePic(); |
|
|
|
break; |
|
|
|
case 2: |
|
|
|
viewBinding.device.btnSilos.setBackgroundResource(R.drawable.bg_btn_run_anim_looper); |
|
|
|
((AnimationDrawable)viewBinding.device.btnSilos.getBackground()).start(); |
|
|
|
handler.removeMessages(MSG_STOP_SILOS); |
|
|
|
handler.sendEmptyMessageDelayed(MSG_STOP_SILOS,time); |
|
|
|
break; |
|
|
|
case 3: |
|
|
|
viewBinding.device.btnMainFood.setBackgroundResource(R.drawable.bg_btn_run_anim_looper); |
|
|
|
((AnimationDrawable)viewBinding.device.btnMainFood.getBackground()).start(); |
|
|
|
handler.removeMessages(MSG_STOP_FOOD); |
|
|
|
handler.sendEmptyMessageDelayed(MSG_STOP_FOOD,time); |
|
|
|
break; |
|
|
|
case 4: |
|
|
|
switch (value){ |
|
|
|
case "开始搅拌": |
|
|
|
isStir=true; |
|
|
|
viewBinding.device.btnStir.setBackgroundResource(R.drawable.bg_btn_run_anim_looper); |
|
|
|
((AnimationDrawable)viewBinding.device.btnStir.getBackground()).start(); |
|
|
|
handler.removeMessages(MSG_STOP_SILOS); |
|
|
|
handler.sendEmptyMessageDelayed(MSG_STOP_SILOS,time); |
|
|
|
break; |
|
|
|
case "停止搅拌": |
|
|
|
viewBinding.device.btnStir.setBackgroundResource(R.drawable.bg_device_position_btn); |
|
|
|
isStir=false; |
|
|
|
break; |
|
|
|
case "电机下降": |
|
|
|
ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) viewBinding.device.btnUpDown.getLayoutParams(); |
|
|
|
params.topMargin = DimensUtil.getDimens(250); |
|
|
|
viewBinding.device.btnUpDown.setLayoutParams(params); |
|
|
|
|
|
|
|
ConstraintLayout.LayoutParams paramsFood = (ConstraintLayout.LayoutParams) viewBinding.device.btnMainFood.getLayoutParams(); |
|
|
|
paramsFood.topMargin = DimensUtil.getDimens(200); |
|
|
|
viewBinding.device.btnMainFood.setLayoutParams(paramsFood); |
|
|
|
|
|
|
|
viewBinding.device.btnUpDown.setBackgroundResource(R.drawable.bg_btn_run_anim_looper); |
|
|
|
((AnimationDrawable)viewBinding.device.btnUpDown.getBackground()).start(); |
|
|
|
handler.removeMessages(MSG_STOP_UPDOWN); |
|
|
|
handler.sendEmptyMessageDelayed(MSG_STOP_UPDOWN,time); |
|
|
|
isUp=false; |
|
|
|
break; |
|
|
|
case "电机上升": |
|
|
|
ConstraintLayout.LayoutParams params2 = (ConstraintLayout.LayoutParams) viewBinding.device.btnUpDown.getLayoutParams(); |
|
|
|
params2.topMargin = DimensUtil.getDimens(150); |
|
|
|
viewBinding.device.btnUpDown.setLayoutParams(params2); |
|
|
|
ConstraintLayout.LayoutParams paramsFood2 = (ConstraintLayout.LayoutParams) viewBinding.device.btnMainFood.getLayoutParams(); |
|
|
|
paramsFood2.topMargin = DimensUtil.getDimens(20); |
|
|
|
viewBinding.device.btnMainFood.setLayoutParams(paramsFood2); |
|
|
|
|
|
|
|
viewBinding.device.btnUpDown.setBackgroundResource(R.drawable.bg_btn_run_anim_looper); |
|
|
|
((AnimationDrawable)viewBinding.device.btnUpDown.getBackground()).start(); |
|
|
|
handler.removeMessages(MSG_STOP_UPDOWN); |
|
|
|
handler.sendEmptyMessageDelayed(MSG_STOP_UPDOWN,time); |
|
|
|
isUp=true; |
|
|
|
break; |
|
|
|
} |
|
|
|
changeDevicePic(); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void onClickDismiss() { |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
private void changeDevicePic(){ |
|
|
|
if(isFire){ |
|
|
|
if(isStir){ |
|
|
|
if(isUp){ |
|
|
|
viewBinding.device.imgDevice.setImageResource(R.mipmap.device_fire_stir_up); |
|
|
|
}else { |
|
|
|
viewBinding.device.imgDevice.setImageResource(R.mipmap.device_fire_stir_down); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
if(isUp){ |
|
|
|
viewBinding.device.imgDevice.setImageResource(R.mipmap.device_fire_unstir_up); |
|
|
|
}else { |
|
|
|
viewBinding.device.imgDevice.setImageResource(R.mipmap.device_fire_unstir_down); |
|
|
|
} |
|
|
|
} |
|
|
|
}else { |
|
|
|
if(isStir){ |
|
|
|
if(isUp){ |
|
|
|
viewBinding.device.imgDevice.setImageResource(R.mipmap.device_unfire_stir_up); |
|
|
|
}else { |
|
|
|
viewBinding.device.imgDevice.setImageResource(R.mipmap.device_unfire_stir_down); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
if(isUp){ |
|
|
|
viewBinding.device.imgDevice.setImageResource(R.mipmap.device_unfire_unstir_up); |
|
|
|
}else { |
|
|
|
viewBinding.device.imgDevice.setImageResource(R.mipmap.device_unfire_unstir_down); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* |
|
|
|
* @param type 1加热 2液体 3主料 4搅拌 |
|
|
|
*/ |
|
|
|
private void showControlDialog(int type){ |
|
|
|
if(ModbusHelper.get().isBtnStop()){ |
|
|
|
NewToastUtil.getInstance().showToast("设备已急停,请关闭急停按钮再调试!"); |
|
|
|
return; |
|
|
|
} |
|
|
|
if(deviceControlDialog == null){ |
|
|
|
deviceControlDialog = new DeviceControlDialog(); |
|
|
|
} |
|
|
|
Bundle bundle =new Bundle(); |
|
|
|
bundle.putInt("type",type); |
|
|
|
deviceControlDialog.setArguments(bundle); |
|
|
|
deviceControlDialog.setDeviceCallBack(deviceCallBack); |
|
|
|
deviceControlDialog.show(getSupportFragmentManager(), "deviceControl"); |
|
|
|
} |
|
|
|
|
|
|
|
//region 计时器 |
|
|
|
/** |
|
|
|
* 是否启动 |
|
|
|
*/ |
|
|
|
public static boolean IsStart = false; |
|
|
|
/** |
|
|
|
* 是否暂停 |
|
|
|
*/ |
|
|
|
public static boolean IsPause = false; |
|
|
|
/** |
|
|
|
* 当前运行总时长 |
|
|
|
*/ |
|
|
|
public int TimeOut = 0; |
|
|
|
/** |
|
|
|
* 上一次点击时间 |
|
|
|
*/ |
|
|
|
public int ClikTime = 0; |
|
|
|
/** |
|
|
|
* 记录下来的总时间 |
|
|
|
*/ |
|
|
|
private long recordingTime = 0; |
|
|
|
/** |
|
|
|
* 工序步骤 |
|
|
|
*/ |
|
|
|
public ArrayList<BPA_GOODSRECIPE> goodsRecipeList = new ArrayList<>(); |
|
|
|
private RecProcessAdapter recProcessAdapter; |
|
|
|
|
|
|
|
/** |
|
|
|
* 刷新工序 |
|
|
|
*/ |
|
|
|
public void RefreshProcedure() { |
|
|
|
recProcessAdapter.updateData(goodsRecipeList); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 启动定时器 |
|
|
|
*/ |
|
|
|
public void onRecordStart() { |
|
|
|
runOnUiThread(new Runnable() { |
|
|
|
@Override |
|
|
|
public void run() { |
|
|
|
viewBinding.runtime.setBase(SystemClock.elapsedRealtime() - recordingTime);// 跳过已经记录了的时间,起到继续计时的作用 |
|
|
|
viewBinding.runtime.start(); |
|
|
|
viewBinding.textMs.setText("请先{开始}录制"); |
|
|
|
viewBinding.textMs.setVisibility(View.GONE); |
|
|
|
//重置暂停开关 |
|
|
|
IsPause = false; |
|
|
|
viewBinding.pauseGoodmake.SetStatus(false); |
|
|
|
viewBinding.pauseGoodmake.setVisibility(View.VISIBLE); |
|
|
|
ExecuteTheRecipe.WritePLC("暂停开关", false, null); |
|
|
|
|
|
|
|
IsStart = true; |
|
|
|
|
|
|
|
goodsRecipeList.clear();//清空所有工序 |
|
|
|
//刷新工序 |
|
|
|
RefreshProcedure(); |
|
|
|
TimeOut = 0; |
|
|
|
ClikTime = 0; |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 停止计时器 |
|
|
|
*/ |
|
|
|
public void onRecordStop() { |
|
|
|
runOnUiThread(new Runnable() { |
|
|
|
@Override |
|
|
|
public void run() { |
|
|
|
runtime.stop(); |
|
|
|
start_goodmake.SetStatus(false); |
|
|
|
IsStart = false; |
|
|
|
kaishiorstop.setVisibility(View.VISIBLE); |
|
|
|
text_ms.setText("请先{开始}录制"); |
|
|
|
|
|
|
|
|
|
|
|
recordingTime = 0; |
|
|
|
long elapsedMillis = SystemClock.elapsedRealtime() - runtime.getBase(); |
|
|
|
TimeOut = (int) (elapsedMillis / 1000); |
|
|
|
DataBus.getInstance().TimeOut = TimeOut; |
|
|
|
|
|
|
|
//重置暂停开关 |
|
|
|
IsPause = false; |
|
|
|
zanting_goodmake.SetStatus(false); |
|
|
|
zanting_goodmake.setVisibility(View.GONE); |
|
|
|
ExecuteTheRecipe.WritePLC("暂停开关", false, null); |
|
|
|
|
|
|
|
ExecuteTheRecipe.WritePLC("搅拌", false, null); |
|
|
|
ExecuteTheRecipe.WritePLC("加热", false, null); |
|
|
|
ConfigName.getInstance().IsOpenHuoLi = false; |
|
|
|
ExecuteTheRecipe.BottomClick("平移-去1号位"); |
|
|
|
} |
|
|
|
}); |
|
|
|
//自动出餐 |
|
|
|
AutomaticServing(); |
|
|
|
gongyibuzhoujilu.setVisibility(View.VISIBLE); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 暂停计时器 |
|
|
|
*/ |
|
|
|
public void onRecordPause() { |
|
|
|
runOnUiThread(new Runnable() { |
|
|
|
@Override |
|
|
|
public void run() { |
|
|
|
runtime.stop(); |
|
|
|
text_ms.setText("录制{暂停}中"); |
|
|
|
recordingTime = SystemClock.elapsedRealtime() - runtime.getBase();// 保存这次记录了的时间 |
|
|
|
IsPause = true; |
|
|
|
kaishiorstop.setVisibility(View.VISIBLE); |
|
|
|
|
|
|
|
ExecuteTheRecipe.WritePLC("暂停开关", true, null); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 继续计时器 |
|
|
|
*/ |
|
|
|
public void onRecordPauseStart() { |
|
|
|
runOnUiThread(new Runnable() { |
|
|
|
@Override |
|
|
|
public void run() { |
|
|
|
runtime.setBase(SystemClock.elapsedRealtime() - recordingTime);// 跳过已经记录了的时间,起到继续计时的作用 |
|
|
|
runtime.start(); |
|
|
|
text_ms.setText("请先{开始}录制"); |
|
|
|
IsPause = false; |
|
|
|
kaishiorstop.setVisibility(View.GONE); |
|
|
|
ExecuteTheRecipe.WritePLC("暂停开关", false, null); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 启动定时器 |
|
|
|
*/ |
|
|
|
public void onRecordStart_CS() { |
|
|
|
runOnUiThread(new Runnable() { |
|
|
|
@Override |
|
|
|
public void run() { |
|
|
|
guoneichoushui.setVisibility(View.VISIBLE); |
|
|
|
runtime_cs.setBase(SystemClock.elapsedRealtime()); |
|
|
|
runtime_cs.start(); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 停止计时器 |
|
|
|
*/ |
|
|
|
public void onRecordStop_CS() { |
|
|
|
runOnUiThread(new Runnable() { |
|
|
|
@Override |
|
|
|
public void run() { |
|
|
|
guoneichoushui.setVisibility(View.GONE); |
|
|
|
runtime_cs.stop(); |
|
|
|
|
|
|
|
long elapsedMillis = SystemClock.elapsedRealtime() - runtime_cs.getBase(); |
|
|
|
DataBus.getInstance().PumpWaterTimeOut = (int) (elapsedMillis / 1000); |
|
|
|
|
|
|
|
ClikTime = (int) ((SystemClock.elapsedRealtime() - runtime.getBase()) / 1000); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
//endregion |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void onResume() { |
|
|
|
super.onResume(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void onPause() { |
|
|
|
super.onPause(); |
|
|
|
if(handler!=null){ |
|
|
|
handler.removeCallbacksAndMessages(null); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void onDestroy() { |
|
|
|
super.onDestroy(); |
|
|
|
if(handler != null){ |
|
|
|
handler.removeCallbacksAndMessages(null); |
|
|
|
handler = null; |
|
|
|
} |
|
|
|
deviceCallBack = null; |
|
|
|
} |
|
|
|
} |
|
|
|
//package com.bonait.bnframework.ui.activity; |
|
|
|
// |
|
|
|
//import static com.bonait.bnframework.MainApplication.getContext; |
|
|
|
// |
|
|
|
//import android.annotation.SuppressLint; |
|
|
|
//import android.content.Intent; |
|
|
|
//import android.graphics.drawable.AnimationDrawable; |
|
|
|
//import android.os.Bundle; |
|
|
|
//import android.os.Handler; |
|
|
|
//import android.os.Looper; |
|
|
|
//import android.os.Message; |
|
|
|
//import android.os.SystemClock; |
|
|
|
//import android.view.View; |
|
|
|
// |
|
|
|
//import androidx.annotation.NonNull; |
|
|
|
//import androidx.annotation.Nullable; |
|
|
|
//import androidx.constraintlayout.widget.ConstraintLayout; |
|
|
|
// |
|
|
|
//import com.bonait.bnframework.HBL.Thread.ThreadManager; |
|
|
|
//import com.bonait.bnframework.R; |
|
|
|
//import com.bonait.bnframework.Service.ModbusHelper; |
|
|
|
//import com.bonait.bnframework.ViewModel.Adapter.gongxubuzhou_adapter1; |
|
|
|
//import com.bonait.bnframework.ViewModel.Adapter.gongxubuzhou_adapter2; |
|
|
|
//import com.bonait.bnframework.business.ExecuteTheRecipe; |
|
|
|
//import com.bonait.bnframework.common.base.BaseActivity; |
|
|
|
//import com.bonait.bnframework.common.constant.ConfigName; |
|
|
|
//import com.bonait.bnframework.common.constant.DataBus; |
|
|
|
//import com.bonait.bnframework.common.db.mode.BPA_GOODSRECIPE; |
|
|
|
//import com.bonait.bnframework.common.utils.DimensUtil; |
|
|
|
//import com.bonait.bnframework.common.utils.DisplayManager; |
|
|
|
//import com.bonait.bnframework.databinding.ActivityRecProcessBinding; |
|
|
|
//import com.bonait.bnframework.ui.adapter.RecProcessAdapter; |
|
|
|
//import com.bonait.bnframework.ui.dialog.DeviceControlDialog; |
|
|
|
//import com.bonait.bnframework.ui.widget.NewToastUtil; |
|
|
|
// |
|
|
|
//import java.util.ArrayList; |
|
|
|
//import java.util.Collections; |
|
|
|
// |
|
|
|
///** |
|
|
|
// * @author: liup |
|
|
|
// * @description: 录制工序 |
|
|
|
// * @date: 2024/5/25 16:00. |
|
|
|
// */ |
|
|
|
//public class RecProcessActivity extends BaseActivity { |
|
|
|
// protected ActivityRecProcessBinding viewBinding; |
|
|
|
// private DeviceControlDialog deviceControlDialog; |
|
|
|
// private boolean isFire = false; |
|
|
|
// private boolean isStir = false; |
|
|
|
// private boolean isUp = true; |
|
|
|
// private final int MSG_STOP_FOOD = 1001; |
|
|
|
// private final int MSG_STOP_SILOS = 1002; |
|
|
|
// private final int MSG_STOP_STIR = 1003; |
|
|
|
// private final int MSG_STOP_UPDOWN = 1004; |
|
|
|
// /** |
|
|
|
// * 1-6个主料仓名称 |
|
|
|
// */ |
|
|
|
// private ArrayList<String> mainFoods = new ArrayList<>(); |
|
|
|
// /** |
|
|
|
// * 商品id |
|
|
|
// */ |
|
|
|
// private String goodId = ""; |
|
|
|
// /** |
|
|
|
// * 子属性组合id 属性组合名称 |
|
|
|
// */ |
|
|
|
// private String subAttributeGroupId = ""; |
|
|
|
// private String subAttributeGroupName = ""; |
|
|
|
// |
|
|
|
// @SuppressLint("HandlerLeak") |
|
|
|
// private Handler handler = new Handler(Looper.getMainLooper()){ |
|
|
|
// @Override |
|
|
|
// public void handleMessage(@NonNull Message msg) { |
|
|
|
// super.handleMessage(msg); |
|
|
|
// switch (msg.what){ |
|
|
|
// case MSG_STOP_FOOD: |
|
|
|
// viewBinding.device.btnMainFood.setBackgroundResource(R.drawable.bg_device_position_btn); |
|
|
|
// break; |
|
|
|
// case MSG_STOP_SILOS: |
|
|
|
// viewBinding.device.btnSilos.setBackgroundResource(R.drawable.bg_device_position_btn); |
|
|
|
// break; |
|
|
|
// case MSG_STOP_STIR: |
|
|
|
// viewBinding.device.btnFire.setBackgroundResource(R.drawable.bg_device_position_btn); |
|
|
|
// break; |
|
|
|
// case MSG_STOP_UPDOWN: |
|
|
|
// viewBinding.device.btnUpDown.setBackgroundResource(R.drawable.bg_device_position_btn); |
|
|
|
// break; |
|
|
|
// } |
|
|
|
// } |
|
|
|
// }; |
|
|
|
// @Override |
|
|
|
// protected void onCreate(@Nullable Bundle savedInstanceState) { |
|
|
|
// super.onCreate(savedInstanceState); |
|
|
|
// viewBinding = ActivityRecProcessBinding.inflate(getLayoutInflater()); |
|
|
|
// setContentView(viewBinding.getRoot()); |
|
|
|
// DisplayManager.scaleViewGroup(viewBinding.getRoot()); |
|
|
|
// Intent intent = getIntent(); |
|
|
|
// if(intent != null){ |
|
|
|
// if(intent.getStringArrayListExtra("mainFoods")!=null){ |
|
|
|
// mainFoods = intent.getStringArrayListExtra("mainFoods"); |
|
|
|
// } |
|
|
|
// goodId = intent.getStringExtra("goodId"); |
|
|
|
// subAttributeGroupId = intent.getStringExtra("subAttributeGroupId"); |
|
|
|
// subAttributeGroupName = intent.getStringExtra("subAttributeGroupName"); |
|
|
|
// } |
|
|
|
// initView(); |
|
|
|
// |
|
|
|
// } |
|
|
|
// |
|
|
|
// private void initView(){ |
|
|
|
// viewBinding.device.btnMainFood.setOnClickListener(view->{ |
|
|
|
// showControlDialog(3); |
|
|
|
// }); |
|
|
|
// viewBinding.device.btnSilos.setOnClickListener(view->{ |
|
|
|
// showControlDialog(2); |
|
|
|
// }); |
|
|
|
// viewBinding.device.btnStir.setOnClickListener(view->{ |
|
|
|
// showControlDialog(4); |
|
|
|
// }); |
|
|
|
// viewBinding.device.btnUpDown.setOnClickListener(view->{ |
|
|
|
// showControlDialog(4); |
|
|
|
// }); |
|
|
|
// viewBinding.device.btnFire.setOnClickListener(view->{ |
|
|
|
// showControlDialog(1); |
|
|
|
// }); |
|
|
|
// viewBinding.title.setText(subAttributeGroupName+""); |
|
|
|
// |
|
|
|
// } |
|
|
|
// |
|
|
|
// /** |
|
|
|
// * 重置 |
|
|
|
// */ |
|
|
|
// private void clear(){ |
|
|
|
// viewBinding.device.btnMainFood.setBackgroundResource(R.drawable.bg_device_position_btn); |
|
|
|
// viewBinding.device.btnSilos.setBackgroundResource(R.drawable.bg_device_position_btn); |
|
|
|
// viewBinding.device.btnFire.setBackgroundResource(R.drawable.bg_device_position_btn); |
|
|
|
// viewBinding.device.btnUpDown.setBackgroundResource(R.drawable.bg_device_position_btn); |
|
|
|
// viewBinding.device.btnStir.setBackgroundResource(R.drawable.bg_device_position_btn); |
|
|
|
// viewBinding.device.fireView.SetLevel(0); |
|
|
|
// isFire = false; |
|
|
|
// isUp = true; |
|
|
|
// isStir = false; |
|
|
|
// changeDevicePic(); |
|
|
|
// close(); |
|
|
|
// } |
|
|
|
// |
|
|
|
// /** |
|
|
|
// * 关闭所有接口 |
|
|
|
// */ |
|
|
|
// private void close(){ |
|
|
|
// ThreadManager.get().execute(new Thread(() -> ModbusHelper.get().setStirMotor(0,2))); |
|
|
|
// ThreadManager.get().execute(new Thread(() -> ModbusHelper.get().setUpdDownMotor(1))); |
|
|
|
// ThreadManager.get().execute(new Thread(() -> ModbusHelper.get().Heating(0,false))); |
|
|
|
// ThreadManager.get().execute(new Thread(() -> { |
|
|
|
// ModbusHelper.get().addWater(0f,true); |
|
|
|
// })); |
|
|
|
// ThreadManager.get().execute(new Thread(() -> { |
|
|
|
// ModbusHelper.get().addThickenWater(0f,true); |
|
|
|
// })); |
|
|
|
// ThreadManager.get().execute(new Thread(() -> { |
|
|
|
// for(int i =1;i<=9;i++){ |
|
|
|
// ModbusHelper.get().addMaterial(0f,i,true); |
|
|
|
// } |
|
|
|
// })); |
|
|
|
// } |
|
|
|
// |
|
|
|
// private DeviceControlDialog.DeviceCallBack deviceCallBack = new DeviceControlDialog.DeviceCallBack() { |
|
|
|
// @Override |
|
|
|
// public void onClickEvent(int type, String value,long time) { |
|
|
|
// switch (type){ |
|
|
|
// case 1: |
|
|
|
// if(value.contains("启动加热")){ |
|
|
|
// isFire = true; |
|
|
|
// String[] res = value.split("\\|"); |
|
|
|
// if(res[1].equals("0")){ |
|
|
|
// isFire=false; |
|
|
|
// viewBinding.device.fireView.SetLevel(0); |
|
|
|
// }else { |
|
|
|
// viewBinding.device.fireView.SetLevel(Integer.parseInt(res[1])); |
|
|
|
// } |
|
|
|
// }else if(value.contains("停止加热")){ |
|
|
|
// isFire=false; |
|
|
|
// viewBinding.device.fireView.SetLevel(0); |
|
|
|
// } |
|
|
|
// changeDevicePic(); |
|
|
|
// break; |
|
|
|
// case 2: |
|
|
|
// viewBinding.device.btnSilos.setBackgroundResource(R.drawable.bg_btn_run_anim_looper); |
|
|
|
// ((AnimationDrawable)viewBinding.device.btnSilos.getBackground()).start(); |
|
|
|
// handler.removeMessages(MSG_STOP_SILOS); |
|
|
|
// handler.sendEmptyMessageDelayed(MSG_STOP_SILOS,time); |
|
|
|
// break; |
|
|
|
// case 3: |
|
|
|
// viewBinding.device.btnMainFood.setBackgroundResource(R.drawable.bg_btn_run_anim_looper); |
|
|
|
// ((AnimationDrawable)viewBinding.device.btnMainFood.getBackground()).start(); |
|
|
|
// handler.removeMessages(MSG_STOP_FOOD); |
|
|
|
// handler.sendEmptyMessageDelayed(MSG_STOP_FOOD,time); |
|
|
|
// break; |
|
|
|
// case 4: |
|
|
|
// switch (value){ |
|
|
|
// case "开始搅拌": |
|
|
|
// isStir=true; |
|
|
|
// viewBinding.device.btnStir.setBackgroundResource(R.drawable.bg_btn_run_anim_looper); |
|
|
|
// ((AnimationDrawable)viewBinding.device.btnStir.getBackground()).start(); |
|
|
|
// handler.removeMessages(MSG_STOP_SILOS); |
|
|
|
// handler.sendEmptyMessageDelayed(MSG_STOP_SILOS,time); |
|
|
|
// break; |
|
|
|
// case "停止搅拌": |
|
|
|
// viewBinding.device.btnStir.setBackgroundResource(R.drawable.bg_device_position_btn); |
|
|
|
// isStir=false; |
|
|
|
// break; |
|
|
|
// case "电机下降": |
|
|
|
// ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) viewBinding.device.btnUpDown.getLayoutParams(); |
|
|
|
// params.topMargin = DimensUtil.getDimens(250); |
|
|
|
// viewBinding.device.btnUpDown.setLayoutParams(params); |
|
|
|
// |
|
|
|
// ConstraintLayout.LayoutParams paramsFood = (ConstraintLayout.LayoutParams) viewBinding.device.btnMainFood.getLayoutParams(); |
|
|
|
// paramsFood.topMargin = DimensUtil.getDimens(200); |
|
|
|
// viewBinding.device.btnMainFood.setLayoutParams(paramsFood); |
|
|
|
// |
|
|
|
// viewBinding.device.btnUpDown.setBackgroundResource(R.drawable.bg_btn_run_anim_looper); |
|
|
|
// ((AnimationDrawable)viewBinding.device.btnUpDown.getBackground()).start(); |
|
|
|
// handler.removeMessages(MSG_STOP_UPDOWN); |
|
|
|
// handler.sendEmptyMessageDelayed(MSG_STOP_UPDOWN,time); |
|
|
|
// isUp=false; |
|
|
|
// break; |
|
|
|
// case "电机上升": |
|
|
|
// ConstraintLayout.LayoutParams params2 = (ConstraintLayout.LayoutParams) viewBinding.device.btnUpDown.getLayoutParams(); |
|
|
|
// params2.topMargin = DimensUtil.getDimens(150); |
|
|
|
// viewBinding.device.btnUpDown.setLayoutParams(params2); |
|
|
|
// ConstraintLayout.LayoutParams paramsFood2 = (ConstraintLayout.LayoutParams) viewBinding.device.btnMainFood.getLayoutParams(); |
|
|
|
// paramsFood2.topMargin = DimensUtil.getDimens(20); |
|
|
|
// viewBinding.device.btnMainFood.setLayoutParams(paramsFood2); |
|
|
|
// |
|
|
|
// viewBinding.device.btnUpDown.setBackgroundResource(R.drawable.bg_btn_run_anim_looper); |
|
|
|
// ((AnimationDrawable)viewBinding.device.btnUpDown.getBackground()).start(); |
|
|
|
// handler.removeMessages(MSG_STOP_UPDOWN); |
|
|
|
// handler.sendEmptyMessageDelayed(MSG_STOP_UPDOWN,time); |
|
|
|
// isUp=true; |
|
|
|
// break; |
|
|
|
// } |
|
|
|
// changeDevicePic(); |
|
|
|
// break; |
|
|
|
// } |
|
|
|
// } |
|
|
|
// |
|
|
|
// @Override |
|
|
|
// public void onClickDismiss() { |
|
|
|
// } |
|
|
|
// }; |
|
|
|
// |
|
|
|
// private void changeDevicePic(){ |
|
|
|
// if(isFire){ |
|
|
|
// if(isStir){ |
|
|
|
// if(isUp){ |
|
|
|
// viewBinding.device.imgDevice.setImageResource(R.mipmap.device_fire_stir_up); |
|
|
|
// }else { |
|
|
|
// viewBinding.device.imgDevice.setImageResource(R.mipmap.device_fire_stir_down); |
|
|
|
// } |
|
|
|
// }else{ |
|
|
|
// if(isUp){ |
|
|
|
// viewBinding.device.imgDevice.setImageResource(R.mipmap.device_fire_unstir_up); |
|
|
|
// }else { |
|
|
|
// viewBinding.device.imgDevice.setImageResource(R.mipmap.device_fire_unstir_down); |
|
|
|
// } |
|
|
|
// } |
|
|
|
// }else { |
|
|
|
// if(isStir){ |
|
|
|
// if(isUp){ |
|
|
|
// viewBinding.device.imgDevice.setImageResource(R.mipmap.device_unfire_stir_up); |
|
|
|
// }else { |
|
|
|
// viewBinding.device.imgDevice.setImageResource(R.mipmap.device_unfire_stir_down); |
|
|
|
// } |
|
|
|
// }else{ |
|
|
|
// if(isUp){ |
|
|
|
// viewBinding.device.imgDevice.setImageResource(R.mipmap.device_unfire_unstir_up); |
|
|
|
// }else { |
|
|
|
// viewBinding.device.imgDevice.setImageResource(R.mipmap.device_unfire_unstir_down); |
|
|
|
// } |
|
|
|
// } |
|
|
|
// } |
|
|
|
// } |
|
|
|
// |
|
|
|
// /** |
|
|
|
// * |
|
|
|
// * @param type 1加热 2液体 3主料 4搅拌 |
|
|
|
// */ |
|
|
|
// private void showControlDialog(int type){ |
|
|
|
// if(ModbusHelper.get().isBtnStop()){ |
|
|
|
// NewToastUtil.getInstance().showToast("设备已急停,请关闭急停按钮再调试!"); |
|
|
|
// return; |
|
|
|
// } |
|
|
|
// if(deviceControlDialog == null){ |
|
|
|
// deviceControlDialog = new DeviceControlDialog(); |
|
|
|
// } |
|
|
|
// Bundle bundle =new Bundle(); |
|
|
|
// bundle.putInt("type",type); |
|
|
|
// deviceControlDialog.setArguments(bundle); |
|
|
|
// deviceControlDialog.setDeviceCallBack(deviceCallBack); |
|
|
|
// deviceControlDialog.show(getSupportFragmentManager(), "deviceControl"); |
|
|
|
// } |
|
|
|
// |
|
|
|
// //region 计时器 |
|
|
|
// /** |
|
|
|
// * 是否启动 |
|
|
|
// */ |
|
|
|
// public static boolean IsStart = false; |
|
|
|
// /** |
|
|
|
// * 是否暂停 |
|
|
|
// */ |
|
|
|
// public static boolean IsPause = false; |
|
|
|
// /** |
|
|
|
// * 当前运行总时长 |
|
|
|
// */ |
|
|
|
// public int TimeOut = 0; |
|
|
|
// /** |
|
|
|
// * 上一次点击时间 |
|
|
|
// */ |
|
|
|
// public int ClikTime = 0; |
|
|
|
// /** |
|
|
|
// * 记录下来的总时间 |
|
|
|
// */ |
|
|
|
// private long recordingTime = 0; |
|
|
|
// /** |
|
|
|
// * 工序步骤 |
|
|
|
// */ |
|
|
|
// public ArrayList<BPA_GOODSRECIPE> goodsRecipeList = new ArrayList<>(); |
|
|
|
// private RecProcessAdapter recProcessAdapter; |
|
|
|
// |
|
|
|
// /** |
|
|
|
// * 刷新工序 |
|
|
|
// */ |
|
|
|
// public void RefreshProcedure() { |
|
|
|
// recProcessAdapter.updateData(goodsRecipeList); |
|
|
|
// } |
|
|
|
// |
|
|
|
// /** |
|
|
|
// * 启动定时器 |
|
|
|
// */ |
|
|
|
// public void onRecordStart() { |
|
|
|
// runOnUiThread(new Runnable() { |
|
|
|
// @Override |
|
|
|
// public void run() { |
|
|
|
// viewBinding.runtime.setBase(SystemClock.elapsedRealtime() - recordingTime);// 跳过已经记录了的时间,起到继续计时的作用 |
|
|
|
// viewBinding.runtime.start(); |
|
|
|
// viewBinding.textMs.setText("请先{开始}录制"); |
|
|
|
// viewBinding.textMs.setVisibility(View.GONE); |
|
|
|
// //重置暂停开关 |
|
|
|
// IsPause = false; |
|
|
|
// viewBinding.pauseGoodmake.SetStatus(false); |
|
|
|
// viewBinding.pauseGoodmake.setVisibility(View.VISIBLE); |
|
|
|
// ExecuteTheRecipe.WritePLC("暂停开关", false, null); |
|
|
|
// |
|
|
|
// IsStart = true; |
|
|
|
// |
|
|
|
// goodsRecipeList.clear();//清空所有工序 |
|
|
|
// //刷新工序 |
|
|
|
// RefreshProcedure(); |
|
|
|
// TimeOut = 0; |
|
|
|
// ClikTime = 0; |
|
|
|
// } |
|
|
|
// }); |
|
|
|
// } |
|
|
|
// |
|
|
|
// /** |
|
|
|
// * 停止计时器 |
|
|
|
// */ |
|
|
|
// public void onRecordStop() { |
|
|
|
// runOnUiThread(new Runnable() { |
|
|
|
// @Override |
|
|
|
// public void run() { |
|
|
|
// runtime.stop(); |
|
|
|
// start_goodmake.SetStatus(false); |
|
|
|
// IsStart = false; |
|
|
|
// kaishiorstop.setVisibility(View.VISIBLE); |
|
|
|
// text_ms.setText("请先{开始}录制"); |
|
|
|
// |
|
|
|
// |
|
|
|
// recordingTime = 0; |
|
|
|
// long elapsedMillis = SystemClock.elapsedRealtime() - runtime.getBase(); |
|
|
|
// TimeOut = (int) (elapsedMillis / 1000); |
|
|
|
// DataBus.getInstance().TimeOut = TimeOut; |
|
|
|
// |
|
|
|
// //重置暂停开关 |
|
|
|
// IsPause = false; |
|
|
|
// zanting_goodmake.SetStatus(false); |
|
|
|
// zanting_goodmake.setVisibility(View.GONE); |
|
|
|
// ExecuteTheRecipe.WritePLC("暂停开关", false, null); |
|
|
|
// |
|
|
|
// ExecuteTheRecipe.WritePLC("搅拌", false, null); |
|
|
|
// ExecuteTheRecipe.WritePLC("加热", false, null); |
|
|
|
// ConfigName.getInstance().IsOpenHuoLi = false; |
|
|
|
// ExecuteTheRecipe.BottomClick("平移-去1号位"); |
|
|
|
// } |
|
|
|
// }); |
|
|
|
// //自动出餐 |
|
|
|
// AutomaticServing(); |
|
|
|
// gongyibuzhoujilu.setVisibility(View.VISIBLE); |
|
|
|
// } |
|
|
|
// |
|
|
|
// /** |
|
|
|
// * 暂停计时器 |
|
|
|
// */ |
|
|
|
// public void onRecordPause() { |
|
|
|
// runOnUiThread(new Runnable() { |
|
|
|
// @Override |
|
|
|
// public void run() { |
|
|
|
// runtime.stop(); |
|
|
|
// text_ms.setText("录制{暂停}中"); |
|
|
|
// recordingTime = SystemClock.elapsedRealtime() - runtime.getBase();// 保存这次记录了的时间 |
|
|
|
// IsPause = true; |
|
|
|
// kaishiorstop.setVisibility(View.VISIBLE); |
|
|
|
// |
|
|
|
// ExecuteTheRecipe.WritePLC("暂停开关", true, null); |
|
|
|
// } |
|
|
|
// }); |
|
|
|
// } |
|
|
|
// |
|
|
|
// /** |
|
|
|
// * 继续计时器 |
|
|
|
// */ |
|
|
|
// public void onRecordPauseStart() { |
|
|
|
// runOnUiThread(new Runnable() { |
|
|
|
// @Override |
|
|
|
// public void run() { |
|
|
|
// runtime.setBase(SystemClock.elapsedRealtime() - recordingTime);// 跳过已经记录了的时间,起到继续计时的作用 |
|
|
|
// runtime.start(); |
|
|
|
// text_ms.setText("请先{开始}录制"); |
|
|
|
// IsPause = false; |
|
|
|
// kaishiorstop.setVisibility(View.GONE); |
|
|
|
// ExecuteTheRecipe.WritePLC("暂停开关", false, null); |
|
|
|
// } |
|
|
|
// }); |
|
|
|
// } |
|
|
|
// |
|
|
|
// /** |
|
|
|
// * 启动定时器 |
|
|
|
// */ |
|
|
|
// public void onRecordStart_CS() { |
|
|
|
// runOnUiThread(new Runnable() { |
|
|
|
// @Override |
|
|
|
// public void run() { |
|
|
|
// guoneichoushui.setVisibility(View.VISIBLE); |
|
|
|
// runtime_cs.setBase(SystemClock.elapsedRealtime()); |
|
|
|
// runtime_cs.start(); |
|
|
|
// } |
|
|
|
// }); |
|
|
|
// } |
|
|
|
// |
|
|
|
// /** |
|
|
|
// * 停止计时器 |
|
|
|
// */ |
|
|
|
// public void onRecordStop_CS() { |
|
|
|
// runOnUiThread(new Runnable() { |
|
|
|
// @Override |
|
|
|
// public void run() { |
|
|
|
// guoneichoushui.setVisibility(View.GONE); |
|
|
|
// runtime_cs.stop(); |
|
|
|
// |
|
|
|
// long elapsedMillis = SystemClock.elapsedRealtime() - runtime_cs.getBase(); |
|
|
|
// DataBus.getInstance().PumpWaterTimeOut = (int) (elapsedMillis / 1000); |
|
|
|
// |
|
|
|
// ClikTime = (int) ((SystemClock.elapsedRealtime() - runtime.getBase()) / 1000); |
|
|
|
// } |
|
|
|
// }); |
|
|
|
// } |
|
|
|
// //endregion |
|
|
|
// |
|
|
|
// |
|
|
|
// |
|
|
|
// @Override |
|
|
|
// public void onResume() { |
|
|
|
// super.onResume(); |
|
|
|
// } |
|
|
|
// |
|
|
|
// @Override |
|
|
|
// public void onPause() { |
|
|
|
// super.onPause(); |
|
|
|
// if(handler!=null){ |
|
|
|
// handler.removeCallbacksAndMessages(null); |
|
|
|
// } |
|
|
|
// } |
|
|
|
// |
|
|
|
// @Override |
|
|
|
// public void onDestroy() { |
|
|
|
// super.onDestroy(); |
|
|
|
// if(handler != null){ |
|
|
|
// handler.removeCallbacksAndMessages(null); |
|
|
|
// handler = null; |
|
|
|
// } |
|
|
|
// deviceCallBack = null; |
|
|
|
// } |
|
|
|
//} |