From 1e6cecbea81f8ba7b80f6ec67b9aebaeeb92e9a8 Mon Sep 17 00:00:00 2001 From: fyf Date: Wed, 5 Jul 2023 18:27:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BD=91=E7=BB=9C=E5=9B=BE?= =?UTF-8?q?=E7=89=872555?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/compiler.xml | 6 - .idea/gradle.xml | 20 - .idea/jarRepositories.xml | 30 -- .idea/misc.xml | 5 - .idea/render.experimental.xml | 6 - .idea/vcs.xml | 6 - .../bnframework/business/ConfigData.java | 3 - .../common/constant/MessageName.java | 2 + .../modules/home/adapter/sp_adapter.java | 11 +- .../home/fragment/from/CpActivity.java | 8 +- .../home/fragment/from/DiyActivity.java | 61 ++- .../home/fragment/from/DiyUpdateActivity.java | 94 +++- .../fragment/from/ImageChooseActivity.java | 4 +- .../fragment/mode/QDListSectionAdapter.java | 6 +- .../home/fragment/mode/SectionItem.java | 16 +- app/src/main/res/layout/activity_diy.xml | 431 ++++++++++-------- .../main/res/layout/activity_diy_update.xml | 428 ++++++++++------- .../main/res/layout/item/layout/item_sp.xml | 12 +- .../item/layout/note_rv_tree_second.xml | 1 + 19 files changed, 699 insertions(+), 451 deletions(-) delete mode 100644 .idea/compiler.xml delete mode 100644 .idea/gradle.xml delete mode 100644 .idea/jarRepositories.xml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/render.experimental.xml delete mode 100644 .idea/vcs.xml diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index fb7f4a8a..00000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml deleted file mode 100644 index 56d6814d..00000000 --- a/.idea/gradle.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml deleted file mode 100644 index eb2873e7..00000000 --- a/.idea/jarRepositories.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index fab34583..00000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/render.experimental.xml b/.idea/render.experimental.xml deleted file mode 100644 index 8ec256a5..00000000 --- a/.idea/render.experimental.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7f..00000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/src/main/java/com/bonait/bnframework/business/ConfigData.java b/app/src/main/java/com/bonait/bnframework/business/ConfigData.java index 6ff5e983..9068bf18 100644 --- a/app/src/main/java/com/bonait/bnframework/business/ConfigData.java +++ b/app/src/main/java/com/bonait/bnframework/business/ConfigData.java @@ -203,14 +203,11 @@ public class ConfigData { { BitmapFactory.Options options = new BitmapFactory.Options(); options.inSampleSize=2;//宽高压缩为原来的1/2 - options.inPreferredConfig=Bitmap.Config.ARGB_4444; - Bitmap bitmap0= BitmapFactory.decodeResource(context.getResources(), R.mipmap.loading3,options); Bitmap bitmap1= BitmapFactory.decodeResource(context.getResources(), R.mipmap.image1,options); Bitmap bitmap2= BitmapFactory.decodeResource(context.getResources(), R.mipmap.image2,options); Bitmap bitmap3= BitmapFactory.decodeResource(context.getResources(), R.mipmap.image3,options); Bitmap bitmap4= BitmapFactory.decodeResource(context.getResources(), R.mipmap.image4,options); LocalCacheUtils localCacheUtils=new LocalCacheUtils(); - localCacheUtils.setBitmapToLocal("image0.png",bitmap0); localCacheUtils.setBitmapToLocal("image1.png",bitmap1); localCacheUtils.setBitmapToLocal("image2.png",bitmap2); localCacheUtils.setBitmapToLocal("image3.png",bitmap3); diff --git a/app/src/main/java/com/bonait/bnframework/common/constant/MessageName.java b/app/src/main/java/com/bonait/bnframework/common/constant/MessageName.java index 8e52437e..09ec04d7 100644 --- a/app/src/main/java/com/bonait/bnframework/common/constant/MessageName.java +++ b/app/src/main/java/com/bonait/bnframework/common/constant/MessageName.java @@ -19,4 +19,6 @@ public interface MessageName { String ClickGood="ClickGood";//点击商品 + String ClickImage="ClickImage";//点击图标 + } diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/adapter/sp_adapter.java b/app/src/main/java/com/bonait/bnframework/modules/home/adapter/sp_adapter.java index f5477945..62fc6e48 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/adapter/sp_adapter.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/adapter/sp_adapter.java @@ -8,12 +8,14 @@ import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.ImageView; import android.widget.RelativeLayout; import com.bonait.bnframework.R; import com.bonait.bnframework.common.constant.DataBus; import com.bonait.bnframework.common.db.mode.BPA_GOODS; import com.bonait.bnframework.common.helper.I.MyClickListener; +import com.bonait.bnframework.common.image.MyBitmapUtils; import com.bonait.bnframework.common.utils.AlertDialogUtils; import com.qmuiteam.qmui.widget.dialog.QMUIDialog; import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction; @@ -52,9 +54,12 @@ public class sp_adapter extends RecyclerView.Adapter { try { if (holder instanceof MyLCViewHolder1) { MyLCViewHolder1 myViewHolder = (MyLCViewHolder1) holder; - myViewHolder.img.setBackground(context.getResources().getDrawable(R.mipmap.hgr)); + if(goods.get(position).url!=null) + { + new MyBitmapUtils().disPlay(myViewHolder.img,goods.get(position).url); + } + //myViewHolder.img.setBackground(context.getResources().getDrawable(R.mipmap.hgr)); myViewHolder.name.setText(goods.get(position).name); - myViewHolder.img.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { @@ -117,7 +122,7 @@ public class sp_adapter extends RecyclerView.Adapter { } public static class MyLCViewHolder1 extends RecyclerView.ViewHolder { - RelativeLayout img;//图片按钮 + ImageView img;//图片按钮 QMUILinkTextView name;//名称 public MyLCViewHolder1(View view) { diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/CpActivity.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/CpActivity.java index 008dad4d..287cfbad 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/CpActivity.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/CpActivity.java @@ -180,10 +180,14 @@ public class CpActivity extends BaseActivity { for (BPA_GOODS item:good) { - contents_bdcp.add(new SectionItem(item.name, String.valueOf(item.maketime), item.id,item.issc==1)); + if(item.url==null) + { + item.url="未知"; + } + contents_bdcp.add(new SectionItem(item.name, String.valueOf(item.maketime), item.id,item.url,item.issc==1)); if(item.issc==1) { - contents_sccp.add(new SectionItem(item.name, String.valueOf(item.maketime), item.id,item.issc==1)); + contents_sccp.add(new SectionItem(item.name, String.valueOf(item.maketime), item.id,item.url,item.issc==1)); } } list.add(new QMUISection<>(header_bdcp, contents_bdcp, false)); diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyActivity.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyActivity.java index 7fdf708f..11d5c8e0 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyActivity.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyActivity.java @@ -5,6 +5,7 @@ import static com.bonait.bnframework.MainApplication.getContext; import androidx.appcompat.app.AppCompatActivity; import android.annotation.SuppressLint; +import android.content.Intent; import android.graphics.Color; import android.graphics.drawable.Drawable; import android.os.Bundle; @@ -14,7 +15,9 @@ import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; +import android.widget.CheckBox; import android.widget.EditText; +import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.Spinner; @@ -31,6 +34,8 @@ import com.bonait.bnframework.common.db.mode.BPA_PROCESS; import com.bonait.bnframework.common.db.mode.BPA_PROCESSModel; import com.bonait.bnframework.common.helper.I.MyClickListener; import com.bonait.bnframework.common.helper.MyImage; +import com.bonait.bnframework.common.image.MyBitmapUtils; +import com.bonait.bnframework.common.message.MessageLooper; import com.bonait.bnframework.common.message.MessageManager; import com.bonait.bnframework.common.utils.AlertDialogUtils; import com.bonait.bnframework.common.utils.ToastUtils; @@ -56,11 +61,17 @@ import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; -public class DiyActivity extends BaseActivity implements MyClickListener { +public class DiyActivity extends BaseActivity { @BindView(R.id.topbar) QMUITopBar mTopBar; @BindView(R.id.edittext) EditText edittext;//菜谱名称 + @BindView(R.id.cpfm) + ImageView cpfm;//菜谱封面 + @BindView(R.id.zzsc) + EditText zzsc;//制作时长 + @BindView(R.id.check) + CheckBox check;//默认收藏 @BindView(R.id.Banner_Main) Banner Banner_Main;//轮播图 //用于存放获取的图片 @@ -76,6 +87,7 @@ public class DiyActivity extends BaseActivity implements MyClickListener { @BindView(R.id.datatab_gxbz) ListView datatab_gxbz;//工序步骤 public gongxubuzhou_adapter gxbz_adapter=null; + public String imageUrl=""; /** * 工序步骤 */ @@ -112,7 +124,7 @@ public class DiyActivity extends BaseActivity implements MyClickListener { } }); //3.工序步骤 - gxbz_adapter = new gongxubuzhou_adapter(getContext(), R.layout.gx_item, (List) bpa_goodsrecipes,this); + gxbz_adapter = new gongxubuzhou_adapter(getContext(), R.layout.gx_item, (List) bpa_goodsrecipes,null); datatab_gxbz.setAdapter(gxbz_adapter); datatab_gxbz.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override @@ -122,6 +134,17 @@ public class DiyActivity extends BaseActivity implements MyClickListener { gxbz_adapter.notifyDataSetInvalidated(); } }); + + //图标选择 + MessageManager.getInstance().registerMessageReceiver(this, MessageName.ClickImage, new MessageLooper.OnMessageListener() { + @Override + public void onMessage(Object msg) { + if (msg != null) { + imageUrl=(String) msg; + new MyBitmapUtils().disPlay(cpfm,imageUrl); + } + } + }); } /** * 根据选中工序id显示集合 @@ -264,9 +287,15 @@ public class DiyActivity extends BaseActivity implements MyClickListener { * 点击事件 * @param view */ - @OnClick({R.id.add_hrgx,R.id.update_gx,R.id.delete_gx,R.id.shangyi,R.id.xiayi,R.id.caozuomoshi,R.id.shengchengcaipu}) + @OnClick({R.id.add_hrgx,R.id.update_gx,R.id.delete_gx,R.id.shangyi,R.id.xiayi,R.id.caozuomoshi,R.id.shengchengcaipu,R.id.cpfm}) public void onViewClicked(View view) { switch (view.getId()) { + case R.id.cpfm://菜谱封面 + // 跳转到登录页面 + Intent intent = new Intent(getContext(), ImageChooseActivity.class); + intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + startActivity(intent); + break; case R.id.add_hrgx://添加工序 BPA_GOODSRECIPE goodsrecipe= GetSelectItemFromValue(); if(goodsrecipe!=null) @@ -339,11 +368,12 @@ public class DiyActivity extends BaseActivity implements MyClickListener { } break; case R.id.caozuomoshi://操作模式 - ToastUtils.info("操作模式"); break; case R.id.shengchengcaipu://生成菜谱 String name=edittext.getText().toString(); + + if(name.isEmpty()) { ToastUtils.info("菜谱名称不能为空!"); @@ -362,13 +392,20 @@ public class DiyActivity extends BaseActivity implements MyClickListener { AlertDialogUtils.showDialog(view.getContext(), title, message, new QMUIDialogAction.ActionListener() { @Override public void onClick(QMUIDialog dialog, int index) { + int sc=60*3; + if(!zzsc.getText().toString().isEmpty() && !zzsc.getText().toString().equals("0")) + { + sc=Integer.parseInt(zzsc.getText().toString()); + } + ArrayList goods=QueryDB.GetGoodsALL(); BPA_GOODS good=new BPA_GOODS(); good.name=name; good.status=1; good.sort=goods.size()+1; - good.maketime=60*3; - good.issc=0; + good.maketime=sc; + good.issc=check.isChecked()?1:0; + good.url=imageUrl; QueryDB.AddGoods(good); for (int k=0;k=0) { @@ -364,7 +395,59 @@ public class DiyUpdateActivity extends BaseActivity { ToastUtils.info("已经最底部!"); } break; - case R.id.shengchengcaipu://保存菜谱 + case R.id.caozuomoshi://操作模式 + ToastUtils.info("操作模式"); + break; + case R.id.shengchengnewcaipu: + String name1=edittext.getText().toString(); + if(name1.isEmpty()) + { + ToastUtils.info("菜谱名称不能为空!"); + return; + }else + { + boolean isSucess= QueryDB.GetGoodsIs(name1); + if(isSucess) + { + ToastUtils.info("菜谱名称已存在!"); + return; + } + //按钮点击 + String title = "生成菜谱操作提示!"; + String message = "请问客官确定要生成["+name1+"]菜谱吗?"; + AlertDialogUtils.showDialog(view.getContext(), title, message, new QMUIDialogAction.ActionListener() { + @Override + public void onClick(QMUIDialog dialog, int index) { + int sc=60*3; + if(!zzsc.getText().toString().isEmpty() && !zzsc.getText().toString().equals("0")) + { + sc=Integer.parseInt(zzsc.getText().toString()); + } + + ArrayList goods=QueryDB.GetGoodsALL(); + BPA_GOODS good=new BPA_GOODS(); + good.name=name1; + good.status=1; + good.sort=goods.size()+1; + good.maketime=sc; + good.issc=check.isChecked()?1:0; + good.url=good.url; + QueryDB.AddGoods(good); + for (int k=0;k pe=QueryDB.GetGoodsSrecipeID(good.id); diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/ImageChooseActivity.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/ImageChooseActivity.java index e374e1be..f8bf9a7e 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/ImageChooseActivity.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/ImageChooseActivity.java @@ -11,9 +11,11 @@ import android.view.View; import com.bonait.bnframework.R; import com.bonait.bnframework.common.base.BaseActivity; import com.bonait.bnframework.common.constant.DataBus; +import com.bonait.bnframework.common.constant.MessageName; import com.bonait.bnframework.common.db.mode.BPA_GOODS; import com.bonait.bnframework.common.helper.AES; 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.common.view.MyLayoutManager; import com.bonait.bnframework.modules.home.adapter.image_sp_adapter; @@ -76,7 +78,7 @@ public class ImageChooseActivity extends BaseActivity { @Override public void clickListener(View v, Object data) { image_sp sp=(image_sp)data; - ToastUtils.info("选择图片:"+sp.url); + MessageManager.getInstance().sendMessage(MessageName.ClickImage,sp.url); finish(); } @Override diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/QDListSectionAdapter.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/QDListSectionAdapter.java index 78894855..e6587068 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/QDListSectionAdapter.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/QDListSectionAdapter.java @@ -75,11 +75,15 @@ public class QDListSectionAdapter extends QMUIDefaultStickySectionAdapter { String name=((SectionItem)section.getItemAt(itemIndex)).getTag(); IsSC=((SectionItem)section.getItemAt(itemIndex)).getIsSC(); String id= ((SectionItem)section.getItemAt(itemIndex)).getAccount(); + String url=((SectionItem)section.getItemAt(itemIndex)).getAddress(); tvTag.setText(name); tvNote.setText("时间:"+ ((SectionItem)section.getItemAt(itemIndex)).getNote()+"秒"); //设置图片 + if(!url.equals("未知")) + { + myBitmapUtils.disPlay(ImageUrl,url); + } //ImageUrl.setBackground(holder.itemView.getContext().getResources().getDrawable(R.mipmap.hgr)); - myBitmapUtils.disPlay(ImageUrl,"https://hbl-test-1305371387.cos.ap-chengdu.myqcloud.com/Franchisee/001/goods/133329989655737022.jpg"); //上传按钮点击 Sc_text.setOnClickListener(new View.OnClickListener() { @Override diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/SectionItem.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/SectionItem.java index 031d34ef..7f51de48 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/SectionItem.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/SectionItem.java @@ -39,12 +39,17 @@ public class SectionItem implements QMUISection.Model { * 是否收藏 */ private Boolean IsSC; + /** + * Url + */ + private String address; - public SectionItem(String name1, String name2, String name3,boolean isSC) { + public SectionItem(String name1, String name2, String name3,String address,boolean isSC) { this.tvTag = name1; this.tvNote = name2; this.tvAccount = name3; this.IsSC=isSC; + this.address=address; } public String getTag() { @@ -61,6 +66,9 @@ public class SectionItem implements QMUISection.Model { public Boolean getIsSC() { return IsSC; } + public String getAddress() { + return address; + } public void SetIsSC(boolean isSC) { @@ -69,14 +77,15 @@ public class SectionItem implements QMUISection.Model { @Override public SectionItem cloneForDiff() { - return new SectionItem(getTag(), getNote(), getAccount(),getIsSC()); + return new SectionItem(getTag(), getNote(), getAccount(),getAddress(),getIsSC()); } @Override public boolean isSameItem(SectionItem other) { return tvTag == other.tvTag || (tvTag != null && tvTag.equals(other.tvTag)) && tvNote == other.tvNote || (tvNote != null && tvNote.equals(other.tvNote)) - && IsSC == other.IsSC || (IsSC != null && IsSC.equals(other.IsSC)) + && IsSC == other.IsSC || (IsSC != null && IsSC.equals(other.IsSC)) + && address == other.address || (address != null && address.equals(other.address)) && tvAccount == other.tvAccount || (tvAccount != null && tvAccount.equals(other.tvAccount)); } @Override @@ -84,5 +93,4 @@ public class SectionItem implements QMUISection.Model { public boolean isSameContent(SectionItem other) { return true; } - } \ No newline at end of file diff --git a/app/src/main/res/layout/activity_diy.xml b/app/src/main/res/layout/activity_diy.xml index 9d227efb..2ab7df78 100644 --- a/app/src/main/res/layout/activity_diy.xml +++ b/app/src/main/res/layout/activity_diy.xml @@ -12,226 +12,301 @@ android:id="@+id/topbar" android:layout_width="match_parent" android:layout_height="?attr/qmui_topbar_height"/> - - - - - + android:layout_height="match_parent" + android:layout_marginBottom="160dp"> - - - + - - - - - - + + + + + + + + android:layout_height="wrap_content"> -