diff options
author | Dmitry Donskoy <donskdmitry@mail.ru> | 2018-08-07 18:56:23 +0300 |
---|---|---|
committer | Aleksey Belousov <beloal@users.noreply.github.com> | 2018-08-10 20:16:14 +0300 |
commit | 864fa1074a402b4fc6fa45dff3c95dc767d252de (patch) | |
tree | 5460ce01b323366948580cd828c8f8b1bfaa5fdd /android/src | |
parent | 6218ed03cc8eadb915c1920eecceba6dac2bfd3b (diff) |
[android] Add discount view
Diffstat (limited to 'android/src')
-rw-r--r-- | android/src/com/mapswithme/maps/ugc/Impress.java | 3 | ||||
-rw-r--r-- | android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java | 11 |
2 files changed, 11 insertions, 3 deletions
diff --git a/android/src/com/mapswithme/maps/ugc/Impress.java b/android/src/com/mapswithme/maps/ugc/Impress.java index fdf702459b..db6d6c6580 100644 --- a/android/src/com/mapswithme/maps/ugc/Impress.java +++ b/android/src/com/mapswithme/maps/ugc/Impress.java @@ -14,7 +14,8 @@ public enum Impress GOOD(R.drawable.ic_24px_rating_good, R.color.rating_good), EXCELLENT(R.drawable.ic_24px_rating_excellent, R.color.rating_excellent), COMING_SOON(R.drawable.ic_24px_rating_coming_soon, R.color.rating_coming_soon), - POPULAR(R.drawable.ic_thumb_up, R.color.rating_coming_soon); + POPULAR(R.drawable.ic_thumb_up, R.color.rating_coming_soon), + DISCOUNT(R.drawable.ic_thumb_up, R.color.rating_coming_soon); @DrawableRes private final int mDrawableId; diff --git a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java index 6335febc17..6da7cf21fd 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java +++ b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java @@ -152,6 +152,9 @@ public class PlacePageView extends RelativeLayout private View mPreviewRatingInfo; private RatingView mRatingView; private TextView mTvSponsoredPrice; + @SuppressWarnings("NullableProblems") + @NonNull + private RatingView mHotelDiscount; // Details. private NestedScrollView mDetails; private View mPhone; @@ -408,6 +411,7 @@ public class PlacePageView extends RelativeLayout mPreviewRatingInfo = mPreview.findViewById(R.id.preview_rating_info); mRatingView = mPreviewRatingInfo.findViewById(R.id.rating_view); mTvSponsoredPrice = mPreviewRatingInfo.findViewById(R.id.tv__hotel_price); + mHotelDiscount = mPreviewRatingInfo.findViewById(R.id.discount_in_percents); mDetails = findViewById(R.id.pp__details); RelativeLayout address = mDetails.findViewById(R.id.ll__place_name); @@ -1448,8 +1452,11 @@ public class PlacePageView extends RelativeLayout UiUtils.showIf(!isRatingEmpty, mRatingView); mTvSponsoredPrice.setText(mSponsoredPrice); UiUtils.showIf(!isPriceEmpty, mTvSponsoredPrice); - UiUtils.showIf((!isRatingEmpty || !isPriceEmpty) && - mSponsored.getType() == Sponsored.TYPE_BOOKING, mPreviewRatingInfo); + boolean isBookingInfoExist = (!isRatingEmpty || !isPriceEmpty) && + mSponsored.getType() == Sponsored.TYPE_BOOKING; + UiUtils.showIf(isBookingInfoExist, mPreviewRatingInfo); + UiUtils.showIf(true, mHotelDiscount); + mHotelDiscount.setRating(Impress.DISCOUNT, "-20%" ); } UiUtils.showIf(mapObject.getHotelType() != null, mPreview, R.id.search_hotels_btn); } |