コード例 #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
 protected void onResume() {
   super.onResume();
   MojiLog.v("WeatherMainActivity", "onResume");
   if (android.os.Build.VERSION.SDK_INT > 4)
     if (mIsFromCityView) {
       mIsFromCityView = false;
       if (mCurrentCityIdx != Gl.getCurrentCityIndex()) {
         mCurrentCityIdx = Gl.getCurrentCityIndex();
         ((ViewGroup) findViewById(0x7f0d01d7)).startAnimation(mFadeAnim);
       }
     } else {
       ((ViewGroup) findViewById(0x7f0d01d7)).startAnimation(mFadeAnim);
     }
   StatsUtil.updateStatsPv(com.moji.mjweather.util.StatsUtil.StatsPv.PV_WW);
 }
コード例 #3
0
 public void doCallback() {
   if (Gl.isChangedCity()) {
     Gl.setChangedCity(false);
     mWorkSpace.loadCityView();
   }
   mWorkSpace.setToScreen(Gl.getCurrentCityIndex());
 }
コード例 #4
0
 private void doIntentCityManager() {
   if (WeatherData.getCityInfo(Gl.getCurrentCityIndex()).mShowType
       == com.moji.mjweather.data.CityWeatherInfo.ShowType.ST_UPDATING) {
     Toast.makeText(this, 0x7f0b0041, 0).show();
   } else {
     Gl.setChangedCity(false);
     startActivityForResult(new Intent(this, CityManagerActivity.class), 99);
   }
 }
コード例 #5
0
 private void doBroadcast() {
   if (WeatherData.getCityInfo(Gl.getCurrentCityIndex()).mShowType
       == com.moji.mjweather.data.CityWeatherInfo.ShowType.ST_NOSET) {
     mCDialogManager.showNotifyAddCityDialog();
   } else {
     // PlayerUtil.manualBroadcast(mCDialogManager, MainHandler);
     if (PlayerUtil.isBroadcasting) mBroadcast.setImageResource(0x7f02014b);
     else mBroadcast.setImageResource(0x7f02014a);
   }
 }
コード例 #6
0
 protected void onActivityResult(int i, int j, Intent intent) {
   super.onActivityResult(i, j, intent);
   mIsFromCityView = true;
   if (i != 99) {
     if (i == 100) checkAddCity();
   } else {
     if (Gl.isChangedCity()) {
       Gl.setChangedCity(false);
       mWorkSpace.loadCityView();
     }
     mWorkSpace.setToScreen(Gl.getCurrentCityIndex());
   }
 }
コード例 #7
0
 private void doUpdateResult(com.moji.mjweather.common.WeatherUpdater.Result result) {
   if (AbstractWeatherUpdater.isSucceed(result)) {
     CityWeatherInfo cityweatherinfo = WeatherData.getCityInfo(result.cityIndex);
     Gl.Ct()
         .deleteFile(
             (new StringBuilder()).append(cityweatherinfo.m_cityID).append(".txt").toString());
     mWorkSpace.replaceCity(Gl.getCurrentCityIndex(), false);
     Gl.setNeedNotifyTrendState(true);
   } else {
     mCDialogManager.CancelCurrentDialog();
     mCDialogManager.ShowMsgOKDialogFromString((String) result.errMsg);
   }
   cancelUpdateWeather(null, false);
 }
コード例 #8
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();
 }
コード例 #9
0
 private void doUpdateCityWeather(boolean flag) {
   CityWeatherInfo cityweatherinfo = WeatherData.getCityInfo(Gl.getCurrentCityIndex());
   if ((!flag
           || cityweatherinfo.mShowType
               == com.moji.mjweather.data.CityWeatherInfo.ShowType.ST_NEED_BE_UPDATE)
       && cityweatherinfo.mShowType != com.moji.mjweather.data.CityWeatherInfo.ShowType.ST_NOSET)
     if (!Util.isConnectInternet(this)) {
       mCDialogManager.CancelCurrentDialog();
       mCDialogManager.ShowMsgOKDialog(0x7f0b0032);
     } else {
       mUpdateLayout =
           (LinearLayout)
               mWorkSpace.getChildAt(mWorkSpace.getCurrentScreen()).findViewById(0x7f0d0106);
       if (cityweatherinfo.mShowType == com.moji.mjweather.data.CityWeatherInfo.ShowType.ST_OK)
         mPublicTextView =
             (TextView)
                 mWorkSpace.getChildAt(mWorkSpace.getCurrentScreen()).findViewById(0x7f0d0117);
       if (isUpdating) cancelUpdateWeather(cityweatherinfo, true);
       else startUpdateWeather();
     }
 }
コード例 #10
0
 private void initMain() {
   mWorkSpace = (Workspace) findViewById(0x7f0d01d7);
   mCDialogManager = new CDialogManager(this, MainHandler);
   mIndexControlView = (CityIndexControlView) findViewById(0x7f0d01d9);
   mIndexControlView.bindScrollIndexView(mWorkSpace);
   mCityWeatherBgSwitcher = (CityWeatherBgSwitcher) getParent().findViewById(0x7f0d01ad);
   mCityWeatherBgSwitcher.bindScrollBgView(mWorkSpace);
   mWorkSpace.setBgSwitcher(mCityWeatherBgSwitcher);
   mCityNameView = (CityNameView) findViewById(0x7f0d01dd);
   mCityNameView.bindScrollCityNameView(mWorkSpace);
   mCityNameView.setOnClickListener(this);
   mCityManager = (ImageView) findViewById(0x7f0d01db);
   mCityManager.setOnClickListener(this);
   mBroadcast = (ImageView) findViewById(0x7f0d01de);
   mBroadcast.setOnClickListener(this);
   mUpdateWeather = (ImageView) findViewById(0x7f0d01dc);
   mUpdateWeather.setOnClickListener(this);
   mAdUmeng = (ImageView) findViewById(0x7f0d01da);
   mAdUmeng.setOnClickListener(this);
   bindCheckNeedUpdate(mWorkSpace);
   mCurrentCityIdx = Gl.getCurrentCityIndex();
 }
コード例 #11
0
 protected void onStop() {
   MojiLog.v("WeatherMainActivity", "onStop");
   super.onStop();
   Gl.saveCurrentCityIndex(Gl.getCurrentCityIndex());
 }