Commit ef19c7db authored by hywang's avatar hywang

1.输入框点击外面不会取消

parent 2bbdab56
......@@ -14,10 +14,10 @@ import org.greenrobot.greendao.identityscope.IdentityScopeType;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* Master of DAO (schema version 1): knows all DAOs.
* Master of DAO (schema version 3): knows all DAOs.
*/
public class DaoMaster extends AbstractDaoMaster {
public static final int SCHEMA_VERSION = 1;
public static final int SCHEMA_VERSION = 3;
/** Creates underlying database table using DAOs. */
public static void createAllTables(Database db, boolean ifNotExists) {
......
......@@ -49,15 +49,15 @@ public class RetrofitClient {
private static final int CACHE_TIMEOUT = 10 * 1024 * 1024;
//服务端根路径
public static String baseUrl =
// "serve.xlglmnmyzspt.org.cn"//正式
"serve.xlglmnmyzspt.org.cn"//正式
// "39.101.170.186"//阿里云测试
"192.168.8.135"//董
// "192.168.8.135"//董
// "192.168.43.154"//张敏
;
public static String port =
// ""//正式
""//正式
// "9000"//阿里云测试
"9000"//董
// "9000"//董
;
private static Context mContext = Utils.getContext();
......
......@@ -45,6 +45,7 @@ import com.phlx.anchorcollect_p.entity.GenTableColumn;
import com.phlx.anchorcollect_p.event.EventTag;
import com.phlx.anchorcollect_p.ui.fragment.vm.BasicsCollectVM;
import com.phlx.anchorcollect_p.ui.info.CattleActivity;
import com.phlx.anchorcollect_p.ui.main.MainActivity;
import com.phlx.anchorcollect_p.util.BaseImageUtils;
import com.phlx.anchorcollect_p.util.DictUtils;
import com.phlx.anchorcollect_p.util.ImagePicker;
......@@ -58,6 +59,7 @@ import java.util.List;
import io.reactivex.functions.Consumer;
import me.goldze.mvvmhabit.base.BaseFragment;
import me.goldze.mvvmhabit.utils.StringUtils;
import me.goldze.mvvmhabit.utils.ToastUtils;
......@@ -67,6 +69,8 @@ public class BasicsCollectFragment extends BaseFragment<FragmentBasicsCollectBin
private ImagePicker mImagePicker;
public MaterialDialog scanRfidDialog;
private static class SingletonClassInstance {
private static final BasicsCollectFragment instance = new BasicsCollectFragment();
}
......@@ -165,6 +169,15 @@ public class BasicsCollectFragment extends BaseFragment<FragmentBasicsCollectBin
@Override
public void initViewObservable() {
super.initViewObservable();
viewModel.setRfidValueEvent.observe(this, new Observer<String>() {
@Override
public void onChanged(String s) {
scanRfidDialog.setContent(s);
}
});
viewModel.onCardClickEvent.observe(getActivity(), new Observer<Boolean>() {
@Override
public void onChanged(Boolean aBoolean) {
......@@ -187,6 +200,9 @@ public class BasicsCollectFragment extends BaseFragment<FragmentBasicsCollectBin
case "photo":
showPhotoDialog(viewModel.currentParamEntity);
break;
case "inventory":
showInventoryDialog(viewModel.currentParamEntity);
break;
}
}
......@@ -309,7 +325,7 @@ public class BasicsCollectFragment extends BaseFragment<FragmentBasicsCollectBin
private void showCheckboxDialog(GenTableColumn uiParamEntity) {
new MaterialDialog.Builder(getActivity()).title("系统信息").content("请选择!!!")
.cancelable(false).canceledOnTouchOutside(false)
// .cancelable(false).canceledOnTouchOutside(false)
.positiveText("确定")
.items(DictUtils.getDistNameList(uiParamEntity.getDictType()))
.itemsCallbackMultiChoice(null, new MaterialDialog.ListCallbackMultiChoice() {
......@@ -354,6 +370,7 @@ public class BasicsCollectFragment extends BaseFragment<FragmentBasicsCollectBin
new MaterialDialog.Builder(getActivity())
.title(uiParamEntity.getColumnComment())
// .iconRes(R.drawable.ic_logo)
.canceledOnTouchOutside(false)
.content("请输入")
// .widgetColor(Color.BLUE)//输入框光标的颜色
.inputType(inputType)//可以输入的类型
......@@ -404,6 +421,53 @@ public class BasicsCollectFragment extends BaseFragment<FragmentBasicsCollectBin
});
}
//盘点
private void showInventoryDialog(GenTableColumn uiParamEntity) {
scanRfidDialog = new MaterialDialog.Builder(getActivity())
.title("牲畜耳标")
// .iconRes(R.drawable.ic_logo)
.content("")
// .widgetColor(Color.BLUE)//输入框光标的颜色
// .inputType(inputType)//可以输入的类型
// .inputRangeRes(0, columnSize, android.R.color.black)
//前2个一个是hint一个是预输入的文字
// .input("低频耳标", "", new MaterialDialog.InputCallback() {
// @Override
// public void onInput(@NonNull MaterialDialog dialog, CharSequence input) {
// Log.i("scan", "输入的是:" + input);
// }
// })
.negativeText("取消")
.neutralText("扫描")
.positiveText("确定")
.autoDismiss(false)
.onPositive(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
viewModel.currentParamEntity.setShowName(dialog.getContentView().getText().toString());
viewModel.currentParamEntity.setContent(dialog.getContentView().getText().toString());
viewModel.currentParamEntity.notifyChange();
dialog.dismiss();
}
})
.onNeutral(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
viewModel.scanFunction = 1;
viewModel.scanRfid();
}
})
.onNegative(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
dialog.dismiss();
}
})
.show();
}
//时间选择
private void showSelectDateDialog(GenTableColumn uiParamEntity) {
pvTime.show(binding.card99);
......
......@@ -204,7 +204,7 @@ public class BreedingRecordFragment extends BaseFragment<FragmentBreedingRecordB
private void showCheckboxDialog(GenTableColumn uiParamEntity) {
new MaterialDialog.Builder(getActivity()).title("系统信息").content("请选择!!!")
.cancelable(false).canceledOnTouchOutside(false)
// .cancelable(false).canceledOnTouchOutside(false)
.positiveText("确定")
.items(DictUtils.getDistNameList(uiParamEntity.getDictType()))
.itemsCallbackMultiChoice(null, new MaterialDialog.ListCallbackMultiChoice() {
......@@ -269,6 +269,7 @@ public class BreedingRecordFragment extends BaseFragment<FragmentBreedingRecordB
new MaterialDialog.Builder(getActivity())
.title(uiParamEntity.getColumnComment())
// .iconRes(R.drawable.ic_logo)
.canceledOnTouchOutside(false)
.content("请输入")
// .widgetColor(Color.BLUE)//输入框光标的颜色
.inputType(inputType)//可以输入的类型
......
......@@ -187,7 +187,7 @@ public class ImmunRecordFragment extends BaseFragment<FragmentImmunRecordBinding
private void showCheckboxDialog(GenTableColumn uiParamEntity) {
new MaterialDialog.Builder(getActivity()).title("系统信息").content("请选择!!!")
.cancelable(false).canceledOnTouchOutside(false)
// .cancelable(false).canceledOnTouchOutside(false)
.positiveText("确定")
.items(DictUtils.getDistNameList(uiParamEntity.getDictType()))
.itemsCallbackMultiChoice(null, new MaterialDialog.ListCallbackMultiChoice() {
......@@ -252,6 +252,7 @@ public class ImmunRecordFragment extends BaseFragment<FragmentImmunRecordBinding
new MaterialDialog.Builder(getActivity())
.title(uiParamEntity.getColumnComment())
// .iconRes(R.drawable.ic_logo)
.canceledOnTouchOutside(false)
.content("请输入")
// .widgetColor(Color.BLUE)//输入框光标的颜色
.inputType(inputType)//可以输入的类型
......
......@@ -186,7 +186,7 @@ public class MedicalRecordFragment extends BaseFragment<FragmentMedicalRecordBin
private void showCheckboxDialog(GenTableColumn uiParamEntity) {
new MaterialDialog.Builder(getActivity()).title("系统信息").content("请选择!!!")
.cancelable(false).canceledOnTouchOutside(false)
// .cancelable(false).canceledOnTouchOutside(false)
.positiveText("确定")
.items(DictUtils.getDistNameList(uiParamEntity.getDictType()))
.itemsCallbackMultiChoice(null, new MaterialDialog.ListCallbackMultiChoice() {
......@@ -251,6 +251,7 @@ public class MedicalRecordFragment extends BaseFragment<FragmentMedicalRecordBin
new MaterialDialog.Builder(getActivity())
.title(uiParamEntity.getColumnComment())
// .iconRes(R.drawable.ic_logo)
.canceledOnTouchOutside(false)
.content("请输入")
// .widgetColor(Color.BLUE)//输入框光标的颜色
.inputType(inputType)//可以输入的类型
......
......@@ -187,7 +187,7 @@ public class PerformanceFragment extends BaseFragment<FragmentPerformanceBinding
private void showCheckboxDialog(GenTableColumn uiParamEntity) {
new MaterialDialog.Builder(getActivity()).title("系统信息").content("请选择!!!")
.cancelable(false).canceledOnTouchOutside(false)
// .cancelable(false).canceledOnTouchOutside(false)
.positiveText("确定")
.items(DictUtils.getDistNameList(uiParamEntity.getDictType()))
.itemsCallbackMultiChoice(null, new MaterialDialog.ListCallbackMultiChoice() {
......@@ -252,6 +252,7 @@ public class PerformanceFragment extends BaseFragment<FragmentPerformanceBinding
new MaterialDialog.Builder(getActivity())
.title(uiParamEntity.getColumnComment())
// .iconRes(R.drawable.ic_logo)
.canceledOnTouchOutside(false)
.content("请输入")
// .widgetColor(Color.BLUE)//输入框光标的颜色
.inputType(inputType)//可以输入的类型
......
......@@ -300,7 +300,7 @@ public class WeightManFragment extends BaseFragment<FragmentWeightmanBinding, We
private void showCheckboxDialog(GenTableColumn uiParamEntity) {
new MaterialDialog.Builder(getActivity()).title("系统信息").content("请选择!!!")
.cancelable(false).canceledOnTouchOutside(false)
// .cancelable(false).canceledOnTouchOutside(false)
.positiveText("确定")
.items(DictUtils.getDistNameList(uiParamEntity.getDictType()))
.itemsCallbackMultiChoice(null, new MaterialDialog.ListCallbackMultiChoice() {
......@@ -366,6 +366,7 @@ public class WeightManFragment extends BaseFragment<FragmentWeightmanBinding, We
new MaterialDialog.Builder(getActivity())
.title(uiParamEntity.getColumnComment())
// .iconRes(R.drawable.ic_logo)
.canceledOnTouchOutside(false)
.content("请输入")
// .widgetColor(Color.BLUE)//输入框光标的颜色
.inputType(inputType)//可以输入的类型
......
......@@ -90,6 +90,8 @@ public class BasicsCollectVM extends BaseViewModel<Repository> implements OnInve
public SingleLiveEvent<Boolean> onTagClickEvent = new SingleLiveEvent<>();
public SingleLiveEvent<Boolean> onNotifyAllEvent = new SingleLiveEvent<>();//true是清空页面
public SingleLiveEvent<String> setRfidValueEvent = new SingleLiveEvent<>();//设置弹窗的扫到的标签epc
public SingleLiveEvent<String> onShowDialogEvent = new SingleLiveEvent<>();//弹窗提示
public ObservableField<String> tag = new ObservableField<>("");
......@@ -118,6 +120,8 @@ public class BasicsCollectVM extends BaseViewModel<Repository> implements OnInve
private List<CattleResumeEntity> uploadData;
public int scanFunction = 0;//0 是普通扫描耳标,1 是弹出窗的扫描耳标
public BasicsCollectVM(@NonNull Application application, Repository model) {
super(application, model);
......@@ -222,7 +226,7 @@ public class BasicsCollectVM extends BaseViewModel<Repository> implements OnInve
}
//扫描rfid
private void scanRfid() {
public void scanRfid() {
if (!isScan) {
rfidTag = "";
......@@ -320,6 +324,7 @@ public class BasicsCollectVM extends BaseViewModel<Repository> implements OnInve
public BindingCommand onWeightChangedClick = new BindingCommand(new BindingAction() {
@Override
public void call() {
scanFunction = 0;
scanRfid();
}
});
......@@ -520,7 +525,11 @@ public class BasicsCollectVM extends BaseViewModel<Repository> implements OnInve
private void checkEpc(String epc, String tid) {
ToastUtils.showShort("盘点到标签:" + epc + "|停止盘点");
rfidTag = epc + tid;
if (scanFunction == 0) {
initDataForRfid(epc);
} else if (scanFunction == 1) {
setRfidValueEvent.setValue(epc);
}
}
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment