summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPrashant Malani <pmalani@google.com>2016-03-09 00:23:51 +0100
committerPrashant Malani <pmalani@google.com>2016-03-09 00:56:54 +0100
commit1c7b2230d8aac9f064f68c48b6aa26aca000cc9d (patch)
tree9f7e07128f339f3a8fbed3cb4c49ce499be60c99
parentrecovery: Begin refactor of WearUI to use ScreenRecoveryUI (diff)
downloadandroid_bootable_recovery-1c7b2230d8aac9f064f68c48b6aa26aca000cc9d.tar
android_bootable_recovery-1c7b2230d8aac9f064f68c48b6aa26aca000cc9d.tar.gz
android_bootable_recovery-1c7b2230d8aac9f064f68c48b6aa26aca000cc9d.tar.bz2
android_bootable_recovery-1c7b2230d8aac9f064f68c48b6aa26aca000cc9d.tar.lz
android_bootable_recovery-1c7b2230d8aac9f064f68c48b6aa26aca000cc9d.tar.xz
android_bootable_recovery-1c7b2230d8aac9f064f68c48b6aa26aca000cc9d.tar.zst
android_bootable_recovery-1c7b2230d8aac9f064f68c48b6aa26aca000cc9d.zip
-rw-r--r--screen_ui.cpp4
-rw-r--r--screen_ui.h3
-rw-r--r--wear_ui.cpp69
-rw-r--r--wear_ui.h12
4 files changed, 4 insertions, 84 deletions
diff --git a/screen_ui.cpp b/screen_ui.cpp
index 522aa6b23..dc596314c 100644
--- a/screen_ui.cpp
+++ b/screen_ui.cpp
@@ -51,7 +51,6 @@ static double now() {
}
ScreenRecoveryUI::ScreenRecoveryUI() :
- currentIcon(NONE),
installingFrame(0),
locale(nullptr),
rtl_locale(false),
@@ -76,7 +75,8 @@ ScreenRecoveryUI::ScreenRecoveryUI() :
animation_fps(-1),
installing_frames(-1),
stage(-1),
- max_stage(-1) {
+ max_stage(-1),
+ currentIcon(NONE) {
for (int i = 0; i < 5; i++) {
backgroundIcon[i] = nullptr;
diff --git a/screen_ui.h b/screen_ui.h
index 08a5f44a9..386deac2d 100644
--- a/screen_ui.h
+++ b/screen_ui.h
@@ -68,7 +68,6 @@ class ScreenRecoveryUI : public RecoveryUI {
void SetColor(UIElement e);
private:
- Icon currentIcon;
int installingFrame;
const char* locale;
bool rtl_locale;
@@ -139,6 +138,8 @@ class ScreenRecoveryUI : public RecoveryUI {
void LoadBitmap(const char* filename, GRSurface** surface);
void LoadBitmapArray(const char* filename, int* frames, int* fps, GRSurface*** surface);
void LoadLocalizedBitmap(const char* filename, GRSurface** surface);
+ protected:
+ Icon currentIcon;
};
#endif // RECOVERY_UI_H
diff --git a/wear_ui.cpp b/wear_ui.cpp
index 65bcd8494..ef48b788b 100644
--- a/wear_ui.cpp
+++ b/wear_ui.cpp
@@ -59,7 +59,6 @@ WearRecoveryUI::WearRecoveryUI() :
intro_frames(22),
loop_frames(60),
animation_fps(30),
- currentIcon(NONE),
intro_done(false),
current_frame(0),
rtl_locale(false),
@@ -366,57 +365,6 @@ void WearRecoveryUI::Init()
RecoveryUI::Init();
}
-void WearRecoveryUI::SetBackground(Icon icon)
-{
- pthread_mutex_lock(&updateMutex);
- currentIcon = icon;
- update_screen_locked();
- pthread_mutex_unlock(&updateMutex);
-}
-
-void WearRecoveryUI::SetProgressType(ProgressType type)
-{
- pthread_mutex_lock(&updateMutex);
- if (progressBarType != type) {
- progressBarType = type;
- }
- progressScopeStart = 0;
- progressScopeSize = 0;
- progress = 0;
- update_screen_locked();
- pthread_mutex_unlock(&updateMutex);
-}
-
-void WearRecoveryUI::ShowProgress(float portion, float seconds)
-{
- pthread_mutex_lock(&updateMutex);
- progressBarType = DETERMINATE;
- progressScopeStart += progressScopeSize;
- progressScopeSize = portion;
- progressScopeTime = now();
- progressScopeDuration = seconds;
- progress = 0;
- update_screen_locked();
- pthread_mutex_unlock(&updateMutex);
-}
-
-void WearRecoveryUI::SetProgress(float fraction)
-{
- pthread_mutex_lock(&updateMutex);
- if (fraction < 0.0) fraction = 0.0;
- if (fraction > 1.0) fraction = 1.0;
- if (progressBarType == DETERMINATE && fraction > progress) {
- // Skip updates that aren't visibly different.
- int width = progress_bar_width;
- float scale = width * progressScopeSize;
- if ((int) (progress * scale) != (int) (fraction * scale)) {
- progress = fraction;
- update_screen_locked();
- }
- }
- pthread_mutex_unlock(&updateMutex);
-}
-
void WearRecoveryUI::SetStage(int current, int max)
{
}
@@ -499,16 +447,6 @@ int WearRecoveryUI::SelectMenu(int sel) {
return sel;
}
-void WearRecoveryUI::EndMenu() {
- int i;
- pthread_mutex_lock(&updateMutex);
- if (show_menu > 0 && text_rows > 0 && text_cols > 0) {
- show_menu = 0;
- update_screen_locked();
- }
- pthread_mutex_unlock(&updateMutex);
-}
-
bool WearRecoveryUI::IsTextVisible()
{
pthread_mutex_lock(&updateMutex);
@@ -539,13 +477,6 @@ void WearRecoveryUI::ShowText(bool visible)
pthread_mutex_unlock(&updateMutex);
}
-void WearRecoveryUI::Redraw()
-{
- pthread_mutex_lock(&updateMutex);
- update_screen_locked();
- pthread_mutex_unlock(&updateMutex);
-}
-
void WearRecoveryUI::ShowFile(FILE* fp) {
std::vector<long> offsets;
offsets.push_back(ftell(fp));
diff --git a/wear_ui.h b/wear_ui.h
index 35ea51660..63a257244 100644
--- a/wear_ui.h
+++ b/wear_ui.h
@@ -24,13 +24,6 @@ class WearRecoveryUI : public ScreenRecoveryUI {
WearRecoveryUI();
void Init();
- // overall recovery state ("background image")
- void SetBackground(Icon icon);
-
- // progress indicator
- void SetProgressType(ProgressType type);
- void ShowProgress(float portion, float seconds);
- void SetProgress(float fraction);
void SetStage(int current, int max);
@@ -49,9 +42,6 @@ class WearRecoveryUI : public ScreenRecoveryUI {
void StartMenu(const char* const * headers, const char* const * items,
int initial_selection);
int SelectMenu(int sel);
- void EndMenu();
-
- void Redraw();
enum UIElement { HEADER, MENU, MENU_SEL_BG, MENU_SEL_FG, LOG, TEXT_FILL };
virtual void SetColor(UIElement e);
@@ -78,8 +68,6 @@ class WearRecoveryUI : public ScreenRecoveryUI {
int animation_fps;
private:
- Icon currentIcon;
-
bool intro_done;
int current_frame;