From 18a2d6a1a8e4d10affce58f71c2e26903f09b6d3 Mon Sep 17 00:00:00 2001 From: liup <1454939542@qq.com> Date: Mon, 27 May 2024 13:16:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/activity/CookingActivity.java | 338 ++++++++++++++++++ app/src/main/res/layout/activity_cook.xml | 171 +++++++++ .../main/res/layout/fragment_home_foods.xml | 12 - 3 files changed, 509 insertions(+), 12 deletions(-) create mode 100644 app/src/main/java/com/bonait/bnframework/ui/activity/CookingActivity.java create mode 100644 app/src/main/res/layout/activity_cook.xml diff --git a/app/src/main/java/com/bonait/bnframework/ui/activity/CookingActivity.java b/app/src/main/java/com/bonait/bnframework/ui/activity/CookingActivity.java new file mode 100644 index 00000000..141240bd --- /dev/null +++ b/app/src/main/java/com/bonait/bnframework/ui/activity/CookingActivity.java @@ -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 +// +//} \ No newline at end of file diff --git a/app/src/main/res/layout/activity_cook.xml b/app/src/main/res/layout/activity_cook.xml new file mode 100644 index 00000000..ce5acf8f --- /dev/null +++ b/app/src/main/res/layout/activity_cook.xml @@ -0,0 +1,171 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_home_foods.xml b/app/src/main/res/layout/fragment_home_foods.xml index 9bde06b1..a899176d 100644 --- a/app/src/main/res/layout/fragment_home_foods.xml +++ b/app/src/main/res/layout/fragment_home_foods.xml @@ -7,18 +7,6 @@ android:id="@+id/topbar" android:layout_width="match_parent" android:layout_height="?attr/qmui_topbar_height" > -