|
|
@@ -0,0 +1,338 @@ |
|
|
|
//package com.bonait.bnframework.ui.activity; |
|
|
|
// |
|
|
|
//import android.app.Activity; |
|
|
|
//import android.content.Context; |
|
|
|
//import android.content.Intent; |
|
|
|
//import android.os.Bundle; |
|
|
|
//import android.view.View; |
|
|
|
// |
|
|
|
//import androidx.annotation.Nullable; |
|
|
|
//import androidx.core.content.ContextCompat; |
|
|
|
// |
|
|
|
//import com.apkfuns.logutils.LogUtils; |
|
|
|
//import com.bonait.bnframework.HBL.Interface.IRunT; |
|
|
|
//import com.bonait.bnframework.R; |
|
|
|
//import com.bonait.bnframework.ViewModel.CustomView.imagebuttom3; |
|
|
|
//import com.bonait.bnframework.business.ExecuteTheRecipe; |
|
|
|
//import com.bonait.bnframework.common.base.BaseActivity; |
|
|
|
//import com.bonait.bnframework.common.constant.MessageName; |
|
|
|
//import com.bonait.bnframework.common.db.mode.BPA_GOODS; |
|
|
|
//import com.bonait.bnframework.common.db.mode.BPA_GOODS_SUBATTRIBUTE_GROUP; |
|
|
|
//import com.bonait.bnframework.common.db.util.GoodsDBUtil; |
|
|
|
//import com.bonait.bnframework.common.db.util.SubAttributeGroupDBUtil; |
|
|
|
//import com.bonait.bnframework.common.helper.I.MyClickListener; |
|
|
|
//import com.bonait.bnframework.common.message.MessageManager; |
|
|
|
//import com.bonait.bnframework.common.utils.ToastUtils; |
|
|
|
//import com.bonait.bnframework.databinding.ActivityCookBinding; |
|
|
|
// |
|
|
|
//import butterknife.ButterKnife; |
|
|
|
//import butterknife.OnClick; |
|
|
|
// |
|
|
|
//public class CookingActivity extends BaseActivity { |
|
|
|
// |
|
|
|
// private ActivityCookBinding viewBinding; |
|
|
|
// |
|
|
|
// private Context contextMian; |
|
|
|
// private View root; |
|
|
|
// private StringBuffer stringBuffer1 = new StringBuffer(); |
|
|
|
// /** |
|
|
|
// * 商品id |
|
|
|
// */ |
|
|
|
// private String goodId = ""; |
|
|
|
// /** |
|
|
|
// * 子属性组合id 属性组合名称 |
|
|
|
// */ |
|
|
|
// private String subAttributeGroupId = ""; |
|
|
|
// private String subAttributeGroupName = ""; |
|
|
|
// private BPA_GOODS goods; |
|
|
|
// private BPA_GOODS_SUBATTRIBUTE_GROUP goodsSubattributeGroup; |
|
|
|
// |
|
|
|
// |
|
|
|
// @Override |
|
|
|
// protected void onCreate(@Nullable Bundle savedInstanceState) { |
|
|
|
// super.onCreate(savedInstanceState); |
|
|
|
// |
|
|
|
// viewBinding = ActivityCookBinding.inflate(getLayoutInflater()); |
|
|
|
// setContentView(viewBinding.getRoot()); |
|
|
|
// ButterKnife.bind(this); |
|
|
|
// initTopBar(); |
|
|
|
// SxUIThread(); |
|
|
|
// Intent intent = new Intent(); |
|
|
|
// goodId = intent.getStringExtra("goodId"); |
|
|
|
// subAttributeGroupId = intent.getStringExtra("subAttributeGroupId"); |
|
|
|
// subAttributeGroupName = intent.getStringExtra("subAttributeGroupName"); |
|
|
|
// goods = GoodsDBUtil.getById(goodId); |
|
|
|
// goodsSubattributeGroup = SubAttributeGroupDBUtil.getByGoodIdAndListId(goodId,subAttributeGroupId); |
|
|
|
// initData(); |
|
|
|
// } |
|
|
|
// |
|
|
|
// //region 公共方法 |
|
|
|
// |
|
|
|
// /** |
|
|
|
// * 初始化数据 |
|
|
|
// */ |
|
|
|
// public void initData( MyClickListener listener) { |
|
|
|
// String name = subAttributeGroupName.isEmpty()?goods.name:(goods.name+"-"+subAttributeGroupName); |
|
|
|
// viewBinding.goodname.setText(name); |
|
|
|
// viewBinding.startGoodmake.mListener = listener; |
|
|
|
// SetReset(); |
|
|
|
// SetRest1(); |
|
|
|
// SetProcess(goods.maketime, 0); |
|
|
|
// SetMiaoShu("等待开始..."); |
|
|
|
// LogUtils.d("制作时长goods.maketime="+goods.maketime); |
|
|
|
// viewBinding.runtime.setText(formatTime(goods.maketime)); |
|
|
|
// |
|
|
|
//// if (ConfigName.getInstance().versionSelectionEnum.equals("大炒版本")) { |
|
|
|
//// touliao_k.setVisibility(View.GONE); |
|
|
|
//// touliao_m.setVisibility(View.GONE); |
|
|
|
//// device_image.setImageResource(R.mipmap.device00); |
|
|
|
//// }else |
|
|
|
//// { |
|
|
|
//// touliao_k.setVisibility(View.VISIBLE); |
|
|
|
//// touliao_m.setVisibility(View.VISIBLE); |
|
|
|
//// device_image.setImageResource(R.mipmap.device1); |
|
|
|
//// } |
|
|
|
// } |
|
|
|
// |
|
|
|
// /** |
|
|
|
// * 设置描述 |
|
|
|
// * |
|
|
|
// * @param text |
|
|
|
// */ |
|
|
|
// public void SetMiaoShu(String text) { |
|
|
|
// gongxumiaoshu.setText(text + ""); |
|
|
|
// stringBuffer1.append(" \n工序:"+text); |
|
|
|
// text1.setText(stringBuffer1+""); |
|
|
|
// } |
|
|
|
// |
|
|
|
// /** |
|
|
|
// * 设置进度条 |
|
|
|
// * |
|
|
|
// * @param |
|
|
|
// */ |
|
|
|
// public void SetProcess(int alltime, int usertime) { |
|
|
|
// try { |
|
|
|
// if(alltime!=0){ |
|
|
|
// t_jindu.SetValue((usertime * 100) / alltime); |
|
|
|
// } |
|
|
|
// runtime.setText(formatTime((alltime - usertime))); |
|
|
|
// } catch (Exception ex) { |
|
|
|
// LogUtils.d("异常信息:" + ex.getMessage()); |
|
|
|
// ToastUtils.error("异常信息:" + ex.getMessage()); |
|
|
|
// } |
|
|
|
// } |
|
|
|
// |
|
|
|
// /** |
|
|
|
// * 复位 |
|
|
|
// */ |
|
|
|
// public void SetReset() { |
|
|
|
// SetMiaoShu("等待开始..."); |
|
|
|
// stringBuffer1 = new StringBuffer(); |
|
|
|
//// zanting_goodmake.SetStatus(false); |
|
|
|
//// zanting_goodmake.setVisibility(View.GONE); |
|
|
|
// } |
|
|
|
// |
|
|
|
// /** |
|
|
|
// * 复位 |
|
|
|
// */ |
|
|
|
// public void SetZanTing(boolean data) { |
|
|
|
//// zanting_goodmake.setVisibility(data ? View.VISIBLE : View.GONE); |
|
|
|
// } |
|
|
|
// |
|
|
|
// public void SetRest1() { |
|
|
|
// stringBuffer1 = new StringBuffer(); |
|
|
|
// start_goodmake.SetStatus(false); |
|
|
|
// if(flicker_buttom!=null) |
|
|
|
// { |
|
|
|
// flicker_buttom.setVisibility(View.VISIBLE); |
|
|
|
// flicker_buttom.SetStatusKK(false); |
|
|
|
// flicker_buttom=null; |
|
|
|
// } |
|
|
|
//// huoli.SetLevel(0); |
|
|
|
// } |
|
|
|
// //endregion |
|
|
|
// |
|
|
|
// //region 私有方法 |
|
|
|
// |
|
|
|
// /** |
|
|
|
// * 将毫秒转化为 分钟:秒 的格式 100* 1000 |
|
|
|
// * |
|
|
|
// * @param millisecond 毫秒 |
|
|
|
// * @return |
|
|
|
// */ |
|
|
|
// public String formatTime(long millisecond) { |
|
|
|
// int minute;//分钟 |
|
|
|
// int second;//秒数 |
|
|
|
// minute = (int) ((millisecond / 1) / 60); |
|
|
|
// second = (int) ((millisecond / 1) % 60); |
|
|
|
// if (minute < 10) { |
|
|
|
// if (second < 10) { |
|
|
|
// return "0" + minute + " : " + "0" + second; |
|
|
|
// } else { |
|
|
|
// return "0" + minute + " : " + second; |
|
|
|
// } |
|
|
|
// } else { |
|
|
|
// if (second < 10) { |
|
|
|
// return minute + " : " + "0" + second; |
|
|
|
// } else { |
|
|
|
// return minute + " : " + second; |
|
|
|
// } |
|
|
|
// } |
|
|
|
// } |
|
|
|
// |
|
|
|
// /** |
|
|
|
// * 初始化顶部弹框 |
|
|
|
// */ |
|
|
|
// private void initTopBar() { |
|
|
|
// mTopBar.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.topbj1)); |
|
|
|
// mTopBar.setTitle("菜谱烹饪"); |
|
|
|
// mTopBar.addLeftImageButton(R.mipmap.fanhui, R.id.topbar).setOnClickListener(new OnClickListener() { |
|
|
|
// @Override |
|
|
|
// public void onClick(View view) { |
|
|
|
// if (ExecuteTheRecipe.IsStart) { |
|
|
|
// ToastUtils.warning("请等待制作完成后退出..."); |
|
|
|
// return; |
|
|
|
// } |
|
|
|
// setVisibility(View.GONE); |
|
|
|
// } |
|
|
|
// }); |
|
|
|
// } |
|
|
|
// |
|
|
|
// /** |
|
|
|
// * 点击事件 |
|
|
|
// * |
|
|
|
// * @param view |
|
|
|
// */ |
|
|
|
// @OnClick({R.id.kancaipu}) |
|
|
|
// public void onViewClicked(View view) { |
|
|
|
// switch (view.getId()) { |
|
|
|
// case R.id.kancaipu://看菜谱 |
|
|
|
// MessageManager.getInstance().sendMessage(MessageName.SelectZY, 0); |
|
|
|
// break; |
|
|
|
// } |
|
|
|
// } |
|
|
|
// |
|
|
|
// /** |
|
|
|
// * 闪烁buttom |
|
|
|
// */ |
|
|
|
// public imagebuttom3 flicker_buttom=null; |
|
|
|
// /** |
|
|
|
// * 刷新UI界面 |
|
|
|
// */ |
|
|
|
// public void SxUIThread() { |
|
|
|
// new Thread(new Runnable() { |
|
|
|
// @Override |
|
|
|
// public void run() { |
|
|
|
// |
|
|
|
// while (true) { |
|
|
|
// try { |
|
|
|
// if (activity != null && getVisibility() == View.VISIBLE) { |
|
|
|
// activity.runOnUiThread(new Runnable() { |
|
|
|
// @Override |
|
|
|
// public void run() { |
|
|
|
// Object val_wd = ExecuteTheRecipe.getListingValue("当前锅底温度"); |
|
|
|
// if (val_wd != null) { |
|
|
|
//// chaoguo_wendu.setText(val_wd + "°C"); |
|
|
|
// } else { |
|
|
|
//// chaoguo_wendu.setText("??°C"); |
|
|
|
// } |
|
|
|
// |
|
|
|
// //闪烁 |
|
|
|
// if (flicker_buttom != null) { |
|
|
|
// flicker_buttom.setVisibility(flicker_buttom.getVisibility() == View.VISIBLE ? View.INVISIBLE : View.VISIBLE); |
|
|
|
// } |
|
|
|
// } |
|
|
|
// }); |
|
|
|
// } |
|
|
|
// Thread.sleep(1000); |
|
|
|
// } catch (InterruptedException e) { |
|
|
|
// LogUtils.d("异常信息:" + e.getMessage()); |
|
|
|
// ToastUtils.info("异常信息:" + e.getMessage()); |
|
|
|
// } |
|
|
|
// } |
|
|
|
// } |
|
|
|
// }).start(); |
|
|
|
// |
|
|
|
// ExecuteTheRecipe.ExecuteCurrentOperation=new IRunT() { |
|
|
|
// @Override |
|
|
|
// public void Run(Object o) { |
|
|
|
// String data=(String)o; |
|
|
|
// if (activity != null && getVisibility() == View.VISIBLE) { |
|
|
|
// activity.runOnUiThread(new Runnable() { |
|
|
|
// @Override |
|
|
|
// public void run() { |
|
|
|
// if(data.contains("|")) |
|
|
|
// { |
|
|
|
// String[] K= data.split("[|]"); |
|
|
|
// if (K.length>=2) |
|
|
|
// { |
|
|
|
// String name=K[0]; |
|
|
|
// String val=K[1]; |
|
|
|
// if(flicker_buttom!=null) |
|
|
|
// { |
|
|
|
// flicker_buttom.setVisibility(View.VISIBLE); |
|
|
|
// flicker_buttom.SetStatusKK(false); |
|
|
|
// } |
|
|
|
// flicker_buttom=null; |
|
|
|
//// switch (name) { |
|
|
|
//// case "搅拌": |
|
|
|
//// flicker_buttom=fanchaoshudu; |
|
|
|
//// flicker_buttom.SetStatusKK(true); |
|
|
|
//// break; |
|
|
|
//// case "位置": |
|
|
|
//// flicker_buttom=guokoucaoxiang; |
|
|
|
//// flicker_buttom.SetStatusKK(true); |
|
|
|
//// break; |
|
|
|
//// case "加热": |
|
|
|
//// huoli.SetLevel(Integer.parseInt(val)); |
|
|
|
//// break; |
|
|
|
//// case "主料": |
|
|
|
//// if(val.equals("1号位")) |
|
|
|
//// { |
|
|
|
//// flicker_buttom=touliao1; |
|
|
|
//// }else if(val.equals("2号位")) |
|
|
|
//// { |
|
|
|
//// flicker_buttom=touliao2; |
|
|
|
//// }else if(val.equals("3号位")) |
|
|
|
//// { |
|
|
|
//// flicker_buttom=touliao3; |
|
|
|
//// }else if(val.equals("4号位")) |
|
|
|
//// { |
|
|
|
//// flicker_buttom=touliao4; |
|
|
|
//// } |
|
|
|
//// flicker_buttom.SetStatusKK(true); |
|
|
|
//// break; |
|
|
|
//// case "加水": |
|
|
|
//// flicker_buttom=chushui; |
|
|
|
//// flicker_buttom.SetStatusKK(true); |
|
|
|
//// break; |
|
|
|
//// case "液体料": |
|
|
|
//// if(val.equals("1")) |
|
|
|
//// { |
|
|
|
//// flicker_buttom=yeliao1; |
|
|
|
//// flicker_buttom.SetStatusKK(true); |
|
|
|
//// }else if(val.equals("2")) |
|
|
|
//// { |
|
|
|
//// flicker_buttom=yeliao2; |
|
|
|
//// flicker_buttom.SetStatusKK(true); |
|
|
|
//// }else if(val.equals("3")) |
|
|
|
//// { |
|
|
|
//// flicker_buttom=yeliao3; |
|
|
|
//// flicker_buttom.SetStatusKK(true); |
|
|
|
//// } |
|
|
|
//// break; |
|
|
|
//// } |
|
|
|
// } |
|
|
|
// } |
|
|
|
// } |
|
|
|
// }); |
|
|
|
// } |
|
|
|
// } |
|
|
|
// }; |
|
|
|
// } |
|
|
|
// //endregion |
|
|
|
// |
|
|
|
// //region 外部调用 |
|
|
|
// //endregion |
|
|
|
// |
|
|
|
//} |