Search in sources :

Example 1 with MultiUpdateEvent

use of com.xiecc.seeWeather.modules.main.domain.MultiUpdateEvent in project SeeWeather by xcc3641.

the class ChoiceCityActivity method initRecyclerView.

private void initRecyclerView() {
    mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
    mRecyclerView.setHasFixedSize(true);
    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).mCityName);
            if (isChecked) {
                OrmLite.getInstance().save(new CityORM(city));
                RxBus.getDefault().post(new MultiUpdateEvent());
            } else {
                SharedPreferenceUtil.getInstance().setCityName(city);
                RxBus.getDefault().post(new ChangeCityEvent());
            }
            quit();
        }
    });
}
Also used : CityORM(com.xiecc.seeWeather.modules.main.domain.CityORM) MultiUpdateEvent(com.xiecc.seeWeather.modules.main.domain.MultiUpdateEvent) CityAdapter(com.xiecc.seeWeather.modules.city.adapter.CityAdapter) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) ChangeCityEvent(com.xiecc.seeWeather.modules.main.domain.ChangeCityEvent)

Aggregations

LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 CityAdapter (com.xiecc.seeWeather.modules.city.adapter.CityAdapter)1 ChangeCityEvent (com.xiecc.seeWeather.modules.main.domain.ChangeCityEvent)1 CityORM (com.xiecc.seeWeather.modules.main.domain.CityORM)1 MultiUpdateEvent (com.xiecc.seeWeather.modules.main.domain.MultiUpdateEvent)1