Skip to content

Commit

Permalink
code improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
Nayanesh-Gupte committed Apr 19, 2016
1 parent 89953f1 commit d465c6b
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 25 deletions.
10 changes: 8 additions & 2 deletions app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,16 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/23.0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-runtime-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-verifier" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-support" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/reload-dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/restart-dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
Expand All @@ -97,11 +103,11 @@
</content>
<orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="recyclerview-v7-23.0.1" level="project" />
<orderEntry type="library" exported="" name="gson-2.6.2" level="project" />
<orderEntry type="library" exported="" name="cardview-v7-23.0.1" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-23.0.1" level="project" />
<orderEntry type="library" exported="" name="recyclerview-v7-23.0.1" level="project" />
<orderEntry type="library" exported="" name="support-v4-23.0.1" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-23.0.1" level="project" />
<orderEntry type="library" exported="" name="support-annotations-23.0.1" level="project" />
<orderEntry type="module" module-name="volley" exported="" />
</component>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ public void add(List<Issue> data) {
@Override
public IssuesViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = inflater.inflate(R.layout.row_issues, parent, false);
IssuesViewHolder holder = new IssuesViewHolder(view);
return holder;
return new IssuesViewHolder(view);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ public void onDetach() {
@Override
public void onDataReceived(List<Comment> listIssues) {

progressBar.setVisibility(View.GONE);

commentsListAdapter.add(listIssues);
progressBar.setVisibility(View.GONE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
/**
* Fragment holding list of issues.
*/
public class GitIssuesListFragment extends Fragment implements IAppConstants, OnItemClickListener {
public class GitIssuesListFragment extends Fragment implements IAppConstants, OnItemClickListener, Response.Listener<Issue[]> {


private static final String TAG = GitIssuesListFragment.class.getSimpleName();
Expand Down Expand Up @@ -92,7 +92,7 @@ private void getIssuesList() {
GsonRequest<Issue[]> myReq = new GsonRequest<Issue[]>(BASE_URL,
Issue[].class,
null,
createMyReqSuccessListener(),
this,
createMyReqErrorListener());

TwitterCrashlyticsApplication.getInstance().addToRequestQueue(myReq, TAG);
Expand All @@ -107,24 +107,6 @@ private void getIssuesList() {

}

private Response.Listener<Issue[]> createMyReqSuccessListener() {
return new Response.Listener<Issue[]>() {
@Override
public void onResponse(Issue[] response) {

List<Issue> listIssues = Arrays.asList(response);

Collections.sort(listIssues, new DateComparator());

issuesListAdapter.add(listIssues);


progressBar.setVisibility(View.GONE);

}

};
}

private Response.ErrorListener createMyReqErrorListener() {
return new Response.ErrorListener() {
Expand Down Expand Up @@ -161,4 +143,16 @@ public void onDetach() {
}


@Override
public void onResponse(Issue[] response) {

List<Issue> listIssues = Arrays.asList(response);

Collections.sort(listIssues, new DateComparator());

issuesListAdapter.add(listIssues);


progressBar.setVisibility(View.GONE);
}
}

0 comments on commit d465c6b

Please sign in to comment.