{"action":"created","issue":{"url":"https://api.github.com/repos/gsantner/markor/issues/319","repository_url":"https://api.github.com/repos/gsantner/markor","labels_url":"https://api.github.com/repos/gsantner/markor/issues/319/labels{/name}","comments_url":"https://api.github.com/repos/gsantner/markor/issues/319/comments","events_url":"https://api.github.com/repos/gsantner/markor/issues/319/events","html_url":"https://github.com/gsantner/markor/pull/319","id":356180709,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEyNTM0NjAy","number":319,"title":"Add option to take photo and insert it's markdown link (#306 -> #319)","user":{"login":"Conceptron","id":35289454,"node_id":"MDQ6VXNlcjM1Mjg5NDU0","avatar_url":"https://avatars0.githubusercontent.com/u/35289454?v=4","gravatar_id":"","url":"https://api.github.com/users/Conceptron","html_url":"https://github.com/Conceptron","followers_url":"https://api.github.com/users/Conceptron/followers","following_url":"https://api.github.com/users/Conceptron/following{/other_user}","gists_url":"https://api.github.com/users/Conceptron/gists{/gist_id}","starred_url":"https://api.github.com/users/Conceptron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Conceptron/subscriptions","organizations_url":"https://api.github.com/users/Conceptron/orgs","repos_url":"https://api.github.com/users/Conceptron/repos","events_url":"https://api.github.com/users/Conceptron/events{/privacy}","received_events_url":"https://api.github.com/users/Conceptron/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2018-09-01T07:30:57Z","updated_at":"2018-09-05T08:54:21Z","closed_at":"2018-09-04T07:19:30Z","author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/gsantner/markor/pulls/319","html_url":"https://github.com/gsantner/markor/pull/319","diff_url":"https://github.com/gsantner/markor/pull/319.diff","patch_url":"https://github.com/gsantner/markor/pull/319.patch"},"body":"Addresses issue #306 \r\n#### Description of the solution and bug\r\n\r\nThe text module actions are added to the bottom `ViewGroup` (in the `DocumentEditFragment`) in the `MarkdownTextModuleActions` class. `onClick` listeners are attached to each button added. So I added an icon to take a photo and insert it's link at the location of the cursor. \r\n\r\nTo call the camera activity and get it's result, we need to use the `startActivityForResult` function which is a member function of `Activity` and `Fragment`. I called the `DocumentActivity`s `startActivityForResult` as the `MarkdownTextModuleActions` class already has a `_activity` member referring to the activity. This is supposed to start the camera activity and call the `onActivityResult` function in `DocumentActivity` on exit of the camera activity (but while debugging using the Android debugger i noticed that the `DocumentEditFragment`'s function is being called). Since it is logical to handle this result in the `MarkdownTextModuleActions` class, i am calling the `DocumentEditFragment`'s `onActivityResult` which in turn calls another method (also called `onActivityResult`) of the `MarkdownTextModuleActions` object. \r\n\r\nNow, if the picture is taken the `url` is inserted using `_hlEditor.getText().insert(...)`. I checked using the Android debugger that this particular statement is being executed on taking a picture but no text is getting inserted. On the other hand the snackbar is being shown when no picture is taken. I have noticed that the cursor position in the editor is being reset to the start of the text when the camera activity returns.\r\n\r\n\r\n<!-- \r\nHello, and thanks for contributing!\r\n\r\nPlease always do auto-reformat on code before creating a PR.\r\nIn Android-Studio do a right-click on java->Reformat and check the first two options.\r\n\r\nAfter creating the PR please wait patiently till somebody from the team has time to give a review.\r\nThe top-priority requirement for this to get merged is, that building/tests don't fail.\r\nIf theres an continious integration system integrated in this project, you should see a colored checkmark in the PR window which tells the status.\r\n\r\n## Contributors document\r\nAdd yourself! When adding your information to the `CONTRIBUTORS.md` file, please use the following format:\r\n\r\nSchema:  **[Name](Reference)**<br/>~° Text \r\nWhere: \r\n  * Name: username, first/lastname \r\n  * Reference: E-Mail, Webpage \r\n  * Text: Information about / kind of contribution \r\nExample:\r\n* **[Nice Guy](http://niceguy.web)**<br/>~° German localization \r\n-->\r\n"},"comment":{"url":"https://api.github.com/repos/gsantner/markor/issues/comments/418652832","html_url":"https://github.com/gsantner/markor/pull/319#issuecomment-418652832","issue_url":"https://api.github.com/repos/gsantner/markor/issues/319","id":418652832,"node_id":"MDEyOklzc3VlQ29tbWVudDQxODY1MjgzMg==","user":{"login":"gsantner","id":6735650,"node_id":"MDQ6VXNlcjY3MzU2NTA=","avatar_url":"https://avatars1.githubusercontent.com/u/6735650?v=4","gravatar_id":"","url":"https://api.github.com/users/gsantner","html_url":"https://github.com/gsantner","followers_url":"https://api.github.com/users/gsantner/followers","following_url":"https://api.github.com/users/gsantner/following{/other_user}","gists_url":"https://api.github.com/users/gsantner/gists{/gist_id}","starred_url":"https://api.github.com/users/gsantner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gsantner/subscriptions","organizations_url":"https://api.github.com/users/gsantner/orgs","repos_url":"https://api.github.com/users/gsantner/repos","events_url":"https://api.github.com/users/gsantner/events{/privacy}","received_events_url":"https://api.github.com/users/gsantner/received_events","type":"User","site_admin":false},"created_at":"2018-09-05T08:54:21Z","updated_at":"2018-09-05T08:54:21Z","author_association":"OWNER","body":"@Conceptron So final on this - thanks for working on it! Well done :+1: \r\n\r\nIf you want to dev more, very appreciated and welcome! :) \r\n\r\nPick something if you want, hot topics (features) currently are:\r\n* File search - <https://github.com/gsantner/markor/issues/301>\r\n* Text search & replace (in editor) <https://github.com/gsantner/markor/issues/155>\r\n* Single document revisioning (using some lib or alike instead full-copy of text for undo/redo) <https://github.com/gsantner/markor/issues/252>\r\n\r\nSmaller:\r\n* Insert time/date via bottom-toolbar button (custom format) <https://github.com/gsantner/markor/issues/260>\r\n* Remember last directory not works when closing app from task switcher <https://github.com/gsantner/markor/issues/229>\r\n*  Sort todo-list (with dialog asking for order) <https://github.com/gsantner/markor/issues/211>\r\n* Start document at the recent cursor position <https://github.com/gsantner/markor/issues/205>"}}
{"actor":{"display_login":"gsantner"}}