From f7d9655213dbc55a451d6d8833446ae9ce32e7bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=8A=B2=E9=B9=8F?= Date: Thu, 12 Jan 2023 11:09:37 +0800 Subject: [PATCH] Android: font style for input --- .../src/main/java/pub/doric/shader/InputNode.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/doric-android/doric/src/main/java/pub/doric/shader/InputNode.java b/doric-android/doric/src/main/java/pub/doric/shader/InputNode.java index ab351670..17016088 100644 --- a/doric-android/doric/src/main/java/pub/doric/shader/InputNode.java +++ b/doric-android/doric/src/main/java/pub/doric/shader/InputNode.java @@ -181,6 +181,21 @@ public class InputNode extends ViewNode implements TextWatcher, View.O case "textAlignment": view.setGravity(prop.asNumber().toInt()); break; + case "fontStyle": + if (prop.isString()) { + if ("bold".equals(prop.asString().value())) { + view.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD)); + } else if ("italic".equals(prop.asString().value())) { + view.setTypeface(Typeface.defaultFromStyle(Typeface.ITALIC)); + } else if ("bold_italic".equals(prop.asString().value())) { + view.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD_ITALIC)); + } else { + view.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL)); + } + } else { + view.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL)); + } + break; case "font": if (!prop.isString()) { return;