LayoutInflater inf = LayoutInflater.from(this);
View v1 = inf.inflate(R.layout.view_offline_download, null, false);
svDown = (MySearchView) v1.findViewById(R.id.svDown);
lvDown = (ListView) v1.findViewById(R.id.lvDown);
views.add(v1);
View v2 = inf.inflate(R.layout.view_offline_countrys, null, false);
svAll = (MySearchView) v2.findViewById(R.id.svAll);
lvWholeCountry = (ExpandableListView) v2.findViewById(R.id.lvWholeCountry);
lvSearchResult = (ListView) v2.findViewById(R.id.lvSearchResult);
views.add(v2);
titles.add("下载管理");
titles.add("城市列表");
pagertab.setTabIndicatorColor(0xff00cccc);
pagertab.setDrawFullUnderline(false);
pagertab.setBackgroundColor(0xFF38B0DE);
pagertab.setTextSpacing(50);
viewpager.setOffscreenPageLimit(2);
viewpager.setAdapter(new MyPagerAdapter());
svDown.setSearchListener(new MySearchView.SearchListener()
{
@Override
public void afterTextChanged(Editable text)
{
refreshDownList();
}
@Override
public void search(String text)
{
}
});
svAll.setSearchListener(new MySearchView.SearchListener()
{
@Override
public void afterTextChanged(Editable text)
{
refreshAllSearchList();
}
@Override
public void search(String text)
{
}
});
downAdapter = new OfflineMapManagerAdapter(this, mOffline, this);
lvDown.setAdapter(downAdapter);
allSearchAdapter = new OfflineMapAdapter(this, mOffline, this);
lvSearchResult.setAdapter(allSearchAdapter);
allCountryAdapter = new OfflineExpandableListAdapter(this, mOffline, this);
lvWholeCountry.setAdapter(allCountryAdapter);
lvWholeCountry.setGroupIndicator(null);
}
/**
* 刷新下载列表, 根据搜索关键字及itemsDown 下载管理数量变动时调用
*/
private void refreshDownList()
{
String key = svDown.getInputText();
if (key == null || key.length()1)
{
downAdapter.setDatas(itemsDown);
}
else
{
ListOfflineMapItem filterList = new ArrayListOfflineMapItem();
if (itemsDown != null!itemsDown.isEmpty())
{
for (OfflineMapItem i : itemsDown)
{
if (i.getCityName().contains(key))
{
filterList.add(i);
}
}
}
downAdapter.setDatas(filterList);
}
}
/**
* 刷新所有城市搜索结果
*/
private void refreshAllSearchList()
{
String key = svAll.getInputText();
if (key == null || key.length()1)
{
lvSearchResult.setVisibility(View.GONE);
lvWholeCountry.setVisibility(View.VISIBLE);
allSearchAdapter.setDatas(null);
}
else
{
lvSearchResult.setVisibility(View.VISIBLE);
lvWholeCountry.setVisibility(View.GONE);
ListOfflineMapItem filterList = new ArrayListOfflineMapItem();
if (itemsAll != null!itemsAll.isEmpty())
{
for (OfflineMapItem i : itemsAll)
{
if (i.getCityName().contains(key))
{
filterList.add(i);
}
}
}
allSearchAdapter.setDatas(filterList);
}
}
private void loadData()
{
new CsqBackgroundTaskVoid(this)
{
@Override
protected Void onRun()
{
// TODO Auto-generated method stub
// 导入离线地图包
// 将从下载的离线包解压,把vmp文件夹拷入SD卡根目录下的BaiduMapSdk文件夹内 。
// 把网站上下载的文件解压 , 将\BaiduMap\vmp\l里面的.dat_svc文件,拷贝到手机BaiduMapSDK/vmp/h目录下
int num = mOffline.importOfflineData();
if (num0)
{
ToastUtil.showToastInfo(BaiduOfflineMapActivity.this, "成功导入" + num + "个离线包", false);
}
ListMKOLSearchRecord all = null;
推荐阅读
- 学习后的ppt如何做,ppt制作学习
- ios如何读取rbxs文件,如何读取iphone文件
- 小小诗直播录屏,小度小小诗
- 浏览量php数据库 php网页数据库
- sqlserver数据库mdf恢复,mdf sql 恢复数据库
- 儿童游戏策划角色扮演方案,儿童角色扮演游戏的作用
- 移动硬盘怎么读取系统,移动硬盘如何读取
- linux下命令执行方式 linux执行指令
- sqlserver获取字段长度函数,sqlserver数据库修改字段长度