diff options
author | r.kuznetsov <r.kuznetsov@corp.mail.ru> | 2018-04-28 19:00:39 +0300 |
---|---|---|
committer | Arsentiy Milchakov <milcars@mapswithme.com> | 2018-05-07 18:03:39 +0300 |
commit | d0faaca2eaad4463f5e9bd68e9345a7e1e1e998d (patch) | |
tree | bb5b39b7858a89875a024fbff7dd0e1b9257e78b /android/src | |
parent | ee06a502da58304ee07c179048eade7a3a283cde (diff) |
Refactored partners
Diffstat (limited to 'android/src')
-rw-r--r-- | android/src/com/mapswithme/maps/widget/placepage/PlacePageButtons.java | 20 | ||||
-rw-r--r-- | android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java | 3 |
2 files changed, 9 insertions, 14 deletions
diff --git a/android/src/com/mapswithme/maps/widget/placepage/PlacePageButtons.java b/android/src/com/mapswithme/maps/widget/placepage/PlacePageButtons.java index cbfc2c50f6..07ca97be19 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/PlacePageButtons.java +++ b/android/src/com/mapswithme/maps/widget/placepage/PlacePageButtons.java @@ -14,7 +14,9 @@ import android.widget.TextView; import java.util.ArrayList; import java.util.Collections; +import java.util.HashMap; import java.util.List; +import java.util.Map; import com.mapswithme.maps.MwmApplication; import com.mapswithme.maps.R; @@ -94,8 +96,6 @@ final class PlacePageButtons } }, - PARTNER2, - PARTNER3 { @Override @@ -111,10 +111,6 @@ final class PlacePageButtons } }, - PARTNER4, - - PARTNER5, - BACK { @Override @@ -261,9 +257,11 @@ final class PlacePageButtons } } - private static final Item[] PARTNERS_ITEMS = new Item[] { Item.PARTNER1, Item.PARTNER2, - Item.PARTNER3, Item.PARTNER4, - Item.PARTNER5 }; + private static final Map<Integer, Item> PARTNERS_ITEMS = new HashMap<Integer, Item>() + {{ + put(1, Item.PARTNER1); + put(3, Item.PARTNER3); + }}; interface ItemListener { @@ -283,9 +281,9 @@ final class PlacePageButtons @NonNull static Item getPartnerItem(int partnerIndex) { - if (partnerIndex < 0 || partnerIndex >= PARTNERS_ITEMS.length) + if (!PARTNERS_ITEMS.containsKey(partnerIndex)) throw new AssertionError("Wrong partner index: " + partnerIndex); - return PARTNERS_ITEMS[partnerIndex]; + return PARTNERS_ITEMS.get(partnerIndex); } private @NonNull List<Item> collectButtons(List<Item> items) diff --git a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java index 1e234e565a..8ff522f81c 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java +++ b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java @@ -581,10 +581,7 @@ public class PlacePageView extends RelativeLayout case BOOKING: case OPENTABLE: case PARTNER1: - case PARTNER2: case PARTNER3: - case PARTNER4: - case PARTNER5: onSponsoredClick(true /* book */, false); break; |