redesigned full screen for BML recipt
Auto Tag on Version Change / check-version (push) Successful in 3s
Auto Tag on Version Change / check-version (push) Successful in 3s
This commit is contained in:
@@ -24,6 +24,7 @@ import android.widget.Toast
|
||||
import androidx.core.content.FileProvider
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.core.view.updatePadding
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.google.android.material.button.MaterialButton
|
||||
@@ -33,6 +34,7 @@ import kotlinx.coroutines.withContext
|
||||
import sh.sar.basedbank.BasedBankApp
|
||||
import sh.sar.basedbank.R
|
||||
import sh.sar.basedbank.api.mib.MibContactsClient
|
||||
import sh.sar.basedbank.databinding.DialogReceiptFullscreenBmlBinding
|
||||
import sh.sar.basedbank.databinding.FragmentReceiptBmlBinding
|
||||
import sh.sar.basedbank.databinding.FragmentReceiptMfaisaBinding
|
||||
import sh.sar.basedbank.databinding.FragmentReceiptMibBinding
|
||||
@@ -440,6 +442,7 @@ class TransferReceiptFragment : Fragment() {
|
||||
private fun showFullScreenReceipt() {
|
||||
val ctx = requireContext()
|
||||
val bank = arguments?.getString(ARG_BANK, "MIB") ?: "MIB"
|
||||
if (bank == "BML") { showBmlFullScreenReceipt(); return }
|
||||
val dialog = Dialog(ctx, android.R.style.Theme_Black_NoTitleBar_Fullscreen)
|
||||
|
||||
val scrollView = android.widget.ScrollView(ctx).apply {
|
||||
@@ -492,6 +495,55 @@ class TransferReceiptFragment : Fragment() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* BML full-screen receipt: status bar stays visible, top bar with back button,
|
||||
* 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() {
|
||||
val ctx = requireContext()
|
||||
val dialog = Dialog(ctx, R.style.Theme_BasedBank)
|
||||
val page = DialogReceiptFullscreenBmlBinding.inflate(layoutInflater)
|
||||
|
||||
val card = FragmentReceiptBmlBinding.inflate(layoutInflater).also { bindBml(it) }.receiptCard
|
||||
(card.parent as? ViewGroup)?.removeView(card)
|
||||
page.cardHolder.addView(card, 0, android.widget.LinearLayout.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT
|
||||
))
|
||||
|
||||
page.btnBack.setOnClickListener { dialog.dismiss() }
|
||||
page.btnSaveFull.setOnClickListener { saveReceipt() }
|
||||
page.btnShareFull.setOnClickListener { shareReceipt() }
|
||||
|
||||
val topBasePadding = page.topBar.paddingTop
|
||||
val bottomBasePadding = page.bottomBar.paddingBottom
|
||||
ViewCompat.setOnApplyWindowInsetsListener(page.root) { _, insets ->
|
||||
val bars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
|
||||
page.topBar.updatePadding(top = topBasePadding + bars.top)
|
||||
page.bottomBar.updatePadding(bottom = bottomBasePadding + bars.bottom)
|
||||
page.root.updatePadding(left = bars.left, right = bars.right)
|
||||
insets
|
||||
}
|
||||
|
||||
dialog.setContentView(page.root)
|
||||
dialog.window?.let { win ->
|
||||
win.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
|
||||
androidx.core.view.WindowCompat.setDecorFitsSystemWindows(win, false)
|
||||
@Suppress("DEPRECATION")
|
||||
win.statusBarColor = Color.TRANSPARENT
|
||||
@Suppress("DEPRECATION")
|
||||
win.navigationBarColor = Color.TRANSPARENT
|
||||
val isLight = (resources.configuration.uiMode and
|
||||
android.content.res.Configuration.UI_MODE_NIGHT_MASK) ==
|
||||
android.content.res.Configuration.UI_MODE_NIGHT_NO
|
||||
androidx.core.view.WindowInsetsControllerCompat(win, win.decorView).apply {
|
||||
isAppearanceLightStatusBars = isLight
|
||||
isAppearanceLightNavigationBars = isLight
|
||||
}
|
||||
}
|
||||
dialog.show()
|
||||
}
|
||||
|
||||
private fun copyOnLongClick(vararg views: android.widget.TextView) {
|
||||
for (tv in views) {
|
||||
tv.setOnLongClickListener {
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:strokeColor="#FFFFFFFF"
|
||||
android:strokeWidth="2"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round"
|
||||
android:pathData="M15,4 L7,12 L15,20" />
|
||||
</vector>
|
||||
@@ -0,0 +1,122 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Full-screen BML receipt, modelled on docs/bmlapi/tmp/recipt_full_*.jpg.
|
||||
The receipt card is inserted at the top of cardHolder, directly followed by
|
||||
the Save/Share buttons; the rest of the screen shows the footer colour. -->
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/bml_receipt_footer">
|
||||
|
||||
<!-- Top bar — status bar inset is added as top padding in code -->
|
||||
<FrameLayout
|
||||
android:id="@+id/topBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/bml_receipt_bg">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/btnBack"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:src="@drawable/ic_chevron_back"
|
||||
app:tint="@color/bml_receipt_amount"
|
||||
android:contentDescription="Back" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="Transfer successful"
|
||||
android:textSize="17sp"
|
||||
android:textColor="@color/bml_receipt_amount"
|
||||
android:fontFamily="@font/sofia_pro" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/bml_receipt_divider" />
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/scroll"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:overScrollMode="never"
|
||||
android:scrollbars="none">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/cardHolder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- receipt card goes here (index 0) -->
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/bml_receipt_bottom_divider" />
|
||||
|
||||
<!-- Bottom actions — nav bar inset is added to bottom padding in code -->
|
||||
<LinearLayout
|
||||
android:id="@+id/bottomBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/bml_receipt_footer"
|
||||
android:paddingHorizontal="20dp"
|
||||
android:paddingTop="20dp"
|
||||
android:paddingBottom="16dp">
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btnSaveFull"
|
||||
style="@style/Widget.Material3.Button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="44dp"
|
||||
android:insetTop="0dp"
|
||||
android:insetBottom="0dp"
|
||||
android:text="Save receipt"
|
||||
android:textAllCaps="false"
|
||||
android:letterSpacing="0"
|
||||
android:textSize="17sp"
|
||||
android:textColor="#FFFFFF"
|
||||
android:fontFamily="@font/sofia_pro"
|
||||
app:backgroundTint="@color/bml_red"
|
||||
app:cornerRadius="10dp" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btnShareFull"
|
||||
style="@style/Widget.Material3.Button.TextButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="44dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:insetTop="0dp"
|
||||
android:insetBottom="0dp"
|
||||
android:text="Share receipt"
|
||||
android:textAllCaps="false"
|
||||
android:letterSpacing="0"
|
||||
android:textSize="17sp"
|
||||
android:textColor="@color/bml_receipt_message"
|
||||
android:fontFamily="@font/sofia_pro"
|
||||
app:rippleColor="@color/bml_receipt_divider" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -7,4 +7,5 @@
|
||||
<color name="bml_receipt_label">#DEDEE0</color>
|
||||
<color name="bml_receipt_footer">#000000</color>
|
||||
<color name="bml_receipt_divider">#3D3E40</color>
|
||||
<color name="bml_receipt_bottom_divider">#1E1F21</color>
|
||||
</resources>
|
||||
|
||||
@@ -13,4 +13,6 @@
|
||||
<color name="bml_receipt_label">#000000</color>
|
||||
<color name="bml_receipt_footer">#F5F5F5</color>
|
||||
<color name="bml_receipt_divider">#E9E9E9</color>
|
||||
<color name="bml_receipt_bottom_divider">#EBEBEB</color>
|
||||
<color name="bml_red">#E21B23</color>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user