diff --git a/android/src/com/mapswithme/maps/editor/data/TimeFormatUtils.java b/android/src/com/mapswithme/maps/editor/data/TimeFormatUtils.java index 3ad161f93f..e1da7521d7 100644 --- a/android/src/com/mapswithme/maps/editor/data/TimeFormatUtils.java +++ b/android/src/com/mapswithme/maps/editor/data/TimeFormatUtils.java @@ -9,6 +9,7 @@ import java.util.Locale; import com.mapswithme.maps.MwmApplication; import com.mapswithme.maps.R; +import com.mapswithme.util.Utils; public class TimeFormatUtils { @@ -23,6 +24,10 @@ public class TimeFormatUtils { sCurrentLocale = Locale.getDefault(); sShortWeekdays = DateFormatSymbols.getInstance().getShortWeekdays(); + for (int i = 0; i < sShortWeekdays.length; i++) + { + sShortWeekdays[i] = Utils.capitalize(sShortWeekdays[i]); + } } } @@ -63,9 +68,10 @@ public class TimeFormatUtils public static String formatTimetables(@NonNull Timetable[] timetables) { + final Resources resources = MwmApplication.get().getResources(); + if (timetables[0].isFullWeek()) { - final Resources resources = MwmApplication.get().getResources(); return timetables[0].isFullday ? resources.getString(R.string.twentyfour_seven) : resources.getString(R.string.daily) + " " + timetables[0].workingTimespan; } @@ -73,8 +79,11 @@ public class TimeFormatUtils final StringBuilder builder = new StringBuilder(); for (Timetable tt : timetables) { + String workingTime = tt.isFullday ? resources.getString(R.string.editor_time_allday) + : tt.workingTimespan.toString(); + builder.append(String.format(Locale.getDefault(), "%-21s", formatWeekdays(tt))).append(" ") - .append(tt.workingTimespan) + .append(workingTime) .append("\n"); } diff --git a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java index 4ffe6b85ba..f9a2ec26a1 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java +++ b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java @@ -1309,8 +1309,21 @@ public class PlacePageView extends RelativeLayout if (tt.containsWeekday(currentDay)) { containsCurrentWeekday = true; - refreshTodayOpeningHours(resources.getString(R.string.today) + " " + tt.workingTimespan, + String workingTime; + + if (tt.isFullday) + { + String allDay = resources.getString(R.string.editor_time_allday); + workingTime = Utils.unCapitalize(allDay); + } + else + { + workingTime = tt.workingTimespan.toString(); + } + + refreshTodayOpeningHours(resources.getString(R.string.today) + " " + workingTime, ThemeUtils.getColor(getContext(), android.R.attr.textColorPrimary)); + break; } } diff --git a/android/src/com/mapswithme/util/Utils.java b/android/src/com/mapswithme/util/Utils.java index 8ad2d60fcb..f009c6bdc0 100644 --- a/android/src/com/mapswithme/util/Utils.java +++ b/android/src/com/mapswithme/util/Utils.java @@ -423,4 +423,26 @@ public class Utils .commit(); } } + + public static String capitalize(@Nullable String src) + { + if (TextUtils.isEmpty(src)) + return src; + + if (src.length() == 1) + return Character.toString(Character.toUpperCase(src.charAt(0))); + + return Character.toUpperCase(src.charAt(0)) + src.substring(1); + } + + public static String unCapitalize(@Nullable String src) + { + if (TextUtils.isEmpty(src)) + return src; + + if (src.length() == 1) + return Character.toString(Character.toLowerCase(src.charAt(0))); + + return Character.toLowerCase(src.charAt(0)) + src.substring(1); + } }