use of com.xiecc.seeWeather.modules.city.adapter.CityAdapter in project SeeWeather by xcc3641.
the class ChoiceCityActivity method initRecyclerView.
private void initRecyclerView() {
mRecyclerview.setLayoutManager(new LinearLayoutManager(this));
mRecyclerview.setHasFixedSize(true);
//mRecyclerview.setItemAnimator(new FadeInUpAnimator());
mAdapter = new CityAdapter(this, dataList);
mRecyclerview.setAdapter(mAdapter);
mAdapter.setOnItemClickListener((view, pos) -> {
if (currentLevel == LEVEL_PROVINCE) {
selectedProvince = provincesList.get(pos);
mRecyclerview.smoothScrollToPosition(0);
queryCities();
} else if (currentLevel == LEVEL_CITY) {
String city = Util.replaceCity(cityList.get(pos).CityName);
if (isChecked) {
OrmLite.getInstance().save(new CityORM(city));
RxBus.getDefault().post(new MultiUpdate());
PLog.d("是多城市管理模式");
} else {
SharedPreferenceUtil.getInstance().setCityName(city);
RxBus.getDefault().post(new ChangeCityEvent());
}
quit();
}
});
}
Aggregations