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);
|
||||
}
|
||||
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 description = (TextView) row.findViewById(R.id.download_descr);
|
||||
IndexItem e = (IndexItem) getChild(groupPosition, childPosition);
|
||||
|
|
|
@ -67,7 +67,8 @@ public class DownloadIndexFragment extends OsmandExpandableListFragment {
|
|||
listView.setAdapter(listAdapter);
|
||||
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
|
||||
|
||||
filterText = (EditText) view.findViewById(R.id.search_box);
|
||||
|
@ -331,7 +332,7 @@ public class DownloadIndexFragment extends OsmandExpandableListFragment {
|
|||
|
||||
@Override
|
||||
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);
|
||||
|
||||
if(ch.isChecked()){
|
||||
|
|
|
@ -103,6 +103,7 @@ public class DownloadIndexesThread {
|
|||
app.getResourceManager().getBackupIndexes(indexFileNames);
|
||||
this.indexFileNames = indexFileNames;
|
||||
this.indexActivatedFileNames = indexActivatedFileNames;
|
||||
//updateFilesToDownload();
|
||||
}
|
||||
|
||||
public Map<String, String> getDownloadedIndexFileNames() {
|
||||
|
@ -504,7 +505,7 @@ public class DownloadIndexesThread {
|
|||
DownloadIndexAdapter a = ((DownloadIndexAdapter) uiFragment.getExpandableListAdapter());
|
||||
a.setLoadedFiles(indexActivatedFileNames, indexFileNames);
|
||||
a.setIndexFiles(filtered, cats);
|
||||
prepareFilesToDownload(filtered);
|
||||
prepareFilesToUpdate(filtered);
|
||||
a.notifyDataSetChanged();
|
||||
a.getFilter().filter(uiFragment.getFilterText());
|
||||
if ((type == DownloadActivityType.SRTM_COUNTRY_FILE || type == DownloadActivityType.HILLSHADE_FILE)
|
||||
|
@ -545,7 +546,17 @@ public class DownloadIndexesThread {
|
|||
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();
|
||||
for (IndexItem item : filtered) {
|
||||
String sfName = item.getTargetFileName();
|
||||
|
|
|
@ -461,6 +461,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
|||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
|
||||
ActionBar actionBar = getDownloadActivity().getSupportActionBar();
|
||||
//hide action bar from downloadindexfragment
|
||||
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
|
||||
|
@ -508,16 +509,13 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
|||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
// if(operationTask == null || operationTask.getStatus() == Status.FINISHED){
|
||||
// menu.setGroupVisible(0, true);
|
||||
// } else {
|
||||
// menu.setGroupVisible(0, false);
|
||||
// }
|
||||
// }
|
||||
if(operationTask == null || operationTask.getStatus() == AsyncTask.Status.FINISHED){
|
||||
menu.setGroupVisible(0, true);
|
||||
} else {
|
||||
menu.setGroupVisible(0, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
|
@ -640,8 +638,6 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
|
|||
descriptionText.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void localOptionsMenu(final int itemId) {
|
||||
if (itemId == R.string.local_index_download) {
|
||||
asyncLoader.setResult(null);
|
||||
|
|
Loading…
Reference in a new issue