printer disable function
This commit is contained in:
parent
84f0620481
commit
2fedb6cee2
@ -28,6 +28,7 @@ import com.utsmm.kbz.ui.core_viewmodel.SharedViewModel;
|
||||
public class PrintReceiptFragment extends DataBindingFragment implements DataBindingFragment.BackPressCallback {
|
||||
private SharedViewModel sharedViewModel;
|
||||
private static final String TAG = PrintReceiptFragment.class.getSimpleName();
|
||||
private boolean printerDisabled = SystemParamsOperation.getInstance().getPrinterDisabled();
|
||||
|
||||
@Override
|
||||
protected int currentId() {
|
||||
@ -48,7 +49,6 @@ public class PrintReceiptFragment extends DataBindingFragment implements DataBin
|
||||
@Override
|
||||
protected void initViewModel() {
|
||||
sharedViewModel = getFragmentScopeViewModel(SharedViewModel.class);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -76,6 +76,7 @@ public class PrintReceiptFragment extends DataBindingFragment implements DataBin
|
||||
setToolBarTitleWithoutBackIcon(getResourceString(R.string.title_print_receipt));
|
||||
|
||||
sharedViewModel.printReceiptButtons.setValue(0);
|
||||
sharedViewModel.printerDisabled.setValue(printerDisabled);
|
||||
|
||||
|
||||
PayDetail payDetail = sharedViewModel.payDetail.getValue();
|
||||
@ -122,7 +123,12 @@ public class PrintReceiptFragment extends DataBindingFragment implements DataBin
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
sharedViewModel.setPrintStatus(PrintStatus.NOT_PRINT);
|
||||
sharedViewModel.postPrintReceiptMsg("Print Receipt for Merchant?");
|
||||
|
||||
if(printerDisabled){
|
||||
sharedViewModel.postPrintReceiptMsg("Receipt is saved as E-receipt!");
|
||||
}else{
|
||||
sharedViewModel.postPrintReceiptMsg("Print Receipt for Merchant?");
|
||||
}
|
||||
|
||||
observePrintProcess();
|
||||
|
||||
@ -278,6 +284,10 @@ public class PrintReceiptFragment extends DataBindingFragment implements DataBin
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void onContinue(){
|
||||
isCardInside();
|
||||
}
|
||||
}
|
||||
|
||||
private void alertPaperRoll(String title, String message) {
|
||||
|
||||
@ -115,6 +115,7 @@ public class SharedViewModel extends ViewModel {
|
||||
public SingleLiveEvent<HostType> hostType = new SingleLiveEvent<>();
|
||||
|
||||
public MutableLiveData<Integer> printReceiptButtons = new MutableLiveData<>(0);
|
||||
public SingleLiveEvent<Boolean> printerDisabled = new SingleLiveEvent<>();
|
||||
|
||||
public SingleLiveEvent<String> printReceiptMsg = new SingleLiveEvent<>();
|
||||
|
||||
|
||||
@ -15,6 +15,7 @@ import com.utsmm.kbz.databinding.FragmentHostConfigBinding;
|
||||
import com.utsmm.kbz.ui.core_viewmodel.SharedViewModel;
|
||||
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
||||
import com.utsmyanmar.baselib.util.DataBindingConfig;
|
||||
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
||||
|
||||
|
||||
public class HostConfigFragment extends DataBindingFragment {
|
||||
@ -22,6 +23,7 @@ public class HostConfigFragment extends DataBindingFragment {
|
||||
private HostConfigViewModel viewModel;
|
||||
|
||||
private SharedViewModel sharedViewModel;
|
||||
private boolean printerDisabled = SystemParamsOperation.getInstance().getPrinterDisabled();
|
||||
protected Printer printer;
|
||||
int FONT_NORMAL = 20;
|
||||
int FONT_HEADER = 24;
|
||||
@ -44,6 +46,7 @@ public class HostConfigFragment extends DataBindingFragment {
|
||||
|
||||
FragmentHostConfigBinding binding = (FragmentHostConfigBinding) this.binding;
|
||||
viewModel.loadConfig();
|
||||
sharedViewModel.printerDisabled.setValue(printerDisabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -51,6 +54,7 @@ public class HostConfigFragment extends DataBindingFragment {
|
||||
super.onResume();
|
||||
|
||||
setToolBarTitleWithBackIcon("Host Configs");
|
||||
sharedViewModel.printerDisabled.setValue(printerDisabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -647,6 +647,9 @@ public class TMSSetupsImpl implements TMSSetups{
|
||||
else if(TextUtils.equals(name,"bin_list")) {
|
||||
SystemParamsOperation.getInstance().setBinValue(data);
|
||||
}
|
||||
else if(TextUtils.equals(name, "printer_disable")){
|
||||
SystemParamsOperation.getInstance().setPrinterDisabled(parseBoolean(data));
|
||||
}
|
||||
}
|
||||
|
||||
SystemParamsOperation.getInstance().setCarouselUrls(convertToString(imgUrls));
|
||||
|
||||
@ -10,6 +10,9 @@
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.utsmm.kbz.ui.settings.HostConfigViewModel" />
|
||||
<variable
|
||||
name="sharedViewModel"
|
||||
type="com.utsmm.kbz.ui.core_viewmodel.SharedViewModel" />
|
||||
<variable
|
||||
name="click"
|
||||
type="com.utsmm.kbz.ui.settings.HostConfigFragment.ClickHandler" />
|
||||
@ -362,6 +365,7 @@
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="8dp"
|
||||
android:text="Print"
|
||||
android:visibility="@{sharedViewModel.printerDisabled ? View.VISIBLE : View.GONE}"
|
||||
android:onClick="@{()-> click.onPrint()}"
|
||||
android:background="@drawable/bg_rounded_btn_cv"
|
||||
android:textColor="@color/white"
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
|
||||
<data>
|
||||
<import type="com.utsmyanmar.paylibs.utils.POSUtil" />
|
||||
<import type="android.view.View"/>
|
||||
<variable
|
||||
name="sharedViewModel"
|
||||
type="com.utsmm.kbz.ui.core_viewmodel.SharedViewModel" />
|
||||
@ -296,92 +297,136 @@
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="@{sharedViewModel.printReceiptButtons}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:padding="12dp">
|
||||
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
<!-- Cancel Button -->
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="@{sharedViewModel.printReceiptButtons}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:padding="12dp">
|
||||
android:layout_weight="1"
|
||||
android:layout_marginEnd="6dp"
|
||||
app:cardCornerRadius="12dp"
|
||||
app:cardElevation="2dp"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
|
||||
<!-- Cancel Button -->
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="0dp"
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginEnd="6dp"
|
||||
app:cardCornerRadius="12dp"
|
||||
app:cardElevation="2dp"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center"
|
||||
android:background="@color/white"
|
||||
android:padding="14dp"
|
||||
android:onClick="@{()->click.onCancel()}">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center"
|
||||
android:background="@color/white"
|
||||
android:padding="14dp"
|
||||
android:onClick="@{()->click.onCancel()}">
|
||||
android:text="@string/layout_cancel"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold"
|
||||
android:fontFamily="@font/rubik_medium" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
<!-- Confirm Button -->
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="6dp"
|
||||
app:cardCornerRadius="12dp"
|
||||
app:cardElevation="4dp"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/layout_cancel"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold"
|
||||
android:fontFamily="@font/rubik_medium" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
<!-- Confirm Button -->
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="0dp"
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="6dp"
|
||||
app:cardCornerRadius="12dp"
|
||||
app:cardElevation="4dp"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center"
|
||||
android:background="@color/colorPrimary"
|
||||
android:padding="14dp"
|
||||
android:onClick="@{()->click.onConfirm()}">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center"
|
||||
android:background="@color/colorPrimary"
|
||||
android:padding="14dp"
|
||||
android:onClick="@{()->click.onConfirm()}">
|
||||
android:text="@string/layout_print"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold"
|
||||
android:fontFamily="@font/rubik_medium" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:padding="12dp"
|
||||
android:visibility="@{sharedViewModel.printerDisabled ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/layout_print"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold"
|
||||
android:fontFamily="@font/rubik_medium" />
|
||||
<!-- Confirm Button -->
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
app:cardCornerRadius="12dp"
|
||||
app:cardElevation="4dp">
|
||||
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/colorPrimary"
|
||||
android:gravity="center"
|
||||
android:onClick="@{()->click.onContinue()}"
|
||||
android:orientation="horizontal"
|
||||
android:padding="14dp">
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/rubik_medium"
|
||||
android:text="@string/txt_continue"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
@ -616,5 +616,6 @@
|
||||
<string name="txt_no_qr_transactions_to_settle">No QR transactions to settle</string>
|
||||
<string name="txt_settle_qr_transactions">Confirm</string>
|
||||
<string name="txt_search_by_trace">Search By Trace No</string>
|
||||
<string name="txt_continue">Continue</string>
|
||||
|
||||
</resources>
|
||||
@ -1750,4 +1750,15 @@ public class SystemParamsOperation {
|
||||
paramsSettings.setCertificateClientUrl(url);
|
||||
saveSystemParamsSettings(paramsSettings);
|
||||
}
|
||||
|
||||
public void setPrinterDisabled(boolean printerDisabled) {
|
||||
SystemParamsSettings paramsSettings = getSystemParamsSettings();
|
||||
paramsSettings.setPrinterDisabled(printerDisabled);
|
||||
saveSystemParamsSettings(paramsSettings);
|
||||
}
|
||||
|
||||
public boolean getPrinterDisabled() {
|
||||
SystemParamsSettings paramsSettings = getSystemParamsSettings();
|
||||
return paramsSettings.getPrinterDisabled();
|
||||
}
|
||||
}
|
||||
@ -260,6 +260,7 @@ public class SystemParamsSettings implements Serializable {
|
||||
private String terminalIdForEreceipt = "";
|
||||
private String certificateUrl = "";
|
||||
private String certificateClientUrl = "";
|
||||
private boolean printerDisabled = false;
|
||||
|
||||
public boolean isQrPartialRefundEnable(){
|
||||
return qrPartialRefundEnable;
|
||||
@ -1067,6 +1068,18 @@ public class SystemParamsSettings implements Serializable {
|
||||
this.certificateClientUrl = url;
|
||||
}
|
||||
|
||||
public boolean isPrinterDisabled() {
|
||||
return printerDisabled;
|
||||
}
|
||||
|
||||
public void setPrinterDisabled(boolean printerDisabled) {
|
||||
this.printerDisabled = printerDisabled;
|
||||
}
|
||||
|
||||
public boolean getPrinterDisabled() {
|
||||
return printerDisabled;
|
||||
}
|
||||
|
||||
/* // 流水号起始
|
||||
private String serialNum = Configs.getInstance().SERIAL_NUM();
|
||||
// 批次号起始
|
||||
|
||||
Loading…
Reference in New Issue
Block a user