Skip to content

Commit

Permalink
keep display on for entire duration of the mixing
Browse files Browse the repository at this point in the history
  • Loading branch information
dreacot committed May 12, 2021
1 parent 126f5fb commit 9f571d2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Expand Up @@ -9,6 +9,7 @@ package com.dcrandroid.activities.privacy
import android.content.DialogInterface
import android.os.Bundle
import android.text.Html
import android.view.WindowManager
import com.dcrandroid.BuildConfig
import com.dcrandroid.R
import com.dcrandroid.activities.BaseActivity
Expand Down Expand Up @@ -172,6 +173,8 @@ class AccountMixerActivity : BaseActivity(), AccountMixerNotificationListener, T

private fun stopAccountMixer() = GlobalScope.launch(Dispatchers.Default) {
multiWallet?.stopAccountMixer(wallet.id)
// Allow display to timeout after mixer is stopped
window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
}

override fun onAccountMixerEnded(walletID: Long) {
Expand All @@ -180,6 +183,8 @@ class AccountMixerActivity : BaseActivity(), AccountMixerNotificationListener, T
setMixerStatus()
GlobalScope.launch(Dispatchers.Main) {
mixer_toggle_switch.isChecked = false
// Allow display to timeout after mixer completes
window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
}
}
}
Expand All @@ -189,6 +194,8 @@ class AccountMixerActivity : BaseActivity(), AccountMixerNotificationListener, T
setMixerStatus()
GlobalScope.launch(Dispatchers.Main) {
mixer_toggle_switch.isChecked = true
// Prevent display from timing out after mixer starts
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
}
}

Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/values/strings.xml
Expand Up @@ -569,7 +569,7 @@
<string name="mix_tx_change">Mix transaction change</string>
<string name="mix_tx_change_summary">Change from transactions will be sent to unmixed account if enabled.</string>
<string name="change_sent_to_unmixed"><![CDATA[Change will be sent to <b>%1$s</b>.]]></string>
<string name="start_mixer_warning">Your wallet will be unlocked until mixing completes.</string>
<string name="start_mixer_warning">Your wallet will be unlocked and your display would remain on until mixing completes.</string>
<string name="mixer_has_stopped_running">cspp mixer has stopped running</string>
<string name="no_mixable_output">Unmixed account has no mixable output</string>
<string name="new_caps">NEW</string>
Expand All @@ -596,7 +596,7 @@
<string name="mix_server">Mix server</string>
<string name="keep_app_opened">Keep this app opened</string>
<string name="mixer_help_title">How to use the mixer?</string>
<string name="mixer_help_desc"><![CDATA[When you turn on the mixer, your unmixed DCRs in this wallet (unmixed balance) will be gradually mixed.<br/><br/><b><font color="#091440">Important: keep this app opened while mixer is running.</font></b><br/><br/>Mixer will automatically stop when unmixed balance are fully mixed.]]></string>
<string name="mixer_help_desc"><![CDATA[When you turn on the mixer, your unmixed DCRs in this wallet (unmixed balance) will be gradually mixed.<br/><br/><b><font color="#091440">Important: keep this app opened while mixer is running. Your display would not timeout until the mixer completes, this may impact your battery life.</font></b><br/><br/>Mixer will automatically stop when unmixed balance are fully mixed.]]></string>
<string name="mixer_is_running">Mixer is running…</string>
<string name="keep_this_app_opened">Keep this app opened</string>
<string name="mixer_status_info">Mixer will automatically stop when unmixed balance are fully mixed.</string>
Expand Down

0 comments on commit 9f571d2

Please sign in to comment.