コード例 #1
0
 private void startUpdateWeather() {
   mUpdateWeather.setImageResource(0x7f02014f);
   isUpdating = true;
   if (mUpdateCallbackImpl == null) mUpdateCallbackImpl = new UpdateCallbackImpl();
   WeatherPublisher.getInstance().unSubscribe(mUpdateCallbackImpl);
   WeatherPublisher.getInstance().subscribe(mUpdateCallbackImpl);
   if (mWeatherUpdater == null) mWeatherUpdater = AbstractWeatherUpdater.createInstance();
   mWeatherUpdater.update(Gl.getCurrentCityIndex());
   WeatherData.getCityInfo(Gl.getCurrentCityIndex()).mShowType =
       com.moji.mjweather.data.CityWeatherInfo.ShowType.ST_UPDATING;
   mUpdateLayout.setVisibility(0);
   if (mPublicTextView != null) mPublicTextView.setVisibility(8);
 }
コード例 #2
0
 private void cancelUpdateWeather(CityWeatherInfo cityweatherinfo, boolean flag) {
   if (cityweatherinfo == null)
     cityweatherinfo = WeatherData.getCityInfo(Gl.getCurrentCityIndex());
   mUpdateWeather.setImageResource(0x7f02014e);
   isUpdating = false;
   Gl.setIsLocationbyGPS(false);
   if (mWeatherUpdater != null) mWeatherUpdater.cancel();
   if (mUpdateCallbackImpl != null)
     WeatherPublisher.getInstance().unSubscribe(mUpdateCallbackImpl);
   mUpdateLayout.setVisibility(8);
   if (mPublicTextView != null) mPublicTextView.setVisibility(0);
   if (cityweatherinfo.mShowType == com.moji.mjweather.data.CityWeatherInfo.ShowType.ST_UPDATING)
     if (cityweatherinfo.m_lastUpdateTime.length() <= 0)
       cityweatherinfo.mShowType =
           com.moji.mjweather.data.CityWeatherInfo.ShowType.ST_NEED_BE_UPDATE;
     else cityweatherinfo.mShowType = com.moji.mjweather.data.CityWeatherInfo.ShowType.ST_OK;
   if (flag) Toast.makeText(this, 0x7f0b0039, 0).show();
 }