Do not show disabled markers on map

This commit is contained in:
PavelRatushny 2017-09-22 18:41:45 +03:00
parent c3931c7145
commit 325c7a387f
3 changed files with 6 additions and 4 deletions

View file

@ -646,6 +646,7 @@ public class MapMarkersHelper {
if (id != null) {
markersDbHelper.updateSyncGroupDisabled(id, disabled);
}
loadMarkers();
}
public void removeActiveMarkersFromSyncGroup(String syncGroupId) {

View file

@ -361,8 +361,8 @@ public class MapMarkersDbHelper {
SQLiteConnection db = openConnection(true);
if (db != null) {
try {
SQLiteCursor query = db.rawQuery(MARKERS_TABLE_SELECT + " WHERE " + MARKERS_COL_ACTIVE + " = ?",
new String[]{String.valueOf(1)});
SQLiteCursor query = db.rawQuery(MARKERS_TABLE_SELECT + " WHERE " + MARKERS_COL_ACTIVE + " = ? " + "AND " + MARKERS_COL_DISABLED + " = ?",
new String[]{String.valueOf(1), String.valueOf(0)});
if (query.moveToFirst()) {
do {
MapMarker marker = readItem(query);
@ -502,8 +502,8 @@ public class MapMarkersDbHelper {
SQLiteConnection db = openConnection(true);
if (db != null) {
try {
SQLiteCursor query = db.rawQuery(MARKERS_TABLE_SELECT + " WHERE " + MARKERS_COL_ACTIVE + " = ?",
new String[]{String.valueOf(0)});
SQLiteCursor query = db.rawQuery(MARKERS_TABLE_SELECT + " WHERE " + MARKERS_COL_ACTIVE + " = ? " + "AND " + MARKERS_COL_DISABLED + " = ?",
new String[]{String.valueOf(0), String.valueOf(0)});
if (query.moveToFirst()) {
do {
markers.add(readItem(query));

View file

@ -313,6 +313,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
headerViewHolder.iconSpace.setVisibility(View.GONE);
headerViewHolder.icon.setImageDrawable(iconsCache.getIcon(groupHeader.getIconRes(), R.color.divider_color));
boolean groupIsDisabled = groupHeader.getGroup().isDisabled();
headerViewHolder.disableGroupSwitch.setVisibility(View.VISIBLE);
headerViewHolder.disableGroupSwitch.setChecked(!groupIsDisabled);
headerViewHolder.disableGroupSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override