Android Open Source - WeatherMate Saved Flights Adapter






From Project

Back to project page WeatherMate.

License

The source code is released under:

Apache License

If you think the Android project WeatherMate listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.brightr.weathermate.adapters;
//w w  w  . j  ava 2 s  .  c  om
import java.util.ArrayList;

import com.brightr.weathermate.R;
import com.brightr.weathermate.activities.MyFlightsActivity;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class SavedFlightsAdapter extends BaseAdapter {

  Activity mContext;
  ArrayList<String> mFlightNumbers;
  ArrayList<String> mFromTo;
  ArrayList<String> mTimeLeaves;
  ArrayList<String> mTimeArrives;
  ArrayList<String> mArrivals;
  LayoutInflater inflater;

  public SavedFlightsAdapter(Activity mContext,
      ArrayList<String> mFlightNumbers, ArrayList<String> mFromTo, ArrayList<String> mArrivals,
      ArrayList<String> mTimeLeaves, ArrayList<String> mTimeArrives) {

    this.mContext = mContext;
    this.mFlightNumbers = mFlightNumbers;
    this.mFromTo = mFromTo;
    this.mTimeLeaves = mTimeLeaves;
    this.mTimeArrives = mTimeArrives;
        this.mArrivals = mArrivals;
    inflater = mContext.getLayoutInflater();
  }

  @Override
  public int getCount() {

    return mFlightNumbers.size();
  }

  @Override
  public Object getItem(int index) {

    return null;
  }

  @Override
  public long getItemId(int index) {

    return 0;
  }

  public class ViewHolder {

    TextView fromTo;
    TextView flightNumber;
    TextView timeLeaves;
    TextView timeArrives;
    View savedHeader;
    TextView headerText;
  }

  @Override
  public View getView(int position, View convertView, ViewGroup parent) {

    ViewHolder holder = null;

    if (convertView == null) {

      holder = new ViewHolder();

      convertView = inflater.inflate(R.layout.saved_flights_row, null);
      holder.fromTo = (TextView) convertView
          .findViewById(R.id.tvSavedFromTo);
      holder.flightNumber = (TextView) convertView
          .findViewById(R.id.tvSavedFlightNumber);
      holder.timeLeaves = (TextView) convertView
          .findViewById(R.id.tvSavedLeaves);
      holder.timeArrives = (TextView) convertView
          .findViewById(R.id.tvSavedArrives);
      holder.savedHeader = (View)convertView.findViewById(R.id.savedFlightsHeader);
      holder.headerText = (TextView) holder.savedHeader.findViewById(R.id.FlightNameHeader);
      

      convertView.setTag(holder);

    }

    else

      holder = (ViewHolder) convertView.getTag();
    holder.fromTo.setText("Departing from " + mFromTo.get(position));
    holder.flightNumber.setText("Flight Number: "
        + mFlightNumbers.get(position));
    holder.timeLeaves.setText("Leaves: " + mTimeLeaves.get(position));
    holder.timeArrives.setText("Arrives: " + mTimeArrives.get(position));
    holder.headerText.setText(mFromTo.get(position) + " to " + mArrivals.get(position));
    
    
    


    
    

    return convertView;
  }

}




Java Source Code List

.PullToRefreshListView.java
com.brightr.listeners.FlingGestureListener.java
com.brightr.listeners.OnFlingGestureListener.java
com.brightr.listeners.SimpleGestureFilter.java
com.brightr.weathermate.activities.LocationMapview.java
com.brightr.weathermate.activities.MainActivity.java
com.brightr.weathermate.activities.MyFlightsActivity.java
com.brightr.weathermate.activities.NewsViewerActivity.java
com.brightr.weathermate.activities.SearchLocationsActivity.java
com.brightr.weathermate.activities.SettingsActivity.java
com.brightr.weathermate.activities.SocialMediaActivity.java
com.brightr.weathermate.activities.WebsiteViewActivity.java
com.brightr.weathermate.adapters.FlightListAdapter.java
com.brightr.weathermate.adapters.LocationListAdapter.java
com.brightr.weathermate.adapters.MenuAdapter.java
com.brightr.weathermate.adapters.MyPagerAdapter.java
com.brightr.weathermate.adapters.NewsPagerAdapter.java
com.brightr.weathermate.adapters.SavedFlightsAdapter.java
com.brightr.weathermate.adapters.SearchListAdapter.java
com.brightr.weathermate.adapters.TweetAdapter.java
com.brightr.weathermate.adapters.WeatherAdapter.java
com.brightr.weathermate.databases.FlightStorage.java
com.brightr.weathermate.databases.LocationStorage.java
com.brightr.weathermate.databases.NewsStorage.java
com.brightr.weathermate.fragments.EntertainmentNewsFragment.java
com.brightr.weathermate.fragments.GeneralNewsFragment.java
com.brightr.weathermate.fragments.MainWeatherFragment.java
com.brightr.weathermate.fragments.MenuFragment.java
com.brightr.weathermate.fragments.PoliticalNewsFragment.java
com.brightr.weathermate.fragments.SidePanelFragment.java
com.brightr.weathermate.fragments.SportsNewsFragment.java
com.brightr.weathermate.parsers.FlightTrackingParser.java
com.brightr.weathermate.parsers.JSONParser.java
com.brightr.weathermate.parsers.JSONTrafficParser.java
com.brightr.weathermate.parsers.TwitterFeedParser.java
com.brightr.weathermate.providers.FlightTrackingProvider.java
com.brightr.weathermate.providers.LocationSearchProvider.java
com.brightr.weathermate.providers.TrafficIncidentProvider.java
com.brightr.weathermate.providers.WeatherProvider.java
com.brightr.weathermate.utils.AirlineNamesCollection.java
com.brightr.weathermate.views.CustomDialogPreference.java
com.brightr.weathermate.views.CustomPreferenceCategory.java