@Test public void shouldOnlyEnableCurrentSelectedEditTextWhenChoseMovementTypeWhenToggleIsOn() throws ParseException, LMISException { viewModel.setDraft(true); viewHolder.populate(viewModel, stockCard); viewHolder.txMovementDate.setText(""); StockMovementViewHolder.MovementSelectListener listener = viewHolder.new MovementSelectListener(viewModel); MovementReasonManager.MovementReason receiveReason = new MovementReasonManager.MovementReason(MovementReasonManager.MovementType.RECEIVE, "DON", "Donations"); listener.onComplete(receiveReason); assertTrue(viewHolder.etReceived.isEnabled()); assertFalse(viewHolder.etPositiveAdjustment.isEnabled()); assertFalse(viewHolder.etNegativeAdjustment.isEnabled()); assertFalse(viewHolder.etIssued.isEnabled()); assertFalse(viewHolder.etRequested.isEnabled()); MovementReasonManager.MovementReason positiveReason = new MovementReasonManager.MovementReason(MovementReasonManager.MovementType.POSITIVE_ADJUST, "POSITIVE", "BOUGHT"); listener.onComplete(positiveReason); assertFalse(viewHolder.etReceived.isEnabled()); assertTrue(viewHolder.etPositiveAdjustment.isEnabled()); assertFalse(viewHolder.etNegativeAdjustment.isEnabled()); assertFalse(viewHolder.etIssued.isEnabled()); assertFalse(viewHolder.etRequested.isEnabled()); }
public void populate(final StockMovementViewModel model, StockCard stockCard) { removeTextChangeListeners(model, stockCard.calculateSOHFromLots()); disableLine(); hideUnderline(); txMovementDate.setText(model.getMovementDate()); etDocumentNo.setText(model.getDocumentNo()); etReceived.setText(model.getReceived()); etNegativeAdjustment.setText(model.getNegativeAdjustment()); etPositiveAdjustment.setText(model.getPositiveAdjustment()); etIssued.setText(model.getIssued()); etRequested.setText(model.getRequested()); txStockExistence.setText(model.getStockExistence()); txSignature.setText(model.getSignature()); if (model.getReason() != null) { txReason.setText(model.getReason().getDescription()); } else { txReason.setText(StringUtils.EMPTY); } setItemViewTextColor(model); if (model.isDraft()) { setInitialDraftStyle(model); } else { itemView.setBackgroundColor(Color.TRANSPARENT); } addClickListeners(model, getPreviousMovementDate(stockCard)); addTextChangedListeners(model, stockCard.calculateSOHFromLots()); }
StockMovementViewHolder extends BaseViewHolder { public void populate(final StockMovementViewModel model, StockCard stockCard) { removeTextChangeListeners(model, stockCard.calculateSOHFromLots()); disableLine(); hideUnderline(); txMovementDate.setText(model.getMovementDate()); etDocumentNo.setText(model.getDocumentNo()); etReceived.setText(model.getReceived()); etNegativeAdjustment.setText(model.getNegativeAdjustment()); etPositiveAdjustment.setText(model.getPositiveAdjustment()); etIssued.setText(model.getIssued()); etRequested.setText(model.getRequested()); txStockExistence.setText(model.getStockExistence()); txSignature.setText(model.getSignature()); if (model.getReason() != null) { txReason.setText(model.getReason().getDescription()); } else { txReason.setText(StringUtils.EMPTY); } setItemViewTextColor(model); if (model.isDraft()) { setInitialDraftStyle(model); } else { itemView.setBackgroundColor(Color.TRANSPARENT); } addClickListeners(model, getPreviousMovementDate(stockCard)); addTextChangedListeners(model, stockCard.calculateSOHFromLots()); } }
StockMovementViewHolder extends BaseViewHolder { public void populate(final StockMovementViewModel model, StockCard stockCard) { removeTextChangeListeners(model, stockCard.calculateSOHFromLots()); disableLine(); hideUnderline(); txMovementDate.setText(model.getMovementDate()); etDocumentNo.setText(model.getDocumentNo()); etReceived.setText(model.getReceived()); etNegativeAdjustment.setText(model.getNegativeAdjustment()); etPositiveAdjustment.setText(model.getPositiveAdjustment()); etIssued.setText(model.getIssued()); etRequested.setText(model.getRequested()); txStockExistence.setText(model.getStockExistence()); txSignature.setText(model.getSignature()); if (model.getReason() != null) { txReason.setText(model.getReason().getDescription()); } else { txReason.setText(StringUtils.EMPTY); } setItemViewTextColor(model); if (model.isDraft()) { setInitialDraftStyle(model); } else { itemView.setBackgroundColor(Color.TRANSPARENT); } addClickListeners(model, getPreviousMovementDate(stockCard)); addTextChangedListeners(model, stockCard.calculateSOHFromLots()); } StockMovementViewHolder(View itemView); }
StockMovementViewHolder extends BaseViewHolder { public void populate(final StockMovementViewModel model, StockCard stockCard) { removeTextChangeListeners(model, stockCard.calculateSOHFromLots()); disableLine(); hideUnderline(); txMovementDate.setText(model.getMovementDate()); etDocumentNo.setText(model.getDocumentNo()); etReceived.setText(model.getReceived()); etNegativeAdjustment.setText(model.getNegativeAdjustment()); etPositiveAdjustment.setText(model.getPositiveAdjustment()); etIssued.setText(model.getIssued()); etRequested.setText(model.getRequested()); txStockExistence.setText(model.getStockExistence()); txSignature.setText(model.getSignature()); if (model.getReason() != null) { txReason.setText(model.getReason().getDescription()); } else { txReason.setText(StringUtils.EMPTY); } setItemViewTextColor(model); if (model.isDraft()) { setInitialDraftStyle(model); } else { itemView.setBackgroundColor(Color.TRANSPARENT); } addClickListeners(model, getPreviousMovementDate(stockCard)); addTextChangedListeners(model, stockCard.calculateSOHFromLots()); } StockMovementViewHolder(View itemView); void populate(final StockMovementViewModel model, StockCard stockCard); void highLightAndShowBottomBtn(); }
StockMovementViewHolder extends BaseViewHolder { public void populate(final StockMovementViewModel model, StockCard stockCard) { removeTextChangeListeners(model, stockCard.calculateSOHFromLots()); disableLine(); hideUnderline(); txMovementDate.setText(model.getMovementDate()); etDocumentNo.setText(model.getDocumentNo()); etReceived.setText(model.getReceived()); etNegativeAdjustment.setText(model.getNegativeAdjustment()); etPositiveAdjustment.setText(model.getPositiveAdjustment()); etIssued.setText(model.getIssued()); etRequested.setText(model.getRequested()); txStockExistence.setText(model.getStockExistence()); txSignature.setText(model.getSignature()); if (model.getReason() != null) { txReason.setText(model.getReason().getDescription()); } else { txReason.setText(StringUtils.EMPTY); } setItemViewTextColor(model); if (model.isDraft()) { setInitialDraftStyle(model); } else { itemView.setBackgroundColor(Color.TRANSPARENT); } addClickListeners(model, getPreviousMovementDate(stockCard)); addTextChangedListeners(model, stockCard.calculateSOHFromLots()); } StockMovementViewHolder(View itemView); void populate(final StockMovementViewModel model, StockCard stockCard); void highLightAndShowBottomBtn();  }