print button hide in hostConfigScreen

This commit is contained in:
MooN 2026-02-05 21:04:08 +06:30
parent 74e9e21ee0
commit 3b08569a48
2 changed files with 8 additions and 1 deletions

View File

@ -36,6 +36,7 @@ public class HostConfigFragment extends DataBindingFragment {
@Override @Override
protected DataBindingConfig getDataBindingConfig() { protected DataBindingConfig getDataBindingConfig() {
return new DataBindingConfig(R.layout.fragment_host_config, BR.viewModel, viewModel) return new DataBindingConfig(R.layout.fragment_host_config, BR.viewModel, viewModel)
.addBindingParam(BR.sharedViewModel, sharedViewModel)
.addBindingParam(BR.click, new ClickHandler()); .addBindingParam(BR.click, new ClickHandler());
} }
@ -52,6 +53,7 @@ public class HostConfigFragment extends DataBindingFragment {
super.onResume(); super.onResume();
setToolBarTitleWithBackIcon("Host Configs"); setToolBarTitleWithBackIcon("Host Configs");
sharedViewModel.printerDisabled.setValue(!SystemParamsOperation.getInstance().getPrinterEnabled());
} }
@Override @Override
@ -75,6 +77,10 @@ public class HostConfigFragment extends DataBindingFragment {
} }
public void onPrint(){ public void onPrint(){
if (!SystemParamsOperation.getInstance().getPrinterEnabled()) {
showDeclineDialog("Printer is disabled!");
return;
}
sharedViewModel.printTerminalHostConfigs(); sharedViewModel.printTerminalHostConfigs();
} }
} }

View File

@ -257,6 +257,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:orientation="horizontal"
android:visibility="@{sharedViewModel.printerDisabled ? View.GONE : View.VISIBLE}"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"> app:layout_constraintStart_toStartOf="parent">