Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(android): textAlignment for DatePicker #14012

Merged
merged 2 commits into from
Jun 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -100,6 +101,15 @@ public TiUIDatePicker(@NonNull PickerProxy proxy)
};
textInputLayout.getEditText().setOnClickListener(clickListener);
textInputLayout.setEndIconOnClickListener(clickListener);

if (proxy.hasPropertyAndNotNull(TiC.PROPERTY_TEXT_ALIGN)) {
m1ga marked this conversation as resolved.
Show resolved Hide resolved
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;
}
}
Expand Down
9 changes: 9 additions & 0 deletions apidoc/Titanium/UI/Picker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,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: |
Expand Down
Loading