{"action":"created","issue":{"url":"https://api.github.com/repos/MrLiKH/supercustomtoast/issues/1","labels_url":"https://api.github.com/repos/MrLiKH/supercustomtoast/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/MrLiKH/supercustomtoast/issues/1/comments","events_url":"https://api.github.com/repos/MrLiKH/supercustomtoast/issues/1/events","html_url":"https://github.com/MrLiKH/supercustomtoast/issues/1","id":120742027,"number":1,"title":"关于同一个消息只显示一个的问题.","user":{"login":"a120200793","id":14799516,"avatar_url":"https://avatars.githubusercontent.com/u/14799516?v=3","gravatar_id":"","url":"https://api.github.com/users/a120200793","html_url":"https://github.com/a120200793","followers_url":"https://api.github.com/users/a120200793/followers","following_url":"https://api.github.com/users/a120200793/following{/other_user}","gists_url":"https://api.github.com/users/a120200793/gists{/gist_id}","starred_url":"https://api.github.com/users/a120200793/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/a120200793/subscriptions","organizations_url":"https://api.github.com/users/a120200793/orgs","repos_url":"https://api.github.com/users/a120200793/repos","events_url":"https://api.github.com/users/a120200793/events{/privacy}","received_events_url":"https://api.github.com/users/a120200793/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-12-07T10:24:47Z","updated_at":"2015-12-09T08:25:28Z","closed_at":null,"body":"您好,这个项目的效果非常赞.\r\n但是在用的时候,有些问题,我并不能解决.\r\n一个是如何判断 一个toast已经显示了,在下一个msg相同的情况下,一定时间不显示新的toast.如果同样的消息,在两次显示时间差大于duration的情况下,才出现新的toast就好了.\r\n第二个是在activity 消失的时候,toast可以也消失掉吗\r\n期待您的回复,谢谢"},"comment":{"url":"https://api.github.com/repos/MrLiKH/supercustomtoast/issues/comments/163148618","html_url":"https://github.com/MrLiKH/supercustomtoast/issues/1#issuecomment-163148618","issue_url":"https://api.github.com/repos/MrLiKH/supercustomtoast/issues/1","id":163148618,"user":{"login":"a120200793","id":14799516,"avatar_url":"https://avatars.githubusercontent.com/u/14799516?v=3","gravatar_id":"","url":"https://api.github.com/users/a120200793","html_url":"https://github.com/a120200793","followers_url":"https://api.github.com/users/a120200793/followers","following_url":"https://api.github.com/users/a120200793/following{/other_user}","gists_url":"https://api.github.com/users/a120200793/gists{/gist_id}","starred_url":"https://api.github.com/users/a120200793/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/a120200793/subscriptions","organizations_url":"https://api.github.com/users/a120200793/orgs","repos_url":"https://api.github.com/users/a120200793/repos","events_url":"https://api.github.com/users/a120200793/events{/privacy}","received_events_url":"https://api.github.com/users/a120200793/received_events","type":"User","site_admin":false},"created_at":"2015-12-09T08:25:28Z","updated_at":"2015-12-09T08:25:28Z","body":"@MrLiKH \r\n目前我在你的代码中添加了这样的方法,但是效果不是特别好,有的时候会快速的出现两条,activity结束后马上消失的问题也没解决.\r\n        private static String oldMsg = null;\r\n\tprivate static long oneTime = 0;\r\n\tprivate static long twoTime = 0;\r\npublic void showOnlyOne(String msg, Long duration, Animation startAnim, Animation endAnim) {\r\n\t\tif (mView.getChildCount() == 1) {\r\n\t\t\tshow(getTextView(msg), duration, startAnim, endAnim);\r\n\t\t\toldMsg = msg;\r\n\t\t\toneTime = System.currentTimeMillis();\r\n\t\t} else {\r\n\t\t\ttwoTime = System.currentTimeMillis();\r\n\t\t\tif (msg.equals(oldMsg)) {\r\n\t\t\t\tif (twoTime - oneTime > TIME_DURATION) {\r\n\t\t\t\t\tshow(getTextView(msg), duration, startAnim, endAnim);\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\toldMsg = msg;\r\n\t\t\t\tshow(getTextView(msg), duration, startAnim, endAnim);\r\n\t\t\t}\r\n\t\t}\r\n\t\toneTime = twoTime;\r\n\t}"}}