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="value_downloaded_from_max">%1$.1f from %2$.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_description">You can set how many free downloads you have used</string>
|
||||
</resources>
|
||||
|
|
|
@ -50,6 +50,7 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download
|
|||
@Override
|
||||
public void downloadHasFinished() {
|
||||
invalidateListView();
|
||||
updateUpdateAllButton();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -60,6 +61,7 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download
|
|||
@Override
|
||||
public void newDownloadIndexes() {
|
||||
invalidateListView();
|
||||
updateUpdateAllButton();
|
||||
}
|
||||
|
||||
public void invalidateListView() {
|
||||
|
@ -82,15 +84,17 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download
|
|||
.compareTo(indexItem2.getVisibleName(getMyApplication(), osmandRegions));
|
||||
}
|
||||
});
|
||||
updateUpdateAllButton(indexes.getItemsToUpdate());
|
||||
setListAdapter(listAdapter);
|
||||
}
|
||||
|
||||
private void updateUpdateAllButton(final List<IndexItem> indexItems) {
|
||||
private void updateUpdateAllButton() {
|
||||
|
||||
View view = getView();
|
||||
if (getView() == null) {
|
||||
if (view == null) {
|
||||
return;
|
||||
}
|
||||
DownloadResources indexes = getMyActivity().getDownloadThread().getIndexes();
|
||||
final List<IndexItem> indexItems = indexes.getItemsToUpdate();
|
||||
final TextView updateAllButton = (TextView) view.findViewById(R.id.updateAllButton);
|
||||
if (indexItems.size() == 0 || indexItems.get(0).getType() == null) {
|
||||
updateAllButton.setVisibility(View.GONE);
|
||||
|
@ -114,6 +118,7 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download
|
|||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
updateUpdateAllButton();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue