private void loadFlightTime() { try { if (flightVo.getLeave()) { setViewFromFlightListVo( RemoteImpl.getInstance() .searchFlight(true, FlightActivity.DFLIGHT_NUMBER, flightVo.getFlightNumber())); } else { setViewFromFlightListVo( RemoteImpl.getInstance() .searchFlight(true, FlightActivity.AFLIGHT_NUMBER, flightVo.getFlightNumber())); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } new ItktOtherAsyncTask<Void, Void, FlightListVo>() { @Override public FlightListVo before(Void... params) throws Exception { if (flightVo.getLeave()) { return RemoteImpl.getInstance() .searchFlight(false, FlightActivity.DFLIGHT_NUMBER, flightVo.getFlightNumber()); } else { return RemoteImpl.getInstance() .searchFlight(false, FlightActivity.AFLIGHT_NUMBER, flightVo.getFlightNumber()); } } @Override public void after(FlightListVo result) { if (result != null && result.getAir() != null && !result.getAir().isEmpty()) { setViewFromFlightListVo(result); } } @Override public void exception() { // TODO Auto-generated method stub } }.execute(); }
private void initView() { titleView.setVisibility(View.INVISIBLE); tvFrom = (TextView) findViewById(R.id.tv1); tvTo = (TextView) findViewById(R.id.tv2); // tvCheckInCounter=(TextView)findViewById(R.id.tv3); tvBoardingGate = (TextView) findViewById(R.id.tv4); tvFlightState = (TextView) findViewById(R.id.tv5); tvDepartureYear = (TextView) findViewById(R.id.tvDepartureYear); tvArriveYear = (TextView) findViewById(R.id.tvArriveYear); tvDepartureDay = (TextView) findViewById(R.id.tvDepartureDay); tvArriveDay = (TextView) findViewById(R.id.tvArriveDay); tvDepartureTime = (TextView) findViewById(R.id.tvDepartureTime); tvArriveTime = (TextView) findViewById(R.id.tvArriveTime); tvTempratureFrom = (TextView) findViewById(R.id.tvTempratureFrom); tvTempratureTo = (TextView) findViewById(R.id.tvTempratureTo); tvAirline = (TextView) findViewById(R.id.tvAirLine); ivWeatherFrom = (ImageView) findViewById(R.id.iv1); ivWeatherTo = (ImageView) findViewById(R.id.iv2); // tvCheckInCounter.setVisibility(View.GONE); tvBoardingGate.setVisibility(View.GONE); tvTempratureFrom.setVisibility(View.GONE); tvTempratureTo.setVisibility(View.GONE); // tvAirline.setText(getString(R.string.flight_num)+" : "+flightVo.getFlightNumber()); tvAirline.setText(flightVo.getFlightNumber()); if (flightVo.getLeave()) { tvFrom.setText(getString(R.string.Macau)); tvTo.setText(flightVo.getDestination()); tvDepartureTime.setText(flightVo.getTime()); tvArriveTime.setText(null); // if(flightVo.getRealTime()){ // tvBoardingGate.setVisibility(View.VISIBLE); // tvBoardingGate.setText(getString(R.string.boarding_gate)+flightVo.getGate()); // } if (TextUtil.stringIsNotNull(flightVo.getWeatheren())) { int res = BitmapUtiles.getDrwableForName( this, flightVo.getWeatheren().toLowerCase().replace(" ", "") + "_big"); ivWeatherTo.setImageResource(res); if (res == 0) { ivWeatherTo.setVisibility(View.INVISIBLE); } } else { ivWeatherTo.setVisibility(View.INVISIBLE); } ivWeatherFrom.setVisibility(View.INVISIBLE); } else { tvTo.setText(getString(R.string.Macau)); tvFrom.setText(flightVo.getOrigin()); tvDepartureTime.setText(null); tvArriveTime.setText(flightVo.getTime()); if (TextUtil.stringIsNotNull(flightVo.getWeatheren())) { int res = BitmapUtiles.getDrwableForName( this, flightVo.getWeatheren().toLowerCase().replace(" ", "") + "_big"); ivWeatherFrom.setImageResource(res); if (res == 0) { ivWeatherFrom.setVisibility(View.INVISIBLE); } } else { ivWeatherFrom.setVisibility(View.INVISIBLE); } ivWeatherTo.setVisibility(View.INVISIBLE); } if (TextUtil.stringIsNotNull(flightVo.getDate())) { String[] date = flightVo.getDate().split("/"); tvDepartureYear.setText(date[2]); tvArriveYear.setText(date[2]); // tvDepartureDay.setText(date[0]+"/"+date[1]); // tvArriveDay.setText(date[0]+"/"+date[1]); tvDepartureYear.setVisibility(View.GONE); tvArriveYear.setVisibility(View.GONE); // if("en".equals(FlyApplication.language)){ // tvDepartureDay.setText(flightVo.getDate()); // tvArriveDay.setText(flightVo.getDate()); // }else{ // SimpleDateFormat sdf=new SimpleDateFormat("yyyy/MM/dd"); // Date date2=new Date(System.currentTimeMillis()); // tvDepartureDay.setText(TimeUtil.parseDateToString(sdf, date2)); // tvArriveDay.setText(TimeUtil.parseDateToString(sdf, date2)); // } } String flightStateStr = null; if (TextUtil.stringIsNotNull(flightVo.getStatue())) { flightStateStr = getString(R.string.flight_detail_state) + flightVo.getStatue(); } if (TextUtil.stringIsNotNull(flightVo.getGate())) { flightStateStr = flightStateStr + " " + getString(R.string.boarding_gate) + flightVo.getGate(); } tvFlightState.setText(flightStateStr); }