Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
6d890873cc
2 changed files with 29 additions and 21 deletions
|
@ -1,6 +1,5 @@
|
|||
package net.osmand.plus.dashboard;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
|
@ -53,15 +52,9 @@ public class DashRecentsFragment extends DashLocationFragment {
|
|||
(view.findViewById(R.id.show_all)).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Activity activity = getActivity();
|
||||
OsmAndAppCustomization appCustomization = getMyApplication().getAppCustomization();
|
||||
|
||||
final Intent search = new Intent(activity, appCustomization.getSearchActivity());
|
||||
// search.putExtra(SearchActivity.SHOW_ONLY_ONE_TAB, true);
|
||||
search.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||
getMyApplication().getSettings().SEARCH_TAB.set(SearchActivity.HISTORY_TAB_INDEX);
|
||||
activity.startActivity(search);
|
||||
closeDashboard();
|
||||
MapActivity activity = (MapActivity) getActivity();
|
||||
activity.showQuickSearch(MapActivity.ShowQuickSearchMode.NEW, false);
|
||||
}
|
||||
});
|
||||
return view;
|
||||
|
|
|
@ -394,18 +394,9 @@ public class DownloadResources extends DownloadResourceGroup {
|
|||
}
|
||||
}
|
||||
WorldRegion downloadRegion = regions.getRegionData(regions.getFullName(o));
|
||||
if (downloadRegion == null || !isRegion || !regions.contain(o, point31x, point31y)) {
|
||||
it.remove();
|
||||
}
|
||||
List<IndexItem> otherIndexItems = new ArrayList<>(downloadThread.getIndexes().getIndexItems(downloadRegion));
|
||||
for (IndexItem indexItem : otherIndexItems) {
|
||||
if (indexItem.getType() == type
|
||||
&& !res.contains(indexItem)) {
|
||||
if (indexItem.isDownloaded()) {
|
||||
res.clear();
|
||||
return res;
|
||||
}
|
||||
res.add(indexItem);
|
||||
if (downloadRegion != null && isRegion && regions.contain(o, point31x, point31y)) {
|
||||
if (!isIndexItemDownloaded(downloadThread, type, downloadRegion, res)) {
|
||||
addIndexItem(downloadThread, type, downloadRegion, res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -413,4 +404,28 @@ public class DownloadResources extends DownloadResourceGroup {
|
|||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
private static boolean isIndexItemDownloaded(DownloadIndexesThread downloadThread, DownloadActivityType type, WorldRegion downloadRegion, List<IndexItem> res) {
|
||||
List<IndexItem> otherIndexItems = new ArrayList<>(downloadThread.getIndexes().getIndexItems(downloadRegion));
|
||||
for (IndexItem indexItem : otherIndexItems) {
|
||||
if (indexItem.getType() == type && indexItem.isDownloaded()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return downloadRegion.getSuperregion() != null
|
||||
&& isIndexItemDownloaded(downloadThread, type, downloadRegion.getSuperregion(), res);
|
||||
}
|
||||
|
||||
private static boolean addIndexItem(DownloadIndexesThread downloadThread, DownloadActivityType type, WorldRegion downloadRegion, List<IndexItem> res) {
|
||||
List<IndexItem> otherIndexItems = new ArrayList<>(downloadThread.getIndexes().getIndexItems(downloadRegion));
|
||||
for (IndexItem indexItem : otherIndexItems) {
|
||||
if (indexItem.getType() == type
|
||||
&& !res.contains(indexItem)) {
|
||||
res.add(indexItem);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return downloadRegion.getSuperregion() != null
|
||||
&& addIndexItem(downloadThread, type, downloadRegion.getSuperregion(), res);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue