Give toast with no updates
This commit is contained in:
parent
944dc7f723
commit
a23ca5a61e
2 changed files with 44 additions and 40 deletions
|
@ -1,5 +1,38 @@
|
|||
package net.osmand.plus.download;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.Collator;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.osmand.IProgress;
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.LocalIndexHelper;
|
||||
import net.osmand.plus.activities.LocalIndexHelper.LocalIndexType;
|
||||
import net.osmand.plus.activities.LocalIndexInfo;
|
||||
import net.osmand.plus.activities.OsmandBaseExpandableListAdapter;
|
||||
import net.osmand.plus.activities.OsmandExpandableListFragment;
|
||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||
import net.osmand.plus.helpers.FileNameTranslationHelper;
|
||||
import net.osmand.plus.resources.IncrementalChangesManager;
|
||||
import net.osmand.plus.resources.IncrementalChangesManager.IncrementalUpdate;
|
||||
import net.osmand.plus.resources.IncrementalChangesManager.IncrementalUpdateList;
|
||||
import net.osmand.util.Algorithms;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.AlertDialog.Builder;
|
||||
|
@ -36,41 +69,6 @@ import android.widget.ImageView;
|
|||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import net.osmand.IProgress;
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.LocalIndexHelper;
|
||||
import net.osmand.plus.activities.LocalIndexHelper.LocalIndexType;
|
||||
import net.osmand.plus.activities.LocalIndexInfo;
|
||||
import net.osmand.plus.activities.OsmandBaseExpandableListAdapter;
|
||||
import net.osmand.plus.activities.OsmandExpandableListFragment;
|
||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||
import net.osmand.plus.helpers.FileNameTranslationHelper;
|
||||
import net.osmand.plus.resources.IncrementalChangesManager;
|
||||
import net.osmand.plus.resources.IncrementalChangesManager.IncrementalUpdate;
|
||||
import net.osmand.plus.resources.IncrementalChangesManager.IncrementalUpdateList;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.Collator;
|
||||
import java.text.MessageFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
||||
|
@ -1201,11 +1199,15 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
|||
Toast.makeText(getDownloadActivity(), result.errorMessage, Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
List<IncrementalUpdate> ll = result.getItemsForUpdate();
|
||||
for (IncrementalUpdate iu : ll) {
|
||||
IndexItem ii = new IndexItem(iu.fileName, "Incremental update", iu.timestamp, iu.sizeText,
|
||||
iu.contentSize, iu.containerSize, DownloadActivityType.LIVE_UPDATES_FILE);
|
||||
getDownloadActivity().addToDownload(ii);
|
||||
getDownloadActivity().updateDownloadButton();
|
||||
if(ll.isEmpty()) {
|
||||
Toast.makeText(getDownloadActivity(), R.string.no_updates_available, Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
for (IncrementalUpdate iu : ll) {
|
||||
IndexItem ii = new IndexItem(iu.fileName, "Incremental update", iu.timestamp, iu.sizeText,
|
||||
iu.contentSize, iu.containerSize, DownloadActivityType.LIVE_UPDATES_FILE);
|
||||
getDownloadActivity().addToDownload(ii);
|
||||
getDownloadActivity().updateDownloadButton();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ public class IncrementalChangesManager {
|
|||
resourceManager.closeFile(ru.file.getName());
|
||||
regionUpdateFiles.monthUpdates.remove(month);
|
||||
ru.file.delete();
|
||||
log.info("Delete overlapping month update " + ru.file.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,6 +63,7 @@ public class IncrementalChangesManager {
|
|||
resourceManager.closeFile(ru.file.getName());
|
||||
it.remove();
|
||||
ru.file.delete();
|
||||
log.info("Delete overlapping day update " + ru.file.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue