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>2018-07-23 17:29:34 +0300
committerAleksandr Zatsepin <alexzatsepin@users.noreply.github.com>2018-07-23 17:40:36 +0300
commit3457daae1feb9535409c568c57c23146e88d3826 (patch)
treedc8a69aa2d0c61a0687b62d14b7b7e417d0fa07c
parentddcee4a6b8259388920e119582e18449ba518463 (diff)
[android] Fixed bookmarks list updated from location listenerandroid-gr-832
-rw-r--r--android/src/com/mapswithme/maps/bookmarks/BookmarkListAdapter.java22
-rw-r--r--android/src/com/mapswithme/maps/bookmarks/BookmarksListFragment.java12
-rw-r--r--android/src/com/mapswithme/maps/bookmarks/data/AbstractCategoriesSnapshot.java5
-rw-r--r--android/src/com/mapswithme/maps/bookmarks/data/BookmarkCategory.java2
4 files changed, 12 insertions, 29 deletions
diff --git a/android/src/com/mapswithme/maps/bookmarks/BookmarkListAdapter.java b/android/src/com/mapswithme/maps/bookmarks/BookmarkListAdapter.java
index e21ca59e52..56e6239cd5 100644
--- a/android/src/com/mapswithme/maps/bookmarks/BookmarkListAdapter.java
+++ b/android/src/com/mapswithme/maps/bookmarks/BookmarkListAdapter.java
@@ -1,6 +1,5 @@
package com.mapswithme.maps.bookmarks;
-import android.location.Location;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
@@ -13,8 +12,6 @@ import com.mapswithme.maps.R;
import com.mapswithme.maps.bookmarks.data.BookmarkCategory;
import com.mapswithme.maps.bookmarks.data.BookmarkManager;
import com.mapswithme.maps.content.DataSource;
-import com.mapswithme.maps.location.LocationHelper;
-import com.mapswithme.maps.location.LocationListener;
import com.mapswithme.maps.widget.recycler.RecyclerClickListener;
import com.mapswithme.maps.widget.recycler.RecyclerLongClickListener;
@@ -40,15 +37,6 @@ public class BookmarkListAdapter extends RecyclerView.Adapter<Holders.BaseBookma
static final int TYPE_SECTION = 2;
static final int TYPE_DESC = 3;
- private final LocationListener mLocationListener = new LocationListener.Simple()
- {
- @Override
- public void onLocationUpdated(Location location)
- {
- notifyDataSetChanged();
- }
- };
-
@Nullable
private RecyclerLongClickListener mLongClickListener;
@Nullable
@@ -69,16 +57,6 @@ public class BookmarkListAdapter extends RecyclerView.Adapter<Holders.BaseBookma
mLongClickListener = listener;
}
- public void startLocationUpdate()
- {
- LocationHelper.INSTANCE.addListener(mLocationListener, true);
- }
-
- public void stopLocationUpdate()
- {
- LocationHelper.INSTANCE.removeListener(mLocationListener);
- }
-
@Override
public Holders.BaseBookmarkHolder onCreateViewHolder(ViewGroup parent, int viewType)
{
diff --git a/android/src/com/mapswithme/maps/bookmarks/BookmarksListFragment.java b/android/src/com/mapswithme/maps/bookmarks/BookmarksListFragment.java
index 2c8a3b79f4..fdafb093e1 100644
--- a/android/src/com/mapswithme/maps/bookmarks/BookmarksListFragment.java
+++ b/android/src/com/mapswithme/maps/bookmarks/BookmarksListFragment.java
@@ -16,6 +16,7 @@ import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
+import com.crashlytics.android.Crashlytics;
import com.mapswithme.maps.MwmActivity;
import com.mapswithme.maps.R;
import com.mapswithme.maps.base.BaseMwmRecyclerFragment;
@@ -53,6 +54,7 @@ public class BookmarksListFragment extends BaseMwmRecyclerFragment<BookmarkListA
public void onCreate(@Nullable Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
+ Crashlytics.log("onCreate");
BookmarkCategory category = getCategoryOrThrow();
mCategoryDataSource = new CategoryDataSource(category);
}
@@ -86,6 +88,7 @@ public class BookmarksListFragment extends BaseMwmRecyclerFragment<BookmarkListA
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState)
{
super.onViewCreated(view, savedInstanceState);
+ Crashlytics.log("onViewCreated");
configureAdapter();
setHasOptionsMenu(true);
boolean isEmpty = getAdapter().getItemCount() == 0;
@@ -108,6 +111,7 @@ public class BookmarksListFragment extends BaseMwmRecyclerFragment<BookmarkListA
public void onStart()
{
super.onStart();
+ Crashlytics.log("onStart");
BookmarkManager.INSTANCE.addSharingListener(this);
}
@@ -115,9 +119,9 @@ public class BookmarksListFragment extends BaseMwmRecyclerFragment<BookmarkListA
public void onResume()
{
super.onResume();
+ Crashlytics.log("onResume");
BookmarkListAdapter adapter = getAdapter();
- adapter.startLocationUpdate();
adapter.notifyDataSetChanged();
}
@@ -125,15 +129,14 @@ public class BookmarksListFragment extends BaseMwmRecyclerFragment<BookmarkListA
public void onPause()
{
super.onPause();
-
- BookmarkListAdapter adapter = getAdapter();
- adapter.stopLocationUpdate();
+ Crashlytics.log("onPause");
}
@Override
public void onStop()
{
super.onStop();
+ Crashlytics.log("onStop");
BookmarkManager.INSTANCE.removeSharingListener(this);
}
@@ -141,7 +144,6 @@ public class BookmarksListFragment extends BaseMwmRecyclerFragment<BookmarkListA
{
BookmarkListAdapter adapter = getAdapter();
adapter.registerAdapterDataObserver(mCategoryDataSource);
- adapter.startLocationUpdate();
adapter.setOnClickListener(this);
adapter.setOnLongClickListener(isCatalogCategory() ? null : this);
}
diff --git a/android/src/com/mapswithme/maps/bookmarks/data/AbstractCategoriesSnapshot.java b/android/src/com/mapswithme/maps/bookmarks/data/AbstractCategoriesSnapshot.java
index 6ba78b5127..faa4654cf0 100644
--- a/android/src/com/mapswithme/maps/bookmarks/data/AbstractCategoriesSnapshot.java
+++ b/android/src/com/mapswithme/maps/bookmarks/data/AbstractCategoriesSnapshot.java
@@ -42,11 +42,14 @@ public abstract class AbstractCategoriesSnapshot
public int indexOfOrThrow(@NonNull BookmarkCategory category)
{
- int indexOf = getItems().indexOf(category);
+ List<BookmarkCategory> items = getItems();
+ int indexOf = items.indexOf(category);
if (indexOf < 0)
{
throw new UnsupportedOperationException(new StringBuilder("This category absent in current snapshot ")
.append(category)
+ .append("all items : ")
+ .append(Arrays.toString(items.toArray()))
.toString());
}
return indexOf;
diff --git a/android/src/com/mapswithme/maps/bookmarks/data/BookmarkCategory.java b/android/src/com/mapswithme/maps/bookmarks/data/BookmarkCategory.java
index d4e741e637..435bf3b5bf 100644
--- a/android/src/com/mapswithme/maps/bookmarks/data/BookmarkCategory.java
+++ b/android/src/com/mapswithme/maps/bookmarks/data/BookmarkCategory.java
@@ -260,7 +260,7 @@ public class BookmarkCategory implements Parcelable
sb.append(", mDescription='").append(mDescription).append('\'');
sb.append(", mTracksCount=").append(mTracksCount);
sb.append(", mBookmarksCount=").append(mBookmarksCount);
- sb.append(", mTypeIndex=").append(mTypeIndex);
+ sb.append(", mType=").append(Type.values()[mTypeIndex]);
sb.append(", mIsVisible=").append(mIsVisible);
sb.append('}');
return sb.toString();