/* (non-Javadoc) * @see android.os.AsyncTask#onPostExecute(java.lang.Object) */ @Override protected void onPostExecute(String airport) { if (null != mGestureCallBack && null != mPointProjection && null != airport) { mLongTouchDestination = new LongTouchDestination(); mLongTouchDestination.airport = airport; mLongTouchDestination.info = Math.round(mPointProjection.getDistance()) + Preferences.distanceConversionUnit + "(" + mPointProjection.getGeneralDirectionFrom(mGpsParams.getDeclinition()) + ") " + Helper.correctConvertHeading( Math.round( Helper.getMagneticHeading( mPointProjection.getBearing(), mGpsParams.getDeclinition()))) + '\u00B0'; /* * Clear old weather */ mService.getAdsbWeather().sweep(); /* * Do not background ADSB weather as its a RAM opertation and quick, * also avoids concurrent mod exception. */ if (mPref.useAdsbWeather()) { taf = mService.getAdsbWeather().getTaf(airport); metar = mService.getAdsbWeather().getMETAR(airport); aireps = mService.getAdsbWeather().getAireps(lon, lat); wa = mService.getAdsbWeather().getWindsAloft(lon, lat); layer = mService.getAdsbWeather().getNexrad().getDate(); } else { boolean inWeatherOld = mService.getInternetWeatherCache().isOld(mPref.getExpiryTime()); if (inWeatherOld) { // expired weather and TFR text do not show taf = null; metar = null; aireps = null; textMets = null; tfr = null; wa = null; } } if (null != aireps) { for (Airep a : aireps) { a.updateTextWithLocation(lon, lat, mGpsParams.getDeclinition()); } } if (null != wa) { wa.updateStationWithLocation(lon, lat, mGpsParams.getDeclinition()); } mLongTouchDestination.tfr = tfr; mLongTouchDestination.taf = taf; mLongTouchDestination.metar = metar; mLongTouchDestination.airep = aireps; mLongTouchDestination.mets = textMets; mLongTouchDestination.wa = wa; mLongTouchDestination.freq = freq; mLongTouchDestination.sua = sua; mLongTouchDestination.layer = layer; mLongTouchDestination.fuel = fuel; mLongTouchDestination.ratings = ratings; if (metar != null) { mLongTouchDestination.performance = WeatherHelper.getMetarTime(metar.rawText) + "\n" + mContext.getString(R.string.DensityAltitude) + " " + WeatherHelper.getDensityAltitude(metar.rawText, elev) + "\n" + mContext.getString(R.string.BestRunway) + " " + WeatherHelper.getBestRunway(metar.rawText, runways); } // If the long press event has already occurred, we need to do the gesture callback here if (mDoCallbackWhenDone) { mGestureCallBack.gestureCallBack(GestureInterface.LONG_PRESS, mLongTouchDestination); } } invalidate(); }