safe to route fix
This commit is contained in:
parent
f142df0144
commit
2358782f3d
@ -849,37 +849,37 @@ public class MainFragment extends DataBindingFragment {
|
||||
}
|
||||
}
|
||||
|
||||
public void onClickQRPay(){
|
||||
public void onClickQR(){
|
||||
// navigate to new QR Pay fragment
|
||||
routeId = R.id.action_nav_main_to_qrFragment;
|
||||
safeNavigateToRouteId();
|
||||
}
|
||||
|
||||
// public void onClickQRPay() {
|
||||
//
|
||||
// String mmqrIp = SystemParamsOperation.getInstance().getSecHostIpAddress();
|
||||
//
|
||||
// if (mainViewModel.payDetailSingle.getValue() != null) {
|
||||
// mainViewModel.startReversal(mainViewModel.payDetailSingle.getValue());
|
||||
public void onClickQRPay() {
|
||||
|
||||
String mmqrIp = SystemParamsOperation.getInstance().getSecHostIpAddress();
|
||||
|
||||
if (mainViewModel.payDetailSingle.getValue() != null) {
|
||||
mainViewModel.startReversal(mainViewModel.payDetailSingle.getValue());
|
||||
}
|
||||
// else if (TMSUtil.getInstance().checkSecHostParams().isStatus() == ValidityStatus.FAILURE) {
|
||||
// showDeclineDialog(getResourceString(R.string.txt_please_download_config)+"\n"+TMSUtil.getInstance().checkSecHostParams().getMessage());
|
||||
// }
|
||||
//// else if (TMSUtil.getInstance().checkSecHostParams().isStatus() == ValidityStatus.FAILURE) {
|
||||
//// showDeclineDialog(getResourceString(R.string.txt_please_download_config)+"\n"+TMSUtil.getInstance().checkSecHostParams().getMessage());
|
||||
//// }
|
||||
// else if (!Connectivity.isConnectedWifi(getContext()) && !Connectivity.isConnectedMobile(getContext())) {
|
||||
// showSingleInfoDialog(getResourceString(R.string.txt_please_enable_internet));
|
||||
else if (!Connectivity.isConnectedWifi(getContext()) && !Connectivity.isConnectedMobile(getContext())) {
|
||||
showSingleInfoDialog(getResourceString(R.string.txt_please_enable_internet));
|
||||
}
|
||||
// else if (!isValidDomain(mmqrIp)) {
|
||||
// showDeclineDialog(getResourceString(R.string.txt_please_check_mmqr_ip));
|
||||
// }
|
||||
//// else if (!isValidDomain(mmqrIp)) {
|
||||
//// showDeclineDialog(getResourceString(R.string.txt_please_check_mmqr_ip));
|
||||
//// }
|
||||
// else {
|
||||
// CurrencyType currencyType = TMSUtil.getInstance().currencyTextToCurrencyType(SystemParamsOperation.getInstance().getSecHostCurrency());
|
||||
// sharedViewModel.set_currencyText(currencyType.name);
|
||||
// processBatch();
|
||||
// sharedViewModel.transactionsType.setValue(TransactionsType.MMQR);
|
||||
// navigateToAmount();
|
||||
//
|
||||
// }
|
||||
// }
|
||||
else {
|
||||
CurrencyType currencyType = TMSUtil.getInstance().currencyTextToCurrencyType(SystemParamsOperation.getInstance().getSecHostCurrency());
|
||||
sharedViewModel.set_currencyText(currencyType.name);
|
||||
processBatch();
|
||||
sharedViewModel.transactionsType.setValue(TransactionsType.MMQR);
|
||||
navigateToAmount();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void onClickSettlement() {
|
||||
|
||||
|
||||
@ -30,15 +30,11 @@ public class QRPayFragment extends DataBindingFragment {
|
||||
|
||||
private MainViewModel mainViewModel;
|
||||
private SharedViewModel sharedViewModel;
|
||||
private SettlementViewModel settlementViewModel;
|
||||
private ManagementViewModel managementViewModel;
|
||||
private static final int hostId = Constants.NAV_HOST_ID;
|
||||
private int routeId;
|
||||
private static final int currentId = R.id.qrFragment;
|
||||
|
||||
public static QRPayFragment newInstance() {
|
||||
return new QRPayFragment();
|
||||
}
|
||||
|
||||
|
||||
private Observer<PayDetail> observeLastTrans;
|
||||
private PayDetail lastPay;
|
||||
@ -51,11 +47,8 @@ public class QRPayFragment extends DataBindingFragment {
|
||||
|
||||
@Override
|
||||
protected void initViewModel() {
|
||||
|
||||
mainViewModel = new ViewModelProvider(requireActivity()).get(MainViewModel.class);
|
||||
sharedViewModel = new ViewModelProvider(requireActivity()).get(SharedViewModel.class);
|
||||
settlementViewModel = getFragmentScopeViewModel(SettlementViewModel.class);
|
||||
managementViewModel = getFragmentScopeViewModel(ManagementViewModel.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -127,6 +120,21 @@ public class QRPayFragment extends DataBindingFragment {
|
||||
}
|
||||
}
|
||||
|
||||
private void onClickHistory(){
|
||||
sharedViewModel.hostType.setValue(HostType.QR);
|
||||
routeId = R.id.action_qrFragment_to_qrHistory;
|
||||
safeNavigateToRouteId();
|
||||
}
|
||||
|
||||
private void onClickRefund(){
|
||||
routeId = R.id.action_qrFragment_to_qr_refund_list;
|
||||
safeNavigateToRouteId();
|
||||
}
|
||||
|
||||
private void navigateToAmount() {
|
||||
routeId = R.id.action_qrFragment_to_inputAmountFragment;
|
||||
safeNavigateToRouteId();
|
||||
}
|
||||
private void processBatch() {
|
||||
calculateLastTransaction();
|
||||
mainViewModel.observeSettlementPOS();
|
||||
@ -384,21 +392,5 @@ public class QRPayFragment extends DataBindingFragment {
|
||||
|
||||
}
|
||||
|
||||
private void navigateToAmount() {
|
||||
// routeId = R.id.action_nav_main_to_inputAmountFragment;
|
||||
// safeNavigateToRouteId();
|
||||
NavHostFragment.findNavController(this)
|
||||
.navigate(R.id.action_qrFragment_to_inputAmountFragment);
|
||||
}
|
||||
|
||||
private void onClickHistory(){
|
||||
sharedViewModel.hostType.setValue(HostType.QR);
|
||||
routeId = R.id.action_qrFragment_to_qrHistory;
|
||||
safeNavigateToRouteId();
|
||||
}
|
||||
|
||||
private void onClickRefund(){
|
||||
routeId = R.id.action_qrFragment_to_qr_refund_list;
|
||||
safeNavigateToRouteId();
|
||||
}
|
||||
}
|
||||
@ -240,7 +240,7 @@
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:onClick="@{() -> click.onClickQRPay()}"
|
||||
android:onClick="@{() -> click.onClickQR()}"
|
||||
app:disableBtn="@{mainViewModel.kPayStatus}"
|
||||
app:layout_constraintTop_toBottomOf="@+id/cardMenuCard"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user