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
|
// navigate to new QR Pay fragment
|
||||||
routeId = R.id.action_nav_main_to_qrFragment;
|
routeId = R.id.action_nav_main_to_qrFragment;
|
||||||
safeNavigateToRouteId();
|
safeNavigateToRouteId();
|
||||||
}
|
}
|
||||||
|
|
||||||
// public void onClickQRPay() {
|
public void onClickQRPay() {
|
||||||
//
|
|
||||||
// String mmqrIp = SystemParamsOperation.getInstance().getSecHostIpAddress();
|
String mmqrIp = SystemParamsOperation.getInstance().getSecHostIpAddress();
|
||||||
//
|
|
||||||
// if (mainViewModel.payDetailSingle.getValue() != null) {
|
if (mainViewModel.payDetailSingle.getValue() != null) {
|
||||||
// mainViewModel.startReversal(mainViewModel.payDetailSingle.getValue());
|
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) {
|
else if (!Connectivity.isConnectedWifi(getContext()) && !Connectivity.isConnectedMobile(getContext())) {
|
||||||
//// showDeclineDialog(getResourceString(R.string.txt_please_download_config)+"\n"+TMSUtil.getInstance().checkSecHostParams().getMessage());
|
showSingleInfoDialog(getResourceString(R.string.txt_please_enable_internet));
|
||||||
//// }
|
}
|
||||||
// else if (!Connectivity.isConnectedWifi(getContext()) && !Connectivity.isConnectedMobile(getContext())) {
|
// else if (!isValidDomain(mmqrIp)) {
|
||||||
// showSingleInfoDialog(getResourceString(R.string.txt_please_enable_internet));
|
// showDeclineDialog(getResourceString(R.string.txt_please_check_mmqr_ip));
|
||||||
// }
|
// }
|
||||||
//// else if (!isValidDomain(mmqrIp)) {
|
else {
|
||||||
//// showDeclineDialog(getResourceString(R.string.txt_please_check_mmqr_ip));
|
CurrencyType currencyType = TMSUtil.getInstance().currencyTextToCurrencyType(SystemParamsOperation.getInstance().getSecHostCurrency());
|
||||||
//// }
|
sharedViewModel.set_currencyText(currencyType.name);
|
||||||
// else {
|
processBatch();
|
||||||
// CurrencyType currencyType = TMSUtil.getInstance().currencyTextToCurrencyType(SystemParamsOperation.getInstance().getSecHostCurrency());
|
sharedViewModel.transactionsType.setValue(TransactionsType.MMQR);
|
||||||
// sharedViewModel.set_currencyText(currencyType.name);
|
navigateToAmount();
|
||||||
// processBatch();
|
|
||||||
// sharedViewModel.transactionsType.setValue(TransactionsType.MMQR);
|
}
|
||||||
// navigateToAmount();
|
}
|
||||||
//
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
public void onClickSettlement() {
|
public void onClickSettlement() {
|
||||||
|
|
||||||
|
|||||||
@ -30,15 +30,11 @@ public class QRPayFragment extends DataBindingFragment {
|
|||||||
|
|
||||||
private MainViewModel mainViewModel;
|
private MainViewModel mainViewModel;
|
||||||
private SharedViewModel sharedViewModel;
|
private SharedViewModel sharedViewModel;
|
||||||
private SettlementViewModel settlementViewModel;
|
|
||||||
private ManagementViewModel managementViewModel;
|
|
||||||
private static final int hostId = Constants.NAV_HOST_ID;
|
private static final int hostId = Constants.NAV_HOST_ID;
|
||||||
private int routeId;
|
private int routeId;
|
||||||
private static final int currentId = R.id.qrFragment;
|
private static final int currentId = R.id.qrFragment;
|
||||||
|
|
||||||
public static QRPayFragment newInstance() {
|
|
||||||
return new QRPayFragment();
|
|
||||||
}
|
|
||||||
|
|
||||||
private Observer<PayDetail> observeLastTrans;
|
private Observer<PayDetail> observeLastTrans;
|
||||||
private PayDetail lastPay;
|
private PayDetail lastPay;
|
||||||
@ -51,11 +47,8 @@ public class QRPayFragment extends DataBindingFragment {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initViewModel() {
|
protected void initViewModel() {
|
||||||
|
|
||||||
mainViewModel = new ViewModelProvider(requireActivity()).get(MainViewModel.class);
|
mainViewModel = new ViewModelProvider(requireActivity()).get(MainViewModel.class);
|
||||||
sharedViewModel = new ViewModelProvider(requireActivity()).get(SharedViewModel.class);
|
sharedViewModel = new ViewModelProvider(requireActivity()).get(SharedViewModel.class);
|
||||||
settlementViewModel = getFragmentScopeViewModel(SettlementViewModel.class);
|
|
||||||
managementViewModel = getFragmentScopeViewModel(ManagementViewModel.class);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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() {
|
private void processBatch() {
|
||||||
calculateLastTransaction();
|
calculateLastTransaction();
|
||||||
mainViewModel.observeSettlementPOS();
|
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:foreground="?android:attr/selectableItemBackground"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:onClick="@{() -> click.onClickQRPay()}"
|
android:onClick="@{() -> click.onClickQR()}"
|
||||||
app:disableBtn="@{mainViewModel.kPayStatus}"
|
app:disableBtn="@{mainViewModel.kPayStatus}"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/cardMenuCard"
|
app:layout_constraintTop_toBottomOf="@+id/cardMenuCard"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user