RAdd group

This commit is contained in:
Victor Shcherb 2018-04-15 22:54:35 +02:00
parent 899941c2fc
commit 05da1a3b75

View file

@ -8,6 +8,7 @@ import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import net.osmand.AndroidUtils;
import net.osmand.IndexConstants;
import net.osmand.PlatformUtil;
import net.osmand.data.FavouritePoint;
import net.osmand.data.LatLon;
import net.osmand.data.LocationPoint;
@ -38,6 +39,8 @@ import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.apache.commons.logging.Log;
import static net.osmand.data.PointDescription.POINT_TYPE_MAP_MARKER;
public class MapMarkersHelper {
@ -48,8 +51,11 @@ public class MapMarkersHelper {
public static final int BY_DISTANCE_DESC = 1;
public static final int BY_DISTANCE_ASC = 2;
public static final int BY_DATE_ADDED_DESC = 3;
public static final int BY_DATE_ADDED_ASC = 4;
private static final Log LOG = PlatformUtil.getLog(MapMarkersHelper.class);
@Retention(RetentionPolicy.SOURCE)
@IntDef({BY_NAME, BY_DISTANCE_DESC, BY_DISTANCE_ASC, BY_DATE_ADDED_DESC, BY_DATE_ADDED_ASC})
public @interface MapMarkersSortByDef {
@ -318,7 +324,7 @@ public class MapMarkersHelper {
} else if (group.isDisabled()) {
updateGroupDisabled(group, false);
}
runSynchronization(group);
runSynchronization(group, true);
}
private void addHistoryMarkersToGroup(@NonNull MapMarkersGroup group) {
@ -508,7 +514,8 @@ public class MapMarkersHelper {
for (TravelArticle art : savedArticles) {
String gpxName = travelDbHelper.getGPXName(art);
File path = ctx.getAppPath(IndexConstants.GPX_TRAVEL_DIR + gpxName);
MapMarkersGroup group = getOrCreateGroup(new File(path.getAbsolutePath()));
LOG.debug("Article group " + path.getAbsolutePath() + " " + path.exists()) ;
MapMarkersGroup group = getOrCreateGroup(path);
if (!isGroupSynced(group.getId())) {
group.disabled = true;
createHeaderInGroup(group);