Always show fullscreen recipt toggle
This commit is contained in:
@@ -167,6 +167,12 @@ class SettingsAppearanceFragment : Fragment() {
|
||||
val isDark = prefs.getString("theme", "system") == "dark"
|
||||
updatePitchBlackState(isDark)
|
||||
|
||||
// Receipts
|
||||
binding.switchFullscreenReceipt.isChecked = prefs.getBoolean("always_fullscreen_receipt", false)
|
||||
binding.switchFullscreenReceipt.setOnCheckedChangeListener { _, checked ->
|
||||
prefs.edit().putBoolean("always_fullscreen_receipt", checked).apply()
|
||||
}
|
||||
|
||||
// Accent color
|
||||
val savedPreset = prefs.getString("accent_preset", ThemeHelper.PRESET_BLUE)
|
||||
binding.accentToggle.check(when (savedPreset) {
|
||||
|
||||
@@ -168,6 +168,15 @@ class TransferReceiptFragment : Fragment() {
|
||||
view.findViewById<MaterialButton>(R.id.btnSave).setOnClickListener {
|
||||
saveReceipt()
|
||||
}
|
||||
|
||||
val alwaysFullScreen = requireContext().getSharedPreferences("prefs", Context.MODE_PRIVATE)
|
||||
.getBoolean("always_fullscreen_receipt", false)
|
||||
if (alwaysFullScreen) {
|
||||
// The normal page is skipped: keep it laid out (share/save capture its card) but hidden,
|
||||
// and leave the receipt entirely when the full-screen view is closed
|
||||
view.alpha = 0f
|
||||
view.post { if (_receiptCard != null) showFullScreenReceipt(closePageOnDismiss = true) }
|
||||
}
|
||||
}
|
||||
|
||||
// ── Data binding ──────────────────────────────────────────────────────────
|
||||
@@ -483,11 +492,11 @@ class TransferReceiptFragment : Fragment() {
|
||||
return bm
|
||||
}
|
||||
|
||||
private fun showFullScreenReceipt() {
|
||||
private fun showFullScreenReceipt(closePageOnDismiss: Boolean = false) {
|
||||
val ctx = requireContext()
|
||||
val bank = arguments?.getString(ARG_BANK, "MIB") ?: "MIB"
|
||||
if (bank == "BML") { showBmlFullScreenReceipt(); return }
|
||||
if (bank == "MIB") { showMibFullScreenReceipt(); return }
|
||||
if (bank == "BML") { showBmlFullScreenReceipt(closePageOnDismiss); return }
|
||||
if (bank == "MIB") { showMibFullScreenReceipt(closePageOnDismiss); return }
|
||||
val dialog = Dialog(ctx, android.R.style.Theme_Black_NoTitleBar_Fullscreen)
|
||||
|
||||
val scrollView = android.widget.ScrollView(ctx).apply {
|
||||
@@ -529,6 +538,7 @@ class TransferReceiptFragment : Fragment() {
|
||||
android.content.res.Configuration.UI_MODE_NIGHT_MASK) ==
|
||||
android.content.res.Configuration.UI_MODE_NIGHT_NO
|
||||
insetsCtrl.isAppearanceLightStatusBars = isLight
|
||||
if (closePageOnDismiss) closeReceiptPage()
|
||||
}
|
||||
dialog.show()
|
||||
dialog.window?.let { win ->
|
||||
@@ -545,7 +555,7 @@ class TransferReceiptFragment : Fragment() {
|
||||
* edge-to-edge card right under it, BML-styled Save/Share buttons directly below the card.
|
||||
* Follows the app theme (light/dark).
|
||||
*/
|
||||
private fun showBmlFullScreenReceipt() {
|
||||
private fun showBmlFullScreenReceipt(closePageOnDismiss: Boolean) {
|
||||
val ctx = requireContext()
|
||||
val dialog = Dialog(ctx, R.style.Theme_BasedBank)
|
||||
val page = DialogReceiptFullscreenBmlBinding.inflate(layoutInflater)
|
||||
@@ -557,6 +567,7 @@ class TransferReceiptFragment : Fragment() {
|
||||
))
|
||||
|
||||
page.btnBack.setOnClickListener { dialog.dismiss() }
|
||||
if (closePageOnDismiss) dialog.setOnDismissListener { closeReceiptPage() }
|
||||
page.btnSaveFull.setOnClickListener { saveReceipt() }
|
||||
page.btnShareFull.setOnClickListener { shareReceipt() }
|
||||
|
||||
@@ -594,7 +605,7 @@ class TransferReceiptFragment : Fragment() {
|
||||
* (visible) status bar, a floating close button top-right just below the status bar,
|
||||
* and MIB-styled Share/Save buttons pinned to the bottom. Follows the app theme.
|
||||
*/
|
||||
private fun showMibFullScreenReceipt() {
|
||||
private fun showMibFullScreenReceipt(closePageOnDismiss: Boolean) {
|
||||
val ctx = requireContext()
|
||||
val dialog = Dialog(ctx, R.style.Theme_BasedBank)
|
||||
val page = DialogReceiptFullscreenMibBinding.inflate(layoutInflater)
|
||||
@@ -607,6 +618,7 @@ class TransferReceiptFragment : Fragment() {
|
||||
))
|
||||
|
||||
page.btnClose.setOnClickListener { dialog.dismiss() }
|
||||
if (closePageOnDismiss) dialog.setOnDismissListener { closeReceiptPage() }
|
||||
page.btnShareFull.setOnClickListener { shareReceipt() }
|
||||
page.btnSaveFull.setOnClickListener { saveReceipt() }
|
||||
|
||||
@@ -647,6 +659,12 @@ class TransferReceiptFragment : Fragment() {
|
||||
dialog.show()
|
||||
}
|
||||
|
||||
/** Pops this receipt off the back stack, returning to whatever screen opened it. */
|
||||
private fun closeReceiptPage() {
|
||||
if (!isAdded || parentFragmentManager.isStateSaved) return
|
||||
parentFragmentManager.popBackStack()
|
||||
}
|
||||
|
||||
private fun copyOnLongClick(vararg views: android.widget.TextView) {
|
||||
for (tv in views) {
|
||||
tv.setOnLongClickListener {
|
||||
|
||||
@@ -304,6 +304,34 @@
|
||||
|
||||
</com.google.android.material.button.MaterialButtonToggleGroup>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/settings_receipts"
|
||||
android:textAppearance="?attr/textAppearanceTitleMedium"
|
||||
android:layout_marginTop="24dp"
|
||||
android:layout_marginBottom="12dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/settings_always_fullscreen_receipt"
|
||||
android:textAppearance="?attr/textAppearanceBodyLarge" />
|
||||
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
android:id="@+id/switchFullscreenReceipt"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
@@ -157,6 +157,8 @@
|
||||
<string name="theme_dark">Dark</string>
|
||||
<string name="settings_pitch_black">Pitch Black</string>
|
||||
<string name="settings_accent_color">Accent Color</string>
|
||||
<string name="settings_receipts">Receipts</string>
|
||||
<string name="settings_always_fullscreen_receipt">Always show full screen receipt</string>
|
||||
<string name="accent_blue">Blue</string>
|
||||
<string name="accent_orange">Red</string>
|
||||
<string name="accent_green">Green</string>
|
||||
|
||||
Reference in New Issue
Block a user