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-05-15 14:51:50 +0300
committerAleksandr Zatsepin <alexzatsepin@users.noreply.github.com>2019-05-16 10:32:21 +0300
commit87717e0fa483a6f007523746d6b77dd94c8d64ba (patch)
tree442c6c32f91b615db7a4c9398b2029b367fe9fea /android
parent51bf87efa7659062b1d6fb1f3d694cd1de91bf70 (diff)
[android] Changed behaviour of catalog closing btn
Diffstat (limited to 'android')
-rw-r--r--android/res/menu/menu_top_bookmark_categories.xml8
-rw-r--r--android/src/com/mapswithme/maps/base/BaseToolbarActivity.java8
-rw-r--r--android/src/com/mapswithme/maps/bookmarks/BookmarksCatalogActivity.java7
-rw-r--r--android/src/com/mapswithme/maps/bookmarks/BookmarksCatalogFragment.java19
4 files changed, 41 insertions, 1 deletions
diff --git a/android/res/menu/menu_top_bookmark_categories.xml b/android/res/menu/menu_top_bookmark_categories.xml
new file mode 100644
index 0000000000..606a10a9b8
--- /dev/null
+++ b/android/res/menu/menu_top_bookmark_categories.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<menu
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto">
+ <item android:id="@+id/close"
+ app:showAsAction="always"
+ android:icon="@drawable/ic_clear"/>
+</menu>
diff --git a/android/src/com/mapswithme/maps/base/BaseToolbarActivity.java b/android/src/com/mapswithme/maps/base/BaseToolbarActivity.java
index 882fa422c0..8a8c5e772e 100644
--- a/android/src/com/mapswithme/maps/base/BaseToolbarActivity.java
+++ b/android/src/com/mapswithme/maps/base/BaseToolbarActivity.java
@@ -2,6 +2,7 @@ package com.mapswithme.maps.base;
import android.os.Bundle;
import android.support.annotation.CallSuper;
+import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.support.v4.app.Fragment;
@@ -28,11 +29,16 @@ public abstract class BaseToolbarActivity extends BaseMwmFragmentActivity
else
toolbar.setTitle(title);
- UiUtils.showHomeUpButton(toolbar);
+ setupHomeButton(toolbar);
displayToolbarAsActionBar();
}
}
+ protected void setupHomeButton(@NonNull Toolbar toolbar)
+ {
+ UiUtils.showHomeUpButton(toolbar);
+ }
+
@StringRes
protected int getToolbarTitle()
{
diff --git a/android/src/com/mapswithme/maps/bookmarks/BookmarksCatalogActivity.java b/android/src/com/mapswithme/maps/bookmarks/BookmarksCatalogActivity.java
index 9978c8fac3..b0ac9bb943 100644
--- a/android/src/com/mapswithme/maps/bookmarks/BookmarksCatalogActivity.java
+++ b/android/src/com/mapswithme/maps/bookmarks/BookmarksCatalogActivity.java
@@ -5,6 +5,7 @@ import android.content.Context;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
+import android.support.v7.widget.Toolbar;
import com.mapswithme.maps.base.BaseToolbarActivity;
@@ -46,6 +47,12 @@ public class BookmarksCatalogActivity extends BaseToolbarActivity
}
@Override
+ protected void setupHomeButton(@NonNull Toolbar toolbar)
+ {
+
+ }
+
+ @Override
protected Class<? extends Fragment> getFragmentClass()
{
return BookmarksCatalogFragment.class;
diff --git a/android/src/com/mapswithme/maps/bookmarks/BookmarksCatalogFragment.java b/android/src/com/mapswithme/maps/bookmarks/BookmarksCatalogFragment.java
index 459b262035..b42562a29a 100644
--- a/android/src/com/mapswithme/maps/bookmarks/BookmarksCatalogFragment.java
+++ b/android/src/com/mapswithme/maps/bookmarks/BookmarksCatalogFragment.java
@@ -10,6 +10,9 @@ import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.SslErrorHandler;
@@ -107,6 +110,7 @@ public class BookmarksCatalogFragment extends BaseWebViewMwmFragment
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState)
{
+ setHasOptionsMenu(true);
mFailedPurchaseController = PurchaseFactory.createFailedBookmarkPurchaseController(getContext());
mFailedPurchaseController.initialize(getActivity());
mFailedPurchaseController.validateExistingPurchases();
@@ -177,6 +181,21 @@ public class BookmarksCatalogFragment extends BaseWebViewMwmFragment
}
@Override
+ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater)
+ {
+ inflater.inflate(R.menu.menu_top_bookmark_categories, menu);
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item)
+ {
+ if (item.getItemId() == R.id.close)
+ requireActivity().finish();
+
+ return super.onOptionsItemSelected(item);
+ }
+
+ @Override
public void onTargetFragmentResult(int resultCode, @Nullable Intent data)
{
mDelegate.onTargetFragmentResult(resultCode, data);