forked from organicmaps/organicmaps
[android] Modified hide/show btn
This commit is contained in:
parent
f26d10cde8
commit
9b8d7a5726
2 changed files with 31 additions and 1 deletions
|
@ -1,5 +1,7 @@
|
|||
package com.mapswithme.maps.bookmarks.data;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.annotation.IntDef;
|
||||
import androidx.annotation.IntRange;
|
||||
import androidx.annotation.MainThread;
|
||||
|
@ -465,6 +467,17 @@ public enum BookmarkManager
|
|||
mOnElevationActivePointChangedListener.onElevationActivePointChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public BookmarkCategory getCategoryByServerId(@NonNull String guideId)
|
||||
{
|
||||
List<BookmarkCategory> items = getAllCategoriesSnapshot().getItems();
|
||||
for (BookmarkCategory each : items)
|
||||
if (TextUtils.equals(each.getServerId(), guideId))
|
||||
return each;
|
||||
|
||||
throw new IllegalArgumentException("Guide id not found : " + guideId);
|
||||
}
|
||||
|
||||
public boolean isVisible(long catId)
|
||||
{
|
||||
return nativeIsVisible(catId);
|
||||
|
|
|
@ -25,6 +25,8 @@ import com.bumptech.glide.Glide;
|
|||
import com.bumptech.glide.request.target.BitmapImageViewTarget;
|
||||
import com.mapswithme.HotelUtils;
|
||||
import com.mapswithme.maps.R;
|
||||
import com.mapswithme.maps.bookmarks.data.BookmarkCategory;
|
||||
import com.mapswithme.maps.bookmarks.data.BookmarkManager;
|
||||
import com.mapswithme.maps.guides.GuidesGallery;
|
||||
import com.mapswithme.maps.promo.PromoCityGallery;
|
||||
import com.mapswithme.maps.promo.PromoEntity;
|
||||
|
@ -608,8 +610,13 @@ public class Holders
|
|||
|
||||
private void toggleBoughtContentBtnVisibility()
|
||||
{
|
||||
int index = getAdapterPosition();
|
||||
/* int index = getAdapterPosition();
|
||||
GuidesGallery.Item item = mItems.get(index);
|
||||
BookmarkCategory category =
|
||||
BookmarkManager.INSTANCE.getCategoryByServerId(item.getGuideId());
|
||||
boolean isVisible = category.isVisible();
|
||||
BookmarkManager.INSTANCE.setVisibility(category.getId(), !isVisible);
|
||||
mBoughtContentBtn.setText(!isVisible ? R.string.hide : R.string.show);*/
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -628,7 +635,10 @@ public class Holders
|
|||
UiUtils.showIf(item.isDownloaded(), mBoughtContent, mBoughtContentCheckbox);
|
||||
|
||||
if (item.isDownloaded())
|
||||
{
|
||||
bindBoughtContentBlock(item);
|
||||
return;
|
||||
}
|
||||
|
||||
boolean isCity = item.getGuideType() == GuidesGallery.Type.City;
|
||||
if (isCity)
|
||||
|
@ -637,6 +647,13 @@ public class Holders
|
|||
bindOutdoorBlock(item);
|
||||
}
|
||||
|
||||
private void bindBoughtContentBlock(@NonNull GuidesGallery.Item item)
|
||||
{
|
||||
/* BookmarkCategory category =
|
||||
BookmarkManager.INSTANCE.getCategoryByServerId(item.getGuideId());
|
||||
mBoughtContentBtn.setText(category.isVisible() ? R.string.hide : R.string.show);*/
|
||||
}
|
||||
|
||||
private void bindOutdoorBlock(@NonNull GuidesGallery.Item item)
|
||||
{
|
||||
UiUtils.show(mOutdoorContent);
|
||||
|
|
Loading…
Add table
Reference in a new issue