private void initList() { List<PurchaseHistory> purchaseHistories = PurchaseHistory.find(PurchaseHistory.class, "dealer_name = ?", dealerName); List<PaymentHistory> paymentHistories = PaymentHistory.find(PaymentHistory.class, "dealer_id =?", dealerName); Myenum.INSTANCE.setPurchaseHistories(purchaseHistories); Myenum.INSTANCE.setPaymentHistories(paymentHistories); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment MkShop.SCRREN = "RepairListItemFragment"; service = Myenum.INSTANCE.getServiceCenterEntity(); ViewGroup v = (ViewGroup) inflater.inflate(R.layout.fragment_repair_list_item, container, false); initView(v); problem.setText(service.getProblem()); brand.setText(service.getBrand().replace("\\n", "")); modelNo.setText(service.getModel()); price.setText("" + service.getPrice()); jobNo.setText(service.getJobNo()); jobNo.setEnabled(false); if (service.getResolution() != null && !service.getResolution().equalsIgnoreCase("null")) resolution.setText(service.getResolution()); status.setText(service.getStatus()); stringStatus = service.getStatus(); setIndex(service.getStatus()); status.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { new MaterialDialog.Builder(getActivity()) .items(R.array.items) .itemsCallbackSingleChoice( index, new MaterialDialog.ListCallbackSingleChoice() { @Override public boolean onSelection( MaterialDialog dialog, View view, int which, CharSequence text) { stringStatus = text.toString(); if (stringStatus.equalsIgnoreCase("Returned")) { price.setVisibility(View.GONE); price.setText("0"); } else { price.setVisibility(View.VISIBLE); } status.setText(stringStatus); setIndex(stringStatus); return true; } }) .positiveText("select") .show(); } }); submit.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { service.setPrice(price.getText().toString()); service.setStatus(stringStatus); service.setProblem(problem.getText().toString()); service.setDeliveryDate(""); service.setUsername(MkShop.Username); if (resolution.getText().length() > 0) service.setResolution(resolution.getText().toString()); else service.setResolution(""); new SendData().execute(); } }); return v; }