From 9f571d2e61f7f01ccc99f2796c2767d465c68f47 Mon Sep 17 00:00:00 2001 From: dreacot Date: Wed, 12 May 2021 18:19:04 +0100 Subject: [PATCH] keep display on for entire duration of the mixing --- .../dcrandroid/activities/privacy/AccountMixerActivity.kt | 7 +++++++ app/src/main/res/values/strings.xml | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/dcrandroid/activities/privacy/AccountMixerActivity.kt b/app/src/main/java/com/dcrandroid/activities/privacy/AccountMixerActivity.kt index e67cbd2e..11ce9faf 100644 --- a/app/src/main/java/com/dcrandroid/activities/privacy/AccountMixerActivity.kt +++ b/app/src/main/java/com/dcrandroid/activities/privacy/AccountMixerActivity.kt @@ -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 @@ -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) { @@ -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) } } } @@ -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) } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 393f7029..8ad64ffc 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -569,7 +569,7 @@ Mix transaction change Change from transactions will be sent to unmixed account if enabled. %1$s.]]> - Your wallet will be unlocked until mixing completes. + Your wallet will be unlocked and your display would remain on until mixing completes. cspp mixer has stopped running Unmixed account has no mixable output NEW @@ -596,7 +596,7 @@ Mix server Keep this app opened How to use the mixer? -
Important: keep this app opened while mixer is running.

Mixer will automatically stop when unmixed balance are fully mixed.]]>
+
Important: keep this app opened while mixer is running. Your display would not timeout until the mixer completes, this may impact your battery life.

Mixer will automatically stop when unmixed balance are fully mixed.]]>
Mixer is running… Keep this app opened Mixer will automatically stop when unmixed balance are fully mixed.