{"action":"created","issue":{"url":"https://api.github.com/repos/madhavs-uber/InstagramViewer/issues/3","labels_url":"https://api.github.com/repos/madhavs-uber/InstagramViewer/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/madhavs-uber/InstagramViewer/issues/3/comments","events_url":"https://api.github.com/repos/madhavs-uber/InstagramViewer/issues/3/events","html_url":"https://github.com/madhavs-uber/InstagramViewer/issues/3","id":120090305,"number":3,"title":"[Android Bootcamp] Project 1: InstagramViewer, Day 3 - Ready for Review","user":{"login":"madhavs-uber","id":15880001,"avatar_url":"https://avatars.githubusercontent.com/u/15880001?v=3","gravatar_id":"","url":"https://api.github.com/users/madhavs-uber","html_url":"https://github.com/madhavs-uber","followers_url":"https://api.github.com/users/madhavs-uber/followers","following_url":"https://api.github.com/users/madhavs-uber/following{/other_user}","gists_url":"https://api.github.com/users/madhavs-uber/gists{/gist_id}","starred_url":"https://api.github.com/users/madhavs-uber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/madhavs-uber/subscriptions","organizations_url":"https://api.github.com/users/madhavs-uber/orgs","repos_url":"https://api.github.com/users/madhavs-uber/repos","events_url":"https://api.github.com/users/madhavs-uber/events{/privacy}","received_events_url":"https://api.github.com/users/madhavs-uber/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-12-03T04:04:41Z","updated_at":"2015-12-03T16:16:16Z","closed_at":null,"body":"I have completed all Day 3 user stories, and my app is ready for review. /cc @codepathreview @codepath"},"comment":{"url":"https://api.github.com/repos/madhavs-uber/InstagramViewer/issues/comments/161698198","html_url":"https://github.com/madhavs-uber/InstagramViewer/issues/3#issuecomment-161698198","issue_url":"https://api.github.com/repos/madhavs-uber/InstagramViewer/issues/3","id":161698198,"user":{"login":"nickai","id":4792749,"avatar_url":"https://avatars.githubusercontent.com/u/4792749?v=3","gravatar_id":"","url":"https://api.github.com/users/nickai","html_url":"https://github.com/nickai","followers_url":"https://api.github.com/users/nickai/followers","following_url":"https://api.github.com/users/nickai/following{/other_user}","gists_url":"https://api.github.com/users/nickai/gists{/gist_id}","starred_url":"https://api.github.com/users/nickai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nickai/subscriptions","organizations_url":"https://api.github.com/users/nickai/orgs","repos_url":"https://api.github.com/users/nickai/repos","events_url":"https://api.github.com/users/nickai/events{/privacy}","received_events_url":"https://api.github.com/users/nickai/received_events","type":"User","site_admin":false},"created_at":"2015-12-03T16:16:16Z","updated_at":"2015-12-03T16:16:16Z","body":"Great work Madhav! Today is the the most challenging day of the assignment because of OAuth and working with nested fragments. Glad to see you were able to complete it!\r\n \r\nBelow we've captured some of the common issues with today's stories. Please read through this point-by-point to determine how you could improve your submission.\r\n\r\n-   **Using a global helper method to retrieve the InstagramClient instance in the Application class**\r\n\r\n    ```java\r\n        public static InstagramClient getRestClient() {\r\n            return (InstagramClient) InstagramClient.getInstance(InstagramClient.class, sharedApplication());\r\n        }\r\n    ```\r\n-   **Helpful Fragment methods**\r\n    -   **getActivity()**\r\n        -   `getActivity()` returns the parent activity.\r\n        -   Can be called anytime after the `onAttach()` callback method has been run.\r\n    -   **getView()**\r\n        -   `getView()` returns the root view returned by `onCreateView`\r\n        -   Will return null if called within or before `onCreateView()`\r\n        -   Safe to call during or after `onViewCreated()`\r\n-   **When fetching items to populate a RecyclerView.Adapter, it's better to update the the dataset rather than creating a new adapter on each fetch.**\r\n\r\n    ```java\r\n        // In initialization of the fragment or activity\r\n        mInstagramPostsList = new ArrayList<Post>();\r\n        mInstagramPostsAdapter = new InstagramPostsAdapter(mInstagramPostsList);\r\n        mInstagramRecyclerView.setAdapter(mInstagramPostsAdapter);\r\n\r\n        // Fetching posts in the user's feed\r\n        instagramClient.getSelfFeed(new JsonHttpResponseHandler() {\r\n            @Override\r\n            public void onSuccess(int statusCode, Header[] headers, JSONObject response) {\r\n                // Resets the list of posts and calls notifyDataSetChanged()\r\n                mInstagramPostsAdapter.reloadPosts(Utils.decodePostsFromJsonResponse(response));\r\n            }\r\n        };\r\n    ```\r\n\r\n-   **Fragment newInstance method only necessary to initialize data**\r\n    -   If no initialization data is expected for a fragment, then using the default no args constructor is sufficient. `MyFragment.newInstance()` is only used to set the fragment's argument bundle so that any initialized data is restored on fragment re-creation.\r\n-   **Did you add a ProgressBar for any long running tasks, such as fetching data via the network?**\r\n    -   It's always a good idea to display an indeterminate or determinate progress bar to the user when potentially long running tasks are happening in the background, especially those that update views. See **[this guide on implementing a ProgressBarView](https://guides.codepath.com/android/Handling-ProgressBars)**.\r\n-   **Hardcoding integer dimensions (not sp or dp)**\r\n    -   If hardcoding an integer that is used to provide spacing, it's ideally better to supply a value in `dimens.xml` as an `integer` to allow different orientations/screen sizes to supply different values.\r\n    -   And referring to it in code via `getResources().getInteger(R.integer.vertical_spacer_height)`. E.g.,\r\n\r\n    ```xml\r\n    // in dimens.xml\r\n    <resources>\r\n        <dimen name=\"some_padding\">16dp</dimen>\r\n        <integer name=\"vertical_spacer_height\">24</integer>\r\n    </resources>\r\n    ```\r\n\r\n-   **Almost never call getBaseContext()**\r\n    -   `getBaseContext()` returns the context that's wrapped inside an Activity. An Activity is a `ContextWrapper` subclass. it's outside the scope of this class, but usually you'd only use `getBaseContext()` if you want a context without activity specific styles applied.\r\n    -   If you want a context that is not tied to the activity lifecycle, then use `activity.getApplicationContext()` instead.\r\n-   **AsyncHttpClient get method with no RequestParams**\r\n    -   Theres a `client.get(String url, ResponseHander handler)` signature.\r\n    -   see **[AsyncHttpClient Javadocs](https://loopj.com/android-async-http/doc/com/loopj/android/http/AsyncHttpClient.html#get-java.lang.String-com.loopj.android.http.ResponseHandlerInterface-)**\r\n"}}