// Path: android/app/src/main/java/com/ustwo/sample/data/CommitSummary.java
// public class CommitSummary {
//     public String sha;
//     public Commit commit;
// 
//     public class Commit {
//         public Author author;
//         public String message;
//     }
// 
//     public class Author {
//         public String date;
//     }
// }
// 
// Path: android/app/src/main/java/com/ustwo/sample/data/GitHub.java
// public interface GitHub {
//     @GET("/repos/{username}/{repo}")
//     void repository(@Path("username") String username,
//                     @Path("repo") String repo,
//                     Callback<RepositoryInfo> commit);
// 
//     @GET("/repos/{username}/{repo}/commits")
//     void commitList(@Path("username") String username,
//                     @Path("repo") String repo,
//                     Callback<List<CommitSummary>> commit);
// 
//     @GET("/repos/{username}/{repo}/git/commits/{commit}")
//     void commit(@Path("username") String username,
//                 @Path("repo") String repo,
//                 @Path("commit") String commit,
//                 Callback<Commit> user);
// }
// 
// Path: android/app/src/main/java/com/ustwo/sample/data/RepositoryInfo.java
// public class RepositoryInfo {
//     public String name;
//     public String description;
// 
//     @SerializedName("private")
//     public boolean isPrivate;
// }


import android.app.ProgressDialog;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import com.ustwo.sample.data.CommitSummary;
import com.ustwo.sample.data.GitHub;
import com.ustwo.sample.data.RepositoryInfo;
import java.util.List;
import retrofit.Callback;
import retrofit.RestAdapter;
import retrofit.RetrofitError;
import retrofit.client.Response;
    public boolean onOptionsItemSelected(MenuItem item) {
        int id = item.getItemId();
        if (id == R.id.commit_list_button_refresh) {
            refresh();
            return true;
        }

        return super.onOptionsItemSelected(item);
    }

    private void refresh() {
        mProgressDialog = ProgressDialog.show(this, "", getString(R.string.shared_loading), true, false);
        retrieveRepositoryInfo();
    }

    @Override
    protected void onPause() {
        super.onPause();

        dismissProgressDialog();
    }

    private void dismissProgressDialog() {
        if (mProgressDialog != null) {
            mProgressDialog.dismiss();
            mProgressDialog = null;
        }
    }

    private void retrieveRepositoryInfo() {
// Path: android/app/src/main/java/com/ustwo/sample/data/CommitSummary.java
// public class CommitSummary {
//     public String sha;
//     public Commit commit;
// 
//     public class Commit {
//         public Author author;
//         public String message;
//     }
// 
//     public class Author {
//         public String date;
//     }
// }
// 
// Path: android/app/src/main/java/com/ustwo/sample/data/GitHub.java
// public interface GitHub {
//     @GET("/repos/{username}/{repo}")
//     void repository(@Path("username") String username,
//                     @Path("repo") String repo,
//                     Callback<RepositoryInfo> commit);
// 
//     @GET("/repos/{username}/{repo}/commits")
//     void commitList(@Path("username") String username,
//                     @Path("repo") String repo,
//                     Callback<List<CommitSummary>> commit);
// 
//     @GET("/repos/{username}/{repo}/git/commits/{commit}")
//     void commit(@Path("username") String username,
//                 @Path("repo") String repo,
//                 @Path("commit") String commit,
//                 Callback<Commit> user);
// }
// 
// Path: android/app/src/main/java/com/ustwo/sample/data/RepositoryInfo.java
// public class RepositoryInfo {
//     public String name;
//     public String description;
// 
//     @SerializedName("private")
//     public boolean isPrivate;
// }


// Path: android/app/src/main/java/com/ustwo/sample/CommitListActivity.java
import android.app.ProgressDialog;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import com.ustwo.sample.data.CommitSummary;
import com.ustwo.sample.data.GitHub;
import com.ustwo.sample.data.RepositoryInfo;
import java.util.List;
import retrofit.Callback;
import retrofit.RestAdapter;
import retrofit.RetrofitError;
import retrofit.client.Response;

    public boolean onOptionsItemSelected(MenuItem item) {
        int id = item.getItemId();
        if (id == R.id.commit_list_button_refresh) {
            refresh();
            return true;
        }

        return super.onOptionsItemSelected(item);
    }

    private void refresh() {
        mProgressDialog = ProgressDialog.show(this, "", getString(R.string.shared_loading), true, false);
        retrieveRepositoryInfo();
    }

    @Override
    protected void onPause() {
        super.onPause();

        dismissProgressDialog();
    }

    private void dismissProgressDialog() {
        if (mProgressDialog != null) {
            mProgressDialog.dismiss();
            mProgressDialog = null;
        }
    }

    private void retrieveRepositoryInfo() {
        mGitHubService.repository(getString(R.string.default_repository_user), getString(R.string.default_repository_name), new Callback<RepositoryInfo>() {