Update indexes
This commit is contained in:
parent
d66031f4d7
commit
654f6c37df
2 changed files with 9 additions and 4 deletions
|
@ -2016,7 +2016,7 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A
|
||||||
<string name="confirm_download_roadmaps">Are you sure you want to download map of roads, even though you have full map?</string>
|
<string name="confirm_download_roadmaps">Are you sure you want to download map of roads, even though you have full map?</string>
|
||||||
<string name="value_downloaded_from_max">%1$.1f from %2$.1f MB</string>
|
<string name="value_downloaded_from_max">%1$.1f from %2$.1f MB</string>
|
||||||
<string name="file_size_in_mb">%.1f MB</string>
|
<string name="file_size_in_mb">%.1f MB</string>
|
||||||
<string name="update_all">Update all(%1$s Mb)</string>
|
<string name="update_all">Update all (%1$s MB)</string>
|
||||||
<string name="free_downloads_used">Free downloads used</string>
|
<string name="free_downloads_used">Free downloads used</string>
|
||||||
<string name="free_downloads_used_description">You can set how many free downloads you have used</string>
|
<string name="free_downloads_used_description">You can set how many free downloads you have used</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -50,6 +50,7 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download
|
||||||
@Override
|
@Override
|
||||||
public void downloadHasFinished() {
|
public void downloadHasFinished() {
|
||||||
invalidateListView();
|
invalidateListView();
|
||||||
|
updateUpdateAllButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -60,6 +61,7 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download
|
||||||
@Override
|
@Override
|
||||||
public void newDownloadIndexes() {
|
public void newDownloadIndexes() {
|
||||||
invalidateListView();
|
invalidateListView();
|
||||||
|
updateUpdateAllButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void invalidateListView() {
|
public void invalidateListView() {
|
||||||
|
@ -82,15 +84,17 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download
|
||||||
.compareTo(indexItem2.getVisibleName(getMyApplication(), osmandRegions));
|
.compareTo(indexItem2.getVisibleName(getMyApplication(), osmandRegions));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
updateUpdateAllButton(indexes.getItemsToUpdate());
|
|
||||||
setListAdapter(listAdapter);
|
setListAdapter(listAdapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateUpdateAllButton(final List<IndexItem> indexItems) {
|
private void updateUpdateAllButton() {
|
||||||
|
|
||||||
View view = getView();
|
View view = getView();
|
||||||
if (getView() == null) {
|
if (view == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
DownloadResources indexes = getMyActivity().getDownloadThread().getIndexes();
|
||||||
|
final List<IndexItem> indexItems = indexes.getItemsToUpdate();
|
||||||
final TextView updateAllButton = (TextView) view.findViewById(R.id.updateAllButton);
|
final TextView updateAllButton = (TextView) view.findViewById(R.id.updateAllButton);
|
||||||
if (indexItems.size() == 0 || indexItems.get(0).getType() == null) {
|
if (indexItems.size() == 0 || indexItems.get(0).getType() == null) {
|
||||||
updateAllButton.setVisibility(View.GONE);
|
updateAllButton.setVisibility(View.GONE);
|
||||||
|
@ -114,6 +118,7 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
updateUpdateAllButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue