Back to project page PrincePolo.
The source code is released under:
GNU General Public License
If you think the Android project PrincePolo listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package se.agile.asynctasks; /*from ww w.j a va 2s.c om*/ import java.util.ArrayList; import se.agile.githubdata.Directory; import se.agile.githubdata.Folder; import se.agile.model.JSONParser; public class RequestFiles extends RequestTask<String, Void, ArrayList<Directory>>{ private Folder folder; private String url = "https://api.github.com/repos/"; public RequestFiles(){ super(); } public RequestFiles(RequestListener<ArrayList<Directory>> listener){ this(null, listener); } public RequestFiles(Folder folder, RequestListener<ArrayList<Directory>> listener){ super(listener); this.folder = folder; url += super.getSelectedRepositoryName() + "/contents"; } @Override protected ArrayList<Directory> doInBackground(String... params) { String path = ""; String branch = ""; if(folder != null){ branch = folder.getBranchName(); path = folder.getPath().equals("") ? "" : "/" + folder.getPath(); }else{ path = params[0].equals("") ? "" : "/" + params[0]; branch = params[1]; } ArrayList<Directory> list = JSONParser.parseDirectories(generalGETRequest(url + path + "?ref=" + branch), branch); if(folder != null){ folder.setDirectoryList(list); } return list; } @Override protected void onPostExecute(ArrayList<Directory> directoryList){ if(!isCancelled()){ finishedWithRequest(directoryList); } } }