// Path: java/com/raidzero/teamcitydownloader/data/TeamCityBuild.java
// public class TeamCityBuild implements Parcelable {
//     private static final String tag = "TeamCityBuild";
// 
//     private String number;
//     private String status;
//     private String url;
//     private String webUrl;
//     private String branch;
// 
//     public TeamCityBuild(String number, String status, String url, String branch, String weburl) {
//         this.number = number;
//         this.status = status;
//         this.url = url;
//         this.branch = branch;
//         this.webUrl = weburl;
// 
//         //Debug.Log(tag, "instance created. Number: " + number + " Status: " + status + " URL: " + url);
//     }
// 
//     public String getNumber() {
//         return this.number;
//     }
//     public String getStatus() {
//         return this.status;
//     }
//     public String getUrl() {
//         return this.url;
//     }
//     public String getWebUrl() {
//         return this.webUrl;
//     }
// 
//     public String getBranch() {
//         if (branch.isEmpty()) {
//             return "";
//         } else {
//             return branch;
//         }
//     }
// 
//     public void setUrl(String url) {
//         this.url = url;
//     }
// 
//     @Override
//     public int describeContents() {
//         return 0;
//     }
// 
//     @Override
//     public void writeToParcel(Parcel dest, int flags) {
//         dest.writeString(number);
//         dest.writeString(status);
//         dest.writeString(url);
//         dest.writeString(branch);
//         dest.writeString(webUrl);
//     }
// 
//     // this is needed to make the parcel
//     public TeamCityBuild(Parcel source) {
//         number = source.readString();
//         status = source.readString();
//         url = source.readString();
//         branch = source.readString();
//         webUrl = source.readString();
//     }
// 
//     public static final Parcelable.Creator CREATOR = new Parcelable.Creator<TeamCityBuild>() {
//         public TeamCityBuild createFromParcel(Parcel source) {
//             return new TeamCityBuild(source);
//         }
//         public TeamCityBuild[] newArray(int size) {
//             return new TeamCityBuild[size];
//         }
//     };
// }


import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import com.raidzero.teamcitydownloader.R;
import com.raidzero.teamcitydownloader.data.TeamCityBuild;
import java.util.ArrayList;
    public View getView(int position, View convertView, ViewGroup parent) {

        TeamCityBuild build = getItem(position);

        // if we arent reusing a view, inflate one
        if (convertView == null) {
            convertView = LayoutInflater.from(getContext()).inflate(R.layout.build_row, parent, false);
        }

        // get the views
        TextView txtName = (TextView) convertView.findViewById(R.id.txt_buildNumber);
        TextView txtBranch = (TextView) convertView.findViewById(R.id.txt_branchName);
        TextView txtStatus = (TextView) convertView.findViewById(R.id.txt_buildStatus);

        if (build.getStatus() != null) {
            if (build.getStatus().equalsIgnoreCase("FAILURE")) {
                txtStatus.setTextColor(getContext().getResources().getColor(R.color.color_build_failed));
            } else {
                txtStatus.setTextColor(getContext().getResources().getColor(R.color.color_build_success));
            }
            txtStatus.setText(build.getStatus());
        }

        // set their values
        txtName.setText("#" + build.getNumber());
        String branchName = build.getBranch();
        if (!branchName.isEmpty()) {
            txtBranch.setText(branchName);
            displayedDifferentBranches = true;
        } else if (displayedDifferentBranches) {
// Path: java/com/raidzero/teamcitydownloader/data/TeamCityBuild.java
// public class TeamCityBuild implements Parcelable {
//     private static final String tag = "TeamCityBuild";
// 
//     private String number;
//     private String status;
//     private String url;
//     private String webUrl;
//     private String branch;
// 
//     public TeamCityBuild(String number, String status, String url, String branch, String weburl) {
//         this.number = number;
//         this.status = status;
//         this.url = url;
//         this.branch = branch;
//         this.webUrl = weburl;
// 
//         //Debug.Log(tag, "instance created. Number: " + number + " Status: " + status + " URL: " + url);
//     }
// 
//     public String getNumber() {
//         return this.number;
//     }
//     public String getStatus() {
//         return this.status;
//     }
//     public String getUrl() {
//         return this.url;
//     }
//     public String getWebUrl() {
//         return this.webUrl;
//     }
// 
//     public String getBranch() {
//         if (branch.isEmpty()) {
//             return "";
//         } else {
//             return branch;
//         }
//     }
// 
//     public void setUrl(String url) {
//         this.url = url;
//     }
// 
//     @Override
//     public int describeContents() {
//         return 0;
//     }
// 
//     @Override
//     public void writeToParcel(Parcel dest, int flags) {
//         dest.writeString(number);
//         dest.writeString(status);
//         dest.writeString(url);
//         dest.writeString(branch);
//         dest.writeString(webUrl);
//     }
// 
//     // this is needed to make the parcel
//     public TeamCityBuild(Parcel source) {
//         number = source.readString();
//         status = source.readString();
//         url = source.readString();
//         branch = source.readString();
//         webUrl = source.readString();
//     }
// 
//     public static final Parcelable.Creator CREATOR = new Parcelable.Creator<TeamCityBuild>() {
//         public TeamCityBuild createFromParcel(Parcel source) {
//             return new TeamCityBuild(source);
//         }
//         public TeamCityBuild[] newArray(int size) {
//             return new TeamCityBuild[size];
//         }
//     };
// }


// Path: java/com/raidzero/teamcitydownloader/adapters/BuildAdapter.java
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import com.raidzero.teamcitydownloader.R;
import com.raidzero.teamcitydownloader.data.TeamCityBuild;
import java.util.ArrayList;

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

        TeamCityBuild build = getItem(position);

        // if we arent reusing a view, inflate one
        if (convertView == null) {
            convertView = LayoutInflater.from(getContext()).inflate(R.layout.build_row, parent, false);
        }

        // get the views
        TextView txtName = (TextView) convertView.findViewById(R.id.txt_buildNumber);
        TextView txtBranch = (TextView) convertView.findViewById(R.id.txt_branchName);
        TextView txtStatus = (TextView) convertView.findViewById(R.id.txt_buildStatus);

        if (build.getStatus() != null) {
            if (build.getStatus().equalsIgnoreCase("FAILURE")) {
                txtStatus.setTextColor(getContext().getResources().getColor(R.color.color_build_failed));
            } else {
                txtStatus.setTextColor(getContext().getResources().getColor(R.color.color_build_success));
            }
            txtStatus.setText(build.getStatus());
        }

        // set their values
        txtName.setText("#" + build.getNumber());
        String branchName = build.getBranch();
        if (!branchName.isEmpty()) {
            txtBranch.setText(branchName);
            displayedDifferentBranches = true;
        } else if (displayedDifferentBranches) {
            txtBranch.setText(context.getResources().getString(R.string.default_branch));