}
allSearchAdapter.notifyDataSetChanged();
allCountryAdapter.notifyDataSetChanged();
}
// --------------------- Methods public ----------------------
public void toDownloadPage()
{
viewpager.setCurrentItem(0);
}
// --------------------- Methods private ---------------------
private void initViews()
{
// TODO
viewpager = (ViewPager) findViewById(R.id.viewpager);
pagertab = (PagerTabStrip) findViewById(R.id.pagertab);
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
推荐阅读
- mp3播放器html代码,html 音频播放器
- gis等值线赋值,gis怎么生成等值线
- jquery五子棋下棋计算,js五子棋算法
- 游戏竞技乐园酒店,竞技主题娱乐公园
- python函数点 python 函数
- wordpress进度条源码,进度条html
- 上海食品公司代理记账软件,上海小型食品代加工厂
- erp网店系统多少钱一套,erp系统大概多少钱
- php中的常用数据类型 php中的常用数据类型是什么