private void checkAddCity() { if (WeatherData.getCityInfo(0).mShowType == com.moji.mjweather.data.CityWeatherInfo.ShowType.ST_NOSET) { Gl.setHandler(MainHandler); Intent intent = new Intent(this, AddCityActivity.class); Bundle bundle = new Bundle(); bundle.putInt("cityindex", 0); bundle.putBoolean("isNoDisplayLocation", true); intent.putExtras(bundle); startActivity(intent); } }
public void doCallback() { if (Gl.isChangedCity()) { Gl.setChangedCity(false); mWorkSpace.loadCityView(); } mWorkSpace.setToScreen(Gl.getCurrentCityIndex()); }
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); } }
private void forFirstRun() { if (Gl.getIsFirstRun()) { if (!Gl.getAdON()) StatsService.checkAdSwitchAsync(); StatsUtil.setNextSendTime(false); if (PlayerUtil.isDataExpired()) { FileUtil.delFile(PlayerUtil.TTS_DATA_BG_PATH); Toast.makeText(Gl.Ct(), 0x7f0b0221, 1).show(); } } }
private void addUmengAd() { mExchangeViewManager = new ExchangeViewManager(this); if (sReportListner == null) sReportListner = new com.adm.controller.ReportThread.ReportListener() { public void onReportEnd(int i) { MojiLog.d("WeatherMainActivity", "onReportEnd"); } public void onReportStart(Map map) { StringBuffer stringbuffer = new StringBuffer(); Iterator iterator = map.keySet().iterator(); do { if (!iterator.hasNext()) break; String s = (String) iterator.next(); MojiLog.d("exchange_demo", stringbuffer.toString()); stringbuffer.append( (new StringBuilder()) .append(s) .append(": ") .append(map.get(s).toString()) .toString()); if (stringbuffer.toString().equals("action_type: 3") || stringbuffer.toString().equals("action_type: 7")) { StatsUtil.updateStatsAdDown(); MojiLog.d("WeatherMainActivity", "AdDown + 1"); } else if (stringbuffer.toString().equals("action_type: 0")) { StatsUtil.updateStatsAdView(); MojiLog.d("WeatherMainActivity", "AdArea + 1"); } } while (true); } }; ReportThread.unregisterReportListener(sReportListner); ReportThread.registerReportListener(sReportListner); ExchangeConstants.ONLY_CHINESE = false; MojiLog.d( "WeatherMainActivity", (new StringBuilder()).append("AdOn = ").append(Gl.getAdON()).toString()); if (Gl.getAdON()) { mAdUmeng.setVisibility(0); Drawable drawable = getResources().getDrawable(0x7f02016d); ExchangeViewManager exchangeviewmanager = mExchangeViewManager; ImageView imageview = mAdUmeng; Drawable adrawable[] = new Drawable[1]; adrawable[0] = drawable; exchangeviewmanager.addView(7, imageview, adrawable); } else { mAdUmeng.setVisibility(8); } }
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()); } }
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); }
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); }
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); }
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(); }
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); } }
private void doAddCityResult(Message message) { int i = 0; while (i < 9) { if (WeatherData.getCityInfo(i).m_cityID == message.arg2) { mCDialogManager.CancelCurrentDialog(); if (message.arg2 != -1) mCDialogManager.ShowMsgOKDialog(0x7f0b0035); else mCDialogManager.ShowMsgOKDialog(0x7f0b003f); } i++; } CityWeatherInfo cityweatherinfo = WeatherData.getCityInfo(message.arg1); cityweatherinfo.Clean(); cityweatherinfo.m_cityID = message.arg2; cityweatherinfo.mCityName = message.obj.toString(); cityweatherinfo.mShowType = com.moji.mjweather.data.CityWeatherInfo.ShowType.ST_NEED_BE_UPDATE; cityweatherinfo.mWeatherMainInfo.mWeatherDescription = ""; cityweatherinfo.m_lastUpdateTime = ""; Gl.saveCityInfo(message.arg1, cityweatherinfo); Gl.saveCurrentCityIndex(message.arg1); }
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(); } }
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(); }
protected void onStop() { MojiLog.v("WeatherMainActivity", "onStop"); super.onStop(); Gl.saveCurrentCityIndex(Gl.getCurrentCityIndex()); }
private void checkTuorialDisplay() { if (Gl.getIsFirstRun()) startActivityForResult(new Intent(this, TutorialActivity.class), 100); else checkAddCity(); }