From 835ad612d083b691ef5ae35e81ddf9343bf48c25 Mon Sep 17 00:00:00 2001 From: Michael Gangolf Date: Fri, 22 Mar 2024 15:34:39 +0100 Subject: [PATCH 1/2] feat(android): textAlignment for DatePicker --- .../titanium/ui/widget/picker/TiUIDatePicker.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/picker/TiUIDatePicker.java b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/picker/TiUIDatePicker.java index ee3fb90a86f..1f0c29e857c 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/picker/TiUIDatePicker.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/picker/TiUIDatePicker.java @@ -7,6 +7,7 @@ package ti.modules.titanium.ui.widget.picker; import android.os.Build; +import android.view.Gravity; import android.view.View; import android.widget.DatePicker; import android.widget.DatePicker.OnDateChangedListener; @@ -100,6 +101,15 @@ public TiUIDatePicker(@NonNull PickerProxy proxy) }; textInputLayout.getEditText().setOnClickListener(clickListener); textInputLayout.setEndIconOnClickListener(clickListener); + + if (proxy.hasPropertyAndNotNull(TiC.PROPERTY_TEXT_ALIGN)) { + String textAlign = TiConvert.toString(proxy.getProperty(TiC.PROPERTY_TEXT_ALIGN)); + if (textAlign.equals("center")) { + textInputLayout.getEditText().setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER); + } else if (textAlign.equals("right")) { + textInputLayout.getEditText().setGravity(Gravity.CENTER_VERTICAL | Gravity.END); + } + } view = textInputLayout; } } From 9ca7a2027602d6b6d6dc85c794098789c049fb09 Mon Sep 17 00:00:00 2001 From: Michael Gangolf Date: Sat, 15 Jun 2024 14:56:40 +0200 Subject: [PATCH 2/2] docs --- apidoc/Titanium/UI/Picker.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/apidoc/Titanium/UI/Picker.yml b/apidoc/Titanium/UI/Picker.yml index f32ace414ae..73af1e9f7e4 100644 --- a/apidoc/Titanium/UI/Picker.yml +++ b/apidoc/Titanium/UI/Picker.yml @@ -394,6 +394,15 @@ properties: platforms: [android] since: "5.0.0" + - name: textAlign + summary: | + Horizontal text alignment of the date picker when using . + type: [String, Number] + constants: Titanium.UI.TEXT_ALIGNMENT_* + default: , + platforms: [android] + since: "12.4.0" + - name: datePickerStyle summary: Determines how a date or time picker should appear. description: |