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-05 18:48:24 +0300
committerVlad Mihaylenko <vxmihaylenko@gmail.com>2018-07-20 14:51:41 +0300
commitc9649224f9777c5ad206f3aa95e3bfa723deff73 (patch)
treea3f56df1af18372f151320eb8f3fec1d900b3542 /android
parent65c80820869bfbe2b691167f1c18d1d451b50573 (diff)
[android] Fixed review notes
Diffstat (limited to 'android')
-rw-r--r--android/src/com/mapswithme/maps/bookmarks/BookmarkListAdapter.java2
-rw-r--r--android/src/com/mapswithme/maps/bookmarks/Holders.java18
2 files changed, 11 insertions, 9 deletions
diff --git a/android/src/com/mapswithme/maps/bookmarks/BookmarkListAdapter.java b/android/src/com/mapswithme/maps/bookmarks/BookmarkListAdapter.java
index 71563db8f8..795a6f980d 100644
--- a/android/src/com/mapswithme/maps/bookmarks/BookmarkListAdapter.java
+++ b/android/src/com/mapswithme/maps/bookmarks/BookmarkListAdapter.java
@@ -26,7 +26,7 @@ import static com.mapswithme.maps.bookmarks.Holders.BaseBookmarkHolder.getDescSe
import static com.mapswithme.maps.bookmarks.Holders.BaseBookmarkHolder.getTracksSectionPosition;
import static com.mapswithme.maps.bookmarks.Holders.BaseBookmarkHolder.isSectionEmpty;
import static com.mapswithme.maps.bookmarks.Holders.BookmarkViewHolder.calculateBookmarkPosition;
-import static com.mapswithme.maps.bookmarks.Holders.BookmarkViewHolder.calculateTrackPosition;
+import static com.mapswithme.maps.bookmarks.Holders.BaseBookmarkHolder.calculateTrackPosition;
public class BookmarkListAdapter extends RecyclerView.Adapter<Holders.BaseBookmarkHolder>
{
diff --git a/android/src/com/mapswithme/maps/bookmarks/Holders.java b/android/src/com/mapswithme/maps/bookmarks/Holders.java
index b1f50b9aa1..58bf78ba08 100644
--- a/android/src/com/mapswithme/maps/bookmarks/Holders.java
+++ b/android/src/com/mapswithme/maps/bookmarks/Holders.java
@@ -223,6 +223,13 @@ public class Holders
abstract void bind(int position);
+ static int calculateTrackPosition(@NonNull BookmarkCategory category, int position)
+ {
+ return position
+ - (isSectionEmpty(category, SECTION_TRACKS) ? 0 : 1)
+ - getDescItemCount(category);
+ }
+
static boolean isSectionEmpty(@NonNull BookmarkCategory category, @Section int section)
{
switch (section)
@@ -356,13 +363,8 @@ public class Holders
// Since bookmarks are always below tracks and header we should take it into account
// during the bookmark's position calculation.
return calculateTrackPosition(category, position)
- - (isSectionEmpty(category, SECTION_BMKS) ? 0 : 1)
- - category.getTracksCount();
- }
-
- static int calculateTrackPosition(@NonNull BookmarkCategory category, int position)
- {
- return position - (isSectionEmpty(category, SECTION_TRACKS) ? 0 : 1) - getDescItemCount(category);
+ - category.getTracksCount()
+ - (isSectionEmpty(category, SECTION_BMKS) ? 0 : 1);
}
}
@@ -386,7 +388,7 @@ public class Holders
@Override
void bind(int position)
{
- int relativePos = BookmarkViewHolder.calculateTrackPosition(mCategory, position);
+ int relativePos = calculateTrackPosition(mCategory, position);
final long trackId = BookmarkManager.INSTANCE.getTrackIdByPosition(mCategory.getId(), relativePos);
Track track = BookmarkManager.INSTANCE.getTrack(trackId);
mName.setText(track.getName());