Search in sources :

Example 1 with Prediction

use of com.example.androidforios.app.data.model.Prediction in project AndroidForiOS by smbarne.

the class PredictionArrayAdapter method getView.

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    Prediction prediction = this.getItem(position);
    View inflatedView = convertView;
    if (convertView == null) {
        LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        inflatedView = inflater.inflate(LAYOUT_RESOURCE_ID, parent, false);
    }
    TextView stopNameTextView = (TextView) inflatedView.findViewById(R.id.view_three_item_list_view_left_text_view);
    TextView middleTextView = (TextView) inflatedView.findViewById(R.id.view_three_item_list_view_middle_text_view);
    TextView stopSecondsTextView = (TextView) inflatedView.findViewById(R.id.view_three_item_list_view_right_text_view);
    stopNameTextView.setText(prediction.stopName);
    middleTextView.setVisibility(View.GONE);
    stopSecondsTextView.setText(prediction.stopSeconds.toString());
    return inflatedView;
}
Also used : Prediction(com.example.androidforios.app.data.model.Prediction) LayoutInflater(android.view.LayoutInflater) TextView(android.widget.TextView) TextView(android.widget.TextView) View(android.view.View)

Example 2 with Prediction

use of com.example.androidforios.app.data.model.Prediction in project AndroidForiOS by smbarne.

the class TripDetailFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Prediction[] predictions = mTrip.predictions.toArray(new Prediction[mTrip.predictions.size()]);
    PredictionArrayAdapter predictionArrayAdapter = new PredictionArrayAdapter(getActivity().getApplicationContext(), predictions);
    setListAdapter(predictionArrayAdapter);
    return super.onCreateView(inflater, container, savedInstanceState);
}
Also used : Prediction(com.example.androidforios.app.data.model.Prediction) PredictionArrayAdapter(com.example.androidforios.app.adapters.PredictionArrayAdapter)

Aggregations

Prediction (com.example.androidforios.app.data.model.Prediction)2 LayoutInflater (android.view.LayoutInflater)1 View (android.view.View)1 TextView (android.widget.TextView)1 PredictionArrayAdapter (com.example.androidforios.app.adapters.PredictionArrayAdapter)1