From ab4801d68768d033ce5f71935ee882fca634f1fd Mon Sep 17 00:00:00 2001 From: MooN <56061215+MgKyawLay@users.noreply.github.com> Date: Sun, 23 Nov 2025 18:45:49 +0630 Subject: [PATCH] version fix --- .../com/utsmm/kbz/ui/SettingsFragment.java | 33 +- .../kbz/ui/navigation/VersionFragment.java | 4 +- .../kbz/ui/navigation/VersionViewModel.java | 23 +- .../res/layout/fragment_management_screen.xml | 86 +-- .../res/layout/fragment_settings_modern.xml | 652 +++++++++--------- 5 files changed, 410 insertions(+), 388 deletions(-) diff --git a/app/src/main/java/com/utsmm/kbz/ui/SettingsFragment.java b/app/src/main/java/com/utsmm/kbz/ui/SettingsFragment.java index 7da4c35..09bc43d 100644 --- a/app/src/main/java/com/utsmm/kbz/ui/SettingsFragment.java +++ b/app/src/main/java/com/utsmm/kbz/ui/SettingsFragment.java @@ -144,35 +144,34 @@ public class SettingsFragment extends DataBindingFragment { private void updateDemoSettings() { boolean isDemo = SystemParamsOperation.getInstance().getDemoStatus(); - binding.demoSwitch.setChecked(isDemo); - binding.demoSummary.setText(isDemo ? - "Demo mode active - Test transactions without real processing" : - "Simulator mode active - Real transaction processing"); +// binding.demoSwitch.setChecked(isDemo); +// binding.demoSummary.setText(isDemo ? +// "Demo mode active - Test transactions without real processing" : +// "Simulator mode active - Real transaction processing"); } private void updateAlertSoundSettings() { boolean isEnabled = SystemParamsOperation.getInstance().isAlertSound(); - binding.alertSoundSwitch.setChecked(isEnabled); - binding.alertSoundSummary.setText(isEnabled ? - "Sound alerts enabled for notifications" : - "Sound alerts disabled - Silent mode"); +// binding.alertSoundSwitch.setChecked(isEnabled); +// binding.alertSoundSummary.setText(isEnabled ? +// "Sound alerts enabled for notifications" : +// "Sound alerts disabled - Silent mode"); } - private void updateReversalSettings() { boolean isEnabled = SystemParamsOperation.getInstance().isReversalOn(); - binding.reversalSwitch.setChecked(isEnabled); - binding.reversalSummary.setText(isEnabled ? - "Automatic reversal enabled for failed transactions" : - "Automatic reversal disabled - Manual reversal only"); +// binding.reversalSwitch.setChecked(isEnabled); +// binding.reversalSummary.setText(isEnabled ? +// "Automatic reversal enabled for failed transactions" : +// "Automatic reversal disabled - Manual reversal only"); } private void updateMultiHostSettings() { boolean isEnabled = SystemParamsOperation.getInstance().isMultiHost(); - binding.multiHostSwitch.setChecked(isEnabled); - binding.multiHostSummary.setText(isEnabled ? - "Multiple host support enabled" : - "Single host mode - Primary host only"); +// binding.multiHostSwitch.setChecked(isEnabled); +// binding.multiHostSummary.setText(isEnabled ? +// "Multiple host support enabled" : +// "Single host mode - Primary host only"); } private void updateTmsAddressSettings() { diff --git a/app/src/main/java/com/utsmm/kbz/ui/navigation/VersionFragment.java b/app/src/main/java/com/utsmm/kbz/ui/navigation/VersionFragment.java index cf1a68c..8a8e9b9 100644 --- a/app/src/main/java/com/utsmm/kbz/ui/navigation/VersionFragment.java +++ b/app/src/main/java/com/utsmm/kbz/ui/navigation/VersionFragment.java @@ -6,6 +6,8 @@ import android.view.View; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import com.nexgo.oaf.apiv3.DeviceEngine; +import com.nexgo.oaf.apiv3.DeviceInfo; import com.utsmyanmar.baselib.fragment.DataBindingFragment; import com.utsmyanmar.baselib.util.DataBindingConfig; import com.utsmm.kbz.BR; @@ -32,6 +34,7 @@ public class VersionFragment extends DataBindingFragment { setToolBarTitleWithBackIcon(getString(R.string.title_version)); fetchVersions(); + versionViewModel.loadDeviceInfo(requireContext()); } @Override @@ -75,5 +78,4 @@ public class VersionFragment extends DataBindingFragment { - } diff --git a/app/src/main/java/com/utsmm/kbz/ui/navigation/VersionViewModel.java b/app/src/main/java/com/utsmm/kbz/ui/navigation/VersionViewModel.java index 2fa7254..769348a 100644 --- a/app/src/main/java/com/utsmm/kbz/ui/navigation/VersionViewModel.java +++ b/app/src/main/java/com/utsmm/kbz/ui/navigation/VersionViewModel.java @@ -1,9 +1,13 @@ package com.utsmm.kbz.ui.navigation; +import android.content.Context; import android.os.RemoteException; import androidx.lifecycle.ViewModel; +import com.nexgo.oaf.apiv3.APIProxy; +import com.nexgo.oaf.apiv3.DeviceEngine; +import com.nexgo.oaf.apiv3.DeviceInfo; import com.sunmi.pay.hardware.aidl.AidlConstants; import com.utsmyanmar.paylibs.system.SingleLiveEvent; import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation; @@ -28,7 +32,8 @@ public class VersionViewModel extends ViewModel { public VersionViewModel() { - initData(); +// initData(); +// loadDeviceInfo(); } private void initData() { @@ -55,5 +60,21 @@ public class VersionViewModel extends ViewModel { return value; } + public void loadDeviceInfo(Context context){ + try{ + DeviceEngine deviceEngine = APIProxy.getDeviceEngine(context); + DeviceInfo deviceInfo = deviceEngine.getDeviceInfo(); + serialNumber.setValue(deviceInfo.getSn()); + deviceModel.setValue(deviceInfo.getModel()); + hardwareVersion.setValue(deviceInfo.getKernelVer()); + firmwareVersion.setValue(deviceInfo.getFirmWareVer()); + swFinalVersion.setValue(deviceInfo.getFirmWareFullVersion()); + payHardwareVersion.setValue(deviceInfo.getSpCoreVersion()); + romVersion.setValue(deviceInfo.getOsVer()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + } diff --git a/app/src/main/res/layout/fragment_management_screen.xml b/app/src/main/res/layout/fragment_management_screen.xml index c7ed3c1..488f0c6 100644 --- a/app/src/main/res/layout/fragment_management_screen.xml +++ b/app/src/main/res/layout/fragment_management_screen.xml @@ -446,55 +446,55 @@ - + + + + + + + + + + + - + + + + + + + + - + + + + + + + - + + + + + + + + + - + + + + + + - + - + diff --git a/app/src/main/res/layout/fragment_settings_modern.xml b/app/src/main/res/layout/fragment_settings_modern.xml index 60bc4fd..6323c42 100644 --- a/app/src/main/res/layout/fragment_settings_modern.xml +++ b/app/src/main/res/layout/fragment_settings_modern.xml @@ -316,189 +316,14 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -522,7 +347,7 @@ - + @@ -537,19 +362,19 @@ - + - + - + @@ -557,7 +382,7 @@ - + @@ -568,164 +393,339 @@ - - + + + + + + + + + + + + - + + + + + + - + + + + + + + - + + + + + + - + - + + + + + - + + + + + + + + + - + + + + + + + + + + - + - + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +