{"action":"created","issue":{"url":"https://api.github.com/repos/robinhood/spark/issues/60","repository_url":"https://api.github.com/repos/robinhood/spark","labels_url":"https://api.github.com/repos/robinhood/spark/issues/60/labels{/name}","comments_url":"https://api.github.com/repos/robinhood/spark/issues/60/comments","events_url":"https://api.github.com/repos/robinhood/spark/issues/60/events","html_url":"https://github.com/robinhood/spark/issues/60","id":313172116,"number":60,"title":"[Request] New animation","user":{"login":"kojimasuki","id":3781786,"avatar_url":"https://avatars2.githubusercontent.com/u/3781786?v=4","gravatar_id":"","url":"https://api.github.com/users/kojimasuki","html_url":"https://github.com/kojimasuki","followers_url":"https://api.github.com/users/kojimasuki/followers","following_url":"https://api.github.com/users/kojimasuki/following{/other_user}","gists_url":"https://api.github.com/users/kojimasuki/gists{/gist_id}","starred_url":"https://api.github.com/users/kojimasuki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kojimasuki/subscriptions","organizations_url":"https://api.github.com/users/kojimasuki/orgs","repos_url":"https://api.github.com/users/kojimasuki/repos","events_url":"https://api.github.com/users/kojimasuki/events{/privacy}","received_events_url":"https://api.github.com/users/kojimasuki/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-04-11T04:45:49Z","updated_at":"2018-04-21T17:35:28Z","closed_at":"2018-04-21T17:35:28Z","author_association":"NONE","body":"First of all thank you for developing this lib!\r\n\r\nI'm trying to reproduce the heart rate \"spark\" in the gif below.\r\n\r\nAny plans to implement an animation like this? Have you seen anything similiar? Or maybe if you could point me in the right direction on how to implement this. I don't even know where to start.\r\n\r\nThank you!\r\n\r\n![ezgif-3-107271d80a](https://user-images.githubusercontent.com/3781786/38596710-665daf78-3d29-11e8-8ae5-3e5086b8408a.gif)\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/robinhood/spark/issues/comments/383315176","html_url":"https://github.com/robinhood/spark/issues/60#issuecomment-383315176","issue_url":"https://api.github.com/repos/robinhood/spark/issues/60","id":383315176,"user":{"login":"danh32","id":447085,"avatar_url":"https://avatars1.githubusercontent.com/u/447085?v=4","gravatar_id":"","url":"https://api.github.com/users/danh32","html_url":"https://github.com/danh32","followers_url":"https://api.github.com/users/danh32/followers","following_url":"https://api.github.com/users/danh32/following{/other_user}","gists_url":"https://api.github.com/users/danh32/gists{/gist_id}","starred_url":"https://api.github.com/users/danh32/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danh32/subscriptions","organizations_url":"https://api.github.com/users/danh32/orgs","repos_url":"https://api.github.com/users/danh32/repos","events_url":"https://api.github.com/users/danh32/events{/privacy}","received_events_url":"https://api.github.com/users/danh32/received_events","type":"User","site_admin":false},"created_at":"2018-04-21T17:35:28Z","updated_at":"2018-04-21T17:35:28Z","author_association":"CONTRIBUTOR","body":"Hi @kojimasuki, this effect should be achievable with Spark. I'm not sure where your data is coming from, but assuming you get a callback with the new heart rate value every time it updates:\r\n\r\n```\r\ninterface HeartRateCallback {\r\n  void onHearRateUpdated(float heartRate);\r\n}\r\n```\r\n\r\nI'd recommend storing the heartRate into a list of size, say 100. The first 100 values will fill up this list, then each value after that will push out the earliest value. Each time you get a new value, set this list on your SparkAdapter, and call `sparkAdapter.notifyDataSetChanged()`. This will trigger a redraw of your data. This should result in something close to the animation above.\r\n\r\nAnd as @naturalwarren said, you can look into setting a custom SparkAnimator to have more control over how the sparkline animates each time you call `notifyDataSetChanged()`. By default it will just redraw the new sparkline immediately, but you could do a translation between the old path and the new path to make it a little less jerky. But I'd guess that the default behavior is pretty close to the above effect, so try that out first.\r\n\r\nHope that helps!"}}
{"actor":{"display_login":"danh32"}}