add check for shown groups

This commit is contained in:
Chumva 2018-04-17 12:46:05 +03:00
parent c41238fdb1
commit 429aeeb403
3 changed files with 16 additions and 8 deletions

View file

@ -4,7 +4,6 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants"
android:orientation="vertical">
<ImageView
@ -24,9 +23,9 @@
android:orientation="vertical">
<LinearLayout
android:background="?attr/selectableItemBackground"
android:layout_width="match_parent"
android:layout_height="@dimen/map_button_shadow_width"
android:background="?attr/selectableItemBackground">
android:layout_height="@dimen/map_button_shadow_width">
<ImageButton
android:id="@+id/icon_left"

View file

@ -1219,6 +1219,7 @@ public class MapMarkersHelper {
private long creationDate;
private boolean disabled;
private boolean visible = true;
private boolean wasShown = false;
private boolean visibleUntilRestart;
private List<MapMarker> markers = new ArrayList<>();
// TODO should be removed from this class:
@ -1269,6 +1270,14 @@ public class MapMarkersHelper {
return visible;
}
public boolean wasShown() {
return wasShown;
}
public void setWasShown(boolean wasShown) {
this.wasShown = wasShown;
}
public void setVisibleUntilRestart(boolean visibleUntilRestart) {
this.visibleUntilRestart = visibleUntilRestart;
}

View file

@ -439,10 +439,11 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
final MapMarkersHelper mapMarkersHelper = app.getMapMarkersHelper();
final GPXFile[] gpxFile = new GPXFile[1];
boolean disabled = !enabled;
if (groupIsDisabled) {
String m = group.getGpxPath();
if (groupIsDisabled&&!group.wasShown()) {
group.setWasShown(true);
Bundle args = new Bundle();
args.putString(SelectWptCategoriesBottomSheetDialogFragment.GPX_FILE_PATH_KEY, m);
args.putString(SelectWptCategoriesBottomSheetDialogFragment.GPX_FILE_PATH_KEY, group.getGpxPath());
args.putBoolean(SelectWptCategoriesBottomSheetDialogFragment.UPDATE_CATEGORIES_KEY, true);
SelectWptCategoriesBottomSheetDialogFragment fragment = new SelectWptCategoriesBottomSheetDialogFragment();
@ -523,8 +524,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
if (header instanceof MapMarkersHelper.CategoriesHeader) {
final MapMarkersHelper.CategoriesHeader groupHeader = (MapMarkersHelper.CategoriesHeader) header;
final MapMarkersGroup group = groupHeader.getGroup();
categoriesViewHolder.icon.setImageDrawable(iconsCache.getIcon(groupHeader.getIconRes()));
categoriesViewHolder.icon.setImageDrawable(iconsCache.getIcon(groupHeader.getIconRes(), R.color.divider_color));
categoriesViewHolder.title.setText(group.getWptCategoriesString());
categoriesViewHolder.itemView.setOnClickListener(new View.OnClickListener() {
@Override