fix recipt buttons not showing on some phones/DPI #22
Auto Tag on Version Change / check-version (push) Successful in 6s
Auto Tag on Version Change / check-version (push) Successful in 6s
This commit is contained in:
@@ -26,6 +26,8 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.core.content.FileProvider
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.google.android.material.button.MaterialButton
|
||||
@@ -111,6 +113,32 @@ class TransferReceiptFragment : Fragment() {
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
receiptCard.setOnClickListener { showFullScreenReceipt() }
|
||||
|
||||
val btnRow = view.findViewById<View>(R.id.btnRow)
|
||||
val basePaddingBottom = btnRow.paddingBottom
|
||||
ViewCompat.setOnApplyWindowInsetsListener(btnRow) { v, insets ->
|
||||
val isBottomNav = requireContext().getSharedPreferences("prefs", Context.MODE_PRIVATE).getBoolean("bottom_nav", false)
|
||||
val navBar = insets.getInsets(WindowInsetsCompat.Type.systemBars())
|
||||
v.setPadding(v.paddingLeft, v.paddingTop, v.paddingRight, basePaddingBottom + if (isBottomNav) 0 else navBar.bottom)
|
||||
insets
|
||||
}
|
||||
|
||||
val receiptContainer = view.findViewById<android.widget.ScrollView>(R.id.receiptContainer)
|
||||
receiptContainer.setOnTouchListener { _, _ -> true }
|
||||
receiptContainer.viewTreeObserver.addOnGlobalLayoutListener(object : android.view.ViewTreeObserver.OnGlobalLayoutListener {
|
||||
override fun onGlobalLayout() {
|
||||
receiptContainer.viewTreeObserver.removeOnGlobalLayoutListener(this)
|
||||
val available = receiptContainer.height
|
||||
val natural = receiptCard.height
|
||||
if (natural > available && available > 0) {
|
||||
val scale = available.toFloat() / natural
|
||||
receiptCard.scaleX = scale
|
||||
receiptCard.scaleY = scale
|
||||
receiptCard.pivotX = receiptCard.width / 2f
|
||||
receiptCard.pivotY = 0f
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
view.findViewById<MaterialButton>(R.id.btnDone).setOnClickListener {
|
||||
parentFragmentManager.popBackStack()
|
||||
}
|
||||
|
||||
@@ -7,6 +7,14 @@
|
||||
android:orientation="vertical"
|
||||
android:background="?attr/colorSurface">
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/receiptContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:overScrollMode="never"
|
||||
android:scrollbars="none">
|
||||
|
||||
<!-- ══════════════════════════════════════════════════════════════════════ -->
|
||||
<!-- Renderable receipt card -->
|
||||
<!-- ══════════════════════════════════════════════════════════════════════ -->
|
||||
@@ -207,10 +215,13 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
<!-- ══════════════════════════════════════════════════════════════════════ -->
|
||||
<!-- Action buttons — outside renderable area -->
|
||||
<!-- ══════════════════════════════════════════════════════════════════════ -->
|
||||
<LinearLayout
|
||||
android:id="@+id/btnRow"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
|
||||
@@ -7,6 +7,14 @@
|
||||
android:orientation="vertical"
|
||||
android:background="?attr/colorSurface">
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/receiptContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:overScrollMode="never"
|
||||
android:scrollbars="none">
|
||||
|
||||
<!-- Renderable receipt card (header grows to fill remaining space) -->
|
||||
<LinearLayout
|
||||
android:id="@+id/receiptCard"
|
||||
@@ -236,8 +244,11 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
<!-- Action buttons — outside renderable area -->
|
||||
<LinearLayout
|
||||
android:id="@+id/btnRow"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
|
||||
Reference in New Issue
Block a user