{"action":"created","comment":{"url":"https://api.github.com/repos/pubnative/pubnative-android-library/pulls/comments/63880160","id":63880160,"diff_hunk":"@@ -0,0 +1,414 @@\n+package net.pubnative.library.banner;\n+\n+import android.app.Activity;\n+import android.content.Context;\n+import android.os.Handler;\n+import android.os.Looper;\n+import android.text.TextUtils;\n+import android.util.Log;\n+import android.view.LayoutInflater;\n+import android.view.View;\n+import android.view.ViewGroup;\n+import android.widget.Button;\n+import android.widget.ImageView;\n+import android.widget.RelativeLayout;\n+import android.widget.TextView;\n+\n+import com.squareup.picasso.Callback;\n+import com.squareup.picasso.Picasso;\n+\n+import net.pubnative.library.exceptions.PubnativeException;\n+import net.pubnative.library.request.PubnativeAsset;\n+import net.pubnative.library.request.PubnativeRequest;\n+import net.pubnative.library.request.model.PubnativeAdModel;\n+\n+import java.util.List;\n+\n+public class PubnativeBanner implements PubnativeRequest.Listener,\n+                                        PubnativeAdModel.Listener {\n+\n+    public static final String TAG = PubnativeBanner.class.getSimpleName();\n+    protected Context               mContext;\n+    protected String                mAppToken;\n+    protected Size                  mBannerSize;\n+    protected Position              mBannerPosition;\n+    protected Boolean               mIsLoading = false;\n+    protected Boolean               mIsShown = false;\n+    protected Listener              mListener;\n+    protected PubnativeAdModel      mAdModel;\n+    protected Handler               mHandler;\n+    // Banner view\n+    protected ViewGroup             mContainer;\n+    protected TextView              mTitle;\n+    protected TextView              mDescription;\n+    protected ImageView             mIcon;\n+    protected RelativeLayout        mBannerView;\n+    protected Button                mInstall;\n+    protected TextView              mAdText;\n+\n+    public enum Size {\n+        BANNER_50,\n+        BANNER_90\n+    }\n+\n+    public enum Position {\n+        TOP,\n+        BOTTOM\n+    }\n+\n+    /**\n+     * Interface for callbacks related to the banner view behaviour\n+     */\n+    public interface Listener {\n+\n+        /**\n+         * Called whenever the banner finished loading an ad\n+         *\n+         * @param banner banner that finished the load\n+         */\n+        void onPubnativeBannerLoadFinish(PubnativeBanner banner);\n+\n+        /**\n+         * Called whenever the banner failed loading an ad\n+         *\n+         * @param banner banner that failed the load\n+         * @param exception    exception with the description of the load error\n+         */\n+        void onPubnativeBannerLoadFail(PubnativeBanner banner, Exception exception);\n+\n+        /**\n+         * Called when the Banner was just shown on the screen\n+         *\n+         * @param banner banner that was shown in the screen\n+         */\n+        void onPubnativeBannerShow(PubnativeBanner banner);\n+\n+        /**\n+         * Called when the banner impression was confrimed\n+         *\n+         * @param banner banner which impression was confirmed\n+         */\n+        void onPubnativeBannerImpressionConfirmed(PubnativeBanner banner);\n+\n+        /**\n+         * Called whenever the banner was clicked by the user\n+         *\n+         * @param banner banner that was clicked\n+         */\n+        void onPubnativeBannerClick(PubnativeBanner banner);\n+\n+        /**\n+         * Called whenever the banner was removed from the screen\n+         *\n+         * @param banner banner that was hidden\n+         */\n+        void onPubnativeBannerHide(PubnativeBanner banner);\n+    }\n+\n+    /**\n+     * Sets a callback listener for this interstitial object\n+     *\n+     * @param listener valid PubnativeInterstitial.Listener object\n+     */\n+    public void setListener(Listener listener) {\n+\n+        Log.v(TAG, \"setListener\");\n+        mListener = listener;\n+    }\n+\n+    /**\n+     * Starts loading an ad for this interstitial\n+     *\n+     * @param context context of {@link Activity}, where is banner will show\n+     * @param appToken application token from settings\n+     * @param bannerSize size of banner\n+     * @param bannerPosition banner position on the screen\n+     */\n+    public void load(Context context, String appToken, Size bannerSize, Position bannerPosition) {\n+\n+        Log.v(TAG, \"load\");\n+        mHandler = new Handler(Looper.getMainLooper());","path":"library.banner/src/main/java/net/pubnative/library/banner/PubnativeBanner.java","position":130,"original_position":130,"commit_id":"bdaa2ca9958f6bea3cf6dc56407e08ea18964f85","original_commit_id":"bdaa2ca9958f6bea3cf6dc56407e08ea18964f85","user":{"login":"cerberillo","id":422329,"avatar_url":"https://avatars.githubusercontent.com/u/422329?v=3","gravatar_id":"","url":"https://api.github.com/users/cerberillo","html_url":"https://github.com/cerberillo","followers_url":"https://api.github.com/users/cerberillo/followers","following_url":"https://api.github.com/users/cerberillo/following{/other_user}","gists_url":"https://api.github.com/users/cerberillo/gists{/gist_id}","starred_url":"https://api.github.com/users/cerberillo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cerberillo/subscriptions","organizations_url":"https://api.github.com/users/cerberillo/orgs","repos_url":"https://api.github.com/users/cerberillo/repos","events_url":"https://api.github.com/users/cerberillo/events{/privacy}","received_events_url":"https://api.github.com/users/cerberillo/received_events","type":"User","site_admin":false},"body":"yup, makes sense","created_at":"2016-05-19T13:43:43Z","updated_at":"2016-05-19T13:43:43Z","html_url":"https://github.com/pubnative/pubnative-android-library/pull/97#discussion_r63880160","pull_request_url":"https://api.github.com/repos/pubnative/pubnative-android-library/pulls/97","_links":{"self":{"href":"https://api.github.com/repos/pubnative/pubnative-android-library/pulls/comments/63880160"},"html":{"href":"https://github.com/pubnative/pubnative-android-library/pull/97#discussion_r63880160"},"pull_request":{"href":"https://api.github.com/repos/pubnative/pubnative-android-library/pulls/97"}}},"pull_request":{"url":"https://api.github.com/repos/pubnative/pubnative-android-library/pulls/97","id":69316675,"html_url":"https://github.com/pubnative/pubnative-android-library/pull/97","diff_url":"https://github.com/pubnative/pubnative-android-library/pull/97.diff","patch_url":"https://github.com/pubnative/pubnative-android-library/pull/97.patch","issue_url":"https://api.github.com/repos/pubnative/pubnative-android-library/issues/97","number":97,"state":"open","locked":false,"title":"Banner implementation","user":{"login":"RagnarR","id":897618,"avatar_url":"https://avatars.githubusercontent.com/u/897618?v=3","gravatar_id":"","url":"https://api.github.com/users/RagnarR","html_url":"https://github.com/RagnarR","followers_url":"https://api.github.com/users/RagnarR/followers","following_url":"https://api.github.com/users/RagnarR/following{/other_user}","gists_url":"https://api.github.com/users/RagnarR/gists{/gist_id}","starred_url":"https://api.github.com/users/RagnarR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RagnarR/subscriptions","organizations_url":"https://api.github.com/users/RagnarR/orgs","repos_url":"https://api.github.com/users/RagnarR/repos","events_url":"https://api.github.com/users/RagnarR/events{/privacy}","received_events_url":"https://api.github.com/users/RagnarR/received_events","type":"User","site_admin":false},"body":"Implemented Banner module. Added example of using in library demo app.","created_at":"2016-05-09T09:21:55Z","updated_at":"2016-05-19T13:43:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bc4fb85ad1a0099839244500379e287c0f30eff8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/pubnative/pubnative-android-library/pulls/97/commits","review_comments_url":"https://api.github.com/repos/pubnative/pubnative-android-library/pulls/97/comments","review_comment_url":"https://api.github.com/repos/pubnative/pubnative-android-library/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pubnative/pubnative-android-library/issues/97/comments","statuses_url":"https://api.github.com/repos/pubnative/pubnative-android-library/statuses/bdaa2ca9958f6bea3cf6dc56407e08ea18964f85","head":{"label":"pubnative:banner_implementation","ref":"banner_implementation","sha":"bdaa2ca9958f6bea3cf6dc56407e08ea18964f85","user":{"login":"pubnative","id":7806659,"avatar_url":"https://avatars.githubusercontent.com/u/7806659?v=3","gravatar_id":"","url":"https://api.github.com/users/pubnative","html_url":"https://github.com/pubnative","followers_url":"https://api.github.com/users/pubnative/followers","following_url":"https://api.github.com/users/pubnative/following{/other_user}","gists_url":"https://api.github.com/users/pubnative/gists{/gist_id}","starred_url":"https://api.github.com/users/pubnative/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pubnative/subscriptions","organizations_url":"https://api.github.com/users/pubnative/orgs","repos_url":"https://api.github.com/users/pubnative/repos","events_url":"https://api.github.com/users/pubnative/events{/privacy}","received_events_url":"https://api.github.com/users/pubnative/received_events","type":"Organization","site_admin":false},"repo":{"id":28917789,"name":"pubnative-android-library","full_name":"pubnative/pubnative-android-library","owner":{"login":"pubnative","id":7806659,"avatar_url":"https://avatars.githubusercontent.com/u/7806659?v=3","gravatar_id":"","url":"https://api.github.com/users/pubnative","html_url":"https://github.com/pubnative","followers_url":"https://api.github.com/users/pubnative/followers","following_url":"https://api.github.com/users/pubnative/following{/other_user}","gists_url":"https://api.github.com/users/pubnative/gists{/gist_id}","starred_url":"https://api.github.com/users/pubnative/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pubnative/subscriptions","organizations_url":"https://api.github.com/users/pubnative/orgs","repos_url":"https://api.github.com/users/pubnative/repos","events_url":"https://api.github.com/users/pubnative/events{/privacy}","received_events_url":"https://api.github.com/users/pubnative/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pubnative/pubnative-android-library","description":"","fork":false,"url":"https://api.github.com/repos/pubnative/pubnative-android-library","forks_url":"https://api.github.com/repos/pubnative/pubnative-android-library/forks","keys_url":"https://api.github.com/repos/pubnative/pubnative-android-library/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pubnative/pubnative-android-library/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pubnative/pubnative-android-library/teams","hooks_url":"https://api.github.com/repos/pubnative/pubnative-android-library/hooks","issue_events_url":"https://api.github.com/repos/pubnative/pubnative-android-library/issues/events{/number}","events_url":"https://api.github.com/repos/pubnative/pubnative-android-library/events","assignees_url":"https://api.github.com/repos/pubnative/pubnative-android-library/assignees{/user}","branches_url":"https://api.github.com/repos/pubnative/pubnative-android-library/branches{/branch}","tags_url":"https://api.github.com/repos/pubnative/pubnative-android-library/tags","blobs_url":"https://api.github.com/repos/pubnative/pubnative-android-library/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pubnative/pubnative-android-library/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pubnative/pubnative-android-library/git/refs{/sha}","trees_url":"https://api.github.com/repos/pubnative/pubnative-android-library/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pubnative/pubnative-android-library/statuses/{sha}","languages_url":"https://api.github.com/repos/pubnative/pubnative-android-library/languages","stargazers_url":"https://api.github.com/repos/pubnative/pubnative-android-library/stargazers","contributors_url":"https://api.github.com/repos/pubnative/pubnative-android-library/contributors","subscribers_url":"https://api.github.com/repos/pubnative/pubnative-android-library/subscribers","subscription_url":"https://api.github.com/repos/pubnative/pubnative-android-library/subscription","commits_url":"https://api.github.com/repos/pubnative/pubnative-android-library/commits{/sha}","git_commits_url":"https://api.github.com/repos/pubnative/pubnative-android-library/git/commits{/sha}","comments_url":"https://api.github.com/repos/pubnative/pubnative-android-library/comments{/number}","issue_comment_url":"https://api.github.com/repos/pubnative/pubnative-android-library/issues/comments{/number}","contents_url":"https://api.github.com/repos/pubnative/pubnative-android-library/contents/{+path}","compare_url":"https://api.github.com/repos/pubnative/pubnative-android-library/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pubnative/pubnative-android-library/merges","archive_url":"https://api.github.com/repos/pubnative/pubnative-android-library/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pubnative/pubnative-android-library/downloads","issues_url":"https://api.github.com/repos/pubnative/pubnative-android-library/issues{/number}","pulls_url":"https://api.github.com/repos/pubnative/pubnative-android-library/pulls{/number}","milestones_url":"https://api.github.com/repos/pubnative/pubnative-android-library/milestones{/number}","notifications_url":"https://api.github.com/repos/pubnative/pubnative-android-library/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pubnative/pubnative-android-library/labels{/name}","releases_url":"https://api.github.com/repos/pubnative/pubnative-android-library/releases{/id}","deployments_url":"https://api.github.com/repos/pubnative/pubnative-android-library/deployments","created_at":"2015-01-07T14:26:18Z","updated_at":"2016-01-29T10:58:51Z","pushed_at":"2016-05-19T11:35:59Z","git_url":"git://github.com/pubnative/pubnative-android-library.git","ssh_url":"git@github.com:pubnative/pubnative-android-library.git","clone_url":"https://github.com/pubnative/pubnative-android-library.git","svn_url":"https://github.com/pubnative/pubnative-android-library","homepage":null,"size":4526,"stargazers_count":6,"watchers_count":6,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":3,"forks":6,"open_issues":3,"watchers":6,"default_branch":"master"}},"base":{"label":"pubnative:development","ref":"development","sha":"a3ab1d21263849758944df7889c1ac53d67527c3","user":{"login":"pubnative","id":7806659,"avatar_url":"https://avatars.githubusercontent.com/u/7806659?v=3","gravatar_id":"","url":"https://api.github.com/users/pubnative","html_url":"https://github.com/pubnative","followers_url":"https://api.github.com/users/pubnative/followers","following_url":"https://api.github.com/users/pubnative/following{/other_user}","gists_url":"https://api.github.com/users/pubnative/gists{/gist_id}","starred_url":"https://api.github.com/users/pubnative/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pubnative/subscriptions","organizations_url":"https://api.github.com/users/pubnative/orgs","repos_url":"https://api.github.com/users/pubnative/repos","events_url":"https://api.github.com/users/pubnative/events{/privacy}","received_events_url":"https://api.github.com/users/pubnative/received_events","type":"Organization","site_admin":false},"repo":{"id":28917789,"name":"pubnative-android-library","full_name":"pubnative/pubnative-android-library","owner":{"login":"pubnative","id":7806659,"avatar_url":"https://avatars.githubusercontent.com/u/7806659?v=3","gravatar_id":"","url":"https://api.github.com/users/pubnative","html_url":"https://github.com/pubnative","followers_url":"https://api.github.com/users/pubnative/followers","following_url":"https://api.github.com/users/pubnative/following{/other_user}","gists_url":"https://api.github.com/users/pubnative/gists{/gist_id}","starred_url":"https://api.github.com/users/pubnative/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pubnative/subscriptions","organizations_url":"https://api.github.com/users/pubnative/orgs","repos_url":"https://api.github.com/users/pubnative/repos","events_url":"https://api.github.com/users/pubnative/events{/privacy}","received_events_url":"https://api.github.com/users/pubnative/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pubnative/pubnative-android-library","description":"","fork":false,"url":"https://api.github.com/repos/pubnative/pubnative-android-library","forks_url":"https://api.github.com/repos/pubnative/pubnative-android-library/forks","keys_url":"https://api.github.com/repos/pubnative/pubnative-android-library/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pubnative/pubnative-android-library/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pubnative/pubnative-android-library/teams","hooks_url":"https://api.github.com/repos/pubnative/pubnative-android-library/hooks","issue_events_url":"https://api.github.com/repos/pubnative/pubnative-android-library/issues/events{/number}","events_url":"https://api.github.com/repos/pubnative/pubnative-android-library/events","assignees_url":"https://api.github.com/repos/pubnative/pubnative-android-library/assignees{/user}","branches_url":"https://api.github.com/repos/pubnative/pubnative-android-library/branches{/branch}","tags_url":"https://api.github.com/repos/pubnative/pubnative-android-library/tags","blobs_url":"https://api.github.com/repos/pubnative/pubnative-android-library/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pubnative/pubnative-android-library/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pubnative/pubnative-android-library/git/refs{/sha}","trees_url":"https://api.github.com/repos/pubnative/pubnative-android-library/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pubnative/pubnative-android-library/statuses/{sha}","languages_url":"https://api.github.com/repos/pubnative/pubnative-android-library/languages","stargazers_url":"https://api.github.com/repos/pubnative/pubnative-android-library/stargazers","contributors_url":"https://api.github.com/repos/pubnative/pubnative-android-library/contributors","subscribers_url":"https://api.github.com/repos/pubnative/pubnative-android-library/subscribers","subscription_url":"https://api.github.com/repos/pubnative/pubnative-android-library/subscription","commits_url":"https://api.github.com/repos/pubnative/pubnative-android-library/commits{/sha}","git_commits_url":"https://api.github.com/repos/pubnative/pubnative-android-library/git/commits{/sha}","comments_url":"https://api.github.com/repos/pubnative/pubnative-android-library/comments{/number}","issue_comment_url":"https://api.github.com/repos/pubnative/pubnative-android-library/issues/comments{/number}","contents_url":"https://api.github.com/repos/pubnative/pubnative-android-library/contents/{+path}","compare_url":"https://api.github.com/repos/pubnative/pubnative-android-library/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pubnative/pubnative-android-library/merges","archive_url":"https://api.github.com/repos/pubnative/pubnative-android-library/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pubnative/pubnative-android-library/downloads","issues_url":"https://api.github.com/repos/pubnative/pubnative-android-library/issues{/number}","pulls_url":"https://api.github.com/repos/pubnative/pubnative-android-library/pulls{/number}","milestones_url":"https://api.github.com/repos/pubnative/pubnative-android-library/milestones{/number}","notifications_url":"https://api.github.com/repos/pubnative/pubnative-android-library/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pubnative/pubnative-android-library/labels{/name}","releases_url":"https://api.github.com/repos/pubnative/pubnative-android-library/releases{/id}","deployments_url":"https://api.github.com/repos/pubnative/pubnative-android-library/deployments","created_at":"2015-01-07T14:26:18Z","updated_at":"2016-01-29T10:58:51Z","pushed_at":"2016-05-19T11:35:59Z","git_url":"git://github.com/pubnative/pubnative-android-library.git","ssh_url":"git@github.com:pubnative/pubnative-android-library.git","clone_url":"https://github.com/pubnative/pubnative-android-library.git","svn_url":"https://github.com/pubnative/pubnative-android-library","homepage":null,"size":4526,"stargazers_count":6,"watchers_count":6,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":3,"forks":6,"open_issues":3,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pubnative/pubnative-android-library/pulls/97"},"html":{"href":"https://github.com/pubnative/pubnative-android-library/pull/97"},"issue":{"href":"https://api.github.com/repos/pubnative/pubnative-android-library/issues/97"},"comments":{"href":"https://api.github.com/repos/pubnative/pubnative-android-library/issues/97/comments"},"review_comments":{"href":"https://api.github.com/repos/pubnative/pubnative-android-library/pulls/97/comments"},"review_comment":{"href":"https://api.github.com/repos/pubnative/pubnative-android-library/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pubnative/pubnative-android-library/pulls/97/commits"},"statuses":{"href":"https://api.github.com/repos/pubnative/pubnative-android-library/statuses/bdaa2ca9958f6bea3cf6dc56407e08ea18964f85"}}}}