[android] Added start of Catalog screen for result when discovery and pp promo objects are clicked, close pp when get result on main screen

This commit is contained in:
Dmitry Donskoy 2019-09-16 16:21:31 +03:00 committed by Aleksandr Zatsepin
parent 66191f8db1
commit 307f294621
3 changed files with 21 additions and 2 deletions

View file

@ -1015,6 +1015,8 @@ public class MwmActivity extends BaseMwmFragmentActivity
MapTask mapTask = target -> showBookmarkCategory(category);
addTask(mapTask);
if (!mPlacePageController.isClosed())
mPlacePageController.close();
}
private boolean showBookmarkCategory(@NonNull BookmarkCategory category)
@ -1025,6 +1027,14 @@ public class MwmActivity extends BaseMwmFragmentActivity
private void handleDiscoveryResult(@NonNull Intent data)
{
BookmarkCategory category =
data.getParcelableExtra(BookmarksCatalogActivity.EXTRA_DOWNLOADED_CATEGORY);
if (category != null)
{
handleDownloadedCategoryResult(data);
return;
}
String action = data.getAction();
if (TextUtils.isEmpty(action))
return;

View file

@ -8,6 +8,7 @@ import android.support.v4.app.Fragment;
import com.mapswithme.maps.R;
import com.mapswithme.maps.activity.CustomNavigateUpListener;
import com.mapswithme.maps.base.BaseMwmFragmentActivity;
import com.mapswithme.maps.bookmarks.BookmarkCategoriesActivity;
import com.mapswithme.maps.bookmarks.data.MapObject;
import com.mapswithme.maps.gallery.Items;
import com.mapswithme.maps.search.FilterActivity;
@ -89,6 +90,11 @@ public class DiscoveryActivity extends BaseMwmFragmentActivity
setResult(Activity.RESULT_OK, data);
finish();
break;
case BookmarkCategoriesActivity.REQ_CODE_DOWNLOAD_BOOKMARK_CATEGORY:
setResult(Activity.RESULT_OK, data);
finish();
break;
}
}
}

View file

@ -4,6 +4,7 @@ import android.app.Activity;
import android.support.annotation.NonNull;
import android.text.TextUtils;
import com.mapswithme.maps.bookmarks.BookmarkCategoriesActivity;
import com.mapswithme.maps.bookmarks.BookmarksCatalogActivity;
import com.mapswithme.maps.gallery.ItemSelectedListener;
import com.mapswithme.maps.promo.PromoEntity;
@ -31,7 +32,8 @@ public class RegularCatalogPromoListener implements ItemSelectedListener<PromoEn
if (TextUtils.isEmpty(item.getUrl()))
return;
BookmarksCatalogActivity.start(mActivity, item.getUrl());
BookmarksCatalogActivity.startForResult(mActivity, BookmarkCategoriesActivity.REQ_CODE_DOWNLOAD_BOOKMARK_CATEGORY,
item.getUrl());
Statistics.INSTANCE.trackGalleryProductItemSelected(GalleryType.PROMO, mPlacement, position,
Destination.CATALOGUE);
}
@ -43,7 +45,8 @@ public class RegularCatalogPromoListener implements ItemSelectedListener<PromoEn
if (TextUtils.isEmpty(item.getUrl()))
return;
BookmarksCatalogActivity.start(mActivity, item.getUrl());
BookmarksCatalogActivity.startForResult(mActivity, BookmarkCategoriesActivity.REQ_CODE_DOWNLOAD_BOOKMARK_CATEGORY,
item.getUrl());
Statistics.INSTANCE.trackGalleryEvent(Statistics.EventName.PP_SPONSOR_MORE_SELECTED,
GalleryType.PROMO,
mPlacement);