Skip to content

Commit 234c5c2

Browse files
committed
Profile: Fix year number for english language
1 parent b37652d commit 234c5c2

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

app/src/main/java/com/lithium/leona/openstud/activities/ProfileActivity.java

+7-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
import org.apache.commons.lang3.StringUtils;
2222
import org.threeten.bp.Duration;
23-
import org.threeten.bp.LocalDate;
2423
import org.threeten.bp.LocalDateTime;
2524
import org.threeten.bp.format.DateTimeFormatter;
2625

@@ -150,7 +149,6 @@ private void applyInfos(Student st, Isee isee) {
150149
TextView navSubtitle = headerLayout.findViewById(R.id.nav_subtitle);
151150
navSubtitle.setText(st.getStudentID());
152151
studentId.setText(st.getStudentID());
153-
LocalDate date = st.getBirthDate();
154152
birthDate.setText((st.getBirthDate().format(formatter)));
155153
birthPlace.setText(st.getBirthPlace());
156154
if (isee == null) isee_field.setText(getResources().getString(R.string.isee_not_available));
@@ -162,9 +160,13 @@ private void applyInfos(Student st, Isee isee) {
162160
courseYear.setText(getResources().getString(R.string.year_corse_profile, st.getCourseYear() + "°"));
163161
else {
164162
String year = st.getCourseYear();
165-
if (StringUtils.isNumeric(st.getCourseYear()) && Integer.parseInt(year) <= 3)
166-
year = year + "rd";
167-
else year = year + "th";
163+
if (StringUtils.isNumeric(st.getCourseYear())) {
164+
int number = Integer.parseInt(year);
165+
if (number == 1) year = year + "st";
166+
else if (number == 2) year = year + "nd";
167+
else if (number == 3) year = year + "rd";
168+
else year = year + "th";
169+
}
168170
courseYear.setText(getResources().getString(R.string.year_corse_profile, year));
169171
}
170172
studentStatus.setText(st.getStudentStatus());

0 commit comments

Comments
 (0)