forked from organicmaps/organicmaps
[android] Fixed offline mode hotels filters
This commit is contained in:
parent
1376bec5f3
commit
c41faf2af3
2 changed files with 24 additions and 4 deletions
|
@ -5,6 +5,8 @@ import android.os.Parcelable;
|
|||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import com.mapswithme.util.ConnectionState;
|
||||
|
||||
public class BookingFilterParams implements Parcelable
|
||||
{
|
||||
protected BookingFilterParams(Parcel in)
|
||||
|
@ -103,7 +105,7 @@ public class BookingFilterParams implements Parcelable
|
|||
@NonNull
|
||||
private final Room[] mRooms;
|
||||
|
||||
BookingFilterParams(long checkinMillisec, long checkoutMillisec, @NonNull Room... rooms)
|
||||
private BookingFilterParams(long checkinMillisec, long checkoutMillisec, @NonNull Room... rooms)
|
||||
{
|
||||
mCheckinMillisec = checkinMillisec;
|
||||
mCheckoutMillisec = checkoutMillisec;
|
||||
|
@ -125,4 +127,15 @@ public class BookingFilterParams implements Parcelable
|
|||
{
|
||||
return mRooms;
|
||||
}
|
||||
|
||||
|
||||
public static class Factory
|
||||
{
|
||||
@Nullable
|
||||
public BookingFilterParams createParams(long checkIn, long checkOut, @NonNull Room... rooms)
|
||||
{
|
||||
return ConnectionState.isConnected() ? new BookingFilterParams(checkIn, checkOut, rooms)
|
||||
: null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -125,6 +125,10 @@ public class FilterFragment extends BaseMwmToolbarFragment
|
|||
}
|
||||
};
|
||||
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@NonNull
|
||||
private BookingFilterParams.Factory mFilterParamsFactory;
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context)
|
||||
{
|
||||
|
@ -135,6 +139,8 @@ public class FilterFragment extends BaseMwmToolbarFragment
|
|||
|
||||
if (context instanceof Listener)
|
||||
mListener = (Listener) context;
|
||||
|
||||
mFilterParamsFactory = new BookingFilterParams.Factory();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -214,9 +220,10 @@ public class FilterFragment extends BaseMwmToolbarFragment
|
|||
return;
|
||||
|
||||
HotelsFilter filter = populateFilter();
|
||||
mListener.onFilterApply(filter, new BookingFilterParams(mCheckinDate.getTimeInMillis(),
|
||||
mCheckoutDate.getTimeInMillis(),
|
||||
BookingFilterParams.Room.DEFAULT));
|
||||
BookingFilterParams params = mFilterParamsFactory.createParams(mCheckinDate.getTimeInMillis(),
|
||||
mCheckoutDate.getTimeInMillis(),
|
||||
BookingFilterParams.Room.DEFAULT);
|
||||
mListener.onFilterApply(filter, params);
|
||||
Statistics.INSTANCE.trackFilterEvent(Statistics.EventName.SEARCH_FILTER_APPLY,
|
||||
Statistics.EventParam.HOTEL);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue