Skip to content

Commit

Permalink
feat(android): textAlignment for DatePicker
Browse files Browse the repository at this point in the history
  • Loading branch information
m1ga committed Mar 22, 2024
1 parent e963c72 commit 835ad61
Showing 1 changed file with 10 additions and 0 deletions.
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)) {
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

0 comments on commit 835ad61

Please sign in to comment.