Skip to content

Commit

Permalink
Reduce themes to 5 and rely on scaling
Browse files Browse the repository at this point in the history
This will significantly reduce theme maintainence and should be a
lot more sustainable over time. Eliminate most themes leaving only
5 remaining in 3 categores:
 * watch_mdpi: 320x320
 * portrait_mdpi: 480x800
 * portrait_hdpi: 1080x1920
 * landscape_mdpi: 800x480
 * landscape_hdpi: 1920x1200

Add handling to map the old DEVICE RESOLUTION to the new TW_THEME
build flag. New devices should specify a theme using the new
TW_THEME build flag using one of the 5 values from the list above.
Long term we will eliminate the use of the DEVICE_RESOLUTION flag
in favor of the new flag.

Change the way sliders render so that they completely follow the
placement="5". This will probably break some custom themes but is
necessary so that we can retain the aspect ratio on slider images
and still have them rendered at the center of the screen.

Add code to the console slideout button so that it can be centered.
Centering the slideout button allows us to keep the button at the
center of the screen when retaining aspect ratios on the image.

Add more retain aspect ratios for home, back, slideout, folder,
file, and lock screen images.

Change the way we build the top bar in TWRP. It is now mostly
drawn using fill objects and the TWRP logo is a separate image so
that we can retain its aspect ratio during scaling. Thanks to Mark
Norelus for providing the TWRP logo.

Change-Id: I801a7b3163cad9ef353461f4c327690a9ccbb3aa
  • Loading branch information
Dees-Troy committed Mar 12, 2015
1 parent 4142408 commit 591b920
Show file tree
Hide file tree
Showing 534 changed files with 225 additions and 6,147 deletions.
96 changes: 55 additions & 41 deletions gui/Android.mk
Expand Up @@ -29,9 +29,9 @@ LOCAL_SRC_FILES := \
scrolllist.cpp

ifneq ($(TWRP_CUSTOM_KEYBOARD),)
LOCAL_SRC_FILES += $(TWRP_CUSTOM_KEYBOARD)
LOCAL_SRC_FILES += $(TWRP_CUSTOM_KEYBOARD)
else
LOCAL_SRC_FILES += hardwarekeyboard.cpp
LOCAL_SRC_FILES += hardwarekeyboard.cpp
endif

LOCAL_SHARED_LIBRARIES += libminuitwrp libc libstdc++ libminzip libaosprecovery
Expand All @@ -43,10 +43,10 @@ LOCAL_CFLAGS += -D_EVENT_LOGGING
endif

ifneq ($(TW_NO_SCREEN_BLANK),)
LOCAL_CFLAGS += -DTW_NO_SCREEN_BLANK
LOCAL_CFLAGS += -DTW_NO_SCREEN_BLANK
endif
ifneq ($(TW_NO_SCREEN_TIMEOUT),)
LOCAL_CFLAGS += -DTW_NO_SCREEN_TIMEOUT
LOCAL_CFLAGS += -DTW_NO_SCREEN_TIMEOUT
endif
ifeq ($(HAVE_SELINUX), true)
LOCAL_CFLAGS += -DHAVE_SELINUX
Expand All @@ -58,31 +58,13 @@ ifeq ($(TW_DISABLE_TTF), true)
LOCAL_CFLAGS += -DTW_DISABLE_TTF
endif
ifneq ($(TW_X_OFFSET),)
LOCAL_CFLAGS += -DTW_X_OFFSET=$(TW_X_OFFSET)
LOCAL_CFLAGS += -DTW_X_OFFSET=$(TW_X_OFFSET)
endif
ifneq ($(TW_Y_OFFSET),)
LOCAL_CFLAGS += -DTW_Y_OFFSET=$(TW_Y_OFFSET)
LOCAL_CFLAGS += -DTW_Y_OFFSET=$(TW_Y_OFFSET)
endif
ifeq ($(TW_ROUND_SCREEN), true)
LOCAL_CFLAGS += -DTW_ROUND_SCREEN
endif

ifeq ($(DEVICE_RESOLUTION),)
$(warning ********************************************************************************)
$(warning * DEVICE_RESOLUTION is NOT SET in BoardConfig.mk )
$(warning * Please see http://tinyw.in/50tg for details. )
$(warning ********************************************************************************)
$(error stopping)
endif

ifeq ($(TW_CUSTOM_THEME),)
ifeq "$(wildcard $(commands_recovery_local_path)/gui/devices/$(DEVICE_RESOLUTION))" ""
$(warning ********************************************************************************)
$(warning * DEVICE_RESOLUTION ($(DEVICE_RESOLUTION)) does NOT EXIST in $(commands_recovery_local_path)/gui/devices )
$(warning * Please choose an existing theme or create a new one for your device. )
$(warning ********************************************************************************)
$(error stopping)
endif
LOCAL_CFLAGS += -DTW_ROUND_SCREEN
endif

LOCAL_C_INCLUDES += bionic external/stlport/stlport $(commands_recovery_local_path)/gui/devices/$(DEVICE_RESOLUTION)
Expand All @@ -100,32 +82,64 @@ TWRP_RES_LOC := $(commands_recovery_local_path)/gui/devices/common/res
TWRP_COMMON_XML := $(hide) echo "No common TWRP XML resources"

ifeq ($(TW_CUSTOM_THEME),)
PORTRAIT := 320x480 480x800 480x854 540x960 720x1280 800x1280 1080x1920 1200x1920 1440x2560 1600x2560
LANDSCAPE := 800x480 1024x600 1024x768 1280x800 1920x1200 2560x1600
WATCH := 240x240 280x280 320x320
TWRP_THEME_LOC := $(commands_recovery_local_path)/gui/devices/$(DEVICE_RESOLUTION)/res
ifneq ($(filter $(DEVICE_RESOLUTION), $(PORTRAIT)),)
TWRP_COMMON_XML := cp -fr $(commands_recovery_local_path)/gui/devices/portrait/res/* $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
else ifneq ($(filter $(DEVICE_RESOLUTION), $(LANDSCAPE)),)
TWRP_COMMON_XML := cp -fr $(commands_recovery_local_path)/gui/devices/landscape/res/* $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
else ifneq ($(filter $(DEVICE_RESOLUTION), $(WATCH)),)
TWRP_COMMON_XML := cp -fr $(commands_recovery_local_path)/gui/devices/watch/res/* $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
endif
ifeq ($(TW_THEME),)
# This converts the old DEVICE_RESOLUTION flag to the new TW_THEME flag
PORTRAIT_MDPI := 320x480 480x800 480x854 540x960
PORTRAIT_HDPI := 720x1280 800x1280 1080x1920 1200x1920 1440x2560 1600x2560
WATCH_MDPI := 240x240 280x280 320x320
LANDSCAPE_MDPI := 800x480 1024x600 1024x768
LANDSCAPE_HDPI := 1280x800 1920x1200 2560x1600
ifneq ($(filter $(DEVICE_RESOLUTION), $(PORTRAIT_MDPI)),)
TW_THEME := portrait_mdpi
else ifneq ($(filter $(DEVICE_RESOLUTION), $(PORTRAIT_HDPI)),)
TW_THEME := portrait_hdpi
else ifneq ($(filter $(DEVICE_RESOLUTION), $(WATCH_MDPI)),)
TW_THEME := watch_mdpi
else ifneq ($(filter $(DEVICE_RESOLUTION), $(LANDSCAPE_MDPI)),)
TW_THEME := landscape_mdpi
else ifneq ($(filter $(DEVICE_RESOLUTION), $(LANDSCAPE_HDPI)),)
TW_THEME := landscape_hdpi
endif
endif
ifeq ($(TW_THEME), portrait_mdpi)
TWRP_THEME_LOC := $(commands_recovery_local_path)/gui/devices/480x800/res
TWRP_COMMON_XML := cp -fr $(commands_recovery_local_path)/gui/devices/portrait/res/* $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
else ifeq ($(TW_THEME), portrait_hdpi)
TWRP_THEME_LOC := $(commands_recovery_local_path)/gui/devices/1080x1920/res
TWRP_COMMON_XML := cp -fr $(commands_recovery_local_path)/gui/devices/portrait/res/* $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
else ifeq ($(TW_THEME), watch_mdpi)
TWRP_THEME_LOC := $(commands_recovery_local_path)/gui/devices/320x320/res
TWRP_COMMON_XML := cp -fr $(commands_recovery_local_path)/gui/devices/watch/res/* $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
else ifeq ($(TW_THEME), landscape_mdpi)
TWRP_THEME_LOC := $(commands_recovery_local_path)/gui/devices/800x480/res
TWRP_COMMON_XML := cp -fr $(commands_recovery_local_path)/gui/devices/landscape/res/* $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
else ifeq ($(TW_THEME), landscape_hdpi)
TWRP_THEME_LOC := $(commands_recovery_local_path)/gui/devices/1920x1200/res
TWRP_COMMON_XML := cp -fr $(commands_recovery_local_path)/gui/devices/landscape/res/* $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
else
$(warning ****************************************************************************)
$(warning * TW_THEME ($(TW_THEME)) is not valid.)
$(warning * Please choose an appropriate TW_THEME or create a new one for your device.)
$(warning * Valid options are portrait_mdpi portrait_hdpi watch_mdpi)
$(warning * landscape_mdpi landscape_hdpi)
$(warning ****************************************************************************)
$(error stopping)
endif
else
TWRP_THEME_LOC := $(TW_CUSTOM_THEME)
TWRP_THEME_LOC := $(TW_CUSTOM_THEME)
endif

ifeq ($(TW_DISABLE_TTF), true)
TWRP_REMOVE_FONT := rm -f $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)fonts/*.ttf
TWRP_REMOVE_FONT := rm -f $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)fonts/*.ttf
else
TWRP_REMOVE_FONT := rm -f $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)fonts/*.dat
TWRP_REMOVE_FONT := rm -f $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)fonts/*.dat
endif

TWRP_RES_GEN := $(intermediates)/twrp
ifneq ($(TW_USE_TOOLBOX), true)
TWRP_SH_TARGET := /sbin/busybox
TWRP_SH_TARGET := /sbin/busybox
else
TWRP_SH_TARGET := /sbin/mksh
TWRP_SH_TARGET := /sbin/mksh
endif

$(TWRP_RES_GEN):
Expand Down
8 changes: 7 additions & 1 deletion gui/console.cpp
Expand Up @@ -130,14 +130,20 @@ GUIConsole::GUIConsole(xml_node<>* node) : GUIScrollList(node)
{
mSlideout = 1;
mSlideoutState = hidden;
LoadPlacement(child, &mSlideoutX, &mSlideoutY);
LoadPlacement(child, &mSlideoutX, &mSlideoutY, &mSlideoutW, &mSlideoutH, &mPlacement);

mSlideoutImage = LoadAttrImage(child, "resource");

if (mSlideoutImage && mSlideoutImage->GetResource())
{
mSlideoutW = mSlideoutImage->GetWidth();
mSlideoutH = mSlideoutImage->GetHeight();
if (mPlacement == CENTER || mPlacement == CENTER_X_ONLY) {
mSlideoutX = mSlideoutX - (mSlideoutW / 2);
if (mPlacement == CENTER) {
mSlideoutY = mSlideoutY - (mSlideoutH / 2);
}
}
}
}
}
Expand Down
Binary file removed gui/devices/1024x600/res/fonts/Roboto-Regular-20.dat
Binary file not shown.
Binary file removed gui/devices/1024x600/res/images/back-icon.png
Binary file not shown.
Binary file removed gui/devices/1024x600/res/images/background.jpg
Binary file not shown.
Binary file removed gui/devices/1024x600/res/images/button.png
Binary file not shown.
Binary file removed gui/devices/1024x600/res/images/checkbox_checked.png
Binary file not shown.
Binary file removed gui/devices/1024x600/res/images/checkbox_empty.png
Binary file not shown.
Binary file removed gui/devices/1024x600/res/images/console-icon.png
Binary file not shown.
Binary file removed gui/devices/1024x600/res/images/console-toggle.png
Binary file not shown.
Binary file removed gui/devices/1024x600/res/images/cursor.png
Binary file not shown.
Binary file removed gui/devices/1024x600/res/images/curtain.jpg
Binary file not shown.
Binary file removed gui/devices/1024x600/res/images/file.png
Binary file not shown.
Binary file removed gui/devices/1024x600/res/images/folder.png
Binary file not shown.
Binary file removed gui/devices/1024x600/res/images/home-icon.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed gui/devices/1024x600/res/images/indeterminate003.png
Binary file not shown.
Binary file removed gui/devices/1024x600/res/images/indeterminate004.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed gui/devices/1024x600/res/images/keyboard1.png
Binary file not shown.
Binary file removed gui/devices/1024x600/res/images/keyboard2.png
Binary file not shown.
Binary file removed gui/devices/1024x600/res/images/keyboard3.png
Binary file not shown.
Binary file removed gui/devices/1024x600/res/images/keyboard4.png
Binary file not shown.
Binary file removed gui/devices/1024x600/res/images/medium-button.png
Binary file not shown.
Binary file removed gui/devices/1024x600/res/images/mediumwide-button.png
Binary file not shown.
Binary file removed gui/devices/1024x600/res/images/minus-button.png
Binary file not shown.
Binary file removed gui/devices/1024x600/res/images/plus-button.png
Diff not rendered.
Binary file removed gui/devices/1024x600/res/images/progress_empty.png
Diff not rendered.
Binary file removed gui/devices/1024x600/res/images/progress_fill.png
Diff not rendered.
Binary file removed gui/devices/1024x600/res/images/radio_empty.png
Diff not rendered.
Binary file removed gui/devices/1024x600/res/images/radio_selected.png
Diff not rendered.
Binary file removed gui/devices/1024x600/res/images/slider-touch.png
Diff not rendered.
Binary file removed gui/devices/1024x600/res/images/slider-used.png
Diff not rendered.
Binary file removed gui/devices/1024x600/res/images/slider.png
Diff not rendered.
Binary file removed gui/devices/1024x600/res/images/sort-button.png
Diff not rendered.
Binary file removed gui/devices/1024x600/res/images/unlock.png
Diff not rendered.

0 comments on commit 591b920

Please sign in to comment.