summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthat <github@that.at>2016-01-24 21:59:00 +0100
committerz31s1g <z31s1g@googlemail.com>2016-01-25 19:25:34 +0100
commit235c648a6828bdd8201e1151b7e2815a4daf1201 (patch)
treeea3d840730107fdec717a32d496e3b085cab1ce0
parentUpdate mStartPage to make language selection work on other pages (diff)
downloadandroid_bootable_recovery-235c648a6828bdd8201e1151b7e2815a4daf1201.tar
android_bootable_recovery-235c648a6828bdd8201e1151b7e2815a4daf1201.tar.gz
android_bootable_recovery-235c648a6828bdd8201e1151b7e2815a4daf1201.tar.bz2
android_bootable_recovery-235c648a6828bdd8201e1151b7e2815a4daf1201.tar.lz
android_bootable_recovery-235c648a6828bdd8201e1151b7e2815a4daf1201.tar.xz
android_bootable_recovery-235c648a6828bdd8201e1151b7e2815a4daf1201.tar.zst
android_bootable_recovery-235c648a6828bdd8201e1151b7e2815a4daf1201.zip
Diffstat (limited to '')
-rw-r--r--gui/gui.cpp117
-rw-r--r--gui/pages.cpp9
-rw-r--r--gui/pages.hpp1
-rw-r--r--gui/theme/landscape_hdpi/images/curtain.jpgbin133833 -> 0 bytes
-rwxr-xr-xgui/theme/landscape_hdpi/images/splashlogo.pngbin0 -> 15097 bytes
-rwxr-xr-xgui/theme/landscape_hdpi/images/splashteamwin.pngbin0 -> 1680 bytes
-rwxr-xr-xgui/theme/landscape_hdpi/splash.xml52
-rw-r--r--gui/theme/landscape_mdpi/images/curtain.jpgbin39268 -> 0 bytes
-rwxr-xr-xgui/theme/landscape_mdpi/images/splashlogo.pngbin0 -> 6239 bytes
-rwxr-xr-xgui/theme/landscape_mdpi/images/splashteamwin.pngbin0 -> 1547 bytes
-rwxr-xr-xgui/theme/landscape_mdpi/splash.xml52
-rw-r--r--gui/theme/portrait_hdpi/images/curtain.jpgbin52988 -> 0 bytes
-rwxr-xr-xgui/theme/portrait_hdpi/images/splashlogo.pngbin0 -> 15097 bytes
-rwxr-xr-xgui/theme/portrait_hdpi/images/splashteamwin.pngbin0 -> 1680 bytes
-rwxr-xr-xgui/theme/portrait_hdpi/splash.xml52
-rw-r--r--gui/theme/portrait_mdpi/images/curtain.jpgbin43476 -> 0 bytes
-rwxr-xr-xgui/theme/portrait_mdpi/images/splashlogo.pngbin0 -> 6239 bytes
-rwxr-xr-xgui/theme/portrait_mdpi/images/splashteamwin.pngbin0 -> 1547 bytes
-rwxr-xr-xgui/theme/portrait_mdpi/splash.xml52
-rw-r--r--gui/theme/watch_mdpi/images/curtain.jpgbin28427 -> 0 bytes
-rwxr-xr-xgui/theme/watch_mdpi/images/splashlogo.pngbin0 -> 5597 bytes
-rwxr-xr-xgui/theme/watch_mdpi/images/splashteamwin.pngbin0 -> 983 bytes
-rwxr-xr-xgui/theme/watch_mdpi/splash.xml52
23 files changed, 270 insertions, 117 deletions
diff --git a/gui/gui.cpp b/gui/gui.cpp
index d99764aea..7cf21b0a0 100644
--- a/gui/gui.cpp
+++ b/gui/gui.cpp
@@ -62,15 +62,11 @@ extern "C"
#define LOGEVENT(...) do {} while (0)
#endif
-const static int CURTAIN_FADE = 32;
-
using namespace rapidxml;
// Global values
-static gr_surface gCurtain = NULL;
static int gGuiInitialized = 0;
static TWAtomicInt gForceRender;
-const int gNoAnimation = 1;
blanktimer blankTimer;
int ors_read_fd = -1;
static FILE* orsout = NULL;
@@ -107,80 +103,6 @@ void rapidxml::parse_error_handler(const char *what, void *where)
//abort();
}
-static void curtainSet()
-{
- gr_color(0, 0, 0, 255);
- gr_fill(0, 0, gr_fb_width(), gr_fb_height());
- gr_blit(gCurtain, 0, 0, gr_get_width(gCurtain), gr_get_height(gCurtain), TW_X_OFFSET, TW_Y_OFFSET);
- gr_flip();
-}
-
-static void curtainRaise(gr_surface surface)
-{
- int sy = 0;
- int h = gr_get_height(gCurtain) - 1;
- int w = gr_get_width(gCurtain);
- int fy = 1;
-
- int msw = gr_get_width(surface);
- int msh = gr_get_height(surface);
- int CURTAIN_RATE = msh / 30;
-
- if (gNoAnimation == 0)
- {
- for (; h > 0; h -= CURTAIN_RATE, sy += CURTAIN_RATE, fy += CURTAIN_RATE)
- {
- gr_blit(surface, 0, 0, msw, msh, 0, 0);
- gr_blit(gCurtain, 0, sy, w, h, 0, 0);
- gr_flip();
- }
- }
- gr_blit(surface, 0, 0, msw, msh, 0, 0);
- flip();
-}
-
-void curtainClose()
-{
-#if 0
- int w = gr_get_width(gCurtain);
- int h = 1;
- int sy = gr_get_height(gCurtain) - 1;
- int fbh = gr_fb_height();
- int CURTAIN_RATE = fbh / 30;
-
- if (gNoAnimation == 0)
- {
- for (; h < fbh; h += CURTAIN_RATE, sy -= CURTAIN_RATE)
- {
- gr_blit(gCurtain, 0, sy, w, h, 0, 0);
- gr_flip();
- }
- gr_blit(gCurtain, 0, 0, gr_get_width(gCurtain),
- gr_get_height(gCurtain), 0, 0);
- gr_flip();
-
- if (gRecorder != -1)
- close(gRecorder);
-
- int fade;
- for (fade = 16; fade < 255; fade += CURTAIN_FADE)
- {
- gr_blit(gCurtain, 0, 0, gr_get_width(gCurtain),
- gr_get_height(gCurtain), 0, 0);
- gr_color(0, 0, 0, fade);
- gr_fill(0, 0, gr_fb_width(), gr_fb_height());
- gr_flip();
- }
- gr_color(0, 0, 0, 255);
- gr_fill(0, 0, gr_fb_width(), gr_fb_height());
- gr_flip();
- }
-#else
- gr_blit(gCurtain, 0, 0, gr_get_width(gCurtain), gr_get_height(gCurtain), 0, 0);
- gr_flip();
-#endif
-}
-
class InputHandler
{
public:
@@ -618,17 +540,6 @@ static int runPages(const char *page_name, const int stop_on_page_done)
gui_changePage(page_name);
}
- // Raise the curtain
- if (gCurtain != NULL)
- {
- gr_surface surface;
-
- PageManager::Render();
- gr_get_surface(&surface);
- curtainRaise(surface);
- gr_free_surface(surface);
- }
-
gGuiRunning = 1;
DataManager::SetValue("tw_loaded", 1);
@@ -822,30 +733,18 @@ std::string gui_lookup(const std::string& resource_name, const std::string& defa
extern "C" int gui_init(void)
{
gr_init();
- std::string curtain_path = TWRES "images/curtain.jpg";
- gr_surface source_Surface = NULL;
- if (res_create_surface(curtain_path.c_str(), &source_Surface))
- {
- printf("Unable to locate '%s'\nDid you set a TW_THEME in your config files?\n", curtain_path.c_str());
- return -1;
+ // load and show splash screen
+ if (PageManager::LoadPackage("splash", TWRES "splash.xml", "splash")) {
+ LOGERR("Failed to load splash screen XML.\n");
}
- if (gr_get_width(source_Surface) != (unsigned)gr_fb_width() || gr_get_height(source_Surface) != (unsigned)gr_fb_height()) {
- // We need to scale the curtain to fit the screen
- float scale_w = (float)gr_fb_width() / (float)gr_get_width(source_Surface);
- float scale_h = (float)gr_fb_height() / (float)gr_get_height(source_Surface);
- if (res_scale_surface(source_Surface, &gCurtain, scale_w, scale_h)) {
- LOGINFO("Failed to scale curtain\n");
- gCurtain = source_Surface;
- } else {
- LOGINFO("Scaling the curtain width %fx and height %fx\n", scale_w, scale_h);
- }
- } else {
- gCurtain = source_Surface;
+ else {
+ PageManager::SelectPackage("splash");
+ PageManager::Render();
+ flip();
+ PageManager::ReleasePackage("splash");
}
- curtainSet();
-
ev_init();
return 0;
}
diff --git a/gui/pages.cpp b/gui/pages.cpp
index def262998..c45566232 100644
--- a/gui/pages.cpp
+++ b/gui/pages.cpp
@@ -64,7 +64,6 @@ extern std::vector<std::string> gConsoleColor;
std::map<std::string, PageSet*> PageManager::mPageSets;
PageSet* PageManager::mCurrentSet;
-PageSet* PageManager::mBaseSet = NULL;
MouseCursor *PageManager::mMouseCursor = NULL;
HardwareKeyboard *PageManager::mHardwareKeyboard = NULL;
bool PageManager::mReloadTheme = false;
@@ -1421,10 +1420,6 @@ int PageManager::LoadPackage(std::string name, std::string package, std::string
LOGERR("Package %s failed to load.\n", name.c_str());
}
- // The first successful package we loaded is the base
- if (mBaseSet == NULL)
- mBaseSet = mCurrentSet;
-
mCurrentSet = pageSet;
if (pZip) {
@@ -1500,8 +1495,6 @@ int PageManager::ReloadPackage(std::string name, std::string package)
}
if (mCurrentSet == set)
SelectPackage(name);
- if (mBaseSet == set)
- mBaseSet = mCurrentSet;
delete set;
GUIConsole::Translate_Now();
return 0;
@@ -1518,6 +1511,8 @@ void PageManager::ReleasePackage(std::string name)
PageSet* set = (*iter).second;
mPageSets.erase(iter);
delete set;
+ if (set == mCurrentSet)
+ mCurrentSet = NULL;
return;
}
diff --git a/gui/pages.hpp b/gui/pages.hpp
index bb521c1d2..cf1afa1e9 100644
--- a/gui/pages.hpp
+++ b/gui/pages.hpp
@@ -178,7 +178,6 @@ protected:
protected:
static std::map<std::string, PageSet*> mPageSets;
static PageSet* mCurrentSet;
- static PageSet* mBaseSet;
static MouseCursor *mMouseCursor;
static HardwareKeyboard *mHardwareKeyboard;
static bool mReloadTheme;
diff --git a/gui/theme/landscape_hdpi/images/curtain.jpg b/gui/theme/landscape_hdpi/images/curtain.jpg
deleted file mode 100644
index 51ea6a571..000000000
--- a/gui/theme/landscape_hdpi/images/curtain.jpg
+++ /dev/null
Binary files differ
diff --git a/gui/theme/landscape_hdpi/images/splashlogo.png b/gui/theme/landscape_hdpi/images/splashlogo.png
new file mode 100755
index 000000000..337a7b6de
--- /dev/null
+++ b/gui/theme/landscape_hdpi/images/splashlogo.png
Binary files differ
diff --git a/gui/theme/landscape_hdpi/images/splashteamwin.png b/gui/theme/landscape_hdpi/images/splashteamwin.png
new file mode 100755
index 000000000..f44a8febc
--- /dev/null
+++ b/gui/theme/landscape_hdpi/images/splashteamwin.png
Binary files differ
diff --git a/gui/theme/landscape_hdpi/splash.xml b/gui/theme/landscape_hdpi/splash.xml
new file mode 100755
index 000000000..1a9fd5340
--- /dev/null
+++ b/gui/theme/landscape_hdpi/splash.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0"?>
+<recovery>
+ <details>
+ <resolution width="1920" height="1200"/>
+ <author>TeamWin</author>
+ <title>TWRP</title>
+ <description>Default basic theme</description>
+ <preview>preview.jpg</preview>
+ <themeversion>1</themeversion>
+ </details>
+
+ <resources>
+ <font name="font_l" filename="RobotoCondensed-Regular.ttf" size="52"/>
+ <image name="splashlogo" filename="splashlogo" retainaspect="1"/>
+ <image name="splashteamwin" filename="splashteamwin" retainaspect="1"/>
+ </resources>
+
+ <variables>
+ <variable name="screen_width" value="1920"/>
+ <variable name="screen_height" value="1200"/>
+ <variable name="background_color" value="#222222"/>
+ <variable name="header_color" value="#555555"/>
+ <variable name="accent_color" value="#0090CA"/>
+ </variables>
+
+ <pages>
+ <page name="splash">
+ <background color="%background_color%"/>
+
+ <fill color="%header_color%">
+ <placement x="0" y="0" w="%screen_width%" h="320"/>
+ </fill>
+
+ <image>
+ <image resource="splashlogo"/>
+ <placement x="960" y="320" placement="4"/>
+ </image>
+
+ <image>
+ <image resource="splashteamwin"/>
+ <placement x="960" y="920" placement="4"/>
+ </image>
+
+ <text color="%header_color%">
+ <font resource="font_l"/>
+ <placement x="960" y="970" placement="5"/>
+ <text>Recovery Project %tw_version%</text>
+ </text>
+ </page>
+ </pages>
+</recovery>
+
diff --git a/gui/theme/landscape_mdpi/images/curtain.jpg b/gui/theme/landscape_mdpi/images/curtain.jpg
deleted file mode 100644
index f79ab92b5..000000000
--- a/gui/theme/landscape_mdpi/images/curtain.jpg
+++ /dev/null
Binary files differ
diff --git a/gui/theme/landscape_mdpi/images/splashlogo.png b/gui/theme/landscape_mdpi/images/splashlogo.png
new file mode 100755
index 000000000..4b29425e8
--- /dev/null
+++ b/gui/theme/landscape_mdpi/images/splashlogo.png
Binary files differ
diff --git a/gui/theme/landscape_mdpi/images/splashteamwin.png b/gui/theme/landscape_mdpi/images/splashteamwin.png
new file mode 100755
index 000000000..125501fcb
--- /dev/null
+++ b/gui/theme/landscape_mdpi/images/splashteamwin.png
Binary files differ
diff --git a/gui/theme/landscape_mdpi/splash.xml b/gui/theme/landscape_mdpi/splash.xml
new file mode 100755
index 000000000..34f832578
--- /dev/null
+++ b/gui/theme/landscape_mdpi/splash.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0"?>
+<recovery>
+ <details>
+ <resolution width="800" height="480"/>
+ <author>TeamWin</author>
+ <title>TWRP</title>
+ <description>Default basic theme</description>
+ <preview>preview.jpg</preview>
+ <themeversion>1</themeversion>
+ </details>
+
+ <resources>
+ <font name="font_l" filename="RobotoCondensed-Regular.ttf" size="24"/>
+ <image name="splashlogo" filename="splashlogo" retainaspect="1"/>
+ <image name="splashteamwin" filename="splashteamwin" retainaspect="1"/>
+ </resources>
+
+ <variables>
+ <variable name="screen_width" value="800"/>
+ <variable name="screen_height" value="480"/>
+ <variable name="background_color" value="#222222"/>
+ <variable name="header_color" value="#555555"/>
+ <variable name="accent_color" value="#0090CA"/>
+ </variables>
+
+ <pages>
+ <page name="splash">
+ <background color="%background_color%"/>
+
+ <fill color="%header_color%">
+ <placement x="0" y="0" w="%screen_width%" h="140"/>
+ </fill>
+
+ <image>
+ <image resource="splashlogo"/>
+ <placement x="400" y="140" placement="4"/>
+ </image>
+
+ <image>
+ <image resource="splashteamwin"/>
+ <placement x="400" y="366" placement="4"/>
+ </image>
+
+ <text color="%header_color%">
+ <font resource="font_l"/>
+ <placement x="400" y="386" placement="5"/>
+ <text>Recovery Project %tw_version%</text>
+ </text>
+ </page>
+ </pages>
+</recovery>
+
diff --git a/gui/theme/portrait_hdpi/images/curtain.jpg b/gui/theme/portrait_hdpi/images/curtain.jpg
deleted file mode 100644
index fd0ea31ef..000000000
--- a/gui/theme/portrait_hdpi/images/curtain.jpg
+++ /dev/null
Binary files differ
diff --git a/gui/theme/portrait_hdpi/images/splashlogo.png b/gui/theme/portrait_hdpi/images/splashlogo.png
new file mode 100755
index 000000000..337a7b6de
--- /dev/null
+++ b/gui/theme/portrait_hdpi/images/splashlogo.png
Binary files differ
diff --git a/gui/theme/portrait_hdpi/images/splashteamwin.png b/gui/theme/portrait_hdpi/images/splashteamwin.png
new file mode 100755
index 000000000..f44a8febc
--- /dev/null
+++ b/gui/theme/portrait_hdpi/images/splashteamwin.png
Binary files differ
diff --git a/gui/theme/portrait_hdpi/splash.xml b/gui/theme/portrait_hdpi/splash.xml
new file mode 100755
index 000000000..964b2af98
--- /dev/null
+++ b/gui/theme/portrait_hdpi/splash.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0"?>
+<recovery>
+ <details>
+ <resolution width="1080" height="1920"/>
+ <author>TeamWin</author>
+ <title>TWRP</title>
+ <description>Default basic theme</description>
+ <preview>preview.jpg</preview>
+ <themeversion>1</themeversion>
+ </details>
+
+ <resources>
+ <font name="font_l" filename="RobotoCondensed-Regular.ttf" size="52"/>
+ <image name="splashlogo" filename="splashlogo" retainaspect="1"/>
+ <image name="splashteamwin" filename="splashteamwin" retainaspect="1"/>
+ </resources>
+
+ <variables>
+ <variable name="screen_width" value="1080"/>
+ <variable name="screen_height" value="1920"/>
+ <variable name="background_color" value="#222222"/>
+ <variable name="header_color" value="#555555"/>
+ <variable name="accent_color" value="#0090CA"/>
+ </variables>
+
+ <pages>
+ <page name="splash">
+ <background color="%background_color%"/>
+
+ <fill color="%header_color%">
+ <placement x="0" y="0" w="%screen_width%" h="456"/>
+ </fill>
+
+ <image>
+ <image resource="splashlogo"/>
+ <placement x="540" y="456" placement="4"/>
+ </image>
+
+ <image>
+ <image resource="splashteamwin"/>
+ <placement x="540" y="1540" placement="4"/>
+ </image>
+
+ <text color="%header_color%">
+ <font resource="font_l"/>
+ <placement x="540" y="1590" placement="5"/>
+ <text>Recovery Project %tw_version%</text>
+ </text>
+ </page>
+ </pages>
+</recovery>
+
diff --git a/gui/theme/portrait_mdpi/images/curtain.jpg b/gui/theme/portrait_mdpi/images/curtain.jpg
deleted file mode 100644
index 680b023b6..000000000
--- a/gui/theme/portrait_mdpi/images/curtain.jpg
+++ /dev/null
Binary files differ
diff --git a/gui/theme/portrait_mdpi/images/splashlogo.png b/gui/theme/portrait_mdpi/images/splashlogo.png
new file mode 100755
index 000000000..4b29425e8
--- /dev/null
+++ b/gui/theme/portrait_mdpi/images/splashlogo.png
Binary files differ
diff --git a/gui/theme/portrait_mdpi/images/splashteamwin.png b/gui/theme/portrait_mdpi/images/splashteamwin.png
new file mode 100755
index 000000000..125501fcb
--- /dev/null
+++ b/gui/theme/portrait_mdpi/images/splashteamwin.png
Binary files differ
diff --git a/gui/theme/portrait_mdpi/splash.xml b/gui/theme/portrait_mdpi/splash.xml
new file mode 100755
index 000000000..31f793380
--- /dev/null
+++ b/gui/theme/portrait_mdpi/splash.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0"?>
+<recovery>
+ <details>
+ <resolution width="480" height="800"/>
+ <author>TeamWin</author>
+ <title>TWRP</title>
+ <description>Default basic theme</description>
+ <preview>preview.jpg</preview>
+ <themeversion>1</themeversion>
+ </details>
+
+ <resources>
+ <font name="font_l" filename="RobotoCondensed-Regular.ttf" size="24"/>
+ <image name="splashlogo" filename="splashlogo" retainaspect="1"/>
+ <image name="splashteamwin" filename="splashteamwin" retainaspect="1"/>
+ </resources>
+
+ <variables>
+ <variable name="screen_width" value="480"/>
+ <variable name="screen_height" value="800"/>
+ <variable name="background_color" value="#222222"/>
+ <variable name="header_color" value="#555555"/>
+ <variable name="accent_color" value="#0090CA"/>
+ </variables>
+
+ <pages>
+ <page name="splash">
+ <background color="%background_color%"/>
+
+ <fill color="%header_color%">
+ <placement x="0" y="0" w="%screen_width%" h="200"/>
+ </fill>
+
+ <image>
+ <image resource="splashlogo"/>
+ <placement x="240" y="200" placement="4"/>
+ </image>
+
+ <image>
+ <image resource="splashteamwin"/>
+ <placement x="240" y="660" placement="4"/>
+ </image>
+
+ <text color="%header_color%">
+ <font resource="font_l"/>
+ <placement x="240" y="680" placement="5"/>
+ <text>Recovery Project %tw_version%</text>
+ </text>
+ </page>
+ </pages>
+</recovery>
+
diff --git a/gui/theme/watch_mdpi/images/curtain.jpg b/gui/theme/watch_mdpi/images/curtain.jpg
deleted file mode 100644
index 1d1d49e87..000000000
--- a/gui/theme/watch_mdpi/images/curtain.jpg
+++ /dev/null
Binary files differ
diff --git a/gui/theme/watch_mdpi/images/splashlogo.png b/gui/theme/watch_mdpi/images/splashlogo.png
new file mode 100755
index 000000000..757c74058
--- /dev/null
+++ b/gui/theme/watch_mdpi/images/splashlogo.png
Binary files differ
diff --git a/gui/theme/watch_mdpi/images/splashteamwin.png b/gui/theme/watch_mdpi/images/splashteamwin.png
new file mode 100755
index 000000000..94546f8e6
--- /dev/null
+++ b/gui/theme/watch_mdpi/images/splashteamwin.png
Binary files differ
diff --git a/gui/theme/watch_mdpi/splash.xml b/gui/theme/watch_mdpi/splash.xml
new file mode 100755
index 000000000..81bef4513
--- /dev/null
+++ b/gui/theme/watch_mdpi/splash.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0"?>
+<recovery>
+ <details>
+ <resolution width="320" height="320"/>
+ <author>TeamWin</author>
+ <title>TWRP</title>
+ <description>Default basic theme</description>
+ <preview>preview.jpg</preview>
+ <themeversion>1</themeversion>
+ </details>
+
+ <resources>
+ <font name="font_l" filename="RobotoCondensed-Regular.ttf" size="24"/>
+ <image name="splashlogo" filename="splashlogo" retainaspect="1"/>
+ <image name="splashteamwin" filename="splashteamwin" retainaspect="1"/>
+ </resources>
+
+ <variables>
+ <variable name="screen_width" value="320"/>
+ <variable name="screen_height" value="320"/>
+ <variable name="background_color" value="#222222"/>
+ <variable name="header_color" value="#555555"/>
+ <variable name="accent_color" value="#0090CA"/>
+ </variables>
+
+ <pages>
+ <page name="splash">
+ <background color="%background_color%"/>
+
+ <fill color="%header_color%">
+ <placement x="0" y="0" w="%screen_width%" h="120"/>
+ </fill>
+
+ <image>
+ <image resource="splashlogo"/>
+ <placement x="160" y="120" placement="4"/>
+ </image>
+
+ <image>
+ <image resource="splashteamwin"/>
+ <placement x="160" y="270" placement="4"/>
+ </image>
+
+ <text color="%header_color%">
+ <font resource="font_l"/>
+ <placement x="160" y="290" placement="5"/>
+ <text>Recovery Project %tw_version%</text>
+ </text>
+ </page>
+ </pages>
+</recovery>
+