diff options
Diffstat (limited to 'wallet')
5 files changed, 56 insertions, 37 deletions
diff --git a/wallet/src/main/java/net/taler/wallet/transactions/TransactionDetailFragment.kt b/wallet/src/main/java/net/taler/wallet/transactions/TransactionDetailFragment.kt index c9e51e4..9893852 100644 --- a/wallet/src/main/java/net/taler/wallet/transactions/TransactionDetailFragment.kt +++ b/wallet/src/main/java/net/taler/wallet/transactions/TransactionDetailFragment.kt @@ -16,12 +16,15 @@ package net.taler.wallet.transactions +import android.content.Intent +import android.net.Uri import android.os.Bundle import android.view.LayoutInflater import android.view.Menu import android.view.MenuInflater import android.view.MenuItem import android.view.View +import android.view.View.GONE import android.view.ViewGroup import android.widget.Toast import android.widget.Toast.LENGTH_LONG @@ -33,6 +36,8 @@ import kotlinx.android.synthetic.main.fragment_transaction_withdrawal.* import kotlinx.android.synthetic.main.fragment_transaction_withdrawal.feeView import kotlinx.android.synthetic.main.fragment_transaction_withdrawal.timeView import net.taler.common.Amount +import net.taler.common.AmountOverflowException +import net.taler.common.isSafe import net.taler.common.toAbsoluteTime import net.taler.wallet.MainViewModel import net.taler.wallet.R @@ -90,10 +95,22 @@ class TransactionDetailFragment : Fragment() { private fun bind(t: TransactionWithdrawal) { effectiveAmountLabel.text = getString(R.string.withdraw_total) effectiveAmountView.text = t.amountEffective.toString() + if (t.pending && !t.confirmed && t.bankConfirmationUrl != null) { + val i = Intent().apply { + data = Uri.parse(t.bankConfirmationUrl) + } + if (i.isSafe(requireContext())) { + confirmWithdrawalButton.setOnClickListener { startActivity(i) } + } + } else confirmWithdrawalButton.visibility = GONE chosenAmountLabel.text = getString(R.string.amount_chosen) chosenAmountView.text = getString(R.string.amount_positive, t.amountRaw.toString()) - val fee = t.amountRaw - (t.amountEffective ?: t.amountRaw) + val fee = try { // TODO remove when fixed in wallet-core + t.amountRaw - (t.amountEffective ?: t.amountRaw) + } catch (e: AmountOverflowException) { + (t.amountEffective ?: t.amountRaw) - t.amountRaw + } feeView.text = getString(R.string.amount_negative, fee.toString()) exchangeView.text = cleanExchange(t.exchangeBaseUrl) } @@ -117,6 +134,14 @@ class TransactionDetailFragment : Fragment() { orderAmountView.text = raw.toString() feeView.text = getString(R.string.amount_negative, fee.toString()) orderSummaryView.text = info.summary + if (info.fulfillmentUrl.startsWith("http")) { + val i = Intent().apply { + data = Uri.parse(info.fulfillmentUrl) + } + if (i.isSafe(requireContext())) { + orderSummaryView.setOnClickListener { startActivity(i) } + } + } orderIdView.text = getString(R.string.transaction_order_id, info.orderId) } diff --git a/wallet/src/main/java/net/taler/wallet/transactions/Transactions.kt b/wallet/src/main/java/net/taler/wallet/transactions/Transactions.kt index 7f573ef..cff742f 100644 --- a/wallet/src/main/java/net/taler/wallet/transactions/Transactions.kt +++ b/wallet/src/main/java/net/taler/wallet/transactions/Transactions.kt @@ -140,7 +140,11 @@ class TransactionRefund( override val detailPageLayout = R.layout.fragment_transaction_payment override val amountType = AmountType.Positive override fun getTitle(context: Context): String { - return context.getString(R.string.transaction_refund, info.merchant.name) + return if (info.merchant.name == null) { + context.getString(R.string.transaction_refund_for, info.summary) + } else { + context.getString(R.string.transaction_refund_from, info.merchant.name) + } } } diff --git a/wallet/src/main/res/layout/fragment_transaction_payment.xml b/wallet/src/main/res/layout/fragment_transaction_payment.xml index 3f17464..20ba161 100644 --- a/wallet/src/main/res/layout/fragment_transaction_payment.xml +++ b/wallet/src/main/res/layout/fragment_transaction_payment.xml @@ -104,6 +104,7 @@ <TextView android:id="@+id/orderSummaryView" style="@style/TransactionContent" + android:textColor="?android:textColorPrimary" app:layout_constraintBottom_toTopOf="@+id/orderIdView" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" @@ -113,6 +114,7 @@ <TextView android:id="@+id/orderIdView" style="@style/TransactionLabel" + android:layout_marginBottom="16dp" android:text="@string/transaction_order_id" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" diff --git a/wallet/src/main/res/layout/fragment_transaction_withdrawal.xml b/wallet/src/main/res/layout/fragment_transaction_withdrawal.xml index 5d30fcf..5a1e82f 100644 --- a/wallet/src/main/res/layout/fragment_transaction_withdrawal.xml +++ b/wallet/src/main/res/layout/fragment_transaction_withdrawal.xml @@ -47,40 +47,39 @@ <TextView android:id="@+id/effectiveAmountView" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_marginStart="16dp" - android:layout_marginTop="8dp" - android:layout_marginEnd="16dp" - android:layout_marginBottom="16dp" - android:gravity="center" + style="@style/TransactionContent" android:textColor="@color/green" - android:textSize="24sp" - app:layout_constraintBottom_toTopOf="@+id/chosenAmountLabel" + app:layout_constraintBottom_toTopOf="@+id/confirmWithdrawalButton" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/effectiveAmountLabel" tools:text="23.42 TESTKUDOS" /> + <Button + android:id="@+id/confirmWithdrawalButton" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:drawableLeft="@drawable/ic_account_balance" + android:drawableTint="?attr/colorOnPrimarySurface" + android:text="@string/withdraw_button_confirm_bank" + app:layout_constraintBottom_toTopOf="@+id/chosenAmountLabel" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/effectiveAmountView" + tools:ignore="RtlHardcoded" /> + <TextView android:id="@+id/chosenAmountLabel" style="@style/TransactionLabel" app:layout_constraintBottom_toTopOf="@+id/chosenAmountView" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/effectiveAmountView" + app:layout_constraintTop_toBottomOf="@+id/confirmWithdrawalButton" tools:text="@string/amount_chosen" /> <TextView android:id="@+id/chosenAmountView" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_marginStart="16dp" - android:layout_marginTop="8dp" - android:layout_marginEnd="16dp" - android:layout_marginBottom="16dp" - android:gravity="center" - android:textSize="24sp" + style="@style/TransactionContent" app:layout_constraintBottom_toTopOf="@+id/feeLabel" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" @@ -98,15 +97,8 @@ <TextView android:id="@+id/feeView" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_marginStart="16dp" - android:layout_marginTop="8dp" - android:layout_marginEnd="16dp" - android:layout_marginBottom="16dp" - android:gravity="center" + style="@style/TransactionContent" android:textColor="@color/red" - android:textSize="24sp" app:layout_constraintBottom_toTopOf="@+id/exchangeLabel" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" @@ -124,16 +116,9 @@ <TextView android:id="@+id/exchangeView" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_marginStart="16dp" - android:layout_marginTop="8dp" - android:layout_marginEnd="16dp" - android:gravity="center" - android:textSize="24sp" + style="@style/TransactionContent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintHorizontal_bias="0.5" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/exchangeLabel" tools:text="exchange.demo.taler.net" /> diff --git a/wallet/src/main/res/values/strings.xml b/wallet/src/main/res/values/strings.xml index 58b432a..1f2d80c 100644 --- a/wallet/src/main/res/values/strings.xml +++ b/wallet/src/main/res/values/strings.xml @@ -81,7 +81,9 @@ GNU Taler is immune against many types of fraud, such as phishing of credit card <string name="transaction_tip_accepted">Tip Accepted</string> <string name="transaction_tip_declined">Tip Declined</string> <string name="transaction_tip_from">Tip from %s</string> - <string name="transaction_refund">Refund from %s</string> + <string name="transaction_refund">Refund</string> + <string name="transaction_refund_from">Refund from %s</string> + <string name="transaction_refund_for">Refund for %s</string> <string name="transaction_pending">PENDING</string> <string name="transaction_refresh">Coin expiry change fee</string> <string name="transaction_refresh_reason_manual">because of manual request</string> @@ -110,6 +112,7 @@ GNU Taler is immune against many types of fraud, such as phishing of credit card <string name="withdraw_fees">Fee</string> <string name="withdraw_exchange">Exchange</string> <string name="withdraw_button_confirm">Confirm Withdraw</string> + <string name="withdraw_button_confirm_bank">Confirm with bank</string> <string name="withdraw_button_tos">Review Terms</string> <string name="withdraw_error_title">Withdrawal Error</string> <string name="withdraw_error_message">Withdrawing is currently not possible. Please try again later!</string> |