Skip to content

Commit

Permalink
feat(android): textAlignment for DatePicker (#14012)
Browse files Browse the repository at this point in the history
* feat(android): textAlignment for DatePicker

* docs
  • Loading branch information
m1ga authored Jun 15, 2024
1 parent 960d40c commit afb253e
Showing 2 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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;
}
}
9 changes: 9 additions & 0 deletions apidoc/Titanium/UI/Picker.yml
Original file line number Diff line number Diff line change
@@ -409,6 +409,15 @@ properties:
platforms: [android]
since: "5.0.0"

- name: textAlign
summary: |
Horizontal text alignment of the date picker when using <Titanium.UI.PICKER_TYPE_DATE>.
type: [String, Number]
constants: Titanium.UI.TEXT_ALIGNMENT_*
default: <Titanium.UI.TEXT_ALIGNMENT_LEFT>,
platforms: [android]
since: "12.4.0"

- name: datePickerStyle
summary: Determines how a date or time picker should appear.
description: |

0 comments on commit afb253e

Please sign in to comment.