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:
authorr.kuznetsov <r.kuznetsov@corp.mail.ru>2018-04-19 17:45:26 +0300
committerVladimir Byko-Ianko <bykoianko@gmail.com>2018-04-25 17:59:37 +0300
commit0b1f559e959284c3fea7a916edf87aaf252a8cb1 (patch)
tree4b7449a7a7104d6e40d1e14564c269e553eaf939 /android/src
parent48f4c45df6d22f7445447b493e3ef5e591a3a537 (diff)
Fixed redundant notifications in BM
Diffstat (limited to 'android/src')
-rw-r--r--android/src/com/mapswithme/maps/bookmarks/BookmarkCategoriesActivity.java24
-rw-r--r--android/src/com/mapswithme/maps/bookmarks/BookmarkListActivity.java24
-rw-r--r--android/src/com/mapswithme/maps/bookmarks/data/BookmarkManager.java14
3 files changed, 62 insertions, 0 deletions
diff --git a/android/src/com/mapswithme/maps/bookmarks/BookmarkCategoriesActivity.java b/android/src/com/mapswithme/maps/bookmarks/BookmarkCategoriesActivity.java
index 1eccf9a0ff..2d52b8aa58 100644
--- a/android/src/com/mapswithme/maps/bookmarks/BookmarkCategoriesActivity.java
+++ b/android/src/com/mapswithme/maps/bookmarks/BookmarkCategoriesActivity.java
@@ -1,14 +1,38 @@
package com.mapswithme.maps.bookmarks;
+import android.support.annotation.CallSuper;
import android.support.annotation.NonNull;
import android.support.annotation.StyleRes;
import android.support.v4.app.Fragment;
import com.mapswithme.maps.base.BaseToolbarActivity;
+import com.mapswithme.maps.bookmarks.data.BookmarkManager;
import com.mapswithme.util.ThemeUtils;
public class BookmarkCategoriesActivity extends BaseToolbarActivity
{
+ @CallSuper
+ @Override
+ public void onResume()
+ {
+ super.onResume();
+
+ // Disable all notifications in BM on appearance of this activity.
+ // It allows to significantly improve performance in case of bookmarks
+ // modification. All notifications will be sent on activity's disappearance.
+ BookmarkManager.INSTANCE.setNotificationsEnabled(false);
+ }
+
+ @CallSuper
+ @Override
+ public void onPause()
+ {
+ // Allow to send all notifications in BM.
+ BookmarkManager.INSTANCE.setNotificationsEnabled(true);
+
+ super.onPause();
+ }
+
@Override
@StyleRes
public int getThemeResourceId(@NonNull String theme)
diff --git a/android/src/com/mapswithme/maps/bookmarks/BookmarkListActivity.java b/android/src/com/mapswithme/maps/bookmarks/BookmarkListActivity.java
index 63d975c904..47113a719b 100644
--- a/android/src/com/mapswithme/maps/bookmarks/BookmarkListActivity.java
+++ b/android/src/com/mapswithme/maps/bookmarks/BookmarkListActivity.java
@@ -1,14 +1,38 @@
package com.mapswithme.maps.bookmarks;
+import android.support.annotation.CallSuper;
import android.support.annotation.NonNull;
import android.support.annotation.StyleRes;
import android.support.v4.app.Fragment;
import com.mapswithme.maps.base.BaseToolbarActivity;
+import com.mapswithme.maps.bookmarks.data.BookmarkManager;
import com.mapswithme.util.ThemeUtils;
public class BookmarkListActivity extends BaseToolbarActivity
{
+ @CallSuper
+ @Override
+ public void onResume()
+ {
+ super.onResume();
+
+ // Disable all notifications in BM on appearance of this activity.
+ // It allows to significantly improve performance in case of bookmarks
+ // modification. All notifications will be sent on activity's disappearance.
+ BookmarkManager.INSTANCE.setNotificationsEnabled(false);
+ }
+
+ @CallSuper
+ @Override
+ public void onPause()
+ {
+ // Allow to send all notifications in BM.
+ BookmarkManager.INSTANCE.setNotificationsEnabled(true);
+
+ super.onPause();
+ }
+
@Override
@StyleRes
public int getThemeResourceId(@NonNull String theme)
diff --git a/android/src/com/mapswithme/maps/bookmarks/data/BookmarkManager.java b/android/src/com/mapswithme/maps/bookmarks/data/BookmarkManager.java
index c7e9935a66..34dca9e9a0 100644
--- a/android/src/com/mapswithme/maps/bookmarks/data/BookmarkManager.java
+++ b/android/src/com/mapswithme/maps/bookmarks/data/BookmarkManager.java
@@ -393,6 +393,16 @@ public enum BookmarkManager
nativeCancelRestoring();
}
+ public void setNotificationsEnabled(boolean enabled)
+ {
+ nativeSetNotificationsEnabled(enabled);
+ }
+
+ public boolean areNotificationsEnabled()
+ {
+ return nativeAreNotificationsEnabled();
+ }
+
private native int nativeGetCategoriesCount();
private native int nativeGetCategoryPositionById(long catId);
@@ -477,6 +487,10 @@ public enum BookmarkManager
private static native void nativeCancelRestoring();
+ private static native void nativeSetNotificationsEnabled(boolean enabled);
+
+ private static native boolean nativeAreNotificationsEnabled();
+
public interface BookmarksLoadingListener
{
void onBookmarksLoadingStarted();