diff --git a/data.cpp b/data.cpp
index 81e9ca23..3eb9dada 100644
--- a/data.cpp
+++ b/data.cpp
@@ -716,6 +716,8 @@ void DataManager::SetDefaultValues()
#endif
mData.SetValue("tw_gui_done", "0");
mData.SetValue("tw_encrypt_backup", "0");
+ mData.SetValue("tw_sleep_total", "5");
+ mData.SetValue("tw_sleep", "5");
// Brightness handling
string findbright;
diff --git a/gui/action.cpp b/gui/action.cpp
index 56336f40..328fc2c5 100644
--- a/gui/action.cpp
+++ b/gui/action.cpp
@@ -180,6 +180,7 @@ GUIAction::GUIAction(xml_node<>* node)
ADD_ACTION(cancelzip);
ADD_ACTION(queueclear);
ADD_ACTION(sleep);
+ ADD_ACTION(sleepcounter);
ADD_ACTION(appenddatetobackupname);
ADD_ACTION(generatebackupname);
ADD_ACTION(checkpartitionlist);
@@ -779,6 +780,23 @@ int GUIAction::sleep(std::string arg)
return 0;
}
+int GUIAction::sleepcounter(std::string arg)
+{
+ operation_start("SleepCounter");
+ // Ensure user notices countdown in case it needs to be cancelled
+ blankTimer.resetTimerAndUnblank();
+ int total = atoi(arg.c_str());
+ for (int t = total; t > 0; t--) {
+ int progress = (int)(((float)(total-t)/(float)total)*100.0);
+ DataManager::SetValue("ui_progress", progress);
+ ::sleep(1);
+ DataManager::SetValue("tw_sleep", t-1);
+ }
+ DataManager::SetValue("ui_progress", 100);
+ operation_end(0);
+ return 0;
+}
+
int GUIAction::appenddatetobackupname(std::string arg __unused)
{
operation_start("AppendDateToBackupName");
@@ -1024,12 +1042,6 @@ int GUIAction::flash(std::string arg)
reinject_after_flash();
PartitionManager.Update_System_Details();
- if (DataManager::GetIntValue("tw_install_reboot") > 0 && ret_val == 0) {
- gui_msg("install_reboot=Rebooting in 5 seconds");
- usleep(5000000);
- TWFunc::tw_reboot(rb_system);
- usleep(5000000); // another sleep while we wait for the reboot to occur
- }
operation_end(ret_val);
// This needs to be after the operation_end call so we change pages before we change variables that we display on the screen
DataManager::SetValue(TW_ZIP_QUEUE_COUNT, zip_queue_index);
diff --git a/gui/objects.hpp b/gui/objects.hpp
index 84a9e5ec..0d969279 100644
--- a/gui/objects.hpp
+++ b/gui/objects.hpp
@@ -313,6 +313,7 @@ protected:
int cancelzip(std::string arg);
int queueclear(std::string arg);
int sleep(std::string arg);
+ int sleepcounter(std::string arg);
int appenddatetobackupname(std::string arg);
int generatebackupname(std::string arg);
int checkpartitionlist(std::string arg);
diff --git a/gui/theme/common/landscape.xml b/gui/theme/common/landscape.xml
index 688cef23..9272db01 100644
--- a/gui/theme/common/landscape.xml
+++ b/gui/theme/common/landscape.xml
@@ -578,6 +578,66 @@
clear_vars
+
+
+
+
+
+
+
+
+ tw_sleep=%tw_sleep_total%
+ flash_sleep_and_reboot
+
+
+
+
+
+
+
+
+
+ {@install_zip_hdr=Install Zip}
+
+
+
+
+ {@install_reboot=Rebooting in %tw_sleep% second(s)}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ %tw_sleep_total%
+
+
+
+
+
+
+
+
+ 50000
+ tw_back=main2
+ reboot_system_routine
+
+
diff --git a/gui/theme/common/languages/en.xml b/gui/theme/common/languages/en.xml
index 28dbb6c2..0a89083d 100644
--- a/gui/theme/common/languages/en.xml
+++ b/gui/theme/common/languages/en.xml
@@ -667,7 +667,7 @@
Error changing file system.
Custom theme version does not match TWRP version. Using stock theme.
(Up A Level)
- Rebooting in 5 seconds
+ Rebooting in %tw_sleep% second(s)
Error with ADB Backup. Quitting..."
Cannot write to adb control channel
--twrp option is required to enable twrp adb backup
diff --git a/gui/theme/common/portrait.xml b/gui/theme/common/portrait.xml
index c3fe9ad2..507f3841 100644
--- a/gui/theme/common/portrait.xml
+++ b/gui/theme/common/portrait.xml
@@ -530,6 +530,66 @@
clear_vars
+
+
+
+
+
+
+
+
+ tw_sleep=%tw_sleep_total%
+ flash_sleep_and_reboot
+
+
+
+
+
+
+
+
+
+ {@install_zip_hdr=Install Zip}
+
+
+
+
+ {@install_reboot=Rebooting in %tw_sleep% second(s)}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ %tw_sleep_total%
+
+
+
+
+
+
+
+
+ 50000
+ tw_back=main2
+ reboot_system_routine
+
+
diff --git a/gui/theme/common/watch.xml b/gui/theme/common/watch.xml
index fd604871..d7bba84b 100644
--- a/gui/theme/common/watch.xml
+++ b/gui/theme/common/watch.xml
@@ -734,6 +734,63 @@
clear_vars
+
+
+
+
+
+
+
+
+ tw_sleep=%tw_sleep_total%
+ flash_sleep_and_reboot
+
+
+
+
+
+
+
+
+
+
+
+ {@install_reboot=Rebooting in %tw_sleep% second(s)}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ %tw_sleep_total%
+
+
+
+
+
+
+
+
+ 50000
+ tw_back=main2
+ reboot_system_routine
+
+