Android: use default theme

This commit is contained in:
Vadim Lopatin 2016-04-21 14:33:31 +03:00
parent 21b3a2591f
commit 15343b3f47
4 changed files with 18 additions and 7 deletions

View File

@ -253,9 +253,9 @@ void* android_app_entry(void* param) {
static android_app* android_app_create(ANativeActivity* activity, static android_app* android_app_create(ANativeActivity* activity,
void* savedState, size_t savedStateSize) { void* savedState, size_t savedStateSize) {
size_t sz = android_app.sizeof; size_t sz = android_app.sizeof;
android_app* android_app = cast(android_app*)malloc(sz); android_app* android_app = cast(android_app*)malloc(sz);
memset(android_app, 0, sz); memset(android_app, 0, sz);
android_app.activity = activity; android_app.activity = activity;
pthread_mutex_init(&android_app.mutex, null); pthread_mutex_init(&android_app.mutex, null);

View File

@ -40,10 +40,12 @@ extern (C) int UIAppMain(string[] args) {
RadioButton { id: rb2; text: "Item 2" } RadioButton { id: rb2; text: "Item 2" }
RadioButton { id: rb3; text: "Item 3" } RadioButton { id: rb3; text: "Item 3" }
} }
TextWidget { text: "Switch:" }
SwitchWidget { checked: true }
TextWidget { text: "and checkboxes" } TextWidget { text: "and checkboxes" }
// arrange some checkboxes horizontally // arrange some checkboxes horizontally
HorizontalLayout { HorizontalLayout {
layoutWidth: fill layoutWidth: fill
CheckBox { id: cb1; text: "checkbox 1" } CheckBox { id: cb1; text: "checkbox 1" }
CheckBox { id: cb2; text: "checkbox 2" } CheckBox { id: cb2; text: "checkbox 2" }
} }

View File

@ -106,6 +106,10 @@ class AndroidPlatform : Platform {
} }
~this() { ~this() {
foreach_reverse(w; _windows) {
destroy(w);
}
_windows.length = 0;
termDisplay(); termDisplay();
} }
@ -268,9 +272,11 @@ class AndroidPlatform : Platform {
break; break;
case APP_CMD_WINDOW_REDRAW_NEEDED: case APP_CMD_WINDOW_REDRAW_NEEDED:
Log.d("APP_CMD_WINDOW_REDRAW_NEEDED"); Log.d("APP_CMD_WINDOW_REDRAW_NEEDED");
drawWindow();
break; break;
case APP_CMD_CONTENT_RECT_CHANGED: case APP_CMD_CONTENT_RECT_CHANGED:
Log.d("APP_CMD_CONTENT_RECT_CHANGED"); Log.d("APP_CMD_CONTENT_RECT_CHANGED");
drawWindow();
break; break;
case APP_CMD_CONFIG_CHANGED: case APP_CMD_CONFIG_CHANGED:
Log.d("APP_CMD_CONFIG_CHANGED"); Log.d("APP_CMD_CONFIG_CHANGED");
@ -524,12 +530,15 @@ extern (C) void android_main(android_app* state) {
} }
initResourceManagers(); initResourceManagers();
SCREEN_DPI = getDensityDpi(state); SCREEN_DPI = getDensityDpi(state);
Log.i("SCREEN_DPI=", SCREEN_DPI);
//currentTheme = createDefaultTheme();
currentTheme = createDefaultTheme();
_platform = new AndroidPlatform(state); _platform = new AndroidPlatform(state);
Platform.setInstance(_platform); Platform.setInstance(_platform);
_platform.uiTheme = "theme_default";
// Make sure glue isn't stripped. // Make sure glue isn't stripped.
app_dummy(); app_dummy();

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<theme id="theme_default" <theme id="theme_default"
fontSize="10pt" fontSize="10pt"
fontFace="Helvetica Neue,Verdana,Arial,DejaVu Sans,Liberation Sans,Helvetica" fontFace="Helvetica Neue,Verdana,Arial,DejaVu Sans,Liberation Sans,Helvetica,Roboto,Droid Sans"
fontFamily="SansSerif" fontFamily="SansSerif"
> >
<color id="window_background" value="#FFFFFF"/> <color id="window_background" value="#FFFFFF"/>
<color id="dialog_background" value="#EEEEEE"/> <color id="dialog_background" value="#EEEEEE"/>
<color id="edit_background" value="#FFFFFF"/> <color id="edit_background" value="#FFFFFF"/>