diff options
author | Arsentiy Milchakov <milcars@mapswithme.com> | 2016-11-16 17:41:02 +0300 |
---|---|---|
committer | Roman Romanov <rromanov@65gb.net> | 2016-11-23 11:27:39 +0300 |
commit | 08bd233dc434ea036de420a0cfebc1ce4ba48254 (patch) | |
tree | eb42143beee430b75d5b2b64fcb5a6c4ee39f6af | |
parent | f539abfc6da243933cfbb0d70969c27622cd6440 (diff) |
[android] Place Page banners.
54 files changed, 815 insertions, 29 deletions
diff --git a/3party/Alohalytics b/3party/Alohalytics -Subproject a3e1659ba90ed079b3021ea2fa45a628a832b8e +Subproject 28f74496e58213dd0bc7d793fd17ba0e7f3d89b diff --git a/android/jni/com/mapswithme/core/jni_helper.cpp b/android/jni/com/mapswithme/core/jni_helper.cpp index 52998f840f..5a34088e1e 100644 --- a/android/jni/com/mapswithme/core/jni_helper.cpp +++ b/android/jni/com/mapswithme/core/jni_helper.cpp @@ -21,6 +21,7 @@ jclass g_httpClientClazz; jclass g_httpParamsClazz; jclass g_platformSocketClazz; jclass g_utilsClazz; +jclass g_bannerClazz; extern "C" { @@ -39,6 +40,7 @@ JNI_OnLoad(JavaVM * jvm, void *) g_httpParamsClazz = jni::GetGlobalClassRef(env, "com/mapswithme/util/HttpClient$Params"); g_platformSocketClazz = jni::GetGlobalClassRef(env, "com/mapswithme/maps/location/PlatformSocket"); g_utilsClazz = jni::GetGlobalClassRef(env, "com/mapswithme/util/Utils"); + g_bannerClazz = jni::GetGlobalClassRef(env, "com/mapswithme/maps/bookmarks/data/Banner"); return JNI_VERSION_1_6; } @@ -55,6 +57,7 @@ JNI_OnUnload(JavaVM *, void *) env->DeleteGlobalRef(g_httpParamsClazz); env->DeleteGlobalRef(g_platformSocketClazz); env->DeleteGlobalRef(g_utilsClazz); + env->DeleteGlobalRef(g_bannerClazz); } } // extern "C" diff --git a/android/jni/com/mapswithme/core/jni_helper.hpp b/android/jni/com/mapswithme/core/jni_helper.hpp index 53c4d7875c..605eba9d9f 100644 --- a/android/jni/com/mapswithme/core/jni_helper.hpp +++ b/android/jni/com/mapswithme/core/jni_helper.hpp @@ -16,6 +16,7 @@ extern jclass g_httpClientClazz; extern jclass g_httpParamsClazz; extern jclass g_platformSocketClazz; extern jclass g_utilsClazz; +extern jclass g_bannerClazz; namespace jni { diff --git a/android/jni/com/mapswithme/maps/UserMarkHelper.cpp b/android/jni/com/mapswithme/maps/UserMarkHelper.cpp index 959fd6bbd7..dcadb11597 100644 --- a/android/jni/com/mapswithme/maps/UserMarkHelper.cpp +++ b/android/jni/com/mapswithme/maps/UserMarkHelper.cpp @@ -22,12 +22,36 @@ void InjectMetadata(JNIEnv * env, jclass const clazz, jobject const mapObject, f } } -jobject CreateMapObject(JNIEnv * env, int mapObjectType, string const & title, string const & subtitle, - double lat, double lon, string const & address, Metadata const & metadata, string const & apiId) +jobject CreateBanner(JNIEnv * env, bool hasBanner, string const & bannerTitleId, + string const & bannerMessageId, string const & bannerIconId, + string const & bannerUrl) { - // public MapObject(@MapObjectType int mapObjectType, String title, String subtitle, double lat, double lon, String address, String apiId) + static jmethodID const bannerCtorId = jni::GetConstructorID( + env, g_bannerClazz, + "(ZLjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V"); + + return env->NewObject(g_bannerClazz, bannerCtorId, hasBanner, + jni::ToJavaString(env, bannerTitleId), + jni::ToJavaString(env, bannerMessageId), + jni::ToJavaString(env, bannerIconId), jni::ToJavaString(env, bannerUrl)); +} + +jobject CreateMapObject(JNIEnv * env, int mapObjectType, string const & title, + string const & subtitle, double lat, double lon, string const & address, + Metadata const & metadata, string const & apiId, + bool hasBanner, string const & bannerTitleId, + string const & bannerMessageId, string const & bannerIconId, + string const & bannerUrl) +{ + // public MapObject(@MapObjectType int mapObjectType, String title, String subtitle, double lat, + // double lon, String address, String apiId, @NonNull Banner banner) static jmethodID const ctorId = - jni::GetConstructorID(env, g_mapObjectClazz, "(ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;DDLjava/lang/String;)V"); + jni::GetConstructorID(env, g_mapObjectClazz, + "(ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;DDLjava/lang/" + "String;Lcom/mapswithme/maps/bookmarks/data/Banner;)V"); + + jobject jbanner = + CreateBanner(env, hasBanner, bannerTitleId, bannerMessageId, bannerIconId, bannerUrl); jobject mapObject = env->NewObject(g_mapObjectClazz, ctorId, mapObjectType, @@ -35,7 +59,8 @@ jobject CreateMapObject(JNIEnv * env, int mapObjectType, string const & title, s jni::ToJavaString(env, subtitle), jni::ToJavaString(env, address), lat, lon, - jni::ToJavaString(env, apiId)); + jni::ToJavaString(env, apiId), + jbanner); InjectMetadata(env, g_mapObjectClazz, mapObject, metadata); return mapObject; @@ -46,7 +71,12 @@ jobject CreateMapObject(JNIEnv * env, place_page::Info const & info) if (info.IsBookmark()) { // public Bookmark(@IntRange(from = 0) int categoryId, @IntRange(from = 0) int bookmarkId, String name) - static jmethodID const ctorId = jni::GetConstructorID(env, g_bookmarkClazz, "(IILjava/lang/String;)V"); + static jmethodID const ctorId = jni::GetConstructorID( + env, g_bookmarkClazz, "(IILjava/lang/String;Lcom/mapswithme/maps/bookmarks/data/Banner;)V"); + + jobject jbanner = + CreateBanner(env, info.HasBanner(), info.GetBannerTitleId(), info.GetBannerMessageId(), + info.GetBannerIconId(), info.GetBannerUrl()); auto const & bac = info.GetBookmarkAndCategory(); BookmarkCategory * cat = g_framework->NativeFramework()->GetBmCategory(bac.m_categoryIndex); @@ -56,7 +86,7 @@ jobject CreateMapObject(JNIEnv * env, place_page::Info const & info) jobject mapObject = env->NewObject(g_bookmarkClazz, ctorId, static_cast<jint>(info.m_bac.m_categoryIndex), static_cast<jint>(info.m_bac.m_bookmarkIndex), - jName.get()); + jName.get(), jbanner); if (info.IsFeature()) InjectMetadata(env, g_mapObjectClazz, mapObject, info.GetMetadata()); return mapObject; @@ -68,12 +98,21 @@ jobject CreateMapObject(JNIEnv * env, place_page::Info const & info) // TODO(yunikkk): object can be POI + API + search result + bookmark simultaneously. // TODO(yunikkk): Should we pass localized strings here and in other methods as byte arrays? if (info.IsMyPosition()) - return CreateMapObject(env, kMyPosition, info.GetTitle(), info.GetSubtitle(), ll.lat, ll.lon, address.FormatAddress(), {}, ""); + return CreateMapObject(env, kMyPosition, info.GetTitle(), info.GetSubtitle(), ll.lat, ll.lon, + address.FormatAddress(), {}, "", info.HasBanner(), + info.GetBannerTitleId(), info.GetBannerMessageId(), + info.GetBannerIconId(), info.GetBannerUrl()); if (info.HasApiUrl()) - return CreateMapObject(env, kApiPoint, info.GetTitle(), info.GetSubtitle(), ll.lat, ll.lon, address.FormatAddress(), info.GetMetadata(), info.GetApiUrl()); + return CreateMapObject(env, kApiPoint, info.GetTitle(), info.GetSubtitle(), ll.lat, ll.lon, + address.FormatAddress(), info.GetMetadata(), info.GetApiUrl(), + info.HasBanner(), info.GetBannerTitleId(), info.GetBannerMessageId(), + info.GetBannerIconId(), info.GetBannerUrl()); - return CreateMapObject(env, kPoi, info.GetTitle(), info.GetSubtitle(), ll.lat, ll.lon, address.FormatAddress(), - info.IsFeature() ? info.GetMetadata() : Metadata(), ""); + return CreateMapObject(env, kPoi, info.GetTitle(), info.GetSubtitle(), ll.lat, ll.lon, + address.FormatAddress(), + info.IsFeature() ? info.GetMetadata() : Metadata(), "", info.HasBanner(), + info.GetBannerTitleId(), info.GetBannerMessageId(), info.GetBannerIconId(), + info.GetBannerUrl()); } } // namespace usermark_helper diff --git a/android/res/layout-land/place_page_details.xml b/android/res/layout-land/place_page_details.xml index 515eac12f6..fe20cf04ab 100644 --- a/android/res/layout-land/place_page_details.xml +++ b/android/res/layout-land/place_page_details.xml @@ -18,6 +18,14 @@ android:orientation="vertical"> <include + android:id="@+id/banner" + layout="@layout/place_page_banner" + android:layout_width="match_parent" + android:layout_height="@dimen/placepage_banner_height" + android:visibility="gone" + tools:visibility="visible"/> + + <include layout="@layout/divider_horizontal"/> <include diff --git a/android/res/layout-land/place_page_preview.xml b/android/res/layout-land/place_page_preview.xml new file mode 100644 index 0000000000..3fa1f7aeef --- /dev/null +++ b/android/res/layout-land/place_page_preview.xml @@ -0,0 +1,152 @@ +<?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:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="center_vertical" + android:orientation="horizontal" + android:padding="@dimen/margin_base"> + + <include + android:id="@+id/downloader_status_frame" + layout="@layout/downloader_status" + android:layout_width="@dimen/downloader_status_size" + android:layout_height="@dimen/downloader_status_size" + android:layout_marginEnd="@dimen/margin_base" + android:layout_marginRight="@dimen/margin_base" + android:layout_marginTop="@dimen/margin_half" + android:visibility="gone" + tools:visibility="visible"/> + + <TextView + android:id="@+id/tv__title" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_alignWithParentIfMissing="true" + android:layout_marginTop="@dimen/margin_quarter" + android:layout_toEndOf="@id/downloader_status_frame" + android:layout_toRightOf="@id/downloader_status_frame" + android:ellipsize="end" + android:fontFamily="@string/robotoMedium" + android:maxLines="@integer/pp_title_lines" + android:textAppearance="@style/MwmTextAppearance.Title" + tools:background="#C0800000" + tools:ignore="UnusedAttribute" + tools:text="Title"/> + + <TextView + android:id="@+id/tv__subtitle" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_alignWithParentIfMissing="true" + android:layout_below="@id/tv__title" + android:layout_marginTop="@dimen/margin_quarter" + android:layout_toEndOf="@id/downloader_status_frame" + android:layout_toLeftOf="@+id/direction_frame" + android:layout_toRightOf="@id/downloader_status_frame" + android:layout_toStartOf="@+id/direction_frame" + android:lines="1" + android:textAppearance="@style/MwmTextAppearance.Body1.Secondary" + tools:background="#300000F0" + tools:text="Subtitle, very very very very very very very long"/> + + <LinearLayout + android:id="@+id/direction_frame" + android:layout_width="wrap_content" + android:layout_height="@dimen/direction_frame_min_height" + android:layout_alignParentEnd="true" + android:layout_alignParentRight="true" + android:layout_alignWithParentIfMissing="true" + android:layout_below="@id/tv__title" + android:background="?selectableItemBackground" + android:gravity="center_vertical" + android:minHeight="@dimen/direction_frame_min_height" + android:orientation="horizontal" + tools:background="#111111F0"> + + <com.mapswithme.maps.widget.ArrowView + android:id="@+id/av__direction" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginEnd="@dimen/margin_half" + android:layout_marginRight="@dimen/margin_half" + android:scaleType="center" + android:src="?ppArrowDrawable"/> + + <TextView + android:id="@+id/tv__straight_distance" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textAppearance="@style/MwmTextAppearance.PlacePage.Accent" + tools:text="2000 km"/> + </LinearLayout> + + <TextView + android:id="@+id/tv__downloader_details" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_alignWithParentIfMissing="true" + android:layout_below="@id/tv__subtitle" + android:layout_marginTop="@dimen/margin_quarter" + android:layout_toEndOf="@id/downloader_status_frame" + android:layout_toRightOf="@id/downloader_status_frame" + android:textAppearance="@style/MwmTextAppearance.Body1.Secondary" + android:visibility="gone" + tools:background="#8000F000" + tools:text="2.4 GB • Maps: 1" + tools:visibility="visible"/> + + <!-- TODO set correct color when that block will be handled (now its hidden always) --> + <TextView + android:id="@+id/tv__opened_till" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_alignWithParentIfMissing="true" + android:layout_below="@id/tv__downloader_details" + android:layout_marginTop="@dimen/margin_quarter" + android:textAppearance="@style/MwmTextAppearance.Body1.Secondary" + android:visibility="gone" + tools:background="#80FFF000" + tools:text="Till 9 PM" + tools:visibility="visible"/> + + <LinearLayout + android:id="@+id/hotel_info_frame" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_alignWithParentIfMissing="true" + android:layout_below="@id/tv__opened_till" + android:layout_marginTop="@dimen/margin_quarter" + tools:background="#8000FFFF"> + + <TextView + android:id="@+id/tv__hotel_rating" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:textAppearance="@style/MwmTextAppearance.Body1.Secondary" + android:textColor="@color/base_green" + android:textStyle="bold" + tools:text="Rating: 7.5"/> + + <TextView + android:id="@+id/tv__hotel_price" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textAppearance="@style/MwmTextAppearance.Body1.Secondary" + android:textStyle="bold" + tools:text="$$$"/> + </LinearLayout> + + <TextView + android:id="@+id/tv__address" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_alignWithParentIfMissing="true" + android:layout_below="@id/hotel_info_frame" + android:layout_marginTop="@dimen/margin_half" + android:textAppearance="@style/MwmTextAppearance.Body1.Secondary" + tools:background="#60000000" + tools:text="Lenina str, 10"/> +</RelativeLayout> diff --git a/android/res/layout/place_page_banner.xml b/android/res/layout/place_page_banner.xml new file mode 100644 index 0000000000..14781841a3 --- /dev/null +++ b/android/res/layout/place_page_banner.xml @@ -0,0 +1,81 @@ +<?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:layout_width="match_parent" + android:layout_height="@dimen/placepage_banner_height" + android:background="?bannerBackground" + tools:layout_height="wrap_content"> + + <ImageView + android:id="@+id/iv__banner_icon" + android:layout_width="@dimen/placepage_banner_icon_size" + android:layout_height="@dimen/placepage_banner_icon_size" + android:layout_marginTop="@dimen/margin_half_plus" + android:layout_marginLeft="@dimen/margin_base" + android:layout_marginStart="@dimen/margin_base" + android:layout_marginRight="@dimen/margin_base" + android:layout_marginEnd="@dimen/margin_base" + android:scaleType="centerCrop" + android:visibility="gone" + tools:src="@drawable/about_logo" + tools:visibility="visible" + tools:layout_width="@dimen/placepage_banner_icon_size_full" + tools:layout_height="@dimen/placepage_banner_icon_size_full" + tools:layout_marginRight="0dp" + tools:layout_marginEnd="0dp" + tools:layout_marginTop="@dimen/margin_base"/> + + <TextView + android:id="@+id/tv__banner_title" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="@dimen/margin_base" + android:layout_marginLeft="@dimen/margin_base" + android:layout_marginRight="@dimen/margin_base" + android:layout_toEndOf="@id/iv__banner_icon" + android:layout_toRightOf="@id/iv__banner_icon" + android:maxLines="1" + android:minLines="1" + android:textAppearance="@style/MwmTextAppearance.Body3.Primary" + android:fontFamily="@string/robotoMedium" + tools:paddingTop="0dp" + tools:text="Закажи одежду в интернет-магазине Wildberries." + tools:targetApi="jelly_bean" + tools:maxLines="2"/> + + <TextView + android:id="@+id/tv__banner_message" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_below="@id/tv__banner_title" + android:layout_marginTop="@dimen/margin_half_plus" + android:layout_marginLeft="@dimen/margin_base" + android:layout_marginRight="@dimen/margin_base" + android:layout_toEndOf="@id/iv__banner_icon" + android:layout_toRightOf="@id/iv__banner_icon" + android:textAppearance="@style/MwmTextAppearance.Body4" + android:visibility="gone" + tools:text="Бесплатная курьерская доставка по России! + +Коллекции женской, мужской и детской одежды, обуви, +а также товары для дома и спорта. Цены." + tools:visibility="visible"/> + + <TextView + android:id="@+id/tv__banner" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@id/tv__banner_message" + android:layout_marginBottom="@dimen/margin_base" + android:layout_marginTop="@dimen/margin_half_plus" + android:layout_marginLeft="@dimen/margin_base" + android:layout_marginRight="@dimen/margin_base" + android:layout_toEndOf="@id/iv__banner_icon" + android:layout_toRightOf="@id/iv__banner_icon" + android:textAppearance="@style/MwmTextAppearance.Banner" + android:text="@string/advertisement" + android:visibility="gone" + tools:visibility="visible"/> + +</RelativeLayout> diff --git a/android/res/layout/place_page_preview.xml b/android/res/layout/place_page_preview.xml index 87bf735f84..1b529b7126 100644 --- a/android/res/layout/place_page_preview.xml +++ b/android/res/layout/place_page_preview.xml @@ -6,15 +6,15 @@ android:layout_height="wrap_content" android:gravity="center_vertical" android:orientation="horizontal" - android:padding="@dimen/margin_base"> + android:paddingTop="@dimen/margin_base"> <include android:id="@+id/downloader_status_frame" layout="@layout/downloader_status" android:layout_width="@dimen/downloader_status_size" android:layout_height="@dimen/downloader_status_size" - android:layout_marginEnd="@dimen/margin_base" - android:layout_marginRight="@dimen/margin_base" + android:layout_marginStart="@dimen/margin_base" + android:layout_marginLeft="@dimen/margin_base" android:layout_marginTop="@dimen/margin_half" android:visibility="gone" tools:visibility="visible"/> @@ -25,6 +25,10 @@ android:layout_height="wrap_content" android:layout_alignWithParentIfMissing="true" android:layout_marginTop="@dimen/margin_quarter" + android:layout_marginEnd="@dimen/margin_base" + android:layout_marginRight="@dimen/margin_base" + android:layout_marginStart="@dimen/margin_base" + android:layout_marginLeft="@dimen/margin_base" android:layout_toEndOf="@id/downloader_status_frame" android:layout_toRightOf="@id/downloader_status_frame" android:ellipsize="end" @@ -42,6 +46,8 @@ android:layout_alignWithParentIfMissing="true" android:layout_below="@id/tv__title" android:layout_marginTop="@dimen/margin_quarter" + android:layout_marginStart="@dimen/margin_base" + android:layout_marginLeft="@dimen/margin_base" android:layout_toEndOf="@id/downloader_status_frame" android:layout_toLeftOf="@+id/direction_frame" android:layout_toRightOf="@id/downloader_status_frame" @@ -55,6 +61,8 @@ android:id="@+id/direction_frame" android:layout_width="wrap_content" android:layout_height="@dimen/direction_frame_min_height" + android:layout_marginEnd="@dimen/margin_base" + android:layout_marginRight="@dimen/margin_base" android:layout_alignParentEnd="true" android:layout_alignParentRight="true" android:layout_alignWithParentIfMissing="true" @@ -89,6 +97,10 @@ android:layout_alignWithParentIfMissing="true" android:layout_below="@id/tv__subtitle" android:layout_marginTop="@dimen/margin_quarter" + android:layout_marginEnd="@dimen/margin_base" + android:layout_marginRight="@dimen/margin_base" + android:layout_marginStart="@dimen/margin_base" + android:layout_marginLeft="@dimen/margin_base" android:layout_toEndOf="@id/downloader_status_frame" android:layout_toRightOf="@id/downloader_status_frame" android:textAppearance="@style/MwmTextAppearance.Body1.Secondary" @@ -105,6 +117,10 @@ android:layout_alignWithParentIfMissing="true" android:layout_below="@id/tv__downloader_details" android:layout_marginTop="@dimen/margin_quarter" + android:layout_marginEnd="@dimen/margin_base" + android:layout_marginRight="@dimen/margin_base" + android:layout_marginStart="@dimen/margin_base" + android:layout_marginLeft="@dimen/margin_base" android:textAppearance="@style/MwmTextAppearance.Body1.Secondary" android:visibility="gone" tools:background="#80FFF000" @@ -118,6 +134,10 @@ android:layout_alignWithParentIfMissing="true" android:layout_below="@id/tv__opened_till" android:layout_marginTop="@dimen/margin_quarter" + android:layout_marginEnd="@dimen/margin_base" + android:layout_marginRight="@dimen/margin_base" + android:layout_marginStart="@dimen/margin_base" + android:layout_marginLeft="@dimen/margin_base" tools:background="#8000FFFF"> <TextView @@ -146,8 +166,23 @@ android:layout_alignWithParentIfMissing="true" android:layout_below="@id/hotel_info_frame" android:layout_marginTop="@dimen/margin_half" + android:layout_marginEnd="@dimen/margin_base" + android:layout_marginRight="@dimen/margin_base" + android:layout_marginStart="@dimen/margin_base" + android:layout_marginLeft="@dimen/margin_base" android:textAppearance="@style/MwmTextAppearance.Body1.Secondary" tools:background="#60000000" tools:text="Lenina str, 10"/> + + <include + android:id="@+id/banner" + layout="@layout/place_page_banner" + android:layout_width="match_parent" + android:layout_height="@dimen/placepage_banner_height" + android:layout_alignWithParentIfMissing="true" + android:layout_below="@id/tv__address" + android:layout_marginTop="@dimen/margin_base" + android:visibility="gone" + tools:visibility="visible"/> </RelativeLayout> diff --git a/android/res/values-ru/strings.xml b/android/res/values-ru/strings.xml index 73e24d99e7..7a165e1985 100644 --- a/android/res/values-ru/strings.xml +++ b/android/res/values-ru/strings.xml @@ -1006,4 +1006,5 @@ <string name="whatsnew_uber_message">Закажите такси прямо из приложения!</string> <string name="dialog_taxi_offline">Заказ такси недоступен офлайн.</string> <string name="dialog_taxi_error">Заказ такси временно недоступен.</string> + <string name="advertisement">Реклама</string> </resources> diff --git a/android/res/values/colors.xml b/android/res/values/colors.xml index 814be0823f..0c5c9d7d38 100644 --- a/android/res/values/colors.xml +++ b/android/res/values/colors.xml @@ -147,4 +147,10 @@ <color name="bg_brand_opentable">#FFDA3743</color> <color name="bg_brand_opentable_pressed">#FFFC5965</color> + <!-- Banner colors--> + <color name="bg_banner_color">#FFF8E1</color> + <color name="bg_banner_color_night">#555A5A</color> + <color name="text_banner_color">#28000000</color> + <color name="text_banner_color_night">#28FFFFFF</color> + </resources> diff --git a/android/res/values/dimens.xml b/android/res/values/dimens.xml index c5bb871d90..f47d8f5ca3 100644 --- a/android/res/values/dimens.xml +++ b/android/res/values/dimens.xml @@ -160,4 +160,9 @@ <!-- Compass offset--> <dimen name="compass_navigation_landscape_offset">-54dp</dimen> + <!-- Banner--> + <dimen name="placepage_banner_height">46dp</dimen> + <dimen name="placepage_banner_icon_size">22dp</dimen> + <dimen name="placepage_banner_icon_size_full">40dp</dimen> + </resources> diff --git a/android/res/values/font_sizes.xml b/android/res/values/font_sizes.xml index 90f27baf3f..3e984fe207 100644 --- a/android/res/values/font_sizes.xml +++ b/android/res/values/font_sizes.xml @@ -43,4 +43,6 @@ <dimen name="text_size_nav_circle_exit">12sp</dimen> <dimen name="text_size_nav_number">24sp</dimen> <dimen name="text_size_nav_dimension">20sp</dimen> + + <dimen name="text_size_banner">8sp</dimen> </resources> diff --git a/android/res/values/strings.xml b/android/res/values/strings.xml index 2e1157ff28..5fcc0f8fdb 100644 --- a/android/res/values/strings.xml +++ b/android/res/values/strings.xml @@ -1010,4 +1010,5 @@ <string name="whatsnew_uber_message">Order a taxi directly from the app!</string> <string name="dialog_taxi_offline">Taxi ordering is unavailable in offline mode.</string> <string name="dialog_taxi_error">Taxi ordering is temporarily unavailable.</string> + <string name="advertisement">Advertisement</string> </resources> diff --git a/android/res/values/styles-text.xml b/android/res/values/styles-text.xml index dc016d2b54..4786559b79 100644 --- a/android/res/values/styles-text.xml +++ b/android/res/values/styles-text.xml @@ -171,4 +171,10 @@ <style name="MwmTextAppearance.Editor.Buttons"> <item name="android:textSize">@dimen/text_size_body_3</item> </style> + + <style name="MwmTextAppearance.Banner" parent="MwmTextAppearance.Body4"> + <item name="android:textSize">@dimen/text_size_banner</item> + <item name="android:textAllCaps">true</item> + <item name="android:textColor">?bannerText</item> + </style> </resources> diff --git a/android/res/values/themes-attrs.xml b/android/res/values/themes-attrs.xml index 8f718bdbf8..181b6e787e 100644 --- a/android/res/values/themes-attrs.xml +++ b/android/res/values/themes-attrs.xml @@ -66,6 +66,9 @@ <attr name="routingButtonHint" format="color"/> <attr name="routingButtonPressedHint" format="color"/> <attr name="routingButtonActivatedHint" format="color"/> + + <attr name="bannerText" format="color"/> + <attr name="bannerBackground" format="color"/> </declare-styleable> <declare-styleable name="ThemeAttrs.NavButtons"> diff --git a/android/res/values/themes-base.xml b/android/res/values/themes-base.xml index 9cdefefbc4..bca68417c1 100644 --- a/android/res/values/themes-base.xml +++ b/android/res/values/themes-base.xml @@ -82,6 +82,9 @@ <item name="ppRatingText">@color/text_placepage_rating</item> <item name="ppPositive">@drawable/ic_positive_review</item> <item name="ppNegative">@drawable/ic_negative_review</item> + + <item name="bannerText">@color/text_banner_color</item> + <item name="bannerBackground">@color/bg_banner_color</item> </style> <!-- Night theme --> @@ -167,5 +170,8 @@ <item name="ppRatingText">@color/text_placepage_rating_night</item> <item name="ppPositive">@drawable/ic_positive_review_night</item> <item name="ppNegative">@drawable/ic_negative_review_night</item> + + <item name="bannerText">@color/text_banner_color_night</item> + <item name="bannerBackground">@color/bg_banner_color_night</item> </style> </resources>
\ No newline at end of file diff --git a/android/src/com/mapswithme/maps/MwmActivity.java b/android/src/com/mapswithme/maps/MwmActivity.java index 4bdfd4a128..43a87e9782 100644 --- a/android/src/com/mapswithme/maps/MwmActivity.java +++ b/android/src/com/mapswithme/maps/MwmActivity.java @@ -30,6 +30,7 @@ import com.mapswithme.maps.api.ParsedRoutingData; import com.mapswithme.maps.api.ParsedUrlMwmRequest; import com.mapswithme.maps.api.RoutePoint; import com.mapswithme.maps.routing.RoutingPlanController; +import com.mapswithme.maps.bookmarks.data.Banner; import com.mapswithme.maps.uber.Uber; import com.mapswithme.maps.uber.UberInfo; import com.mapswithme.maps.base.BaseMwmFragmentActivity; @@ -1257,9 +1258,9 @@ public class MwmActivity extends BaseMwmFragmentActivity final RoutePoint from = data.mPoints[0]; final RoutePoint to = data.mPoints[1]; RoutingController.get().prepare(new MapObject(MapObject.API_POINT, from.mName, "", "", - from.mLat, from.mLon, ""), + from.mLat, from.mLon, "", Banner.empty()), new MapObject(MapObject.API_POINT, to.mName, "", "", - to.mLat, to.mLon, "")); + to.mLat, to.mLon, "", Banner.empty())); return true; } diff --git a/android/src/com/mapswithme/maps/bookmarks/data/Banner.java b/android/src/com/mapswithme/maps/bookmarks/data/Banner.java new file mode 100644 index 0000000000..741ea33ffe --- /dev/null +++ b/android/src/com/mapswithme/maps/bookmarks/data/Banner.java @@ -0,0 +1,105 @@ +package com.mapswithme.maps.bookmarks.data; + +import android.os.Parcel; +import android.os.Parcelable; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; + +public final class Banner implements Parcelable +{ + private final boolean mIsActive; + @Nullable + private final String mTitle; + @Nullable + private final String mMessage; + @Nullable + private final String mIconUrl; + @Nullable + private final String mUrl; + + @NonNull + public static Banner empty() + { + return new Banner(false, "", "", "", ""); + } + + public Banner(boolean isActive, @Nullable String title, @Nullable String message, + @Nullable String iconUrl, @Nullable String url) + { + mIsActive = isActive; + mTitle = title; + mMessage = message; +// mIconUrl = iconUrl; + mIconUrl = "https://lh6.ggpht.com/bVwOOcO1jm_bfvqtkUDEyyOl2PZ-ZLaxqzylW5NtM2NHSlLQAnC1t45gf6d6JX07XQ=w300"; + mUrl = url; + } + + protected Banner(Parcel in) + { + mIsActive = in.readByte() != 0; + mTitle = in.readString(); + mMessage = in.readString(); + mIconUrl = in.readString(); + mUrl = in.readString(); + } + + public static final Creator<Banner> CREATOR = new Creator<Banner>() + { + @Override + public Banner createFromParcel(Parcel in) + { + return new Banner(in); + } + + @Override + public Banner[] newArray(int size) + { + return new Banner[size]; + } + }; + + public boolean isActive() + { + return mIsActive; + } + + @Nullable + public String getTitle() + { + return mTitle; + } + + @Nullable + public String getMessage() + { + return mMessage; + } + + @Nullable + public String getIconUrl() + { + return mIconUrl; + } + + @Nullable + public String getUrl() + { + return mUrl; + } + + @Override + public int describeContents() + { + return 0; + } + + @Override + public void writeToParcel(Parcel dest, int flags) + { + dest.writeByte((byte) (mIsActive ? 1 : 0)); + dest.writeString(mTitle); + dest.writeString(mMessage); + dest.writeString(mIconUrl); + dest.writeString(mUrl); + } +} diff --git a/android/src/com/mapswithme/maps/bookmarks/data/Bookmark.java b/android/src/com/mapswithme/maps/bookmarks/data/Bookmark.java index 769957c775..bb34a49e8c 100644 --- a/android/src/com/mapswithme/maps/bookmarks/data/Bookmark.java +++ b/android/src/com/mapswithme/maps/bookmarks/data/Bookmark.java @@ -18,9 +18,10 @@ public class Bookmark extends MapObject private double mMerX; private double mMerY; - Bookmark(@IntRange(from = 0) int categoryId, @IntRange(from = 0) int bookmarkId, String title) + Bookmark(@IntRange(from = 0) int categoryId, @IntRange(from = 0) int bookmarkId, String title, + @NonNull Banner banner) { - super(BOOKMARK, title, "", "", 0, 0, ""); + super(BOOKMARK, title, "", "", 0, 0, "", banner); mCategoryId = categoryId; mBookmarkId = bookmarkId; diff --git a/android/src/com/mapswithme/maps/bookmarks/data/MapObject.java b/android/src/com/mapswithme/maps/bookmarks/data/MapObject.java index 8d9caae8a1..5a007863fe 100644 --- a/android/src/com/mapswithme/maps/bookmarks/data/MapObject.java +++ b/android/src/com/mapswithme/maps/bookmarks/data/MapObject.java @@ -32,13 +32,16 @@ public class MapObject implements Parcelable protected String mAddress; protected Metadata mMetadata; protected String mApiId; + @NonNull + protected Banner mBanner; - public MapObject(@MapObjectType int mapObjectType, String title, String subtitle, String address, double lat, double lon, String apiId) + public MapObject(@MapObjectType int mapObjectType, String title, String subtitle, String address, + double lat, double lon, String apiId, @NonNull Banner banner) { - this(mapObjectType, title, subtitle, address, lat, lon, new Metadata(), apiId); + this(mapObjectType, title, subtitle, address, lat, lon, new Metadata(), apiId, banner); } - public MapObject(@MapObjectType int mapObjectType, String title, String subtitle, String address, double lat, double lon, Metadata metadata, String apiId) + public MapObject(@MapObjectType int mapObjectType, String title, String subtitle, String address, double lat, double lon, Metadata metadata, String apiId, @NonNull Banner banner) { mMapObjectType = mapObjectType; mTitle = title; @@ -48,6 +51,7 @@ public class MapObject implements Parcelable mLon = lon; mMetadata = metadata; mApiId = apiId; + mBanner = banner; } protected MapObject(Parcel source) @@ -60,7 +64,8 @@ public class MapObject implements Parcelable source.readDouble(), // Lat source.readDouble(), // Lon (Metadata) source.readParcelable(Metadata.class.getClassLoader()), - source.readString()); // ApiId; + source.readString(), // ApiId; + (Banner) source.readParcelable(Banner.class.getClassLoader())); } /** @@ -125,6 +130,12 @@ public class MapObject implements Parcelable return mApiId; } + @NonNull + public Banner getBanner() + { + return mBanner; + } + public void setLat(double lat) { mLat = lat; @@ -188,6 +199,7 @@ public class MapObject implements Parcelable dest.writeDouble(mLon); dest.writeParcelable(mMetadata, 0); dest.writeString(mApiId); + dest.writeParcelable(mBanner, 0); } public static final Creator<MapObject> CREATOR = new Creator<MapObject>() diff --git a/android/src/com/mapswithme/maps/location/LocationHelper.java b/android/src/com/mapswithme/maps/location/LocationHelper.java index abfe77a84f..0a367b9e8a 100644 --- a/android/src/com/mapswithme/maps/location/LocationHelper.java +++ b/android/src/com/mapswithme/maps/location/LocationHelper.java @@ -19,6 +19,7 @@ import com.mapswithme.maps.Framework; import com.mapswithme.maps.LocationState; import com.mapswithme.maps.MwmApplication; import com.mapswithme.maps.R; +import com.mapswithme.maps.bookmarks.data.Banner; import com.mapswithme.maps.bookmarks.data.MapObject; import com.mapswithme.maps.routing.RoutingController; import com.mapswithme.util.Config; @@ -303,7 +304,8 @@ public enum LocationHelper return null; if (mMyPosition == null) - mMyPosition = new MapObject(MapObject.MY_POSITION, "", "", "", mSavedLocation.getLatitude(), mSavedLocation.getLongitude(), ""); + mMyPosition = new MapObject(MapObject.MY_POSITION, "", "", "", mSavedLocation.getLatitude(), + mSavedLocation.getLongitude(), "", Banner.empty()); return mMyPosition; } diff --git a/android/src/com/mapswithme/maps/search/SearchFragment.java b/android/src/com/mapswithme/maps/search/SearchFragment.java index bb8abcd570..01581629c6 100644 --- a/android/src/com/mapswithme/maps/search/SearchFragment.java +++ b/android/src/com/mapswithme/maps/search/SearchFragment.java @@ -23,6 +23,7 @@ import com.mapswithme.maps.MwmActivity; import com.mapswithme.maps.R; import com.mapswithme.maps.base.BaseMwmFragment; import com.mapswithme.maps.base.OnBackPressListener; +import com.mapswithme.maps.bookmarks.data.Banner; import com.mapswithme.maps.bookmarks.data.MapObject; import com.mapswithme.maps.downloader.CountrySuggestFragment; import com.mapswithme.maps.downloader.MapManager; @@ -351,7 +352,8 @@ public class SearchFragment extends BaseMwmFragment if (mFromRoutePlan) { //noinspection ConstantConditions - final MapObject point = new MapObject(MapObject.SEARCH, result.name, result.description.featureType, "", result.lat, result.lon, ""); + final MapObject point = new MapObject(MapObject.SEARCH, result.name, + result.description.featureType, "", result.lat, result.lon, "", Banner.empty()); RoutingController.get().onPoiSelected(point); } diff --git a/android/src/com/mapswithme/maps/widget/placepage/BannerController.java b/android/src/com/mapswithme/maps/widget/placepage/BannerController.java new file mode 100644 index 0000000000..18bc2472fc --- /dev/null +++ b/android/src/com/mapswithme/maps/widget/placepage/BannerController.java @@ -0,0 +1,184 @@ +package com.mapswithme.maps.widget.placepage; + +import android.content.res.Resources; +import android.preference.PreferenceManager; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; +import android.text.TextUtils; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.TextView; + +import com.bumptech.glide.Glide; +import com.bumptech.glide.load.resource.drawable.GlideDrawable; +import com.bumptech.glide.request.RequestListener; +import com.bumptech.glide.request.target.Target; +import com.mapswithme.maps.MwmApplication; +import com.mapswithme.maps.R; +import com.mapswithme.maps.bookmarks.data.Banner; +import com.mapswithme.util.ConnectionState; +import com.mapswithme.util.UiUtils; + +import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT; + +final class BannerController implements View.OnClickListener +{ + @Nullable + private Banner mBanner; + @Nullable + private OnBannerClickListener mListener; + + @NonNull + private final View mFrame; + @Nullable + private final ImageView mIcon; + @Nullable + private final TextView mTitle; + @Nullable + private final TextView mMessage; + @Nullable + private final View mAdMarker; + + private final float mCloseFrameHeight; + private final float mCloseIconSize; + private final float mOpenIconSize; + private final float mMarginBase; + private final float mMarginHalfPlus; + + private boolean mState = false; + + private static boolean isShowcaseSwitchedOn() + { + return PreferenceManager.getDefaultSharedPreferences(MwmApplication.get()) + .getBoolean(MwmApplication.get().getString(R.string.pref_showcase_switched_on), false); + } + + BannerController(@NonNull View bannerView, @Nullable OnBannerClickListener listener) + { + mFrame = bannerView; + mListener = listener; + Resources res = mFrame.getResources(); + mCloseFrameHeight = res.getDimension(R.dimen.placepage_banner_height); + mCloseIconSize = res.getDimension(R.dimen.placepage_banner_icon_size); + mOpenIconSize = res.getDimension(R.dimen.placepage_banner_icon_size_full); + mMarginBase = res.getDimension(R.dimen.margin_base); + mMarginHalfPlus = res.getDimension(R.dimen.margin_half_plus); + mIcon = (ImageView) bannerView.findViewById(R.id.iv__banner_icon); + mTitle = (TextView) bannerView.findViewById(R.id.tv__banner_title); + mMessage = (TextView) bannerView.findViewById(R.id.tv__banner_message); + mAdMarker = bannerView.findViewById(R.id.tv__banner); + } + + void updateData(@NonNull Banner banner) + { + mBanner = banner; + loadIcon(banner); + if (mTitle != null) + mTitle.setText(banner.getTitle()); + if (mMessage != null) + mMessage.setText(banner.getMessage()); + boolean showBanner = banner.isActive() && ConnectionState.isConnected() + && isShowcaseSwitchedOn(); + UiUtils.showIf(showBanner, mFrame); + if (UiUtils.isLandscape(mFrame.getContext())) + open(); + } + + boolean isShowing() + { + return !UiUtils.isHidden(mFrame); + } + + void open() + { + if (!isShowing() || mBanner == null || mState) + return; + + mState = true; + setFrameHeight(WRAP_CONTENT); + setIconParams(mOpenIconSize, 0, mMarginBase); + UiUtils.show(mMessage, mAdMarker); + loadIcon(mBanner); + if (mTitle != null) + mTitle.setMaxLines(2); + mFrame.setOnClickListener(this); + } + + void close() + { + if (!isShowing() || mBanner == null || !mState) + return; + + mState = false; + setFrameHeight((int) mCloseFrameHeight); + setIconParams(mCloseIconSize, mMarginBase, mMarginHalfPlus); + UiUtils.hide(mMessage, mAdMarker); + loadIcon(mBanner); + if (mTitle != null) + mTitle.setMaxLines(1); + mFrame.setOnClickListener(null); + } + + private void setFrameHeight(int height) + { + ViewGroup.LayoutParams lp = mFrame.getLayoutParams(); + lp.height = height; + mFrame.setLayoutParams(lp); + } + + private void setIconParams(float size, float marginRight, float marginTop) + { + if (mIcon == null) + return; + + ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) mIcon.getLayoutParams(); + lp.height = (int) size; + lp.width = (int) size; + lp.rightMargin = (int) marginRight; + lp.topMargin = (int) marginTop; + mIcon.setLayoutParams(lp); + } + + private void loadIcon(@NonNull Banner banner) + { + if (mIcon == null || TextUtils.isEmpty(banner.getIconUrl())) + return; + + Glide.with(mIcon.getContext()) + .load(banner.getIconUrl()) + .centerCrop() + .listener(new RequestListener<String, GlideDrawable>() + { + @Override + public boolean onException(Exception e, String model, Target<GlideDrawable> target, + boolean isFirstResource) + { + UiUtils.hide(mIcon); + return false; + } + + @Override + public boolean onResourceReady(GlideDrawable resource, String model, + Target<GlideDrawable> target, boolean isFromMemoryCache, + boolean isFirstResource) + { + UiUtils.show(mIcon); + return false; + } + }) + .into(mIcon); + } + + @Override + public void onClick(View v) + { + if (mListener != null && mBanner != null) + mListener.onBannerClick(mBanner); + } + + interface OnBannerClickListener + { + void onBannerClick(@NonNull Banner banner); + } +} diff --git a/android/src/com/mapswithme/maps/widget/placepage/BottomPlacePageAnimationController.java b/android/src/com/mapswithme/maps/widget/placepage/BottomPlacePageAnimationController.java index 40370e91d4..2762407289 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/BottomPlacePageAnimationController.java +++ b/android/src/com/mapswithme/maps/widget/placepage/BottomPlacePageAnimationController.java @@ -4,6 +4,7 @@ import android.animation.Animator; import android.animation.ValueAnimator; import android.annotation.SuppressLint; import android.support.annotation.NonNull; +import android.support.annotation.Nullable; import android.support.v4.view.GestureDetectorCompat; import android.support.v7.widget.Toolbar; import android.util.DisplayMetrics; @@ -37,6 +38,9 @@ class BottomPlacePageAnimationController extends BasePlacePageAnimationControlle private float mDetailMaxHeight; private float mScrollDelta; + @Nullable + private OnBannerOpenListener mBannerOpenListener; + BottomPlacePageAnimationController(@NonNull PlacePageView placePage) { super(placePage); @@ -315,6 +319,12 @@ class BottomPlacePageAnimationController extends BasePlacePageAnimationControlle mDetailsScroll.setTranslationY(detailsTranslation); notifyProgress(); refreshToolbarVisibility(); + + if (mBannerOpenListener != null + && detailsTranslation < mDetailsScroll.getHeight() - mPreview.getHeight()) + { + mBannerOpenListener.onNeedOpenBanner(); + } return consumeEvent; } @@ -354,7 +364,17 @@ class BottomPlacePageAnimationController extends BasePlacePageAnimationControlle case FULLSCREEN: if (isDetailContentScrollable()) mDetailsScroll.setGestureDetector(null); - showFullscreen(); + mDetailsScroll.addOnLayoutChangeListener(new View.OnLayoutChangeListener() + { + @Override + public void onLayoutChange(View v, int left, int top, int right, int bottom, + int oldLeft, int oldTop, int oldRight, int oldBottom) + { + mDetailsScroll.removeOnLayoutChangeListener(this); + showFullscreen(); + } + }); + mDetailsScroll.requestLayout(); break; } } @@ -533,6 +553,11 @@ class BottomPlacePageAnimationController extends BasePlacePageAnimationControlle notifyProgress(0, mDetailsScroll.getTranslationY() + mPlacePage.getTranslationY()); } + void setBannerOpenListener(@Nullable OnBannerOpenListener bannerOpenListener) + { + mBannerOpenListener = bannerOpenListener; + } + private class UpdateListener implements ValueAnimator.AnimatorUpdateListener { @Override @@ -555,4 +580,9 @@ class BottomPlacePageAnimationController extends BasePlacePageAnimationControlle notifyProgress(); } } + + interface OnBannerOpenListener + { + void onNeedOpenBanner(); + } } diff --git a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java index 55b84f2719..4bc813763d 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java +++ b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java @@ -43,6 +43,7 @@ import com.mapswithme.maps.MwmActivity; import com.mapswithme.maps.MwmApplication; import com.mapswithme.maps.R; import com.mapswithme.maps.api.ParsedMwmRequest; +import com.mapswithme.maps.bookmarks.data.Banner; import com.mapswithme.maps.bookmarks.data.Bookmark; import com.mapswithme.maps.bookmarks.data.BookmarkManager; import com.mapswithme.maps.bookmarks.data.DistanceAndAzimut; @@ -94,7 +95,9 @@ public class PlacePageView extends RelativeLayout Sponsored.OnHotelInfoReceivedListener, LineCountTextView.OnLineCountCalculatedListener, RecyclerClickListener, - NearbyAdapter.OnItemClickListener + NearbyAdapter.OnItemClickListener, + BannerController.OnBannerClickListener, + BottomPlacePageAnimationController.OnBannerOpenListener { private static final String PREF_USE_DMS = "use_dms"; @@ -160,6 +163,9 @@ public class PlacePageView extends RelativeLayout private TextView mHotelRatingBase; //TODO: remove this after booking_api.cpp will be done private View mHotelMore; + // Banner + @Nullable + BannerController mBannerController; // Animations private BaseShadowController mShadowController; @@ -332,6 +338,10 @@ public class PlacePageView extends RelativeLayout initHotelNearbyView(); initHotelRatingView(); + View bannerView = findViewById(R.id.banner); + if (bannerView != null) + mBannerController = new BannerController(bannerView, this); + mButtons = new PlacePageButtons(this, ppButtons, new PlacePageButtons.ItemListener() { @Override @@ -706,6 +716,19 @@ public class PlacePageView extends RelativeLayout }); } + @Override + public void onBannerClick(@NonNull Banner banner) + { +// TODO: go to banner url + } + + @Override + public void onNeedOpenBanner() + { + if (mBannerController != null) + mBannerController.open(); + } + private void init(AttributeSet attrs, int defStyleAttr) { initViews(); @@ -719,8 +742,11 @@ public class PlacePageView extends RelativeLayout mIsFloating = attrArray.getBoolean(R.styleable.PlacePageView_floating, false); attrArray.recycle(); - mAnimationController = animationType == 0 ? new BottomPlacePageAnimationController(this) - : new LeftPlacePageAnimationController(this); + boolean isBottom = animationType == 0; + mAnimationController = isBottom ? new BottomPlacePageAnimationController(this) + : new LeftPlacePageAnimationController(this); + if (isBottom) + ((BottomPlacePageAnimationController)mAnimationController).setBannerOpenListener(this); } public void restore() @@ -766,13 +792,22 @@ public class PlacePageView extends RelativeLayout if (state == State.HIDDEN) clearBookmarkWebView(); + if (mBannerController != null) + { + if ((state == State.HIDDEN || state == State.PREVIEW) && !UiUtils.isLandscape(getContext())) + mBannerController.close(); + else + mBannerController.open(); + } + if (mMapObject != null) mAnimationController.setState(state, mMapObject.getMapObjectType()); if (!mIsDocked && !mIsFloating) { // After ninepatch background is set from code, all paddings are lost, so we need to restore it later. - int bottom = mPreview.getPaddingBottom(); + int bottom = mBannerController != null && mBannerController.isShowing() + ? 0 : (int) getResources().getDimension(R.dimen.margin_base); int left = mPreview.getPaddingLeft(); int right = mPreview.getPaddingRight(); int top = mPreview.getPaddingTop(); @@ -913,6 +948,10 @@ public class PlacePageView extends RelativeLayout mTvSponsoredPrice.setText(mSponsoredPrice); UiUtils.showIf(!isPriceEmpty, mTvSponsoredPrice); } + + Banner banner = mMapObject.getBanner(); + if (mBannerController != null) + mBannerController.updateData(banner); } private void refreshDetails() diff --git a/iphone/Maps/ar.lproj/Localizable.strings b/iphone/Maps/ar.lproj/Localizable.strings index 6897ea59d3..9cc515706f 100644 --- a/iphone/Maps/ar.lproj/Localizable.strings +++ b/iphone/Maps/ar.lproj/Localizable.strings @@ -1699,3 +1699,5 @@ "dialog_taxi_offline" = "طلب تاكسي غير متاح في وضع الطيران."; "dialog_taxi_error" = "طلب تاكسي غير متاح مؤقتا."; + +"advertisement" = "Advertisement"; diff --git a/iphone/Maps/cs.lproj/Localizable.strings b/iphone/Maps/cs.lproj/Localizable.strings index 6e820eddd5..653ee87a41 100644 --- a/iphone/Maps/cs.lproj/Localizable.strings +++ b/iphone/Maps/cs.lproj/Localizable.strings @@ -1699,3 +1699,5 @@ "dialog_taxi_offline" = "Objednání taxi není v režimu offline k dispozici."; "dialog_taxi_error" = "Objednání taxi není dočasně k dispozici."; + +"advertisement" = "Advertisement"; diff --git a/iphone/Maps/da.lproj/Localizable.strings b/iphone/Maps/da.lproj/Localizable.strings index df34f11505..6cd71b366e 100644 --- a/iphone/Maps/da.lproj/Localizable.strings +++ b/iphone/Maps/da.lproj/Localizable.strings @@ -1699,3 +1699,5 @@ "dialog_taxi_offline" = "Det er ikke muligt at bestille en taxi i offlinetilstand."; "dialog_taxi_error" = "Bestilling af en taxi er ikke muligt lige nu."; + +"advertisement" = "Advertisement"; diff --git a/iphone/Maps/de.lproj/Localizable.strings b/iphone/Maps/de.lproj/Localizable.strings index b97559470c..9c1df850a0 100644 --- a/iphone/Maps/de.lproj/Localizable.strings +++ b/iphone/Maps/de.lproj/Localizable.strings @@ -1699,3 +1699,5 @@ "dialog_taxi_offline" = "Das Bestellen eines Taxis ist im Offline-Modus nicht verfügbar."; "dialog_taxi_error" = "Das Bestellen eines Taxis ist vorübergehend nicht verfügbar."; + +"advertisement" = "Advertisement"; diff --git a/iphone/Maps/en-GB.lproj/Localizable.strings b/iphone/Maps/en-GB.lproj/Localizable.strings index 61af39040f..4dab20d0bc 100644 --- a/iphone/Maps/en-GB.lproj/Localizable.strings +++ b/iphone/Maps/en-GB.lproj/Localizable.strings @@ -1699,3 +1699,5 @@ "dialog_taxi_offline" = "Taxi booking is unavailable in offline mode."; "dialog_taxi_error" = "Taxi booking is temporarily unavailable."; + +"advertisement" = "Advertisement"; diff --git a/iphone/Maps/en.lproj/Localizable.strings b/iphone/Maps/en.lproj/Localizable.strings index 60d06e91a8..5a4ba3a9bd 100644 --- a/iphone/Maps/en.lproj/Localizable.strings +++ b/iphone/Maps/en.lproj/Localizable.strings @@ -1699,3 +1699,5 @@ "dialog_taxi_offline" = "Taxi ordering is unavailable in offline mode."; "dialog_taxi_error" = "Taxi ordering is temporarily unavailable."; + +"advertisement" = "Advertisement"; diff --git a/iphone/Maps/es.lproj/Localizable.strings b/iphone/Maps/es.lproj/Localizable.strings index 5c28d43366..531d19ac7a 100644 --- a/iphone/Maps/es.lproj/Localizable.strings +++ b/iphone/Maps/es.lproj/Localizable.strings @@ -1699,3 +1699,5 @@ "dialog_taxi_offline" = "La opción para solicitar un taxi no se encuentra disponible en el modo sin conexión."; "dialog_taxi_error" = "La opción para solicitar un taxi se encuentra temporalmente no disponible."; + +"advertisement" = "Advertisement"; diff --git a/iphone/Maps/fi.lproj/Localizable.strings b/iphone/Maps/fi.lproj/Localizable.strings index 50944ce39e..b1db542d14 100644 --- a/iphone/Maps/fi.lproj/Localizable.strings +++ b/iphone/Maps/fi.lproj/Localizable.strings @@ -1699,3 +1699,5 @@ "dialog_taxi_offline" = "Taksin tilaaminen ei ole mahdollista ilman verkkoyhteyttä."; "dialog_taxi_error" = "Taksin tilaaminen ei ole tällä hetkellä mahdollista."; + +"advertisement" = "Advertisement"; diff --git a/iphone/Maps/fr.lproj/Localizable.strings b/iphone/Maps/fr.lproj/Localizable.strings index caef7b2e7b..b16210cf58 100644 --- a/iphone/Maps/fr.lproj/Localizable.strings +++ b/iphone/Maps/fr.lproj/Localizable.strings @@ -1699,3 +1699,5 @@ "dialog_taxi_offline" = "La commande d'un taxi n'est pas disponible en mode hors ligne."; "dialog_taxi_error" = "La commande d'un taxi est temporairement indisponible."; + +"advertisement" = "Advertisement"; diff --git a/iphone/Maps/hu.lproj/Localizable.strings b/iphone/Maps/hu.lproj/Localizable.strings index 5e2e5c3648..8fe236a60a 100644 --- a/iphone/Maps/hu.lproj/Localizable.strings +++ b/iphone/Maps/hu.lproj/Localizable.strings @@ -1699,3 +1699,5 @@ "dialog_taxi_offline" = "Taxirendelés offline módban nem lehetséges."; "dialog_taxi_error" = "A taxirendelés átmenetileg nem elérhető."; + +"advertisement" = "Advertisement"; diff --git a/iphone/Maps/id.lproj/Localizable.strings b/iphone/Maps/id.lproj/Localizable.strings index 5b961dd15c..676e2dfa63 100644 --- a/iphone/Maps/id.lproj/Localizable.strings +++ b/iphone/Maps/id.lproj/Localizable.strings @@ -1699,3 +1699,5 @@ "dialog_taxi_offline" = "Memesan taksi tidak tersedia dalam modus offline."; "dialog_taxi_error" = "Memesan taksi untuk sementara tidak tersedia."; + +"advertisement" = "Advertisement"; diff --git a/iphone/Maps/it.lproj/Localizable.strings b/iphone/Maps/it.lproj/Localizable.strings index 3f82a814bc..f721cbe62c 100644 --- a/iphone/Maps/it.lproj/Localizable.strings +++ b/iphone/Maps/it.lproj/Localizable.strings @@ -1699,3 +1699,5 @@ "dialog_taxi_offline" = "La chiamata taxi non è disponibile in modalità offline."; "dialog_taxi_error" = "La chiamata taxi è temporaneamente non disponibile."; + +"advertisement" = "Advertisement"; diff --git a/iphone/Maps/ja.lproj/Localizable.strings b/iphone/Maps/ja.lproj/Localizable.strings index 06ae2b3ae4..1e518bf19c 100644 --- a/iphone/Maps/ja.lproj/Localizable.strings +++ b/iphone/Maps/ja.lproj/Localizable.strings @@ -1699,3 +1699,5 @@ "dialog_taxi_offline" = "タクシーの予約がオフラインモードでは使用できません。"; "dialog_taxi_error" = "タクシーの予約が一時的に使用できません。"; + +"advertisement" = "Advertisement"; diff --git a/iphone/Maps/ko.lproj/Localizable.strings b/iphone/Maps/ko.lproj/Localizable.strings index 7ba37cc6b4..e7c7be1bba 100644 --- a/iphone/Maps/ko.lproj/Localizable.strings +++ b/iphone/Maps/ko.lproj/Localizable.strings @@ -1699,3 +1699,5 @@ "dialog_taxi_offline" = "오프라인 모드에서는 택시를 예약할 수 없습니다."; "dialog_taxi_error" = "일시적으로 택시를 예약할 수 없습니다."; + +"advertisement" = "Advertisement"; diff --git a/iphone/Maps/nb.lproj/Localizable.strings b/iphone/Maps/nb.lproj/Localizable.strings index af7d4c0e4e..8526fdc2c8 100644 --- a/iphone/Maps/nb.lproj/Localizable.strings +++ b/iphone/Maps/nb.lproj/Localizable.strings @@ -1699,3 +1699,5 @@ "dialog_taxi_offline" = "Bestilling av taxi er ikke mulig i offlinemodus."; "dialog_taxi_error" = "Bestilling av taxi er ikke tilgjengelig for øyeblikket."; + +"advertisement" = "Advertisement"; diff --git a/iphone/Maps/nl.lproj/Localizable.strings b/iphone/Maps/nl.lproj/Localizable.strings index b7866f7e87..2ab9b42a1f 100644 --- a/iphone/Maps/nl.lproj/Localizable.strings +++ b/iphone/Maps/nl.lproj/Localizable.strings @@ -1699,3 +1699,5 @@ "dialog_taxi_offline" = "Het bestellen van een taxi is niet beschikbaar in de offline modus."; "dialog_taxi_error" = "Het bestellen van een taxi is tijdelijk niet beschikbaar."; + +"advertisement" = "Advertisement"; diff --git a/iphone/Maps/pl.lproj/Localizable.strings b/iphone/Maps/pl.lproj/Localizable.strings index 8f1bc70a79..21c5bf0de5 100644 --- a/iphone/Maps/pl.lproj/Localizable.strings +++ b/iphone/Maps/pl.lproj/Localizable.strings @@ -1699,3 +1699,5 @@ "dialog_taxi_offline" = "Zamawianie taksówek nie jest dostępne w trybie offline."; "dialog_taxi_error" = "Zamawianie taksówek jest tymczasowo niedostępne."; + +"advertisement" = "Advertisement"; diff --git a/iphone/Maps/pt.lproj/Localizable.strings b/iphone/Maps/pt.lproj/Localizable.strings index b3cbddc098..07d5e93099 100644 --- a/iphone/Maps/pt.lproj/Localizable.strings +++ b/iphone/Maps/pt.lproj/Localizable.strings @@ -1699,3 +1699,5 @@ "dialog_taxi_offline" = "O serviço de táxi não está disponível no modo off-line."; "dialog_taxi_error" = "O serviço de táxi está temporariamente indisponível."; + +"advertisement" = "Advertisement"; diff --git a/iphone/Maps/ro.lproj/Localizable.strings b/iphone/Maps/ro.lproj/Localizable.strings index 8eb0572422..ea5b2bdf68 100644 --- a/iphone/Maps/ro.lproj/Localizable.strings +++ b/iphone/Maps/ro.lproj/Localizable.strings @@ -1699,3 +1699,5 @@ "dialog_taxi_offline" = "Comandarea unui taxi nu se poate face în modul offline."; "dialog_taxi_error" = "Comandarea unui taxi este momentan indisponibilă."; + +"advertisement" = "Advertisement"; diff --git a/iphone/Maps/ru.lproj/Localizable.strings b/iphone/Maps/ru.lproj/Localizable.strings index f6457b35f0..78e0954a6e 100644 --- a/iphone/Maps/ru.lproj/Localizable.strings +++ b/iphone/Maps/ru.lproj/Localizable.strings @@ -1699,3 +1699,5 @@ "dialog_taxi_offline" = "Заказ такси недоступен офлайн."; "dialog_taxi_error" = "Заказ такси временно недоступен."; + +"advertisement" = "Реклама"; diff --git a/iphone/Maps/sk.lproj/Localizable.strings b/iphone/Maps/sk.lproj/Localizable.strings index 9b40efe0a0..fe166855ff 100644 --- a/iphone/Maps/sk.lproj/Localizable.strings +++ b/iphone/Maps/sk.lproj/Localizable.strings @@ -1699,3 +1699,5 @@ "dialog_taxi_offline" = "Objednanie taxíka nie je k dispozícii v režime offline."; "dialog_taxi_error" = "Objednanie taxíka je dočasne nedostupné."; + +"advertisement" = "Advertisement"; diff --git a/iphone/Maps/sv.lproj/Localizable.strings b/iphone/Maps/sv.lproj/Localizable.strings index ac9a18d83c..8c065de054 100644 --- a/iphone/Maps/sv.lproj/Localizable.strings +++ b/iphone/Maps/sv.lproj/Localizable.strings @@ -1699,3 +1699,5 @@ "dialog_taxi_offline" = "Du kan inte beställa en taxi i offlineläge."; "dialog_taxi_error" = "Du kan inte beställa en taxi just nu."; + +"advertisement" = "Advertisement"; diff --git a/iphone/Maps/th.lproj/Localizable.strings b/iphone/Maps/th.lproj/Localizable.strings index 809abdd8d0..129117569c 100644 --- a/iphone/Maps/th.lproj/Localizable.strings +++ b/iphone/Maps/th.lproj/Localizable.strings @@ -1699,3 +1699,5 @@ "dialog_taxi_offline" = "ไม่สามารถทำการจองแท็กซี่ได้ในโหมดออฟไลน์"; "dialog_taxi_error" = "ไม่สามารถทำการจองแท็กซี่ได้ชั่วคราว"; + +"advertisement" = "Advertisement"; diff --git a/iphone/Maps/tr.lproj/Localizable.strings b/iphone/Maps/tr.lproj/Localizable.strings index 9cfee6458e..aeedc4dc8e 100644 --- a/iphone/Maps/tr.lproj/Localizable.strings +++ b/iphone/Maps/tr.lproj/Localizable.strings @@ -1699,3 +1699,5 @@ "dialog_taxi_offline" = "Taksi çağırma çevrimdışı modda kullanılamıyor."; "dialog_taxi_error" = "Taksi çağırma geçici olarak kullanılamıyor."; + +"advertisement" = "Advertisement"; diff --git a/iphone/Maps/uk.lproj/Localizable.strings b/iphone/Maps/uk.lproj/Localizable.strings index b9e42e9777..ad8c720961 100644 --- a/iphone/Maps/uk.lproj/Localizable.strings +++ b/iphone/Maps/uk.lproj/Localizable.strings @@ -1699,3 +1699,5 @@ "dialog_taxi_offline" = "Замовлення таксі неможливе в автономному режимі."; "dialog_taxi_error" = "Замовлення таксі тимчасово недоступне."; + +"advertisement" = "Advertisement"; diff --git a/iphone/Maps/vi.lproj/Localizable.strings b/iphone/Maps/vi.lproj/Localizable.strings index f401576f9d..875716ce63 100644 --- a/iphone/Maps/vi.lproj/Localizable.strings +++ b/iphone/Maps/vi.lproj/Localizable.strings @@ -1699,3 +1699,5 @@ "dialog_taxi_offline" = "Gọi taxi không khả dụng trong chế độ ngoại tuyến."; "dialog_taxi_error" = "Gọi taxi tạm thời không khả dụng."; + +"advertisement" = "Advertisement"; diff --git a/iphone/Maps/zh-Hans.lproj/Localizable.strings b/iphone/Maps/zh-Hans.lproj/Localizable.strings index 709ed3b12e..60d4914c07 100644 --- a/iphone/Maps/zh-Hans.lproj/Localizable.strings +++ b/iphone/Maps/zh-Hans.lproj/Localizable.strings @@ -1699,3 +1699,5 @@ "dialog_taxi_offline" = "叫出租车服务在离线模式下无法使用。"; "dialog_taxi_error" = "叫出租车服务暂时无法使用。"; + +"advertisement" = "Advertisement"; diff --git a/iphone/Maps/zh-Hant.lproj/Localizable.strings b/iphone/Maps/zh-Hant.lproj/Localizable.strings index 215c16533a..9d13580a68 100644 --- a/iphone/Maps/zh-Hant.lproj/Localizable.strings +++ b/iphone/Maps/zh-Hant.lproj/Localizable.strings @@ -1699,3 +1699,5 @@ "dialog_taxi_offline" = "叫計程車服務在離線模式下無法使用。"; "dialog_taxi_error" = "叫計程車服務暫時無法使用。"; + +"advertisement" = "Advertisement"; diff --git a/strings.txt b/strings.txt index 0a49067eb0..5843c477b8 100644 --- a/strings.txt +++ b/strings.txt @@ -20797,3 +20797,8 @@ zh-Hant = 叫計程車服務暫時無法使用。 el = Η παραγγελία ταξί είναι προσωρινά μη διαθέσιμη. sk = Objednanie taxíka je dočasne nedostupné. + + [advertisement] + en = Advertisement + en-GB = Advertisement + ru = Реклама |