Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Donskoy <donskdmitry@mail.ru>2019-06-06 14:25:27 +0300
committerAleksandr Zatsepin <alexzatsepin@users.noreply.github.com>2019-06-07 11:39:57 +0300
commit0e8f704106667c9d73e150dc5c95c09a311042fa (patch)
tree8a1e1c1472226e67ddc4659ddd2439f782334b36 /android
parent67866ff33ca237cc807238e41ba7c6d87598ceeb (diff)
[android] Add catalog CTA btn
Diffstat (limited to 'android')
-rw-r--r--android/res/layout-land/onmap_downloader.xml177
-rw-r--r--android/res/layout/onmap_downloader.xml46
-rw-r--r--android/res/values/dimens.xml1
-rw-r--r--android/src/com/mapswithme/maps/downloader/OnmapDownloader.java49
4 files changed, 255 insertions, 18 deletions
diff --git a/android/res/layout-land/onmap_downloader.xml b/android/res/layout-land/onmap_downloader.xml
new file mode 100644
index 0000000000..2d16670f7f
--- /dev/null
+++ b/android/res/layout-land/onmap_downloader.xml
@@ -0,0 +1,177 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ScrollView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:visibility="gone"
+ tools:visibility="visible">
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:background="?cardFrame"
+ android:padding="@dimen/margin_base"
+ android:clipToPadding="false"
+ android:clipChildren="false"
+ android:layout_gravity="center"
+ android:gravity="center"
+ tools:ignore="UselessParent">
+ <LinearLayout
+ android:layout_width="@dimen/square_block_size"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:clipToPadding="false"
+ android:clipChildren="false"
+ android:gravity="center"
+ android:layout_marginTop="@dimen/margin_base"
+ android:layout_marginBottom="@dimen/margin_base"
+ tools:ignore="UselessParent">
+ <TextView
+ android:id="@+id/downloader_parent"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="@dimen/margin_eighth"
+ android:textAppearance="@style/MwmTextAppearance.Body2"
+ android:gravity="center_horizontal"
+ tools:text="Honduras"/>
+ <TextView
+ android:id="@+id/downloader_title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textAppearance="@style/MwmTextAppearance.Title"
+ android:textSize="20sp"
+ android:gravity="center_horizontal"
+ tools:text="Some title very loooooooooong title"/>
+ <TextView
+ android:id="@+id/downloader_size"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="@dimen/margin_half"
+ android:textAppearance="@style/MwmTextAppearance.Body2"
+ android:gravity="center_horizontal"
+ tools:text="1000 MB"/>
+ <FrameLayout
+ android:id="@+id/downloader_controls_frame"
+ android:layout_width="180dp"
+ android:layout_height="@dimen/height_block_base"
+ android:clipChildren="false">
+ <Button
+ android:id="@+id/downloader_button"
+ style="@style/MwmWidget.Button.Primary"
+ android:layout_width="180dp"
+ android:visibility="gone"
+ tools:visibility="visible"/>
+ <com.mapswithme.maps.widget.WheelProgressView
+ android:id="@+id/wheel_downloader_progress"
+ android:layout_width="@dimen/downloader_status_size"
+ android:layout_height="@dimen/downloader_status_size"
+ android:layout_gravity="center"
+ app:wheelProgressColor="?colorAccent"
+ app:wheelSecondaryColor="?dividerHorizontal"
+ app:wheelThickness="@dimen/margin_eighth"
+ android:visibility="visible"
+ tools:visibility="visible"/>
+ </FrameLayout>
+ </LinearLayout>
+ </LinearLayout>
+ <View
+ android:id="@+id/onmap_downloader_divider"
+ android:background="?android:listDivider"
+ android:layout_marginStart="@dimen/margin_half_plus_eight"
+ android:layout_marginEnd="@dimen/margin_half_plus_eight"
+ android:layout_marginRight="@dimen/margin_half_plus_eight"
+ android:layout_marginLeft="@dimen/margin_half_plus_eight"
+ android:layout_height="match_parent"
+ android:layout_width="@dimen/divider_height"/>
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:gravity="center">
+ <LinearLayout
+ android:id="@+id/banner"
+ android:layout_marginTop="@dimen/margin_half"
+ android:layout_width="@dimen/square_block_size"
+ android:orientation="vertical"
+ android:visibility="gone"
+ android:gravity="center"
+ android:layout_height="wrap_content"
+ tools:visibility="visible">
+ <ImageView
+ android:id="@+id/icon"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:src="@drawable/ic_brand_megafon_green"/>
+ <TextView
+ android:id="@id/text"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="@dimen/margin_half"
+ android:gravity="center"
+ android:textAppearance="@style/MwmTextAppearance.Body4"
+ android:textColor="?android:textColorPrimary"
+ android:text="@string/banner_megafon_banner_message"/>
+ <Button
+ android:id="@+id/banner_button"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingLeft="@dimen/margin_half"
+ android:paddingStart="@dimen/margin_half"
+ android:paddingRight="@dimen/margin_half"
+ android:paddingEnd="@dimen/margin_half"
+ android:paddingTop="@dimen/margin_quarter_plus"
+ android:paddingBottom="@dimen/margin_quarter_plus"
+ android:layout_marginTop="@dimen/margin_base"
+ android:fontFamily="@string/robotoMedium"
+ android:textAllCaps="false"
+ android:textSize="@dimen/text_size_body_3"
+ android:text="@string/banner_megafon_banner_button"
+ android:background="@drawable/button_megafon"
+ style="?android:attr/borderlessButtonStyle"
+ android:textColor="@color/white_primary"
+ android:lines="1"
+ tools:targetApi="jelly_bean"/>
+ </LinearLayout>
+ <LinearLayout
+ android:id="@+id/catalog_call_to_action_container"
+ android:orientation="vertical"
+ android:gravity="center"
+ android:layout_width="@dimen/square_block_size"
+ android:layout_height="wrap_content"
+ tools:visibility="gone">
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="@dimen/margin_half"
+ android:gravity="center"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ tools:text="very very very loooooooooooooooooong text"/>
+ <Button
+ android:id="@+id/catalog_call_to_action_btn"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingLeft="@dimen/margin_half"
+ android:paddingStart="@dimen/margin_half"
+ android:paddingRight="@dimen/margin_half"
+ android:paddingEnd="@dimen/margin_half"
+ style="@style/MwmWidget.Button.Primary"
+ android:paddingTop="@dimen/margin_quarter_plus"
+ android:paddingBottom="@dimen/margin_quarter_plus"
+ android:layout_marginTop="@dimen/margin_base"
+ android:fontFamily="@string/robotoMedium"
+ android:textAllCaps="false"
+ android:textSize="@dimen/text_size_body_3"
+ android:text="@string/download_guides"
+ android:textColor="@color/white_primary"
+ android:lines="1"
+ tools:targetApi="jelly_bean"/>
+ </LinearLayout>
+ </LinearLayout>
+ </LinearLayout>
+</ScrollView>
diff --git a/android/res/layout/onmap_downloader.xml b/android/res/layout/onmap_downloader.xml
index 894d580ee2..e1778efb3f 100644
--- a/android/res/layout/onmap_downloader.xml
+++ b/android/res/layout/onmap_downloader.xml
@@ -63,6 +63,12 @@
android:visibility="visible"
tools:visibility="visible"/>
</FrameLayout>
+
+ <View
+ android:id="@+id/onmap_downloader_divider"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/divider_height"
+ android:background="?android:listDivider"/>
<LinearLayout
android:id="@+id/banner"
android:layout_marginTop="@dimen/margin_half"
@@ -71,11 +77,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:visibility="visible">
- <View
- android:id="@+id/divider"
- android:layout_width="match_parent"
- android:layout_height="@dimen/divider_height"
- android:background="?android:listDivider"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -116,5 +117,40 @@
android:textColor="@color/white_primary"
tools:targetApi="jelly_bean"/>
</LinearLayout>
+ <LinearLayout
+ android:id="@+id/catalog_call_to_action_container"
+ android:layout_marginTop="@dimen/margin_half"
+ android:orientation="vertical"
+ android:visibility="gone"
+ android:gravity="center"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ tools:visibility="visible">
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="@dimen/margin_half"
+ android:gravity="center"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ tools:text="Some title"/>
+ <Button
+ android:id="@+id/catalog_call_to_action_btn"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingLeft="@dimen/margin_half"
+ android:paddingStart="@dimen/margin_half"
+ android:paddingRight="@dimen/margin_half"
+ android:paddingEnd="@dimen/margin_half"
+ style="@style/MwmWidget.Button.Primary"
+ android:paddingTop="@dimen/margin_quarter_plus"
+ android:paddingBottom="@dimen/margin_quarter_plus"
+ android:layout_marginTop="@dimen/margin_base"
+ android:fontFamily="@string/robotoMedium"
+ android:textAllCaps="false"
+ android:textSize="@dimen/text_size_body_3"
+ android:text="@string/download_guides"
+ android:textColor="@color/white_primary"
+ tools:targetApi="jelly_bean"/>
+ </LinearLayout>
</LinearLayout>
</ScrollView>
diff --git a/android/res/values/dimens.xml b/android/res/values/dimens.xml
index 96b95b3c00..9647ed8da8 100644
--- a/android/res/values/dimens.xml
+++ b/android/res/values/dimens.xml
@@ -261,4 +261,5 @@
<dimen name="sharing_options_img_size">18dp</dimen>
<dimen name="bookmark_purchase_img_height">258dp</dimen>
<dimen name="bookmark_purchase_img_width">280dp</dimen>
+ <dimen name="square_block_size">168dp</dimen>
</resources>
diff --git a/android/src/com/mapswithme/maps/downloader/OnmapDownloader.java b/android/src/com/mapswithme/maps/downloader/OnmapDownloader.java
index a2beb627cf..50c7cd7885 100644
--- a/android/src/com/mapswithme/maps/downloader/OnmapDownloader.java
+++ b/android/src/com/mapswithme/maps/downloader/OnmapDownloader.java
@@ -1,6 +1,7 @@
package com.mapswithme.maps.downloader;
import android.location.Location;
+import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.view.View;
@@ -12,6 +13,7 @@ import com.mapswithme.maps.Framework;
import com.mapswithme.maps.MwmActivity;
import com.mapswithme.maps.R;
import com.mapswithme.maps.background.Notifier;
+import com.mapswithme.maps.bookmarks.BookmarksCatalogActivity;
import com.mapswithme.maps.location.LocationHelper;
import com.mapswithme.maps.routing.RoutingController;
import com.mapswithme.maps.widget.WheelProgressView;
@@ -37,6 +39,11 @@ public class OnmapDownloader implements MwmActivity.LeftAnimationTrackListener
private final WheelProgressView mProgress;
private final Button mButton;
+ @NonNull
+ private final View mCatalogCallToActionContainer;
+ @NonNull
+ private final View mPromoContentDivider;
+
private int mStorageSubscriptionSlot;
@Nullable
@@ -243,6 +250,11 @@ public class OnmapDownloader implements MwmActivity.LeftAnimationTrackListener
if (mPromoBanner != null && mPromoBanner.getType() != DownloaderPromoBanner.DOWNLOADER_PROMO_TYPE_NO_PROMO)
Utils.openUrl(mActivity, mPromoBanner.getUrl());
});
+
+ View downloadGuidesBtn = mFrame.findViewById(R.id.catalog_call_to_action_btn);
+ mCatalogCallToActionContainer = mFrame.findViewById(R.id.catalog_call_to_action_container);
+ downloadGuidesBtn.setOnClickListener(new CatalogCallToActionListener());
+ mPromoContentDivider = mFrame.findViewById(R.id.onmap_downloader_divider);
}
private void updateBannerVisibility()
@@ -251,22 +263,21 @@ public class OnmapDownloader implements MwmActivity.LeftAnimationTrackListener
return;
mPromoBanner = Framework.nativeGetDownloaderPromoBanner(mCurrentCountry.id);
- if (mPromoBanner.getType() == DownloaderPromoBanner.DOWNLOADER_PROMO_TYPE_NO_PROMO)
+ boolean isPromoNotFound = mPromoBanner.getType() == DownloaderPromoBanner.DOWNLOADER_PROMO_TYPE_NO_PROMO;
+
+ boolean enqueued = mCurrentCountry.status == CountryItem.STATUS_ENQUEUED;
+ boolean progress = mCurrentCountry.status == CountryItem.STATUS_PROGRESS;
+ boolean applying = mCurrentCountry.status == CountryItem.STATUS_APPLYING;
+ boolean hasDialog = enqueued || progress || applying;
+ mPromoContentDivider.setVisibility(isPromoNotFound || !hasDialog ? View.GONE : View.VISIBLE);
+
+ if (isPromoNotFound)
return;
- if (mPromoBanner.getType() == DownloaderPromoBanner.DOWNLOADER_PROMO_TYPE_MEGAFON)
- {
- boolean enqueued = mCurrentCountry.status == CountryItem.STATUS_ENQUEUED;
- boolean progress = mCurrentCountry.status == CountryItem.STATUS_PROGRESS;
- boolean applying = mCurrentCountry.status == CountryItem.STATUS_APPLYING;
+ boolean hasPromo = mPromoBanner.getType() == DownloaderPromoBanner.DOWNLOADER_PROMO_TYPE_MEGAFON;
- UiUtils.showIf(enqueued || progress || applying, mFrame, R.id.banner);
- }
- else
- {
- // TODO: implement me.
- throw new RuntimeException("Not implemented yet");
- }
+ UiUtils.showIf(hasDialog && hasPromo, mFrame, R.id.banner);
+ UiUtils.showIf(hasDialog && !hasPromo, mCatalogCallToActionContainer);
}
@Override
@@ -306,4 +317,16 @@ public class OnmapDownloader implements MwmActivity.LeftAnimationTrackListener
{
sAutodownloadLocked = locked;
}
+
+ private class CatalogCallToActionListener implements View.OnClickListener
+ {
+ @Override
+ public void onClick(View v)
+ {
+ if (mPromoBanner == null)
+ return;
+
+ BookmarksCatalogActivity.start(mActivity, mPromoBanner.getUrl());
+ }
+ }
}