mirror of
https://codeberg.org/anoncontributorxmr/mysu.git
synced 2024-11-25 17:02:28 +00:00
feat: rework fees and hide manual fee selection behind a setting
This commit is contained in:
parent
b69d717651
commit
968019255f
7 changed files with 67 additions and 22 deletions
|
@ -29,6 +29,7 @@ import com.ncorti.slidetoact.SlideToActView.OnSlideCompleteListener
|
||||||
import net.mynero.wallet.model.PendingTransaction
|
import net.mynero.wallet.model.PendingTransaction
|
||||||
import net.mynero.wallet.model.Wallet
|
import net.mynero.wallet.model.Wallet
|
||||||
import net.mynero.wallet.service.BalanceService
|
import net.mynero.wallet.service.BalanceService
|
||||||
|
import net.mynero.wallet.service.PrefService
|
||||||
import net.mynero.wallet.service.TxService
|
import net.mynero.wallet.service.TxService
|
||||||
import net.mynero.wallet.service.UTXOService
|
import net.mynero.wallet.service.UTXOService
|
||||||
import net.mynero.wallet.util.Constants
|
import net.mynero.wallet.util.Constants
|
||||||
|
@ -37,7 +38,7 @@ import net.mynero.wallet.util.UriData
|
||||||
|
|
||||||
class SendActivity : AppCompatActivity() {
|
class SendActivity : AppCompatActivity() {
|
||||||
|
|
||||||
var priority: PendingTransaction.Priority = PendingTransaction.Priority.Priority_Low
|
var priority: PendingTransaction.Priority = PendingTransaction.Priority.Priority_Default
|
||||||
private lateinit var mViewModel: SendViewModel
|
private lateinit var mViewModel: SendViewModel
|
||||||
private lateinit var sendMaxButton: Button
|
private lateinit var sendMaxButton: Button
|
||||||
private lateinit var addOutputImageView: ImageButton
|
private lateinit var addOutputImageView: ImageButton
|
||||||
|
@ -125,15 +126,22 @@ class SendActivity : AppCompatActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun bindListeners() {
|
private fun bindListeners() {
|
||||||
feeRadioGroup.check(R.id.low_fee_radiobutton)
|
feeRadioGroup.check(R.id.default_fee_radiobutton)
|
||||||
priority = PendingTransaction.Priority.Priority_Low
|
priority = PendingTransaction.Priority.Priority_Default
|
||||||
feeRadioGroup.setOnCheckedChangeListener { _: RadioGroup?, i: Int ->
|
feeRadioGroup.setOnCheckedChangeListener { _: RadioGroup?, i: Int ->
|
||||||
when (i) {
|
when (i) {
|
||||||
R.id.low_fee_radiobutton -> priority = PendingTransaction.Priority.Priority_Low
|
R.id.default_fee_radiobutton -> priority = PendingTransaction.Priority.Priority_Default
|
||||||
R.id.med_fee_radiobutton -> priority = PendingTransaction.Priority.Priority_Medium
|
R.id.medium_fee_radiobutton -> priority = PendingTransaction.Priority.Priority_Medium
|
||||||
R.id.high_fee_radiobutton -> priority = PendingTransaction.Priority.Priority_High
|
R.id.high_fee_radiobutton -> priority = PendingTransaction.Priority.Priority_High
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (PrefService.instance.getBoolean(Constants.PREF_ALLOW_FEE_OVERRIDE, false)) {
|
||||||
|
feeRadioGroup.visibility = View.VISIBLE
|
||||||
|
feeRadioGroupLabelTextView.visibility = View.VISIBLE
|
||||||
|
} else {
|
||||||
|
feeRadioGroup.visibility = View.GONE
|
||||||
|
feeRadioGroupLabelTextView.visibility = View.GONE
|
||||||
|
}
|
||||||
addOutputImageView.setOnClickListener {
|
addOutputImageView.setOnClickListener {
|
||||||
sendMaxButton.visibility = View.GONE
|
sendMaxButton.visibility = View.GONE
|
||||||
val outputCount = destCount
|
val outputCount = destCount
|
||||||
|
@ -430,8 +438,13 @@ class SendActivity : AppCompatActivity() {
|
||||||
setAddOutputButtonVisibility(View.VISIBLE)
|
setAddOutputButtonVisibility(View.VISIBLE)
|
||||||
sendMaxButton.visibility = View.VISIBLE
|
sendMaxButton.visibility = View.VISIBLE
|
||||||
createButton.visibility = View.VISIBLE
|
createButton.visibility = View.VISIBLE
|
||||||
|
if (PrefService.instance.getBoolean(Constants.PREF_ALLOW_FEE_OVERRIDE, false)) {
|
||||||
feeRadioGroup.visibility = View.VISIBLE
|
feeRadioGroup.visibility = View.VISIBLE
|
||||||
feeRadioGroupLabelTextView.visibility = View.VISIBLE
|
feeRadioGroupLabelTextView.visibility = View.VISIBLE
|
||||||
|
} else {
|
||||||
|
feeRadioGroup.visibility = View.GONE
|
||||||
|
feeRadioGroupLabelTextView.visibility = View.GONE
|
||||||
|
}
|
||||||
sendTxSlider.visibility = View.GONE
|
sendTxSlider.visibility = View.GONE
|
||||||
feeTextView.visibility = View.GONE
|
feeTextView.visibility = View.GONE
|
||||||
addressTextView.visibility = View.GONE
|
addressTextView.visibility = View.GONE
|
||||||
|
|
|
@ -37,6 +37,7 @@ class SettingsActivity : AppCompatActivity() {
|
||||||
private lateinit var selectNodeButton: Button
|
private lateinit var selectNodeButton: Button
|
||||||
private lateinit var streetModeSwitch: SwitchCompat
|
private lateinit var streetModeSwitch: SwitchCompat
|
||||||
private lateinit var monerochanSwitch: SwitchCompat
|
private lateinit var monerochanSwitch: SwitchCompat
|
||||||
|
private lateinit var allowFeeOverrideSwitch: SwitchCompat
|
||||||
private lateinit var useBundledTor: CheckBox
|
private lateinit var useBundledTor: CheckBox
|
||||||
private lateinit var displaySeedButton: Button
|
private lateinit var displaySeedButton: Button
|
||||||
private lateinit var displayUtxosButton: Button
|
private lateinit var displayUtxosButton: Button
|
||||||
|
@ -59,6 +60,7 @@ class SettingsActivity : AppCompatActivity() {
|
||||||
selectNodeButton = findViewById(R.id.select_node_button)
|
selectNodeButton = findViewById(R.id.select_node_button)
|
||||||
streetModeSwitch = findViewById(R.id.street_mode_switch)
|
streetModeSwitch = findViewById(R.id.street_mode_switch)
|
||||||
monerochanSwitch = findViewById(R.id.monerochan_switch)
|
monerochanSwitch = findViewById(R.id.monerochan_switch)
|
||||||
|
allowFeeOverrideSwitch = findViewById(R.id.allow_fee_override_switch)
|
||||||
torSwitch = findViewById(R.id.tor_switch)
|
torSwitch = findViewById(R.id.tor_switch)
|
||||||
val proxySettingsLayout = findViewById<ConstraintLayout>(R.id.wallet_proxy_settings_layout)
|
val proxySettingsLayout = findViewById<ConstraintLayout>(R.id.wallet_proxy_settings_layout)
|
||||||
walletProxyAddressEditText = findViewById(R.id.wallet_proxy_address_edittext)
|
walletProxyAddressEditText = findViewById(R.id.wallet_proxy_address_edittext)
|
||||||
|
@ -74,10 +76,9 @@ class SettingsActivity : AppCompatActivity() {
|
||||||
walletProxyAddressEditText.isEnabled = !cachedUsingBundledTor && cachedUsingProxy
|
walletProxyAddressEditText.isEnabled = !cachedUsingBundledTor && cachedUsingProxy
|
||||||
proxySettingsLayout.visibility = View.VISIBLE
|
proxySettingsLayout.visibility = View.VISIBLE
|
||||||
|
|
||||||
streetModeSwitch.isChecked =
|
streetModeSwitch.isChecked = PrefService.instance.getBoolean(Constants.PREF_STREET_MODE, false)
|
||||||
PrefService.instance.getBoolean(Constants.PREF_STREET_MODE, false) == true
|
monerochanSwitch.isChecked = PrefService.instance.getBoolean(Constants.PREF_MONEROCHAN, Constants.DEFAULT_PREF_MONEROCHAN)
|
||||||
monerochanSwitch.isChecked =
|
allowFeeOverrideSwitch.isChecked = PrefService.instance.getBoolean(Constants.PREF_ALLOW_FEE_OVERRIDE, false)
|
||||||
PrefService.instance.getBoolean(Constants.PREF_MONEROCHAN, Constants.DEFAULT_PREF_MONEROCHAN) == true
|
|
||||||
useBundledTor.isChecked = cachedUsingBundledTor
|
useBundledTor.isChecked = cachedUsingBundledTor
|
||||||
torSwitch.isChecked = cachedUsingProxy
|
torSwitch.isChecked = cachedUsingProxy
|
||||||
updateProxy(cachedProxyAddress, cachedProxyPort)
|
updateProxy(cachedProxyAddress, cachedProxyPort)
|
||||||
|
@ -108,6 +109,11 @@ class SettingsActivity : AppCompatActivity() {
|
||||||
HistoryService.instance?.refreshHistory()
|
HistoryService.instance?.refreshHistory()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
allowFeeOverrideSwitch.setOnCheckedChangeListener { _: CompoundButton?, b: Boolean ->
|
||||||
|
PrefService.instance.edit().putBoolean(Constants.PREF_ALLOW_FEE_OVERRIDE, b).apply()
|
||||||
|
HistoryService.instance?.refreshHistory()
|
||||||
|
}
|
||||||
|
|
||||||
selectNodeButton.setOnClickListener {
|
selectNodeButton.setOnClickListener {
|
||||||
val listener = NodeSelectionDialogListenerAdapter(
|
val listener = NodeSelectionDialogListenerAdapter(
|
||||||
activity = this,
|
activity = this,
|
||||||
|
|
|
@ -48,6 +48,7 @@ class PendingTransaction internal constructor(var handle: Long) {
|
||||||
1 -> return Priority_Low
|
1 -> return Priority_Low
|
||||||
2 -> return Priority_Medium
|
2 -> return Priority_Medium
|
||||||
3 -> return Priority_High
|
3 -> return Priority_High
|
||||||
|
4 -> return Priority_Last
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ object Constants {
|
||||||
const val PREF_USES_OFFSET = "pref_uses_offset"
|
const val PREF_USES_OFFSET = "pref_uses_offset"
|
||||||
const val PREF_STREET_MODE = "pref_street_mode"
|
const val PREF_STREET_MODE = "pref_street_mode"
|
||||||
const val PREF_MONEROCHAN = "pref_monerochan"
|
const val PREF_MONEROCHAN = "pref_monerochan"
|
||||||
|
const val PREF_ALLOW_FEE_OVERRIDE = "pref_allow_fee_override"
|
||||||
const val PREF_FROZEN_COINS = "pref_frozen_coins"
|
const val PREF_FROZEN_COINS = "pref_frozen_coins"
|
||||||
const val PREF_USE_BUNDLED_TOR = "pref_use_bundled_tor"
|
const val PREF_USE_BUNDLED_TOR = "pref_use_bundled_tor"
|
||||||
|
|
||||||
|
|
|
@ -98,19 +98,19 @@
|
||||||
app:layout_constraintStart_toEndOf="@id/tx_fee_radiogroup_label_textview">
|
app:layout_constraintStart_toEndOf="@id/tx_fee_radiogroup_label_textview">
|
||||||
|
|
||||||
<RadioButton
|
<RadioButton
|
||||||
android:id="@+id/low_fee_radiobutton"
|
android:id="@+id/default_fee_radiobutton"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="48dp"
|
android:layout_height="48dp"
|
||||||
android:checked="true"
|
android:checked="true"
|
||||||
android:text="@string/low"
|
android:text="@string/default_fee"
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
|
|
||||||
<RadioButton
|
<RadioButton
|
||||||
android:id="@+id/med_fee_radiobutton"
|
android:id="@+id/medium_fee_radiobutton"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="48dp"
|
android:layout_height="48dp"
|
||||||
android:checked="false"
|
android:checked="false"
|
||||||
android:text="@string/medium"
|
android:text="@string/medium_fee"
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
|
|
||||||
<RadioButton
|
<RadioButton
|
||||||
|
@ -118,7 +118,7 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="48dp"
|
android:layout_height="48dp"
|
||||||
android:checked="false"
|
android:checked="false"
|
||||||
android:text="@string/high"
|
android:text="@string/high_fee"
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
|
|
||||||
|
|
|
@ -137,6 +137,19 @@
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="@id/monerochan_switch" />
|
app:layout_constraintTop_toTopOf="@id/monerochan_switch" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/monerochan_label_textview2"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="24dp"
|
||||||
|
android:text="@string/option_allow_fee_override"
|
||||||
|
android:textSize="16sp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/allow_fee_override_switch"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/allow_fee_override_switch"
|
||||||
|
app:layout_constraintHorizontal_bias="1.0"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@+id/allow_fee_override_switch" />
|
||||||
|
|
||||||
<androidx.appcompat.widget.SwitchCompat
|
<androidx.appcompat.widget.SwitchCompat
|
||||||
android:id="@+id/monerochan_switch"
|
android:id="@+id/monerochan_switch"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -147,19 +160,29 @@
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/street_mode_switch" />
|
app:layout_constraintTop_toBottomOf="@id/street_mode_switch" />
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.SwitchCompat
|
||||||
|
android:id="@+id/allow_fee_override_switch"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="24dp"
|
||||||
|
android:minWidth="48dp"
|
||||||
|
android:minHeight="48dp"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/monerochan_switch" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/network_settings_textview"
|
android:id="@+id/network_settings_textview"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="24dp"
|
android:layout_marginStart="24dp"
|
||||||
android:layout_marginTop="32dp"
|
android:layout_marginTop="12dp"
|
||||||
android:layout_marginEnd="24dp"
|
android:layout_marginEnd="24dp"
|
||||||
android:text="@string/network"
|
android:text="@string/network"
|
||||||
android:textSize="24sp"
|
android:textSize="24sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/monerochan_switch" />
|
app:layout_constraintTop_toBottomOf="@+id/allow_fee_override_switch" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/select_node_button"
|
android:id="@+id/select_node_button"
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
<string name="copied_to_clipboard">Copied to clipboard</string>
|
<string name="copied_to_clipboard">Copied to clipboard</string>
|
||||||
<string name="street_mode">Street mode (hide balances)</string>
|
<string name="street_mode">Street mode (hide balances)</string>
|
||||||
<string name="option_hide_xmrchan">Show Monerochan</string>
|
<string name="option_hide_xmrchan">Show Monerochan</string>
|
||||||
|
<string name="option_allow_fee_override">Manual fee selection</string>
|
||||||
<string name="display_recovery_phrase">Display wallet keys</string>
|
<string name="display_recovery_phrase">Display wallet keys</string>
|
||||||
<string name="tor_switch_label">SOCKS Proxy</string>
|
<string name="tor_switch_label">SOCKS Proxy</string>
|
||||||
<string name="connection_failed">Failed to connect. Retrying…</string>
|
<string name="connection_failed">Failed to connect. Retrying…</string>
|
||||||
|
@ -97,10 +98,10 @@
|
||||||
<string name="transaction_conf_1_desc2_confirmed">time, and was mined in block</string>
|
<string name="transaction_conf_1_desc2_confirmed">time, and was mined in block</string>
|
||||||
<string name="transaction_on_date_label">on</string>
|
<string name="transaction_on_date_label">on</string>
|
||||||
<string name="node_selected">Using node: %1$s</string>
|
<string name="node_selected">Using node: %1$s</string>
|
||||||
<string name="fee_priority">Fee priority:</string>
|
<string name="fee_priority">Fee:</string>
|
||||||
<string name="low">Low</string>
|
<string name="default_fee">Default</string>
|
||||||
<string name="medium">Medium</string>
|
<string name="medium_fee">Medium</string>
|
||||||
<string name="high">High</string>
|
<string name="high_fee">High</string>
|
||||||
<string name="view_utxos">View coins</string>
|
<string name="view_utxos">View coins</string>
|
||||||
<string name="selected_utxos_value">Selected value: %1$s XMR</string>
|
<string name="selected_utxos_value">Selected value: %1$s XMR</string>
|
||||||
<string name="selected_utxos_value_churning">Selected value: %1$s XMR\n\nThe anonymity benefits of churning are still being researched. Only proceed if you know what you are doing.</string>
|
<string name="selected_utxos_value_churning">Selected value: %1$s XMR\n\nThe anonymity benefits of churning are still being researched. Only proceed if you know what you are doing.</string>
|
||||||
|
|
Loading…
Reference in a new issue