{"action":"created","comment":{"url":"https://api.github.com/repos/tangrams/tangram-es/pulls/comments/224256517","pull_request_review_id":163580223,"id":224256517,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNDI1NjUxNw==","diff_hunk":"@@ -1089,24 +1098,56 @@ public void removeAllMarkers() {\n      */\n     public void setMapChangeListener(@Nullable final MapChangeListener listener) {\n         mapChangeListener = listener;\n+        mapRegionChangeStateManager = new MapRegionChangeStateManager(mapChangeListener);\n     }\n \n-    //Convenience member functions\n-    private void onRegionWillChange(boolean animated) {\n-        if (mapChangeListener != null) {\n-            mapChangeListener.onRegionWillChange(animated);\n+    private static class MapRegionChangeStateManager {\n+\n+        enum MapRegionChangeState {\n+            IDLE,\n+            JUMPING,\n+            ANIMATING,\n         }\n-    }\n \n-    private void onRegionDidChange(boolean animated) {\n-        if (mapChangeListener != null) {\n-            mapChangeListener.onRegionDidChange(animated);\n+        WeakReference<MapChangeListener> mapChangeListenerWeakReference;\n+\n+        MapRegionChangeStateManager(@Nullable MapChangeListener listener) {\n+            mapChangeListenerWeakReference = new WeakReference<>(listener);\n         }\n-    }\n \n-    private void onRegionIsChanging() {\n-        if (mapChangeListener != null) {\n-            mapChangeListener.onRegionIsChanging();\n+        MapRegionChangeState currentState = MapRegionChangeState.IDLE;\n+\n+        void setMapRegionState(MapRegionChangeState state) {\n+\n+            MapChangeListener mapChangeListener = mapChangeListenerWeakReference.get();\n+            if (mapChangeListener != null) {\n+                switch (currentState) {\n+                    case IDLE:\n+                        if (state == MapRegionChangeState.JUMPING) {\n+                            mapChangeListener.onRegionWillChange(false);\n+                        } else if (state == MapRegionChangeState.ANIMATING){\n+                            mapChangeListener.onRegionWillChange(true);\n+                        }\n+                        break;\n+                    case JUMPING:\n+                        if (state == MapRegionChangeState.IDLE) {\n+                            mapChangeListener.onRegionDidChange(false);\n+                        } else if (state == MapRegionChangeState.ANIMATING) { // e.g. panning to fling\n+                            mapChangeListener.onRegionIsChanging();\n+                        }\n+                        break;\n+                    case ANIMATING:\n+                        if (state == MapRegionChangeState.IDLE) {\n+                            mapChangeListener.onRegionDidChange(true);\n+                        } else if (state == MapRegionChangeState.ANIMATING) {\n+                            mapChangeListener.onRegionIsChanging();\n+                        } else { // ?? ANIMATING -> JUMPING?? Possible?","path":"platforms/android/tangram/src/main/java/com/mapzen/tangram/MapController.java","position":null,"original_position":241,"commit_id":"5a9bc94fc5e298a3b9e44ec1d4d28557ed266801","original_commit_id":"0a470944f11d2bca6e5f74caca90310d64a1f167","user":{"login":"tallytalwar","id":360641,"node_id":"MDQ6VXNlcjM2MDY0MQ==","avatar_url":"https://avatars2.githubusercontent.com/u/360641?v=4","gravatar_id":"","url":"https://api.github.com/users/tallytalwar","html_url":"https://github.com/tallytalwar","followers_url":"https://api.github.com/users/tallytalwar/followers","following_url":"https://api.github.com/users/tallytalwar/following{/other_user}","gists_url":"https://api.github.com/users/tallytalwar/gists{/gist_id}","starred_url":"https://api.github.com/users/tallytalwar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tallytalwar/subscriptions","organizations_url":"https://api.github.com/users/tallytalwar/orgs","repos_url":"https://api.github.com/users/tallytalwar/repos","events_url":"https://api.github.com/users/tallytalwar/events{/privacy}","received_events_url":"https://api.github.com/users/tallytalwar/received_events","type":"User","site_admin":false},"body":"Going to remove this. Do not think it makes sense to respect this state transition of `ANIMATING`->`JUMPING`. The transitions of `DID_ANIMATING`, `WILL_CHANGE` implying an `IDLE` state in between will always happen.","created_at":"2018-10-10T22:02:21Z","updated_at":"2018-10-10T22:02:21Z","html_url":"https://github.com/tangrams/tangram-es/pull/1883#discussion_r224256517","pull_request_url":"https://api.github.com/repos/tangrams/tangram-es/pulls/1883","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/tangrams/tangram-es/pulls/comments/224256517"},"html":{"href":"https://github.com/tangrams/tangram-es/pull/1883#discussion_r224256517"},"pull_request":{"href":"https://api.github.com/repos/tangrams/tangram-es/pulls/1883"}},"in_reply_to_id":224153717},"pull_request":{"url":"https://api.github.com/repos/tangrams/tangram-es/pulls/1883","id":218478274,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE4NDc4Mjc0","html_url":"https://github.com/tangrams/tangram-es/pull/1883","diff_url":"https://github.com/tangrams/tangram-es/pull/1883.diff","patch_url":"https://github.com/tangrams/tangram-es/pull/1883.patch","issue_url":"https://api.github.com/repos/tangrams/tangram-es/issues/1883","number":1883,"state":"open","locked":false,"title":"[WIP]Map changing events and map change state management","user":{"login":"tallytalwar","id":360641,"node_id":"MDQ6VXNlcjM2MDY0MQ==","avatar_url":"https://avatars2.githubusercontent.com/u/360641?v=4","gravatar_id":"","url":"https://api.github.com/users/tallytalwar","html_url":"https://github.com/tallytalwar","followers_url":"https://api.github.com/users/tallytalwar/followers","following_url":"https://api.github.com/users/tallytalwar/following{/other_user}","gists_url":"https://api.github.com/users/tallytalwar/gists{/gist_id}","starred_url":"https://api.github.com/users/tallytalwar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tallytalwar/subscriptions","organizations_url":"https://api.github.com/users/tallytalwar/orgs","repos_url":"https://api.github.com/users/tallytalwar/repos","events_url":"https://api.github.com/users/tallytalwar/events{/privacy}","received_events_url":"https://api.github.com/users/tallytalwar/received_events","type":"User","site_admin":false},"body":"- Provides access to platform code to check if camera is in an animating state.\r\n- Adds logic to use this camera animating state to aptly invoke map changing MapChangeListener interface methods for both iOS and android platforms.\r\n- [Android] Adds MapChangeStateManager to aptly manage map change states (`will update`, `will update animated`, `is updating`, `did update`, `did update animated`).\r\n- [ ] Implement the above mentioned StateManager for iOS","created_at":"2018-09-26T22:55:35Z","updated_at":"2018-10-10T22:02:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7f5b2e737e1ecdb454da55e4458eca96506a118a","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/tangrams/tangram-es/pulls/1883/commits","review_comments_url":"https://api.github.com/repos/tangrams/tangram-es/pulls/1883/comments","review_comment_url":"https://api.github.com/repos/tangrams/tangram-es/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tangrams/tangram-es/issues/1883/comments","statuses_url":"https://api.github.com/repos/tangrams/tangram-es/statuses/5a9bc94fc5e298a3b9e44ec1d4d28557ed266801","head":{"label":"tangrams:map-changing-events","ref":"map-changing-events","sha":"5a9bc94fc5e298a3b9e44ec1d4d28557ed266801","user":{"login":"tangrams","id":8495302,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg0OTUzMDI=","avatar_url":"https://avatars2.githubusercontent.com/u/8495302?v=4","gravatar_id":"","url":"https://api.github.com/users/tangrams","html_url":"https://github.com/tangrams","followers_url":"https://api.github.com/users/tangrams/followers","following_url":"https://api.github.com/users/tangrams/following{/other_user}","gists_url":"https://api.github.com/users/tangrams/gists{/gist_id}","starred_url":"https://api.github.com/users/tangrams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tangrams/subscriptions","organizations_url":"https://api.github.com/users/tangrams/orgs","repos_url":"https://api.github.com/users/tangrams/repos","events_url":"https://api.github.com/users/tangrams/events{/privacy}","received_events_url":"https://api.github.com/users/tangrams/received_events","type":"Organization","site_admin":false},"repo":{"id":23391501,"node_id":"MDEwOlJlcG9zaXRvcnkyMzM5MTUwMQ==","name":"tangram-es","full_name":"tangrams/tangram-es","private":false,"owner":{"login":"tangrams","id":8495302,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg0OTUzMDI=","avatar_url":"https://avatars2.githubusercontent.com/u/8495302?v=4","gravatar_id":"","url":"https://api.github.com/users/tangrams","html_url":"https://github.com/tangrams","followers_url":"https://api.github.com/users/tangrams/followers","following_url":"https://api.github.com/users/tangrams/following{/other_user}","gists_url":"https://api.github.com/users/tangrams/gists{/gist_id}","starred_url":"https://api.github.com/users/tangrams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tangrams/subscriptions","organizations_url":"https://api.github.com/users/tangrams/orgs","repos_url":"https://api.github.com/users/tangrams/repos","events_url":"https://api.github.com/users/tangrams/events{/privacy}","received_events_url":"https://api.github.com/users/tangrams/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/tangrams/tangram-es","description":"2D and 3D map renderer using OpenGL ES","fork":false,"url":"https://api.github.com/repos/tangrams/tangram-es","forks_url":"https://api.github.com/repos/tangrams/tangram-es/forks","keys_url":"https://api.github.com/repos/tangrams/tangram-es/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tangrams/tangram-es/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tangrams/tangram-es/teams","hooks_url":"https://api.github.com/repos/tangrams/tangram-es/hooks","issue_events_url":"https://api.github.com/repos/tangrams/tangram-es/issues/events{/number}","events_url":"https://api.github.com/repos/tangrams/tangram-es/events","assignees_url":"https://api.github.com/repos/tangrams/tangram-es/assignees{/user}","branches_url":"https://api.github.com/repos/tangrams/tangram-es/branches{/branch}","tags_url":"https://api.github.com/repos/tangrams/tangram-es/tags","blobs_url":"https://api.github.com/repos/tangrams/tangram-es/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tangrams/tangram-es/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tangrams/tangram-es/git/refs{/sha}","trees_url":"https://api.github.com/repos/tangrams/tangram-es/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tangrams/tangram-es/statuses/{sha}","languages_url":"https://api.github.com/repos/tangrams/tangram-es/languages","stargazers_url":"https://api.github.com/repos/tangrams/tangram-es/stargazers","contributors_url":"https://api.github.com/repos/tangrams/tangram-es/contributors","subscribers_url":"https://api.github.com/repos/tangrams/tangram-es/subscribers","subscription_url":"https://api.github.com/repos/tangrams/tangram-es/subscription","commits_url":"https://api.github.com/repos/tangrams/tangram-es/commits{/sha}","git_commits_url":"https://api.github.com/repos/tangrams/tangram-es/git/commits{/sha}","comments_url":"https://api.github.com/repos/tangrams/tangram-es/comments{/number}","issue_comment_url":"https://api.github.com/repos/tangrams/tangram-es/issues/comments{/number}","contents_url":"https://api.github.com/repos/tangrams/tangram-es/contents/{+path}","compare_url":"https://api.github.com/repos/tangrams/tangram-es/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tangrams/tangram-es/merges","archive_url":"https://api.github.com/repos/tangrams/tangram-es/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tangrams/tangram-es/downloads","issues_url":"https://api.github.com/repos/tangrams/tangram-es/issues{/number}","pulls_url":"https://api.github.com/repos/tangrams/tangram-es/pulls{/number}","milestones_url":"https://api.github.com/repos/tangrams/tangram-es/milestones{/number}","notifications_url":"https://api.github.com/repos/tangrams/tangram-es/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tangrams/tangram-es/labels{/name}","releases_url":"https://api.github.com/repos/tangrams/tangram-es/releases{/id}","deployments_url":"https://api.github.com/repos/tangrams/tangram-es/deployments","created_at":"2014-08-27T13:56:56Z","updated_at":"2018-10-10T21:47:12Z","pushed_at":"2018-10-10T21:47:06Z","git_url":"git://github.com/tangrams/tangram-es.git","ssh_url":"git@github.com:tangrams/tangram-es.git","clone_url":"https://github.com/tangrams/tangram-es.git","svn_url":"https://github.com/tangrams/tangram-es","homepage":"","size":37072,"stargazers_count":445,"watchers_count":445,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":152,"mirror_url":null,"archived":false,"open_issues_count":139,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":152,"open_issues":139,"watchers":445,"default_branch":"master"}},"base":{"label":"tangrams:master","ref":"master","sha":"eb7f7851d75374a84cdd2d7dbb59f06c5fef5f19","user":{"login":"tangrams","id":8495302,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg0OTUzMDI=","avatar_url":"https://avatars2.githubusercontent.com/u/8495302?v=4","gravatar_id":"","url":"https://api.github.com/users/tangrams","html_url":"https://github.com/tangrams","followers_url":"https://api.github.com/users/tangrams/followers","following_url":"https://api.github.com/users/tangrams/following{/other_user}","gists_url":"https://api.github.com/users/tangrams/gists{/gist_id}","starred_url":"https://api.github.com/users/tangrams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tangrams/subscriptions","organizations_url":"https://api.github.com/users/tangrams/orgs","repos_url":"https://api.github.com/users/tangrams/repos","events_url":"https://api.github.com/users/tangrams/events{/privacy}","received_events_url":"https://api.github.com/users/tangrams/received_events","type":"Organization","site_admin":false},"repo":{"id":23391501,"node_id":"MDEwOlJlcG9zaXRvcnkyMzM5MTUwMQ==","name":"tangram-es","full_name":"tangrams/tangram-es","private":false,"owner":{"login":"tangrams","id":8495302,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg0OTUzMDI=","avatar_url":"https://avatars2.githubusercontent.com/u/8495302?v=4","gravatar_id":"","url":"https://api.github.com/users/tangrams","html_url":"https://github.com/tangrams","followers_url":"https://api.github.com/users/tangrams/followers","following_url":"https://api.github.com/users/tangrams/following{/other_user}","gists_url":"https://api.github.com/users/tangrams/gists{/gist_id}","starred_url":"https://api.github.com/users/tangrams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tangrams/subscriptions","organizations_url":"https://api.github.com/users/tangrams/orgs","repos_url":"https://api.github.com/users/tangrams/repos","events_url":"https://api.github.com/users/tangrams/events{/privacy}","received_events_url":"https://api.github.com/users/tangrams/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/tangrams/tangram-es","description":"2D and 3D map renderer using OpenGL ES","fork":false,"url":"https://api.github.com/repos/tangrams/tangram-es","forks_url":"https://api.github.com/repos/tangrams/tangram-es/forks","keys_url":"https://api.github.com/repos/tangrams/tangram-es/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tangrams/tangram-es/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tangrams/tangram-es/teams","hooks_url":"https://api.github.com/repos/tangrams/tangram-es/hooks","issue_events_url":"https://api.github.com/repos/tangrams/tangram-es/issues/events{/number}","events_url":"https://api.github.com/repos/tangrams/tangram-es/events","assignees_url":"https://api.github.com/repos/tangrams/tangram-es/assignees{/user}","branches_url":"https://api.github.com/repos/tangrams/tangram-es/branches{/branch}","tags_url":"https://api.github.com/repos/tangrams/tangram-es/tags","blobs_url":"https://api.github.com/repos/tangrams/tangram-es/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tangrams/tangram-es/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tangrams/tangram-es/git/refs{/sha}","trees_url":"https://api.github.com/repos/tangrams/tangram-es/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tangrams/tangram-es/statuses/{sha}","languages_url":"https://api.github.com/repos/tangrams/tangram-es/languages","stargazers_url":"https://api.github.com/repos/tangrams/tangram-es/stargazers","contributors_url":"https://api.github.com/repos/tangrams/tangram-es/contributors","subscribers_url":"https://api.github.com/repos/tangrams/tangram-es/subscribers","subscription_url":"https://api.github.com/repos/tangrams/tangram-es/subscription","commits_url":"https://api.github.com/repos/tangrams/tangram-es/commits{/sha}","git_commits_url":"https://api.github.com/repos/tangrams/tangram-es/git/commits{/sha}","comments_url":"https://api.github.com/repos/tangrams/tangram-es/comments{/number}","issue_comment_url":"https://api.github.com/repos/tangrams/tangram-es/issues/comments{/number}","contents_url":"https://api.github.com/repos/tangrams/tangram-es/contents/{+path}","compare_url":"https://api.github.com/repos/tangrams/tangram-es/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tangrams/tangram-es/merges","archive_url":"https://api.github.com/repos/tangrams/tangram-es/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tangrams/tangram-es/downloads","issues_url":"https://api.github.com/repos/tangrams/tangram-es/issues{/number}","pulls_url":"https://api.github.com/repos/tangrams/tangram-es/pulls{/number}","milestones_url":"https://api.github.com/repos/tangrams/tangram-es/milestones{/number}","notifications_url":"https://api.github.com/repos/tangrams/tangram-es/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tangrams/tangram-es/labels{/name}","releases_url":"https://api.github.com/repos/tangrams/tangram-es/releases{/id}","deployments_url":"https://api.github.com/repos/tangrams/tangram-es/deployments","created_at":"2014-08-27T13:56:56Z","updated_at":"2018-10-10T21:47:12Z","pushed_at":"2018-10-10T21:47:06Z","git_url":"git://github.com/tangrams/tangram-es.git","ssh_url":"git@github.com:tangrams/tangram-es.git","clone_url":"https://github.com/tangrams/tangram-es.git","svn_url":"https://github.com/tangrams/tangram-es","homepage":"","size":37072,"stargazers_count":445,"watchers_count":445,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":152,"mirror_url":null,"archived":false,"open_issues_count":139,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":152,"open_issues":139,"watchers":445,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tangrams/tangram-es/pulls/1883"},"html":{"href":"https://github.com/tangrams/tangram-es/pull/1883"},"issue":{"href":"https://api.github.com/repos/tangrams/tangram-es/issues/1883"},"comments":{"href":"https://api.github.com/repos/tangrams/tangram-es/issues/1883/comments"},"review_comments":{"href":"https://api.github.com/repos/tangrams/tangram-es/pulls/1883/comments"},"review_comment":{"href":"https://api.github.com/repos/tangrams/tangram-es/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tangrams/tangram-es/pulls/1883/commits"},"statuses":{"href":"https://api.github.com/repos/tangrams/tangram-es/statuses/5a9bc94fc5e298a3b9e44ec1d4d28557ed266801"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"tallytalwar"}}