gui: Fix Android.mk for TW_CUSTOM_THEME

Change-Id: I7814e3960914ebefdc03cf9cf6f44e193efea932
diff --git a/gui/Android.mk b/gui/Android.mk
index 8361bcb..a1cd043 100644
--- a/gui/Android.mk
+++ b/gui/Android.mk
@@ -90,6 +90,13 @@
 LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
 LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
 
+TWRP_RES := $(commands_recovery_local_path)/gui/theme/common/fonts
+TWRP_RES += $(commands_recovery_local_path)/gui/theme/common/languages
+ifeq ($(TW_EXTRA_LANGUAGES),true)
+    TWRP_RES += $(commands_recovery_local_path)/gui/theme/extra-languages/fonts
+    TWRP_RES += $(commands_recovery_local_path)/gui/theme/extra-languages/languages
+endif
+
 ifeq ($(TW_CUSTOM_THEME),)
     ifeq ($(TW_THEME),)
         ifeq ($(DEVICE_RESOLUTION),)
@@ -114,31 +121,30 @@
         endif
     endif
 
-TWRP_THEME_LOC := $(commands_recovery_local_path)/gui/theme/$(TW_THEME)
-TWRP_RES := $(commands_recovery_local_path)/gui/theme/common/fonts
-TWRP_RES += $(commands_recovery_local_path)/gui/theme/common/languages
-TWRP_RES += $(commands_recovery_local_path)/gui/theme/common/$(word 1,$(subst _, ,$(TW_THEME))).xml
-ifeq ($(TW_EXTRA_LANGUAGES),true)
-    TWRP_RES += $(commands_recovery_local_path)/gui/theme/extra-languages/fonts
-    TWRP_RES += $(commands_recovery_local_path)/gui/theme/extra-languages/languages
+    TWRP_THEME_LOC := $(commands_recovery_local_path)/gui/theme/$(TW_THEME)
+    TWRP_RES += $(commands_recovery_local_path)/gui/theme/common/$(word 1,$(subst _, ,$(TW_THEME))).xml
+    # for future copying of used include xmls and fonts:
+    # UI_XML := $(TWRP_THEME_LOC)/ui.xml
+    # TWRP_INCLUDE_XMLS := $(shell xmllint --xpath '/recovery/include/xmlfile/@name' $(UI_XML)|sed -n 's/[^\"]*\"\([^\"]*\)\"[^\"]*/\1\n/gp'|sort|uniq)
+    # TWRP_FONTS_TTF := $(shell xmllint --xpath '/recovery/resources/font/@filename' $(UI_XML)|sed -n 's/[^\"]*\"\([^\"]*\)\"[^\"]*/\1\n/gp'|sort|uniq)niq)
+else
+    TWRP_THEME_LOC := $(TW_CUSTOM_THEME)
 endif
-# for future copying of used include xmls and fonts:
-# UI_XML := $(TWRP_THEME_LOC)/ui.xml
-# TWRP_INCLUDE_XMLS := $(shell xmllint --xpath '/recovery/include/xmlfile/@name' $(UI_XML)|sed -n 's/[^\"]*\"\([^\"]*\)\"[^\"]*/\1\n/gp'|sort|uniq)
-# TWRP_FONTS_TTF := $(shell xmllint --xpath '/recovery/resources/font/@filename' $(UI_XML)|sed -n 's/[^\"]*\"\([^\"]*\)\"[^\"]*/\1\n/gp'|sort|uniq)niq)
+TWRP_RES += $(TW_ADDITIONAL_RES)
+
 ifeq ($(wildcard $(TWRP_THEME_LOC)/ui.xml),)
     $(warning ****************************************************************************)
-    $(warning * TW_THEME is not valid: '$(TW_THEME)')
+    ifeq ($(TW_CUSTOM_THEME),)
+        $(warning * TW_THEME is not valid: '$(TW_THEME)')
+    else
+        $(warning * TW_CUSTOM_THEME is not valid: '$(TW_CUSTOM_THEME)')
+    endif
     $(warning * Please choose an appropriate TW_THEME or create a new one for your device.)
     $(warning * Available themes:)
     $(warning * $(notdir $(wildcard $(commands_recovery_local_path)/gui/theme/*_*)))
     $(warning ****************************************************************************)
     $(error stopping)
 endif
-else
-    TWRP_THEME_LOC := $(TW_CUSTOM_THEME)
-endif
-TWRP_RES += $(TW_ADDITIONAL_RES)
 
 TWRP_RES_GEN := $(intermediates)/twrp
 $(TWRP_RES_GEN):