[Android] Opening hours UI rework #1599

Merged
root merged 4 commits from issue-970-place-opening-hours-rework into master 2021-11-23 22:45:46 +00:00
7 changed files with 373 additions and 43 deletions

View file

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/ll__place_schedule"
style="@style/PlacePageItemFrame"
@ -16,27 +17,49 @@
android:tint="?iconTint"/>
<TextView
android:id="@+id/today_opening_hours"
android:layout_width="match_parent"
android:id="@+id/oh_today_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:layout_marginBottom="0dp"
android:layout_toEndOf="@id/icon"
android:textAppearance="@style/MwmTextAppearance.PlacePage"
tools:text="@string/day_off_today"
tools:textColor="@color/base_red"
tools:text="@string/today"
android:text="@string/today"
tools:visibility="visible"/>
<TextView
android:id="@+id/opening_hours"
android:layout_width="match_parent"
android:id="@+id/oh_today_open_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/today_opening_hours"
android:layout_marginTop="@dimen/margin_base"
android:layout_toEndOf="@id/icon"
android:gravity="top|start"
android:lineSpacingExtra="@dimen/margin_base"
android:textAppearance="@style/MwmTextAppearance.Body3"
android:visibility="gone"
tools:text="Mo-Fr 16:00-18.00"/>
android:layout_marginTop="6dp"
android:layout_toEndOf="@id/oh_today_label"
android:layout_alignParentEnd="true"
android:textAppearance="@style/MwmTextAppearance.PlacePage"
tools:text="@string/twentyfour_seven"
android:text="@string/twentyfour_seven"
android:textAlignment="viewEnd"
tools:visibility="visible"/>
<TextView
android:id="@+id/oh_nonbusiness_time"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignStart="@id/oh_today_label"
android:layout_below="@id/oh_today_label"
android:textAppearance="@style/MwmTextAppearance.Body4"
android:textAlignment="viewEnd"
android:visibility="gone"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rw__full_opening_hours"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignStart="@id/oh_nonbusiness_time"
android:layout_below="@id/oh_nonbusiness_time"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:layout_marginTop="8dp"/>
</RelativeLayout>

View file

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/ll__place_opening_hours_item"
style="@style/PlacePageOpeningHoursItem"
android:visibility="visible">
<TextView
android:id="@+id/tv__opening_hours_weekdays"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_alignParentStart="true"
android:textAppearance="@style/MwmTextAppearance.Body3"
tools:text="Mo-Fr"/>
<TextView
android:id="@+id/tv__opening_hours_time"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_alignParentEnd="true"
android:layout_toEndOf="@id/tv__opening_hours_weekdays"
android:textAppearance="@style/MwmTextAppearance.Body3"
android:textAlignment="viewEnd"
tools:text="08:00 - 19:00"/>
<TextView
android:id="@+id/tv__opening_hours_nonbusiness_time"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_alignParentEnd="true"
android:layout_below="@id/tv__opening_hours_weekdays"
android:textAppearance="@style/MwmTextAppearance.Body4"
android:textAlignment="viewEnd"
android:visibility="gone"/>
</RelativeLayout>

View file

@ -82,4 +82,18 @@
<item name="android:tint">?iconTint</item>
<item name="android:layout_marginEnd">@dimen/margin_base</item>
</style>
<style name="PlacePageOpeningHoursItem">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:minHeight">24dp</item>
<item name="android:adjustViewBounds">true</item>
<item name="android:gravity">center_vertical</item>
<item name="android:clickable">false</item>
<item name="android:paddingStart">0dp</item>
<item name="android:paddingEnd">0dp</item>
<item name="android:paddingTop">@dimen/margin_half</item>
<item name="android:paddingBottom">@dimen/margin_half</item>
<item name="android:orientation">horizontal</item>
</style>
</resources>

View file

@ -42,7 +42,11 @@ public class TimeFormatUtils
public static String formatWeekdays(@NonNull Timetable timetable)
{
refreshWithCurrentLocale();
final int[] weekdays = timetable.weekdays;
return formatWeekdays(timetable.weekdays);
}
public static String formatWeekdays(@NonNull int[] weekdays)
{
if (weekdays.length == 0)
return "";
@ -91,4 +95,55 @@ public class TimeFormatUtils
return builder.toString();
}
public static String formatNonBusinessTime(Timespan[] closedTimespans, String hoursClosedLabel)
{
StringBuilder closedTextBuilder = new StringBuilder();
boolean firstLine = true;
for (Timespan cts: closedTimespans) {
if (!firstLine)
closedTextBuilder.append('\n');
closedTextBuilder.append(hoursClosedLabel).append(' ').append(cts.toWideString());
firstLine = false;
}
return closedTextBuilder.toString();
}
public static String generateCopyText(Resources resources, String ohStr, Timetable[] timetables)
{
if (timetables == null || timetables.length == 0)
return ohStr;
// Generate string "24/7" or "Daily HH:MM - HH:MM".
if (timetables[0].isFullWeek())
{
Timetable tt = timetables[0];
if (tt.isFullday)
return resources.getString(R.string.twentyfour_seven);
return resources.getString(R.string.daily) + " " + tt.workingTimespan.toWideString();
}
// Generate full week multiline string. E.g.
// "Mon-Fri HH:MM - HH:MM
// Sat HH:MM - HH:MM"
StringBuilder weekSchedule = new StringBuilder();
boolean firstRow = true;
for (Timetable tt : timetables)
{
if (!firstRow)
weekSchedule.append('\n');
final String weekdays = formatWeekdays(tt);
final String openTime = tt.isFullday ?
Utils.unCapitalize(resources.getString(R.string.editor_time_allday)) :
tt.workingTimespan.toWideString();
weekSchedule.append(weekdays).append(' ').append(openTime);
firstRow = false;
}
return weekSchedule.toString();
}
}

View file

@ -16,4 +16,9 @@ public class Timespan
{
return start + "-" + end;
}
public String toWideString()
{
return start + "\u2014" + end;
}
}

View file

@ -0,0 +1,148 @@
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
package com.mapswithme.maps.widget.placepage;
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
import android.view.LayoutInflater;
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
import android.view.View;
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
import android.view.ViewGroup;
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
import android.widget.TextView;
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
import androidx.annotation.NonNull;
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
import androidx.recyclerview.widget.RecyclerView;
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
import com.mapswithme.maps.R;
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
import static com.mapswithme.maps.editor.data.TimeFormatUtils.formatWeekdays;
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
import static com.mapswithme.maps.editor.data.TimeFormatUtils.formatNonBusinessTime;
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
import com.mapswithme.maps.editor.data.Timespan;
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
import com.mapswithme.maps.editor.data.Timetable;
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
import com.mapswithme.util.UiUtils;
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
import java.util.ArrayList;
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
import java.util.Arrays;
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
import java.util.List;
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
public class PlaceOpeningHoursAdapter extends RecyclerView.Adapter<PlaceOpeningHoursAdapter.ViewHolder>
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
{
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
private Timetable[] mTimetables = {};
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
private int[] closedDays = null;
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
public PlaceOpeningHoursAdapter() {}
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
public PlaceOpeningHoursAdapter(Timetable[] timetables)
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
{
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
setTimetables(timetables);
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
}
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
biodranik commented 2021-11-23 15:18:09 +00:00 (Migrated from github.com)
Review

Space here and below.

Space here and below.
biodranik commented 2021-11-23 15:19:02 +00:00 (Migrated from github.com)
Review
    for (int i = 0; i < days.length; i++)
```suggestion for (int i = 0; i < days.length; i++) ```
public void setTimetables(Timetable[] timetables)
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
{
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
mTimetables = timetables;
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
closedDays = findUnhandledDays(timetables);
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
notifyDataSetChanged();
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
}
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
private int[] findUnhandledDays(Timetable[] timetables)
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
{
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
List<Integer> unhandledDays = new ArrayList<>(Arrays.asList(1, 2, 3, 4, 5, 6, 7));
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
for (Timetable tt : timetables) {
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
for (int weekDay : tt.weekdays) {
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
unhandledDays.remove(Integer.valueOf(weekDay));
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
}
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
}
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
if (unhandledDays.isEmpty())
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
return null;
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
// Convert List<Integer> to int[].
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
int[] days = new int[unhandledDays.size()];
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
for (int i = 0; i < days.length; i++)
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
days[i] = unhandledDays.get(i);
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
return days;
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
}
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
@NonNull
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
@Override
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType)
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
{
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
return new ViewHolder(LayoutInflater.from(parent.getContext())
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
.inflate(R.layout.place_page_opening_hours_item, parent, false));
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
}
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
@Override
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
public void onBindViewHolder(@NonNull ViewHolder holder, int position)
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
{
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
if (mTimetables == null || position > mTimetables.length || position < 0)
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
return;
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
if (position == mTimetables.length)
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
{
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
if (closedDays == null)
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
return;
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
holder.setWeekdays(formatWeekdays(closedDays));
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
holder.setOpenTime(holder.itemView.getResources().getString(R.string.day_off));
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
holder.hideNonBusinessTime();
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
return;
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
}
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
final Timetable tt = mTimetables[position];
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
final String weekdays = formatWeekdays(tt);
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
String workingTime = tt.isFullday ? holder.itemView.getResources().getString(R.string.editor_time_allday)
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
: tt.workingTimespan.toWideString();
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
holder.setWeekdays(weekdays);
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
holder.setOpenTime(workingTime);
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
final Timespan[] closedTime = tt.closedTimespans;
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
if (closedTime == null || closedTime.length == 0)
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
{
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
holder.hideNonBusinessTime();
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
}
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
else
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
{
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
final String hoursNonBusinessLabel = holder.itemView.getResources().getString(R.string.editor_hours_closed);
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
holder.setNonBusinessTime(formatNonBusinessTime(closedTime, hoursNonBusinessLabel));
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
}
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
}
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
@Override
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
public int getItemCount()
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
{
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
return (mTimetables != null ? mTimetables.length : 0) + (closedDays == null ? 0 : 1);
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
}
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
public static class ViewHolder extends RecyclerView.ViewHolder
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
{
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
private final TextView mWeekdays;
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
private final TextView mOpenTime;
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
private final TextView mNonBusinessTime;
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
public ViewHolder(@NonNull View itemView)
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
{
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
super(itemView);
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
mWeekdays = itemView.findViewById(R.id.tv__opening_hours_weekdays);
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
mOpenTime = itemView.findViewById(R.id.tv__opening_hours_time);
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
mNonBusinessTime = itemView.findViewById(R.id.tv__opening_hours_nonbusiness_time);
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
itemView.setVisibility(View.VISIBLE);
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
}
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
public void setWeekdays(String weekdays)
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
{
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
mWeekdays.setText(weekdays);
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
}
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
public void setOpenTime(String openTime)
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
{
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
mOpenTime.setText(openTime);
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
}
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
public void setNonBusinessTime(String nonBusinessTime)
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
{
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
UiUtils.setTextAndShow(mNonBusinessTime, nonBusinessTime);
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
}
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
public void hideNonBusinessTime()
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
{
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
UiUtils.clearTextAndHide(mNonBusinessTime);
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
}
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
}
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`
}
biodranik commented 2021-11-23 00:41:34 +00:00 (Migrated from github.com)
Review

{

{
biodranik commented 2021-11-23 00:42:24 +00:00 (Migrated from github.com)
Review

== 0

` == 0`
biodranik commented 2021-11-23 00:42:51 +00:00 (Migrated from github.com)
Review

!= null

` != null`

View file

@ -50,6 +50,7 @@ import com.mapswithme.maps.downloader.MapManager;
import com.mapswithme.maps.editor.Editor;
import com.mapswithme.maps.editor.OpeningHours;
import com.mapswithme.maps.editor.data.TimeFormatUtils;
import com.mapswithme.maps.editor.data.Timespan;
import com.mapswithme.maps.editor.data.Timetable;
import com.mapswithme.maps.location.LocationHelper;
import com.mapswithme.maps.routing.RoutingController;
@ -121,8 +122,11 @@ public class PlacePageView extends NestedScrollViewClickFixed
private TextView mTvLinePage;
private View mOpeningHours;
private TextView mFullOpeningHours;
private TextView mTodayOpeningHours;
private TextView mTodayLabel;
private TextView mTodayOpenTime;
private TextView mTodayNonBusinessTime;
private RecyclerView mFullWeekOpeningHours;
private PlaceOpeningHoursAdapter mOpeningHoursAdapter;
private View mWifi;
private View mEmail;
private TextView mTvEmail;
@ -346,8 +350,12 @@ public class PlacePageView extends NestedScrollViewClickFixed
latlon.setOnClickListener(this);
mTvLatlon = findViewById(R.id.tv__place_latlon);
mOpeningHours = findViewById(R.id.ll__place_schedule);
mFullOpeningHours = findViewById(R.id.opening_hours);
mTodayOpeningHours = findViewById(R.id.today_opening_hours);
mTodayLabel = findViewById(R.id.oh_today_label);
mTodayOpenTime = findViewById(R.id.oh_today_open_time);
mTodayNonBusinessTime = findViewById(R.id.oh_nonbusiness_time);
mFullWeekOpeningHours = findViewById(R.id.rw__full_opening_hours);
mOpeningHoursAdapter = new PlaceOpeningHoursAdapter();
mFullWeekOpeningHours.setAdapter(mOpeningHoursAdapter);
mWifi = findViewById(R.id.ll__place_wifi);
mEmail = findViewById(R.id.ll__place_email);
mEmail.setOnClickListener(this);
@ -893,35 +901,51 @@ public class PlacePageView extends NestedScrollViewClickFixed
final boolean isEmptyTT = (timetables == null || timetables.length == 0);
final int color = ThemeUtils.getColor(getContext(), android.R.attr.textColorPrimary);
String ohStringToShow = null;
if (isEmptyTT)
{
// 'opening_hours' tag wasn't parsed either because it's empty or wrong format.
if (!ohStr.isEmpty())
ohStringToShow = ohStr;
{
UiUtils.show(mOpeningHours);
refreshTodayOpeningHours(ohStr, color);
UiUtils.hide(mTodayNonBusinessTime);
UiUtils.hide(mFullWeekOpeningHours);
}
else
{
UiUtils.hide(mOpeningHours);
return;
}
return;
}
UiUtils.show(mOpeningHours);
final Resources resources = getResources();
if (!isEmptyTT && timetables[0].isFullWeek())
{
ohStringToShow = timetables[0].isFullday ? resources.getString(R.string.twentyfour_seven)
: resources.getString(R.string.daily) + " " + timetables[0].workingTimespan;
}
if (ohStringToShow != null)
if (timetables[0].isFullWeek())
{
refreshTodayOpeningHours(ohStringToShow, color);
UiUtils.clearTextAndHide(mFullOpeningHours);
final Timetable tt = timetables[0];
if (tt.isFullday)
{
refreshTodayOpeningHours(resources.getString(R.string.twentyfour_seven), color);
UiUtils.clearTextAndHide(mTodayNonBusinessTime);
UiUtils.hide(mTodayNonBusinessTime);
}
else
{
refreshTodayOpeningHours(resources.getString(R.string.daily), tt.workingTimespan.toWideString(), color);
refreshTodayNonBusinessTime(tt.closedTimespans);
}
UiUtils.hide(mFullWeekOpeningHours);
return;
}
// Show whole week time table.
mOpeningHoursAdapter.setTimetables(timetables);
UiUtils.show(mFullWeekOpeningHours);
// Show today's open time + non-business time.
boolean containsCurrentWeekday = false;
final int currentDay = Calendar.getInstance().get(Calendar.DAY_OF_WEEK);
for (Timetable tt : timetables)
@ -929,26 +953,40 @@ public class PlacePageView extends NestedScrollViewClickFixed
if (tt.containsWeekday(currentDay))
{
containsCurrentWeekday = true;
String workingTime;
String openTime;
if (tt.isFullday)
{
String allDay = resources.getString(R.string.editor_time_allday);
workingTime = Utils.unCapitalize(allDay);
openTime = Utils.unCapitalize(allDay);
}
else
{
workingTime = tt.workingTimespan.toString();
openTime = tt.workingTimespan.toWideString();
}
refreshTodayOpeningHours(resources.getString(R.string.today) + " " + workingTime, color);
refreshTodayOpeningHours(resources.getString(R.string.today), openTime, color);
refreshTodayNonBusinessTime(tt.closedTimespans);
break;
}
}
UiUtils.setTextAndShow(mFullOpeningHours, TimeFormatUtils.formatTimetables(getContext(), timetables));
// Show that place is closed today.
if (!containsCurrentWeekday)
{
refreshTodayOpeningHours(resources.getString(R.string.day_off_today), resources.getColor(R.color.base_red));
UiUtils.hide(mTodayNonBusinessTime);
}
}
private void refreshTodayNonBusinessTime(Timespan[] closedTimespans)
{
final String hoursClosedLabel = getResources().getString(R.string.editor_hours_closed);
if (closedTimespans==null || closedTimespans.length == 0)
UiUtils.clearTextAndHide(mTodayNonBusinessTime);
else
UiUtils.setTextAndShow(mTodayNonBusinessTime, TimeFormatUtils.formatNonBusinessTime(closedTimespans, hoursClosedLabel));
}
private void refreshSocialLinks(@NonNull MapObject mapObject)
@ -999,10 +1037,22 @@ public class PlacePageView extends NestedScrollViewClickFixed
}
}
private void refreshTodayOpeningHours(String text, @ColorInt int color)
private void refreshTodayOpeningHours(String label, String openTime, @ColorInt int color)
{
UiUtils.setTextAndShow(mTodayOpeningHours, text);
mTodayOpeningHours.setTextColor(color);
UiUtils.setTextAndShow(mTodayLabel, label);
UiUtils.setTextAndShow(mTodayOpenTime, openTime);
mTodayLabel.setTextColor(color);
mTodayOpenTime.setTextColor(color);
}
private void refreshTodayOpeningHours(String label, @ColorInt int color)
{
UiUtils.setTextAndShow(mTodayLabel, label);
UiUtils.hide(mTodayOpenTime);
mTodayLabel.setTextColor(color);
mTodayOpenTime.setTextColor(color);
}
private void refreshPhoneNumberList(String phones)
@ -1386,10 +1436,9 @@ public class PlacePageView extends NestedScrollViewClickFixed
items.add(mTvEmail.getText().toString());
break;
case R.id.ll__place_schedule:
String text = UiUtils.isVisible(mFullOpeningHours)
? mFullOpeningHours.getText().toString()
: mTodayOpeningHours.getText().toString();
items.add(text);
final String ohStr = mMapObject.getMetadata(Metadata.MetadataType.FMD_OPEN_HOURS);
final Timetable[] timetables = OpeningHours.nativeTimetablesFromString(ohStr);
items.add(TimeFormatUtils.generateCopyText(getResources(), ohStr, timetables));
break;
case R.id.ll__place_operator:
items.add(mTvOperator.getText().toString());