[android] Added search simialr hotels button

This commit is contained in:
Александр Зацепин 2018-03-30 14:36:30 +03:00 committed by Arsentiy Milchakov
parent cee4b05644
commit 6116a1085c
3 changed files with 28 additions and 3 deletions

View file

@ -150,6 +150,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
private static final int REQ_CODE_LOCATION_PERMISSION = 1;
private static final int REQ_CODE_DISCOVERY = 2;
private static final int REQ_CODE_SHOW_SIMILAR_HOTELS = 3;
// Map tasks that we run AFTER rendering initialized
private final Stack<MapTask> mTasks = new Stack<>();
@ -942,6 +943,8 @@ public class MwmActivity extends BaseMwmFragmentActivity
Statistics.INSTANCE.trackDiscoveryOpen();
}
private void initOnmapDownloader()
{
mOnmapDownloader = new OnmapDownloader(this);
@ -1077,6 +1080,11 @@ public class MwmActivity extends BaseMwmFragmentActivity
case FilterActivity.REQ_CODE_FILTER:
handleFilterResult(data);
break;
case REQ_CODE_SHOW_SIMILAR_HOTELS:
if (mSearchController != null)
mSearchController.setQuery(getString(R.string.hotel));
handleFilterResult(data);
break;
}
}
@ -1157,6 +1165,11 @@ public class MwmActivity extends BaseMwmFragmentActivity
FilterActivity.REQ_CODE_FILTER);
}
public void onShowSimilarHotels()
{
FilterActivity.startForResult(MwmActivity.this, null, null, REQ_CODE_SHOW_SIMILAR_HOTELS);
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
@NonNull int[] grantResults)

View file

@ -110,9 +110,10 @@ class BottomPlacePageAnimationController extends BasePlacePageAnimationControlle
break;
case MotionEvent.ACTION_UP:
final boolean isInside = UiUtils.isViewTouched(event, mDetailsScroll);
final boolean isBannerTouch = mPlacePage.isBannerTouched(event);
boolean isLeaveReviewButtonTouched = mPlacePage.isLeaveReviewButtonTouched(event);
if (isInside && !isBannerTouch && !isLeaveReviewButtonTouched && mIsGestureStartedInsideView)
if (isInside && !mPlacePage.isBannerTouched(event)
&& !mPlacePage.isLeaveReviewButtonTouched(event)
&& !mPlacePage.isSearchSimilarHotelsButtonTouched(event)
&& mIsGestureStartedInsideView)
mGestureDetector.onTouchEvent(event);
mIsDragging = false;
break;

View file

@ -68,6 +68,7 @@ import com.mapswithme.maps.gallery.impl.Factory;
import com.mapswithme.maps.location.LocationHelper;
import com.mapswithme.maps.review.Review;
import com.mapswithme.maps.routing.RoutingController;
import com.mapswithme.maps.search.FilterActivity;
import com.mapswithme.maps.taxi.TaxiManager;
import com.mapswithme.maps.taxi.TaxiType;
import com.mapswithme.maps.ugc.Impress;
@ -356,6 +357,7 @@ public class PlacePageView extends RelativeLayout
directionFrame.setOnClickListener(this);
mTvAddress = (TextView) mPreview.findViewById(R.id.tv__address);
mPreview.findViewById(R.id.search_hotels_btn).setOnClickListener(this);
mPreviewRatingInfo = mPreview.findViewById(R.id.preview_rating_info);
mRatingView = (RatingView) mPreviewRatingInfo.findViewById(R.id.rating_view);
@ -1369,6 +1371,7 @@ public class PlacePageView extends RelativeLayout
UiUtils.showIf((!isRatingEmpty || !isPriceEmpty) &&
mSponsored.getType() == Sponsored.TYPE_BOOKING, mPreviewRatingInfo);
}
UiUtils.showIf(mapObject.getHotelType() != null, mPreview, R.id.search_hotels_btn);
}
private boolean isSponsored()
@ -1894,6 +1897,9 @@ public class PlacePageView extends RelativeLayout
GalleryType.VIATOR, GalleryPlacement.PLACEPAGE);
}
break;
case R.id.search_hotels_btn:
getActivity().onShowSimilarHotels();
break;
}
}
@ -2120,6 +2126,11 @@ public class PlacePageView extends RelativeLayout
return mUgcController != null && mUgcController.isLeaveReviewButtonTouched(event);
}
public boolean isSearchSimilarHotelsButtonTouched(@NonNull MotionEvent event)
{
return UiUtils.isViewTouched(event, mPreview.findViewById(R.id.search_hotels_btn));
}
@Override
public void onSizeChanged()
{