Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android Bootcamp] Week 2 Project: New York Times Article Search #1

Open
mysgithub opened this issue Feb 14, 2016 · 4 comments
Open

Comments

@mysgithub
Copy link
Owner

My app is complete, please review. /cc @codepathreview @codepath

@mysgithub
Copy link
Owner Author

Some time I get exception when I use StaggeredGridLayoutManager; but if I use GridLayoutManager I don't same exception: (Let me know if something wrong I am doing)

00:46:24.544 21671-21671/com.codepath.nytimessearch W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0xa4d46b20)
02-14 00:46:24.544 21671-21671/com.codepath.nytimessearch E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.codepath.nytimessearch, PID: 21671
java.lang.ArrayIndexOutOfBoundsException: src.length=44 srcPos=0 dst.length=44 dstPos=-1 length=45
at java.lang.System.arraycopy(Native Method)
at android.support.v7.widget.StaggeredGridLayoutManager$LazySpanLookup.offsetForAddition(StaggeredGridLayoutManager.java:2488)
at android.support.v7.widget.StaggeredGridLayoutManager.handleUpdate(StaggeredGridLayoutManager.java:1376)
at android.support.v7.widget.StaggeredGridLayoutManager.onItemsAdded(StaggeredGridLayoutManager.java:1332)
at android.support.v7.widget.RecyclerView$6.dispatchUpdate(RecyclerView.java:722)
at android.support.v7.widget.RecyclerView$6.onDispatchSecondPass(RecyclerView.java:739)
at android.support.v7.widget.AdapterHelper.consumePostponedUpdates(AdapterHelper.java:122)
at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2891)
at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3071)
at android.view.View.layout(View.java:14817)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1055)
at android.view.View.layout(View.java:14817)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)

@codepathreview
Copy link

👍 nice work. A few notes after checking out the code:

  • Good layout, proper view naming, usage of sp/dp, margin and relative placement rules
  • Good use of string resources for text values
  • Glad you thought about error handling for invalid or empty input cases
  • Consider adding progress bars to your app whenever a network request goes out
  • Properly reused the single base method in search activity to fetch results for both initial load and the pagination
  • Nice to see you added the search box to the ActionBar!
  • Properly used spinners (with populated values) to allow users to select filters
  • Properly sent and received relevant filters using a listener to pass data between activities
  • Good to see you used a filters object to represent the filters to apply to the query
  • Nice job adding the share intent to the article detail view!

Also, here's a more detailed Project 2 Feedback Guide here which covers the most common issues with this submitted project. Read through the feedback guide point-by-point to determine how you could improve your submission.

Let us know if you have any other thoughts or questions about this assignment. The next assignment (Twitter Client) will be especially important since it introduces the majority of the remaining pieces necessary to build a fully functional API client with complex feeds of data and user creation.

@mysgithub
Copy link
Owner Author

Found fix for exception: Adding that improvement Now...

int curSize = adapter.getItemCount();
JSONArray articleJsonResults = response.getJSONObject("response").getJSONArray("docs");
articles.addAll(Article.fromJson(articleJsonResults));
adapter.notifyItemRangeInserted(curSize, articleJsonResults.length());

This was the fix.

@mysgithub
Copy link
Owner Author

Thanks for the review; Just added progress bar also!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants