Android Open Source - RazorRunner-AndroidProject Workout Item Adapter






From Project

Back to project page RazorRunner-AndroidProject.

License

The source code is released under:

Apache License

If you think the Android project RazorRunner-AndroidProject 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 edu.uark.csce.razorrunner;
/*from www .j  a  va  2  s.c o m*/
import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.LinearLayout;
import android.widget.TextView;

public class WorkoutItemAdapter extends ArrayAdapter<WorkoutData>{
  
  int resource;  
  public WorkoutItemAdapter(Context context, int resource,
      ArrayList<WorkoutData> workoutList) {
    super(context, resource, workoutList);
    // TODO Auto-generated constructor stub
    
    this.resource = resource;
  }
    
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    LinearLayout workoutView;
    
    
    WorkoutData item = getItem(position);
    
    String workoutName = item.getWorkoutName();
    String workoutTime = item.getWorkoutTime();
    
    //Date createdDate = item.getCreatedDate();
    //SimpleDateFormat sdf = new SimpleDateFormat("MM-dd-yyyy");
    //String dateString = sdf.format(createdDate);
    
    if (convertView == null) {
      workoutView = new LinearLayout(getContext());
      String inflater = Context.LAYOUT_INFLATER_SERVICE;
      LayoutInflater lifr = (LayoutInflater)getContext().getSystemService(inflater);
      lifr.inflate(resource, workoutView, true);
    }
    else {
      workoutView = (LinearLayout)convertView;
    }
    
    TextView workoutNameView = (TextView)workoutView.findViewById(R.id.workout_col);
    TextView workoutTimeView = (TextView)workoutView.findViewById(R.id.time_col);
    
    workoutNameView.setText(workoutName);
    workoutTimeView.setText(workoutTime);
    
    return workoutView;
  }  
}




Java Source Code List

edu.uark.csce.razorrunner.ActivityUtils.java
edu.uark.csce.razorrunner.BuildConfig.java
edu.uark.csce.razorrunner.DistanceNotifier.java
edu.uark.csce.razorrunner.HistoryActivity.java
edu.uark.csce.razorrunner.Manifest.java
edu.uark.csce.razorrunner.OverviewActivity.java
edu.uark.csce.razorrunner.PedometerSettings.java
edu.uark.csce.razorrunner.ProfileActivity.java
edu.uark.csce.razorrunner.RemoveDetection.java
edu.uark.csce.razorrunner.RequestDetection.java
edu.uark.csce.razorrunner.StepDetector.java
edu.uark.csce.razorrunner.StepDisplayer.java
edu.uark.csce.razorrunner.StepListener.java
edu.uark.csce.razorrunner.UserActivityRecognition.java
edu.uark.csce.razorrunner.UserSettingsActivity.java
edu.uark.csce.razorrunner.UserStepRecognition.java
edu.uark.csce.razorrunner.WorkoutActivity.java
edu.uark.csce.razorrunner.WorkoutContentProvider.java
edu.uark.csce.razorrunner.WorkoutData.java
edu.uark.csce.razorrunner.WorkoutItemAdapter.java