aboutsummaryrefslogtreecommitdiff
path: root/wallet/src
diff options
context:
space:
mode:
authorTorsten Grote <t@grobox.de>2022-10-24 15:21:08 -0300
committerTorsten Grote <t@grobox.de>2022-10-24 15:21:08 -0300
commit1c43ae08a8dae32bebc13623f6a42d3754903618 (patch)
tree6e59a3076b555a4c864472a5f19a564deb5181e9 /wallet/src
parentf4e22a13b16a9de2ea01ea212dcd20ca5aa7d8b8 (diff)
downloadtaler-android-1c43ae08a8dae32bebc13623f6a42d3754903618.tar.gz
taler-android-1c43ae08a8dae32bebc13623f6a42d3754903618.tar.bz2
taler-android-1c43ae08a8dae32bebc13623f6a42d3754903618.zip
[wallet] allow peer pull payment even when no balance
Diffstat (limited to 'wallet/src')
-rw-r--r--wallet/src/main/java/net/taler/wallet/exchanges/ExchangeAdapter.kt5
-rw-r--r--wallet/src/main/java/net/taler/wallet/exchanges/ExchangeListFragment.kt14
-rw-r--r--wallet/src/main/res/menu/exchange.xml3
3 files changed, 18 insertions, 4 deletions
diff --git a/wallet/src/main/java/net/taler/wallet/exchanges/ExchangeAdapter.kt b/wallet/src/main/java/net/taler/wallet/exchanges/ExchangeAdapter.kt
index e315632..5b0d947 100644
--- a/wallet/src/main/java/net/taler/wallet/exchanges/ExchangeAdapter.kt
+++ b/wallet/src/main/java/net/taler/wallet/exchanges/ExchangeAdapter.kt
@@ -43,6 +43,7 @@ data class ExchangeItem(
interface ExchangeClickListener {
fun onExchangeSelected(item: ExchangeItem)
fun onManualWithdraw(item: ExchangeItem)
+ fun onPeerReceive(item: ExchangeItem)
}
internal class ExchangeAdapter(
@@ -98,6 +99,10 @@ internal class ExchangeAdapter(
listener.onManualWithdraw(item)
true
}
+ R.id.action_receive_peer -> {
+ listener.onPeerReceive(item)
+ true
+ }
else -> false
}
}
diff --git a/wallet/src/main/java/net/taler/wallet/exchanges/ExchangeListFragment.kt b/wallet/src/main/java/net/taler/wallet/exchanges/ExchangeListFragment.kt
index 9a96b59..44c98c1 100644
--- a/wallet/src/main/java/net/taler/wallet/exchanges/ExchangeListFragment.kt
+++ b/wallet/src/main/java/net/taler/wallet/exchanges/ExchangeListFragment.kt
@@ -38,6 +38,7 @@ open class ExchangeListFragment : Fragment(), ExchangeClickListener {
protected val model: MainViewModel by activityViewModels()
private val exchangeManager by lazy { model.exchangeManager }
+ private val transactionManager get() = model.transactionManager
protected lateinit var ui: FragmentExchangeListBinding
protected open val isSelectOnly = false
@@ -61,12 +62,12 @@ open class ExchangeListFragment : Fragment(), ExchangeClickListener {
AddExchangeDialogFragment().show(parentFragmentManager, "ADD_EXCHANGE")
}
- exchangeManager.progress.observe(viewLifecycleOwner, { show ->
+ exchangeManager.progress.observe(viewLifecycleOwner) { show ->
if (show) ui.progressBar.fadeIn() else ui.progressBar.fadeOut()
- })
- exchangeManager.exchanges.observe(viewLifecycleOwner, { exchanges ->
+ }
+ exchangeManager.exchanges.observe(viewLifecycleOwner) { exchanges ->
onExchangeUpdate(exchanges)
- })
+ }
exchangeManager.addError.observe(viewLifecycleOwner, EventObserver { error ->
if (error) onAddExchangeFailed()
})
@@ -96,4 +97,9 @@ open class ExchangeListFragment : Fragment(), ExchangeClickListener {
findNavController().navigate(R.id.action_nav_settings_exchanges_to_nav_exchange_manual_withdrawal)
}
+ override fun onPeerReceive(item: ExchangeItem) {
+ transactionManager.selectedCurrency = item.currency
+ findNavController().navigate(R.id.receiveFunds)
+ }
+
}
diff --git a/wallet/src/main/res/menu/exchange.xml b/wallet/src/main/res/menu/exchange.xml
index 85ec08f..d6a18e7 100644
--- a/wallet/src/main/res/menu/exchange.xml
+++ b/wallet/src/main/res/menu/exchange.xml
@@ -18,4 +18,7 @@
<item
android:id="@+id/action_manual_withdrawal"
android:title="@string/exchange_menu_manual_withdraw" />
+ <item
+ android:id="@+id/action_receive_peer"
+ android:title="@string/receive_peer" />
</menu>