Do not close Define view dialog
This commit is contained in:
parent
69183b57df
commit
0598389eb5
3 changed files with 24 additions and 9 deletions
|
@ -53,6 +53,10 @@ public class ContextMenuAdapter {
|
||||||
return selectedList.get(pos);
|
return selectedList.get(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setSelection(int pos, int s) {
|
||||||
|
selectedList.set(pos, s);
|
||||||
|
}
|
||||||
|
|
||||||
public int getImageId(int pos, boolean light) {
|
public int getImageId(int pos, boolean light) {
|
||||||
if(!light || iconListLight.get(pos) == 0) {
|
if(!light || iconListLight.get(pos) == 0) {
|
||||||
return iconList.get(pos);
|
return iconList.get(pos);
|
||||||
|
|
|
@ -60,6 +60,8 @@ import android.content.Intent;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.AdapterView.OnItemClickListener;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.CompoundButton;
|
import android.widget.CompoundButton;
|
||||||
|
@ -310,7 +312,7 @@ public class MapActivityLayers {
|
||||||
layout = R.layout.list_menu_item_native;
|
layout = R.layout.list_menu_item_native;
|
||||||
}
|
}
|
||||||
|
|
||||||
ListAdapter listAdapter = new ArrayAdapter<String>(
|
final ArrayAdapter<String> listAdapter = new ArrayAdapter<String>(
|
||||||
activity, layout, R.id.title, adapter.getItemNames()){
|
activity, layout, R.id.title, adapter.getItemNames()){
|
||||||
@Override
|
@Override
|
||||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||||
|
@ -344,20 +346,30 @@ public class MapActivityLayers {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
b.setAdapter(listAdapter, new OnClickListener() {
|
OnClickListener onClickListener = new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int position) {
|
public void onClick(DialogInterface dialog, int position) {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
b.setAdapter(listAdapter, onClickListener);
|
||||||
|
b.setPositiveButton(R.string.default_buttons_ok, null);
|
||||||
|
|
||||||
|
final AlertDialog dlg = b.create();
|
||||||
|
listener.setDialog(dlg);
|
||||||
|
dlg.setCanceledOnTouchOutside(true);
|
||||||
|
dlg.getListView().setOnItemClickListener(new OnItemClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
if(adapter.getSelection(position) >= 0) {
|
if(adapter.getSelection(position) >= 0) {
|
||||||
listener.onClick(position, !(adapter.getSelection(position) > 0));
|
listener.onClick(position, !(adapter.getSelection(position) > 0));
|
||||||
|
adapter.setSelection(position, adapter.getSelection(position) > 0 ? 0 : 1);
|
||||||
|
listAdapter.notifyDataSetInvalidated();
|
||||||
} else {
|
} else {
|
||||||
listener.onClick(position, adapter.getSelection(position) > 0);
|
listener.onClick(position, adapter.getSelection(position) > 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
final AlertDialog dlg = b.create();
|
|
||||||
listener.setDialog(dlg);
|
|
||||||
dlg.setCanceledOnTouchOutside(true);
|
|
||||||
dlg.show();
|
dlg.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,6 @@ public class SRTMPlugin extends OsmandPlugin {
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
if (itemId == R.string.layer_hillshade) {
|
if (itemId == R.string.layer_hillshade) {
|
||||||
dialog.dismiss();
|
|
||||||
HILLSHADE.set(!HILLSHADE.get());
|
HILLSHADE.set(!HILLSHADE.get());
|
||||||
updateLayers(mapView, mapActivity);
|
updateLayers(mapView, mapActivity);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue