fix issues
git-svn-id: https://osmand.googlecode.com/svn/trunk@665 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
parent
979f674ede
commit
64e9fd3b8b
4 changed files with 53 additions and 5 deletions
|
@ -85,7 +85,10 @@ public class DownloadIndexActivity extends ListActivity {
|
||||||
|
|
||||||
public void onTextChanged(CharSequence s, int start, int before,
|
public void onTextChanged(CharSequence s, int start, int before,
|
||||||
int count) {
|
int count) {
|
||||||
((DownloadIndexAdapter)getListAdapter()).getFilter().filter(s);
|
DownloadIndexAdapter adapter = ((DownloadIndexAdapter)getListAdapter());
|
||||||
|
if(adapter != null){
|
||||||
|
adapter.getFilter().filter(s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -494,7 +494,9 @@ public class RoutingHelper {
|
||||||
uiActivity.runOnUiThread(new Runnable() {
|
uiActivity.runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Toast.makeText(uiActivity, msg, Toast.LENGTH_SHORT).show();
|
if(uiActivity != null){
|
||||||
|
Toast.makeText(uiActivity, msg, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,12 +8,15 @@ import net.osmand.activities.MapActivity;
|
||||||
import net.osmand.activities.search.SearchHistoryHelper.HistoryEntry;
|
import net.osmand.activities.search.SearchHistoryHelper.HistoryEntry;
|
||||||
import net.osmand.osm.LatLon;
|
import net.osmand.osm.LatLon;
|
||||||
import net.osmand.osm.MapUtils;
|
import net.osmand.osm.MapUtils;
|
||||||
|
import android.app.AlertDialog;
|
||||||
import android.app.ListActivity;
|
import android.app.ListActivity;
|
||||||
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.AdapterView;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
|
@ -45,6 +48,13 @@ public class SearchHistoryActivity extends ListActivity {
|
||||||
setListAdapter(new HistoryAdapter(helper.getHistoryEntries(SearchHistoryActivity.this)));
|
setListAdapter(new HistoryAdapter(helper.getHistoryEntries(SearchHistoryActivity.this)));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
lv.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onItemLongClick(AdapterView<?> av, View v, int pos, long id) {
|
||||||
|
return SearchHistoryActivity.this.onItemLongClick(pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
|
@ -58,6 +68,32 @@ public class SearchHistoryActivity extends ListActivity {
|
||||||
setListAdapter(new HistoryAdapter(historyEntries));
|
setListAdapter(new HistoryAdapter(historyEntries));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean onItemLongClick(int pos) {
|
||||||
|
final HistoryEntry entry = ((HistoryAdapter) getListAdapter()).getItem(pos);
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(SearchHistoryActivity.this);
|
||||||
|
builder.setTitle(entry.getName());
|
||||||
|
builder.setItems(new String[] { getString(R.string.show_poi_on_map), getString(R.string.navigate_to) },
|
||||||
|
new DialogInterface.OnClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
if (which == 0) {
|
||||||
|
OsmandSettings.setMapLocationToShow(SearchHistoryActivity.this, entry.getLat(), entry.getLon());
|
||||||
|
} else if (which == 1) {
|
||||||
|
OsmandSettings.setPointToNavigate(SearchHistoryActivity.this, entry.getLat(), entry.getLon());
|
||||||
|
}
|
||||||
|
|
||||||
|
Intent newIntent = new Intent(SearchHistoryActivity.this, MapActivity.class);
|
||||||
|
startActivity(newIntent);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
builder.show();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onListItemClick(ListView l, View v, int position, long id) {
|
protected void onListItemClick(ListView l, View v, int position, long id) {
|
||||||
HistoryEntry model = ((HistoryAdapter)getListAdapter()).getItem(position);
|
HistoryEntry model = ((HistoryAdapter)getListAdapter()).getItem(position);
|
||||||
|
@ -78,7 +114,7 @@ public class SearchHistoryActivity extends ListActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View getView(int position, View convertView, ViewGroup parent) {
|
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||||
View row = convertView;
|
View row = convertView;
|
||||||
if (row == null) {
|
if (row == null) {
|
||||||
LayoutInflater inflater = getLayoutInflater();
|
LayoutInflater inflater = getLayoutInflater();
|
||||||
|
@ -108,8 +144,16 @@ public class SearchHistoryActivity extends ListActivity {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
selectModel(model);
|
selectModel(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
View.OnLongClickListener longClickListener = new View.OnLongClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onLongClick(View v) {
|
||||||
|
return onItemLongClick(position);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
distanceLabel.setOnLongClickListener(longClickListener);
|
||||||
|
label.setOnLongClickListener(longClickListener);
|
||||||
distanceLabel.setOnClickListener(clickListener);
|
distanceLabel.setOnClickListener(clickListener);
|
||||||
label.setOnClickListener(clickListener);
|
label.setOnClickListener(clickListener);
|
||||||
return row;
|
return row;
|
||||||
|
|
|
@ -210,7 +210,6 @@ public class SearchPOIActivity extends ListActivity implements SensorEventListen
|
||||||
// ListActivity has a ListView, which you can get with:
|
// ListActivity has a ListView, which you can get with:
|
||||||
ListView lv = getListView();
|
ListView lv = getListView();
|
||||||
|
|
||||||
// Then you can create a listener like so:
|
|
||||||
lv.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
|
lv.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemLongClick(AdapterView<?> av, View v, int pos, long id) {
|
public boolean onItemLongClick(AdapterView<?> av, View v, int pos, long id) {
|
||||||
|
|
Loading…
Reference in a new issue