From 71d1194158fd1e656ccf473fadfb164c35819935 Mon Sep 17 00:00:00 2001 From: wangh <123456> Date: Wed, 21 Feb 2024 17:19:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/AndroidManifest.xml | 19 ++- .../example/beijing_daxing/CheckActivity.java | 83 ++++++----- .../example/beijing_daxing/FpInActivity.java | 2 +- .../example/beijing_daxing/FpOutActivity.java | 137 ++++++++++++++++++ .../beijing_daxing/HomePageActivity.java | 33 ++++- .../example/beijing_daxing/InActivity.java | 12 +- .../example/beijing_daxing/MainActivity.java | 11 +- .../beijing_daxing/StoreCheckActivity.java | 1 + .../beijing_daxing/adapter/OutAdapter.java | 65 +++++++++ .../beijing_daxing/base/BaseActivity.java | 19 ++- .../beijing_daxing/dialog/InPutDialog.java | 48 ++++++ .../res/drawable/ic_launcher_background.xml | 2 +- app/src/main/res/drawable/logo.png | Bin 0 -> 2969 bytes app/src/main/res/layout/activity_fp_out.xml | 64 ++++++++ app/src/main/res/layout/activity_main.xml | 5 +- app/src/main/res/layout/dialog_input.xml | 71 +++++++++ app/src/main/res/layout/item_out.xml | 62 ++++++++ .../res/mipmap-anydpi-v26/ic_launcher.xml | 6 - .../mipmap-anydpi-v26/ic_launcher_round.xml | 6 - app/src/main/res/mipmap-hdpi/ic_launcher.webp | Bin 1404 -> 0 bytes .../res/mipmap-hdpi/ic_launcher_round.webp | Bin 2898 -> 0 bytes app/src/main/res/mipmap-mdpi/ic_launcher.webp | Bin 982 -> 0 bytes .../res/mipmap-mdpi/ic_launcher_round.webp | Bin 1772 -> 0 bytes .../main/res/mipmap-xhdpi/ic_launcher.webp | Bin 1900 -> 0 bytes .../res/mipmap-xhdpi/ic_launcher_round.webp | Bin 3918 -> 0 bytes .../main/res/mipmap-xxhdpi/ic_launcher.webp | Bin 2884 -> 0 bytes .../res/mipmap-xxhdpi/ic_launcher_round.webp | Bin 5914 -> 0 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.webp | Bin 3844 -> 0 bytes .../res/mipmap-xxxhdpi/ic_launcher_round.webp | Bin 7778 -> 0 bytes app/src/main/res/values/themes.xml | 15 ++ 30 files changed, 575 insertions(+), 86 deletions(-) create mode 100644 app/src/main/java/com/example/beijing_daxing/FpOutActivity.java create mode 100644 app/src/main/java/com/example/beijing_daxing/adapter/OutAdapter.java create mode 100644 app/src/main/java/com/example/beijing_daxing/dialog/InPutDialog.java create mode 100644 app/src/main/res/drawable/logo.png create mode 100644 app/src/main/res/layout/activity_fp_out.xml create mode 100644 app/src/main/res/layout/dialog_input.xml create mode 100644 app/src/main/res/layout/item_out.xml delete mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml delete mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml delete mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher.webp delete mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher_round.webp delete mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher.webp delete mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher_round.webp delete mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher.webp delete mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp delete mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher.webp delete mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp delete mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp delete mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index f256820..123018e 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -7,12 +7,15 @@ android:allowBackup="true" android:dataExtractionRules="@xml/data_extraction_rules" android:fullBackupContent="@xml/backup_rules" - android:icon="@mipmap/ic_launcher" + android:icon="@drawable/logo" android:label="@string/app_name" - android:roundIcon="@mipmap/ic_launcher_round" + android:roundIcon="@drawable/logo" android:supportsRtl="true" android:theme="@style/Theme.Beijingdaxing" tools:targetApi="31"> + @@ -36,15 +39,19 @@ + + + + + + - - \ No newline at end of file diff --git a/app/src/main/java/com/example/beijing_daxing/CheckActivity.java b/app/src/main/java/com/example/beijing_daxing/CheckActivity.java index 0c1250e..e4c623f 100644 --- a/app/src/main/java/com/example/beijing_daxing/CheckActivity.java +++ b/app/src/main/java/com/example/beijing_daxing/CheckActivity.java @@ -1,17 +1,11 @@ package com.example.beijing_daxing; -import androidx.appcompat.app.AlertDialog; -import androidx.appcompat.app.AppCompatActivity; -import androidx.databinding.BaseObservable; import androidx.databinding.DataBindingUtil; import androidx.databinding.ObservableBoolean; -import androidx.databinding.ObservableField; -import android.content.DialogInterface; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; -import android.widget.EditText; import android.widget.Toast; import com.example.beijing_daxing.adapter.CheckAdapter; @@ -21,6 +15,7 @@ import com.example.beijing_daxing.base.MyRecultCall; import com.example.beijing_daxing.base.MyResult; import com.example.beijing_daxing.been.Stock; import com.example.beijing_daxing.databinding.ActivityCheckBinding; +import com.example.beijing_daxing.dialog.InPutDialog; import com.example.beijing_daxing.uitls.SharedPreferencesUtils; import com.google.gson.reflect.TypeToken; import com.lzy.okgo.OkGo; @@ -28,14 +23,15 @@ import com.lzy.okgo.model.Response; import java.util.Arrays; import java.util.List; +import java.util.concurrent.atomic.AtomicBoolean; -public class CheckActivity extends BaseActivity implements AdapterClickCall { +public class CheckActivity extends BaseActivity implements AdapterClickCall, InPutDialog.InPutDialogCall { private ActivityCheckBinding binding; private CheckAdapter adapter; private List list; private List selectList; private ObservableBoolean state; - private AlertDialog.Builder inputDialog; + private InPutDialog inputDialog; @Override protected void onCreate(Bundle savedInstanceState) { @@ -59,23 +55,14 @@ public class CheckActivity extends BaseActivity implements AdapterClickCall { } }); initRequest(); - initAlertDialog(); - } + inputDialog = new InPutDialog(this); + inputDialog.setInPutDialogCall(this); - private void initAlertDialog() { - final EditText editText = new EditText(this); - inputDialog = new AlertDialog.Builder(this); - inputDialog.setTitle("输入跳过原因").setView(editText); - inputDialog.setPositiveButton("确定", (dialog, which) -> { - var stock = list.get(tag); - stock.setState("跳过"); - stock.setRemark(editText.getText().toString()); - adapter.notifyItemChanged(tag); - }); } + private void initRequest() { OkGo.post(url + "/xj/select").params("user", SharedPreferencesUtils.getstring("user", "")).execute(new MyRecultCall(dialog, this) { @Override @@ -85,6 +72,10 @@ public class CheckActivity extends BaseActivity implements AdapterClickCall { if (body.getCode() == 0) { list = gson.fromJson(body.getData().toString(), new TypeToken>() { }.getType()); + if (list == null || list.isEmpty()) { + Toast.makeText(CheckActivity.this, "没有维护巡检区域", Toast.LENGTH_SHORT).show(); + return; + } adapter.setList(list); adapter.notifyDataSetChanged(); return; @@ -93,41 +84,47 @@ public class CheckActivity extends BaseActivity implements AdapterClickCall { } }); } - private int subIndex=-1; + + private int subIndex = -1; + @Override protected void sanRfid(List epcs) { var text = epcs.get(0); binding.checkEpc.setText(text); - Stock stock=new Stock(); + Stock stock = new Stock(); stock.setEpcCode(text); var index = list.indexOf(stock); - if (index==-1){ + if (index == -1) { Toast.makeText(this, "轮挡扫描错误", Toast.LENGTH_SHORT).show(); return; } - subIndex=index; + subIndex = index; } public void check_submit(View view) { - list.forEach(t->{ - if (t.getState().equals("未检")) return; - }); - OkGo.post(url+"/xj/submit") + + var type = list.stream().anyMatch(t -> t.getState().equals("未检")); + if (type) { + Toast.makeText(this, "未检完全部轮挡,不允许提交", Toast.LENGTH_SHORT).show(); + return; + } + OkGo.post(url + "/xj/submit") .tag(this) - .params("json",gson.toJson(list)) - .params("user", SharedPreferencesUtils.getstring("user","test-user")) - .execute(new MyRecultCall(dialog,this){ - @Override - public void onSuccess(Response response) { - super.onSuccess(response); - Toast.makeText(CheckActivity.this, "提交成功", Toast.LENGTH_SHORT).show(); - // finish(); - } - }); + .params("json", gson.toJson(list)) + .params("user", SharedPreferencesUtils.getstring("user", "test-user")) + .execute(new MyRecultCall(dialog, this) { + @Override + public void onSuccess(Response response) { + super.onSuccess(response); + Toast.makeText(CheckActivity.this, "提交成功", Toast.LENGTH_SHORT).show(); + finish(); + } + }); } + public void check_stock(View view) { - if (subIndex==-1) return; + if (subIndex == -1) return; var stock = list.get(subIndex); stock.setState(binding.checkItemSelect.getSelectedItem().toString()); stock.setRemark(binding.checkRemark.getText().toString()); @@ -145,4 +142,12 @@ public class CheckActivity extends BaseActivity implements AdapterClickCall { } + @Override + public void inPutDialogReculi(String name) { + var stock = list.get(tag); + stock.setState("跳过"); + stock.setRemark(name); + inputDialog.dismiss(); + adapter.notifyDataSetChanged(); + } } \ No newline at end of file diff --git a/app/src/main/java/com/example/beijing_daxing/FpInActivity.java b/app/src/main/java/com/example/beijing_daxing/FpInActivity.java index 7577ddd..58a6955 100644 --- a/app/src/main/java/com/example/beijing_daxing/FpInActivity.java +++ b/app/src/main/java/com/example/beijing_daxing/FpInActivity.java @@ -58,7 +58,7 @@ public class FpInActivity extends BaseActivity { } public void fpin_submit(View view){ - Log.e("TAG", "onSuccess:" +vm.toString() ); + // Log.e("TAG", "onSuccess:" +vm.toString() ); var state = vm.getState(); if (!state.equals("报废")){ Toast.makeText(this, "轮挡状态:"+state+",不能使用废品入库功能", Toast.LENGTH_SHORT).show(); diff --git a/app/src/main/java/com/example/beijing_daxing/FpOutActivity.java b/app/src/main/java/com/example/beijing_daxing/FpOutActivity.java new file mode 100644 index 0000000..12f359e --- /dev/null +++ b/app/src/main/java/com/example/beijing_daxing/FpOutActivity.java @@ -0,0 +1,137 @@ +package com.example.beijing_daxing; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; +import androidx.databinding.DataBindingUtil; +import androidx.databinding.ObservableBoolean; + +import android.annotation.SuppressLint; +import android.os.Bundle; +import android.os.Handler; +import android.os.Message; +import android.view.View; +import android.widget.Toast; + +import com.example.beijing_daxing.adapter.OutAdapter; +import com.example.beijing_daxing.adapter.StoreCheckAdapter; +import com.example.beijing_daxing.base.BaseActivity; +import com.example.beijing_daxing.base.MyRecultCall; +import com.example.beijing_daxing.base.MyResult; +import com.example.beijing_daxing.been.Stock; +import com.example.beijing_daxing.databinding.ActivityFpOutBinding; +import com.example.beijing_daxing.uitls.SharedPreferencesUtils; +import com.google.gson.reflect.TypeToken; +import com.lzy.okgo.OkGo; +import com.lzy.okgo.model.Response; + +import java.util.ArrayList; +import java.util.List; + +public class FpOutActivity extends BaseActivity { + private ObservableBoolean checkState; + private List list; + private OutAdapter adapter; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + ActivityFpOutBinding binding= DataBindingUtil. setContentView(this,R.layout.activity_fp_out); + checkState=new ObservableBoolean(); + binding.setCheckState(checkState); + adapter = new OutAdapter(this); + binding.setAdapter(adapter); + initRequest(); + } + + private List tagList; + @Override + protected void sanRfid(List epcs) { + epcs.forEach(t -> { + if (tagList.contains(t)){ + tagList.add(t); + return; + } + var stock = new Stock(); + stock.setEpcCode(t); + var index = list.indexOf(stock); + if (index != -1) { + list.get(index).setState("Y"); + } + }); + adapter.notifyDataSetChanged(); + } + private void initRequest() { + OkGo.post(url + "/fpout/select").tag(this).execute(new MyRecultCall(dialog, this) { + @Override + public void onSuccess(Response response) { + super.onSuccess(response); + var body = response.body(); + if (body.getCode() == 0) { + list = gson.fromJson(body.getData().toString(), new TypeToken>() { + }.getType()); + tagList=new ArrayList<>(); + adapter.setList(list); + adapter.notifyDataSetChanged(); + } else { + Toast.makeText(FpOutActivity.this, body.getMsg(), Toast.LENGTH_SHORT).show(); + } + } + }); + } + public void fp_out_read(View view) { + var b = checkState.get(); + if (b) { + handler.removeCallbacks(runnable); + } else { + handler.postDelayed(runnable, 0); + } + checkState.set(!b); + } + + public void fp_out_submit(View view) { + if (list.stream().anyMatch(t -> t.getState().equals("N"))){ + return; + } + handler.removeCallbacks(runnable); + + OkGo.post(url+"/fpout/submit") + .tag(this) + .params("user", SharedPreferencesUtils.getstring("user","test")) + .params("json",gson.toJson(list)) + .execute(new MyRecultCall(dialog,this){ + @Override + public void onSuccess(Response response) { + super.onSuccess(response); + var body = response.body(); + if (body.getCode()==0){ + finish(); + Toast.makeText(FpOutActivity.this, "提交成功", Toast.LENGTH_SHORT).show(); + }else { + Toast.makeText(FpOutActivity.this, body.getMsg(), Toast.LENGTH_SHORT).show(); + } + } + }); + } + + @SuppressLint("HandlerLeak") + private Handler handler = new Handler() { + @Override + public void handleMessage(@NonNull Message msg) { + super.handleMessage(msg); + } + }; + private Runnable runnable = new Runnable() { + @Override + public void run() { + sendBroadcast(broadcastIntent); + handler.postDelayed(runnable, 1000); + } + }; + + @Override + protected void onDestroy() { + super.onDestroy(); + handler.removeCallbacks(runnable); + handler=null; + runnable=null; + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/beijing_daxing/HomePageActivity.java b/app/src/main/java/com/example/beijing_daxing/HomePageActivity.java index 2c3224f..c2f958d 100644 --- a/app/src/main/java/com/example/beijing_daxing/HomePageActivity.java +++ b/app/src/main/java/com/example/beijing_daxing/HomePageActivity.java @@ -11,10 +11,16 @@ import android.widget.AdapterView; import android.widget.Toast; import com.example.beijing_daxing.adapter.HomePageAdapter; +import com.example.beijing_daxing.base.BaseActivity; +import com.example.beijing_daxing.base.MyApplication; import com.example.beijing_daxing.databinding.ActivityHomePageBinding; import com.example.beijing_daxing.been.HomeIcon; +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; +import com.handheld.UHFLonger.UHFLongerManager; import java.util.ArrayList; +import java.util.Iterator; import java.util.List; public class HomePageActivity extends AppCompatActivity { @@ -22,19 +28,22 @@ public class HomePageActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - ActivityHomePageBinding binding= DataBindingUtil. setContentView(this,R.layout.activity_home_page); + ActivityHomePageBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_home_page); List list = new ArrayList<>(); + list.add(new HomeIcon(R.mipmap.home_in1, "轮挡入库", InActivity.class)); list.add(new HomeIcon(R.mipmap.home_out1, "轮挡领用出库", OutActivity.class)); list.add(new HomeIcon(R.mipmap.home_store_check, "仓库盘点", StoreCheckActivity.class)); list.add(new HomeIcon(R.mipmap.home_check, "轮挡巡检", CheckActivity.class)); list.add(new HomeIcon(R.mipmap.home_bf, "轮挡报废", BFActivity.class)); list.add(new HomeIcon(R.mipmap.home_in, "废品入库", FpInActivity.class)); - list.add(new HomeIcon(R.mipmap.home_out, "废品出库", CheckActivity.class)); + list.add(new HomeIcon(R.mipmap.home_out, "废品出库", FpOutActivity.class)); + var intent = getIntent(); - /* try { - if (!loginUser.equals("admin")) { - ArrayList strings = getIntent().getStringArrayListExtra("json"); + try { + if (!intent.getStringExtra("user").equals("admin")) { + ArrayList strings = new Gson().fromJson(intent.getStringExtra("json"), new TypeToken>() { + }.getType()); if (strings != null) { Iterator iter = list.iterator(); while (iter.hasNext()) { @@ -49,7 +58,7 @@ public class HomePageActivity extends AppCompatActivity { } } catch (Exception e) { e.printStackTrace(); - }*/ + } HomePageAdapter adapter = new HomePageAdapter(list, this); binding.homeGridview.setAdapter(adapter); binding.homeGridview.setOnItemClickListener(new AdapterView.OnItemClickListener() { @@ -60,7 +69,10 @@ public class HomePageActivity extends AppCompatActivity { } }); } + + private long exitTime = 0; + @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == 4) { @@ -75,4 +87,13 @@ public class HomePageActivity extends AppCompatActivity { return super.onKeyDown(keyCode, event); } + + @Override + protected void onDestroy() { + super.onDestroy(); + var uhfLongerManager = MyApplication.getUhfLongerManager(); + uhfLongerManager.close(); + MyApplication.uhfLongerManager = null; + + } } \ No newline at end of file diff --git a/app/src/main/java/com/example/beijing_daxing/InActivity.java b/app/src/main/java/com/example/beijing_daxing/InActivity.java index 1e73cea..2a5fb82 100644 --- a/app/src/main/java/com/example/beijing_daxing/InActivity.java +++ b/app/src/main/java/com/example/beijing_daxing/InActivity.java @@ -83,19 +83,19 @@ public class InActivity extends BaseActivity implements AdapterClickCall { String binchCode = vm.getBinchCode(); if (binchCode == null || epcList.isEmpty()) return; vm.setEpcList(epcList); - vm.setSubmitUser(SharedPreferencesUtils.getstring("user","test")); + vm.setSubmitUser(SharedPreferencesUtils.getstring("user", "test")); OkGo.post(url + "/instore/submit") .upRequestBody(RequestBody.create(JSON, gson.toJson(vm))) - .execute(new MyRecultCall(dialog,this){ + .execute(new MyRecultCall(dialog, this) { @Override public void onSuccess(Response response) { super.onSuccess(response); - if (response.body().getCode()==0){ - Toast.makeText(InActivity.this, "提交成功", Toast.LENGTH_SHORT).show(); + Toast.makeText(InActivity.this, response.body().getMsg(), Toast.LENGTH_SHORT).show(); + if (response.body().getCode() == 0) { finish(); - }else { - Toast.makeText(InActivity.this, response.body().getMsg(), Toast.LENGTH_SHORT).show(); } + + } }); } diff --git a/app/src/main/java/com/example/beijing_daxing/MainActivity.java b/app/src/main/java/com/example/beijing_daxing/MainActivity.java index 2703e95..2ee1e70 100644 --- a/app/src/main/java/com/example/beijing_daxing/MainActivity.java +++ b/app/src/main/java/com/example/beijing_daxing/MainActivity.java @@ -66,7 +66,8 @@ public class MainActivity extends BaseActivity { SharedPreferencesUtils.putstring("user",name); SharedPreferencesUtils.putstring("pass",pass); Intent intent=new Intent(MainActivity.this, HomePageActivity.class); - intent.putExtra("json",response.body()); + intent.putExtra("json",body); + intent.putExtra("user",name); startActivity(intent); finish(); } @@ -75,11 +76,5 @@ public class MainActivity extends BaseActivity { }); } - @Override - protected void onDestroy() { - super.onDestroy(); - if (uhfLongerManager!=null){ - uhfLongerManager.close(); - } - } + } \ No newline at end of file diff --git a/app/src/main/java/com/example/beijing_daxing/StoreCheckActivity.java b/app/src/main/java/com/example/beijing_daxing/StoreCheckActivity.java index 4e8450e..e5d6ed0 100644 --- a/app/src/main/java/com/example/beijing_daxing/StoreCheckActivity.java +++ b/app/src/main/java/com/example/beijing_daxing/StoreCheckActivity.java @@ -135,6 +135,7 @@ public class StoreCheckActivity extends BaseActivity { @Override protected void onDestroy() { super.onDestroy(); + handler.removeCallbacks(runnable); handler=null; runnable=null; } diff --git a/app/src/main/java/com/example/beijing_daxing/adapter/OutAdapter.java b/app/src/main/java/com/example/beijing_daxing/adapter/OutAdapter.java new file mode 100644 index 0000000..94a9144 --- /dev/null +++ b/app/src/main/java/com/example/beijing_daxing/adapter/OutAdapter.java @@ -0,0 +1,65 @@ +package com.example.beijing_daxing.adapter; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.ViewGroup; + +import androidx.databinding.DataBindingUtil; +import androidx.recyclerview.widget.RecyclerView; + +import com.example.beijing_daxing.R; +import com.example.beijing_daxing.been.Stock; +import com.example.beijing_daxing.databinding.ItemOutBinding; +import com.example.beijing_daxing.databinding.ItemStoreCheckBinding; + +import java.util.List; + +/** + * @author wanghao + * @date 2024/1/19 14:32 + */ +public class OutAdapter extends RecyclerView.Adapter { + private Context context; + private List list; + private LayoutInflater inflater; + + public OutAdapter(Context context) { + this.context = context; + inflater = LayoutInflater.from(context); + } + + public void setList(List list) { + this.list = list; + } + + @Override + public MyViewHoder onCreateViewHolder(ViewGroup parent, int viewType) { + ItemOutBinding binding = DataBindingUtil.inflate(inflater, R.layout.item_out, parent, false); + return new MyViewHoder(binding); + } + + @Override + public void onBindViewHolder(MyViewHoder holder, int position) { + var binding = holder.getBinding(); + binding.setItem(list.get(position)); + + } + + @Override + public int getItemCount() { + return list==null?0:list.size(); + } + + public class MyViewHoder extends RecyclerView.ViewHolder { + private ItemOutBinding binding; + + public MyViewHoder( ItemOutBinding binding) { + super(binding.getRoot()); + this.binding = binding; + } + + public ItemOutBinding getBinding() { + return binding; + } + } +} diff --git a/app/src/main/java/com/example/beijing_daxing/base/BaseActivity.java b/app/src/main/java/com/example/beijing_daxing/base/BaseActivity.java index c6b91a6..a692079 100644 --- a/app/src/main/java/com/example/beijing_daxing/base/BaseActivity.java +++ b/app/src/main/java/com/example/beijing_daxing/base/BaseActivity.java @@ -9,6 +9,8 @@ import android.content.Intent; import android.content.IntentFilter; import android.media.MediaPlayer; import android.os.Bundle; +import android.util.Log; +import android.view.KeyEvent; import android.view.Window; import android.widget.Toast; @@ -23,14 +25,14 @@ import java.util.List; import okhttp3.MediaType; public abstract class BaseActivity extends AppCompatActivity { - // public static String url = "http://192.168.0.102:90/api"; - public static String url = "http://172.20.10.2:90/api"; + public static String url = "http://192.168.0.102:90/api"; + // public static String url = "http://172.20.10.2:90/api"; public ProgressDialog dialog; public Gson gson; public MediaType JSON = MediaType.parse("application/json; charset=utf-8"); public UHFLongerManager uhfLongerManager; private MediaPlayer mediaPlayer; - private MyReceiver myReceiver; + public MyReceiver myReceiver; public Intent broadcastIntent; @@ -45,13 +47,18 @@ public abstract class BaseActivity extends AppCompatActivity { broadcastIntent = new Intent("android.rfid.FUN_KEY"); broadcastIntent.putExtra("keydown", false); } + // private long readTime = 0; public class MyReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { - if (!intent.getBooleanExtra("keydown", false)) { + + var keydown = intent.getBooleanExtra("keydown", false); + if (!keydown ) { + // readTime = System.currentTimeMillis(); List strings = uhfLongerManager.inventoryRealTime(); + Log.e("TAG", "驱动"+(uhfLongerManager==null) ); if (strings == null || strings.isEmpty()) { return; } @@ -77,13 +84,13 @@ public abstract class BaseActivity extends AppCompatActivity { registerReceiver(myReceiver, intentFilter); mediaPlayer = MediaPlayer.create(this, R.raw.msg); } - - @Override protected void onDestroy() { super.onDestroy(); unregisterReceiver(myReceiver); } + + protected abstract void sanRfid(List epcs); } \ No newline at end of file diff --git a/app/src/main/java/com/example/beijing_daxing/dialog/InPutDialog.java b/app/src/main/java/com/example/beijing_daxing/dialog/InPutDialog.java new file mode 100644 index 0000000..54d10db --- /dev/null +++ b/app/src/main/java/com/example/beijing_daxing/dialog/InPutDialog.java @@ -0,0 +1,48 @@ +package com.example.beijing_daxing.dialog; + +import android.app.Dialog; +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; + +import androidx.annotation.NonNull; +import androidx.databinding.DataBindingUtil; + +import com.example.beijing_daxing.R; +import com.example.beijing_daxing.databinding.DialogInputBinding; + +/** + * @author wanghao + * @date 2024/2/21 14:33 + */ +public class InPutDialog extends Dialog { + private InPutDialogCall inPutDialogCall; + private DialogInputBinding binding; + + public void setInPutDialogCall(InPutDialogCall inPutDialogCall) { + this.inPutDialogCall = inPutDialogCall; + } + + public InPutDialog(@NonNull Context context) { + super(context, R.style.dialog); + binding = DataBindingUtil.inflate(LayoutInflater.from(context), + R.layout.dialog_input, null, false); + setContentView(binding.getRoot()); + binding.dialogFalse.setOnClickListener(v -> dismiss()); + binding.dialogTrue.setOnClickListener(v -> { + inPutDialogCall.inPutDialogReculi( binding.inputDialogText.getText().toString().trim()); + }); + } + + + public interface InPutDialogCall { + void inPutDialogReculi(String name); + } + + + + @Override + public void show() { + super.show(); binding.inputDialogText.setText(null); + } +} diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml index 07d5da9..3a1b6ed 100644 --- a/app/src/main/res/drawable/ic_launcher_background.xml +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -5,7 +5,7 @@ android:viewportWidth="108" android:viewportHeight="108"> Px=Q%OWYRCr$PolA&a#TJJD3J3|9U<4o0i6k=x?KTnOSPgEdbLq^fm#HM%As-m_`y%z&nfc>M>g(BLLSwO_yG>4WB6Bwnk4YH%BP} z0>1kD9Pa($i29@2KqCM*&Cr)c`BCb!b)y)9Z|BwRP5_G8Z!P2K3!2=)1r}f<;Cnav zo|Fc*mjK}rJuut^fK$E8R&lyS`|V|$NXg~jw_~@Yh?@XR59oPPcsY?ylxB92fFiuG zxS(F)DmDR_8qhCglBa`IQz}YWSz1t6Zvrr!-X*-BQXfiNyGcMPJjBz+Lklo9OCN%8 zf43@2>7*o}@X^wodSD%Z89G}Qc9K$GAB|mInpZp2jRV@hMd9l{YAki6C4nu3Th-Kn zc!lq^w3=R8+lvGU&oTfPboh=QsvfE4z1-Qd)nFB@kNx>aWI9 zQ)&_@0Hmg|p4(dh=vkntRaXE=O=CT`w*b(yKvSzOTL7-Pd|g%7>;!&31N{77v+ABa z0NlL~;QRR=zW2p{+V3v_L?(fIZUOf02KMdQQ22)8P0bVq^KU0komaf+-Zzf{ZybxP zvn`r4aTY*VxQy}^a`7ti_)*|EzoVP*H8B9N;-9!<-Bge3V&yXgDPPG0@X|j3R(`1K zuES}^1IYr=Me!2waX=@5;PBrT)?<1$6ngzUH#q<}n0w;D`Jm1vhEM+koH)Jit8J0K zUI#;P&%X6%xGt`bEkMdwQUGvD=A#%^`kP<)Dcq*Ke;;&Pgh|K*k^sPG)bnU$rL*$; zxcHguW^8W3HTt=H-TXoyZS13t=mB6szE!hhkrlxcGowhyY!K907zXC8C(nb!ZR-ol zJ``T9BWeI#%4fl{fJc3CJH!&WVhK}l8Z!jZ0#K*?QI7hqFxg^>NZGys_VrfagLPg6Lmx@>a^vABXL z0I-?m!y) zw??L5wd>-Jsm>5_Ko9`B_kCD(p}1^0bolY&-JxrSpy)xnos9ovu8@(Y-ye-Q=)zSK6!1d3Y1S4AS1U)44^+- z%J~9dS{G0w&WutHbat5DIr(yv>-WJwh z{_q|BI>>sTeP$|sWYpxIU;tD%NlIGx>GAs4rd$BX$Qs2=pd2w{IyAyJ`WNMNnGSEF zVAs7t0H}L|mK9fb5~m9Q39j@^pf49-5@wrM)omGo?;L_lsZD+#I{m`&o%&jr^A~l*mdvN0kFOOTWx3)f9mRF zY`@2n0kB-g4uETOg(xe8IUE-#G3|yPI{-e%udyPU236xyUf1WuG6N|67&`#Dy8u)F zLo5OX1Hg6imjrLV8!Nhw$Z?jpjs6h%e=q>}!LAcOC)NDNHu{4EfkGaqR{SLn(|JIl zUzi+)Rfuu)2L-^D6Nfa5eF4C53*@HR!;ro|s0*kHIM%}xx`5yl?8X53*s}nWP;GC@ z#2}zH5ZL;o*A>I)kHQ6rP;6EpMF@N*yF#q}n_!N@0&v4pI8x2W8u+YrNIfx3cSi$2 zU3!>OR^T(wApnF}{Ha156#(2gTkw<;1U@dH!~iw+)D{o8_6qoz=yBZRv)&O)Y!jUY zaK!^DSc1BEhWi)G=#MH3sE$nio4uw{8~b#z?OedvtXPy5K%XU)4>y}2U^D94LpTnT zU-t|KK|Ubmvmgp!Z6arJ543YwXJ0VBF*gojkHw>(7 z-i5q(!p0b(10v?&wI!cLpECk=pay4XfAK4sYV_xZhIpJ(=c&qM$qLUHZD=}UMLXvX|a zVBfw@6aZECz;Ocmbf19HB`{VtA0Inu^9>UVfUZz^Ur;unazxKym@Yj~eOMzt8X+?NpaY4Ou0RYz>qOF&$;`IMNq`fOMdF0mJ<=?ks z_m79vUl#x{3?xF9xmBIax5%^a8M8UOg-@03&<(r&a-%q0A4vPlSMJJKv+@0 z>t}Z0RY~>gn(GCCUcqqM7`P9FJIex6G$gD-;WGt%%+tF~TGbc;z4Ds}w0{lQyRoHg z4-~EiaK#V|!q&3exQQxi?j;Zuc;aRiz;7V@1mF~alWV|Q7u{Qt P00000NkvXXu0mjfb`)Qv literal 0 HcmV?d00001 diff --git a/app/src/main/res/layout/activity_fp_out.xml b/app/src/main/res/layout/activity_fp_out.xml new file mode 100644 index 0000000..6d027ba --- /dev/null +++ b/app/src/main/res/layout/activity_fp_out.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + +