{"action":"created","issue":{"url":"https://api.github.com/repos/commonsguy/cwac-camera/issues/179","repository_url":"https://api.github.com/repos/commonsguy/cwac-camera","labels_url":"https://api.github.com/repos/commonsguy/cwac-camera/issues/179/labels{/name}","comments_url":"https://api.github.com/repos/commonsguy/cwac-camera/issues/179/comments","events_url":"https://api.github.com/repos/commonsguy/cwac-camera/issues/179/events","html_url":"https://github.com/commonsguy/cwac-camera/issues/179","id":36683635,"number":179,"title":"Add CameraHost callback for entering, leaving preview","user":{"login":"commonsguy","id":103772,"avatar_url":"https://avatars.githubusercontent.com/u/103772?v=3","gravatar_id":"","url":"https://api.github.com/users/commonsguy","html_url":"https://github.com/commonsguy","followers_url":"https://api.github.com/users/commonsguy/followers","following_url":"https://api.github.com/users/commonsguy/following{/other_user}","gists_url":"https://api.github.com/users/commonsguy/gists{/gist_id}","starred_url":"https://api.github.com/users/commonsguy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/commonsguy/subscriptions","organizations_url":"https://api.github.com/users/commonsguy/orgs","repos_url":"https://api.github.com/users/commonsguy/repos","events_url":"https://api.github.com/users/commonsguy/events{/privacy}","received_events_url":"https://api.github.com/users/commonsguy/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/commonsguy/cwac-camera/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/commonsguy/cwac-camera/labels/target-0.7.0","name":"target-0.7.0","color":"fad8c7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2014-06-27T16:40:34Z","updated_at":"2016-02-12T12:40:01Z","closed_at":null,"body":"Basically, when `inPreview` changes, that needs to get reflected out to the `CameraHost`, for enabling/disabling anything that might call `takePicture()`.\r\n\r\nRight now, `autoFocusEnabled()` will be invoked when `inPreview` changes to `true`. There is no good counterpart method for when `inPreview` changes to `false`, though `autoFocusDisabled()` comes close. Monitoring `autoFocusDisabled()`, plus noting when you call `takePicture()`, should cover it.\r\n"},"comment":{"url":"https://api.github.com/repos/commonsguy/cwac-camera/issues/comments/183306333","html_url":"https://github.com/commonsguy/cwac-camera/issues/179#issuecomment-183306333","issue_url":"https://api.github.com/repos/commonsguy/cwac-camera/issues/179","id":183306333,"user":{"login":"ishaan-khan","id":9714778,"avatar_url":"https://avatars.githubusercontent.com/u/9714778?v=3","gravatar_id":"","url":"https://api.github.com/users/ishaan-khan","html_url":"https://github.com/ishaan-khan","followers_url":"https://api.github.com/users/ishaan-khan/followers","following_url":"https://api.github.com/users/ishaan-khan/following{/other_user}","gists_url":"https://api.github.com/users/ishaan-khan/gists{/gist_id}","starred_url":"https://api.github.com/users/ishaan-khan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ishaan-khan/subscriptions","organizations_url":"https://api.github.com/users/ishaan-khan/orgs","repos_url":"https://api.github.com/users/ishaan-khan/repos","events_url":"https://api.github.com/users/ishaan-khan/events{/privacy}","received_events_url":"https://api.github.com/users/ishaan-khan/received_events","type":"User","site_admin":false},"created_at":"2016-02-12T12:40:01Z","updated_at":"2016-02-12T12:40:01Z","body":"I had the same issue but resolved it by adding a method in CameraView class and CameraFragment which returns the inPreview boolean. On click of button I first check if inPreview is true then takePicture is called else restart the fragment. Hope this helps!"}}