Fixed bug with address search adapter cast

This commit is contained in:
Bars107 2015-01-13 13:22:16 +02:00
parent 82b7f18df1
commit 51de6682fd
2 changed files with 7 additions and 2 deletions

View file

@ -5,6 +5,7 @@ import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.AdapterView;
import android.widget.HeaderViewListAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;
import net.osmand.plus.OsmandApplication;
@ -82,7 +83,12 @@ public abstract class OsmandListActivity extends
}
public ListAdapter getListAdapter() {
return ((ListView)findViewById(android.R.id.list)).getAdapter();
ListAdapter adapter = getListView().getAdapter();
if (adapter instanceof HeaderViewListAdapter) {
return ((HeaderViewListAdapter)adapter).getWrappedAdapter();
} else {
return adapter;
}
}
public void setOnItemClickListener(AdapterView.OnItemClickListener childClickListener){

View file

@ -335,7 +335,6 @@ public abstract class SearchByNameAbstractActivity<T> extends OsmandListActivity
}
}
@SuppressWarnings("unchecked")
@Override
public NamesAdapter getListAdapter() {
return (NamesAdapter) super.getListAdapter();