Fixed bug when pressing on item in downloads doesnt trigger download button functionality
This commit is contained in:
parent
93cd84b751
commit
400b3263ca
4 changed files with 30 additions and 16 deletions
|
@ -236,6 +236,12 @@ public class DownloadIndexAdapter extends OsmandBaseExpandableListAdapter implem
|
||||||
v = inflater.inflate(net.osmand.plus.R.layout.download_index_list_item, parent, false);
|
v = inflater.inflate(net.osmand.plus.R.layout.download_index_list_item, parent, false);
|
||||||
}
|
}
|
||||||
final View row = v;
|
final View row = v;
|
||||||
|
row.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
downloadFragment.onChildClick(downloadFragment.getExpandableListView(), row, groupPosition, childPosition, getChildId(groupPosition, childPosition));
|
||||||
|
}
|
||||||
|
});
|
||||||
TextView item = (TextView) row.findViewById(R.id.download_item);
|
TextView item = (TextView) row.findViewById(R.id.download_item);
|
||||||
TextView description = (TextView) row.findViewById(R.id.download_descr);
|
TextView description = (TextView) row.findViewById(R.id.download_descr);
|
||||||
IndexItem e = (IndexItem) getChild(groupPosition, childPosition);
|
IndexItem e = (IndexItem) getChild(groupPosition, childPosition);
|
||||||
|
|
|
@ -67,7 +67,8 @@ public class DownloadIndexFragment extends OsmandExpandableListFragment {
|
||||||
listView.setAdapter(listAdapter);
|
listView.setAdapter(listAdapter);
|
||||||
setListView(listView);
|
setListView(listView);
|
||||||
|
|
||||||
//getSupportActionBar().setTitle(R.string.local_index_download);
|
|
||||||
|
getDownloadActivity().getSupportActionBar().setTitle(R.string.local_index_download);
|
||||||
// recreation upon rotation is pgetaprevented in manifest file
|
// recreation upon rotation is pgetaprevented in manifest file
|
||||||
|
|
||||||
filterText = (EditText) view.findViewById(R.id.search_box);
|
filterText = (EditText) view.findViewById(R.id.search_box);
|
||||||
|
@ -331,7 +332,7 @@ public class DownloadIndexFragment extends OsmandExpandableListFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
|
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
|
||||||
final IndexItem e = (IndexItem) listAdapter.getChild(groupPosition, childPosition);
|
final IndexItem e = listAdapter.getChild(groupPosition, childPosition);
|
||||||
final CheckBox ch = (CheckBox) v.findViewById(R.id.check_download_item);
|
final CheckBox ch = (CheckBox) v.findViewById(R.id.check_download_item);
|
||||||
|
|
||||||
if(ch.isChecked()){
|
if(ch.isChecked()){
|
||||||
|
|
|
@ -103,6 +103,7 @@ public class DownloadIndexesThread {
|
||||||
app.getResourceManager().getBackupIndexes(indexFileNames);
|
app.getResourceManager().getBackupIndexes(indexFileNames);
|
||||||
this.indexFileNames = indexFileNames;
|
this.indexFileNames = indexFileNames;
|
||||||
this.indexActivatedFileNames = indexActivatedFileNames;
|
this.indexActivatedFileNames = indexActivatedFileNames;
|
||||||
|
//updateFilesToDownload();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, String> getDownloadedIndexFileNames() {
|
public Map<String, String> getDownloadedIndexFileNames() {
|
||||||
|
@ -504,7 +505,7 @@ public class DownloadIndexesThread {
|
||||||
DownloadIndexAdapter a = ((DownloadIndexAdapter) uiFragment.getExpandableListAdapter());
|
DownloadIndexAdapter a = ((DownloadIndexAdapter) uiFragment.getExpandableListAdapter());
|
||||||
a.setLoadedFiles(indexActivatedFileNames, indexFileNames);
|
a.setLoadedFiles(indexActivatedFileNames, indexFileNames);
|
||||||
a.setIndexFiles(filtered, cats);
|
a.setIndexFiles(filtered, cats);
|
||||||
prepareFilesToDownload(filtered);
|
prepareFilesToUpdate(filtered);
|
||||||
a.notifyDataSetChanged();
|
a.notifyDataSetChanged();
|
||||||
a.getFilter().filter(uiFragment.getFilterText());
|
a.getFilter().filter(uiFragment.getFilterText());
|
||||||
if ((type == DownloadActivityType.SRTM_COUNTRY_FILE || type == DownloadActivityType.HILLSHADE_FILE)
|
if ((type == DownloadActivityType.SRTM_COUNTRY_FILE || type == DownloadActivityType.HILLSHADE_FILE)
|
||||||
|
@ -545,7 +546,17 @@ public class DownloadIndexesThread {
|
||||||
execute(inst, new Void[0]);
|
execute(inst, new Void[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void prepareFilesToDownload(List<IndexItem> filtered) {
|
private void updateFilesToDownload(){
|
||||||
|
for (IndexItem item : itemsToUpdate){
|
||||||
|
for (String key : indexFileNames.keySet()){
|
||||||
|
if (item.getFileName().equals(indexFileNames.get(key))){
|
||||||
|
itemsToUpdate.remove(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void prepareFilesToUpdate(List<IndexItem> filtered) {
|
||||||
itemsToUpdate.clear();
|
itemsToUpdate.clear();
|
||||||
for (IndexItem item : filtered) {
|
for (IndexItem item : filtered) {
|
||||||
String sfName = item.getTargetFileName();
|
String sfName = item.getTargetFileName();
|
||||||
|
|
|
@ -461,6 +461,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||||
|
|
||||||
ActionBar actionBar = getDownloadActivity().getSupportActionBar();
|
ActionBar actionBar = getDownloadActivity().getSupportActionBar();
|
||||||
//hide action bar from downloadindexfragment
|
//hide action bar from downloadindexfragment
|
||||||
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
|
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
|
||||||
|
@ -508,16 +509,13 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// @Override
|
if(operationTask == null || operationTask.getStatus() == AsyncTask.Status.FINISHED){
|
||||||
// public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
menu.setGroupVisible(0, true);
|
||||||
// if(operationTask == null || operationTask.getStatus() == Status.FINISHED){
|
} else {
|
||||||
// menu.setGroupVisible(0, true);
|
menu.setGroupVisible(0, false);
|
||||||
// } else {
|
}
|
||||||
// menu.setGroupVisible(0, false);
|
}
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
@ -640,8 +638,6 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
||||||
descriptionText.setMovementMethod(LinkMovementMethod.getInstance());
|
descriptionText.setMovementMethod(LinkMovementMethod.getInstance());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void localOptionsMenu(final int itemId) {
|
public void localOptionsMenu(final int itemId) {
|
||||||
if (itemId == R.string.local_index_download) {
|
if (itemId == R.string.local_index_download) {
|
||||||
asyncLoader.setResult(null);
|
asyncLoader.setResult(null);
|
||||||
|
|
Loading…
Reference in a new issue