{"id":23678382,"url":"https://github.com/zzyyppqq/countdowntimerlist","last_synced_at":"2025-08-08T04:22:18.086Z","repository":{"id":102401962,"uuid":"156210956","full_name":"zzyyppqq/CountDownTimerList","owner":"zzyyppqq","description":null,"archived":false,"fork":false,"pushed_at":"2018-11-14T08:08:16.000Z","size":2567,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-21T14:38:50.880Z","etag":null,"topics":["countdowntimer","handlerthread"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zzyyppqq.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-05T11:59:28.000Z","updated_at":"2018-11-14T08:08:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"2ebdd7fc-101a-4a84-9fff-4ce297ae5da7","html_url":"https://github.com/zzyyppqq/CountDownTimerList","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zzyyppqq/CountDownTimerList","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zzyyppqq%2FCountDownTimerList","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zzyyppqq%2FCountDownTimerList/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zzyyppqq%2FCountDownTimerList/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zzyyppqq%2FCountDownTimerList/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zzyyppqq","download_url":"https://codeload.github.com/zzyyppqq/CountDownTimerList/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zzyyppqq%2FCountDownTimerList/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269362799,"owners_count":24404619,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-08T02:00:09.200Z","response_time":72,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["countdowntimer","handlerthread"],"created_at":"2024-12-29T15:19:32.631Z","updated_at":"2025-08-08T04:22:18.064Z","avatar_url":"https://github.com/zzyyppqq.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CountDownTimerList\nCountDownTimerList 单线程（HanderThread）实现列表倒计时\n\n![CountDownTimerList](./countdowntimerlist.gif)\n\n-\n\nbuilb.gradle\n```\nimplementation 'com.zyp.timerlist:timerlist:1.0.1'\n```\n\npom.xml\n```\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.zyp.timerlist\u003c/groupId\u003e\n  \u003cartifactId\u003etimerlist\u003c/artifactId\u003e\n  \u003cversion\u003e1.0.1\u003c/version\u003e\n  \u003ctype\u003epom\u003c/type\u003e\n\u003c/dependency\u003e\n\n```\n\n\n- 列表倒计时（支持RecyclerView和ListView）\n\n```\n// Adapter 中使用示例 ，一般在Adapter构造函数中初始化XListCountDownTimer\n\n  class TimeDownAdapter extends BaseAdapter\u003cTimeEntry\u003e {\n\n          private final XListCountDownTimer mXTimeCounter;\n\n          public TimeDownAdapter() {\n              mXTimeCounter = new XListCountDownTimer();\n          }\n\n          @Override\n          protected BaseViewHolder\u003cTimeEntry\u003e createViewHolder(View view) {\n              return new TimeDownViewHolder(view, mXTimeCounter);\n          }\n\n          @Override\n          protected int itemLayout() {\n              return R.layout.item_layout;\n          }\n\n          class TimeDownViewHolder extends BaseViewHolder\u003cTimeEntry\u003e {\n              private XListCountDownTimer mXTimeCounter;\n\n              @BindView(R.id.tv_down_time)\n              TextView tvDownTime;\n\n              public TimeDownViewHolder(View itemView, XListCountDownTimer xTimeCounter) {\n                  super(itemView);\n                  this.mXTimeCounter = xTimeCounter;\n                  ButterKnife.bind(this, itemView);\n              }\n\n              @Override\n              public void bindData(TimeEntry timeEntry) {\n                  final long time = timeEntry.getTime();\n                  final long id = timeEntry.getId();\n\n                  //ViewWrapper的 第一个参数 id必须唯一，类似每隔商品的订单id ，第二个参数View可以是任何View及ViewGroup\n                  mXTimeCounter.running(new XListCountDownTask(new ViewWrapper(id, tvDownTime)) {\n                      @Override\n                      protected boolean updateView(ViewWrapper viewWrapper) {\n                          final TextView tvDownTime = (TextView) viewWrapper.getView();\n\n                          long remainTime = time - SystemClock.elapsedRealtime();\n                          if (remainTime \u003c 0) {\n                              tvDownTime.setText(\"剩余 :\" + DataUtil.formatDownTime(0));\n                              return false;\n                          }\n                          final String downTime = DataUtil.formatDownTime(remainTime);\n                          tvDownTime.setText(\"剩余 :\" + downTime);\n                          return true;\n                      }\n\n                  });\n              }\n          }\n      }\n\n```\n\n- 单个倒计时\n\n```\n // 倒计时在UI线程中执行\n XCountDownTimer xCountDownTimer = new XCountDownTimer(30 * 1000, 1000) {\n    @Override\n    protected void onTick(long millisUntilFinished) {\n        Log.e(TAG, \"millisUntilFinished : \" + millisUntilFinished / 1000);\n    }\n\n    @Override\n    protected void onFinish() {\n        Log.e(TAG, \"onFinish\" + \" , thread:\" + Thread.currentThread().getName());\n    }\n};\nxCountDownTimer.start();\n\n// 倒计时在子线程中执行\n XCountDownTimer xCountDownTimer = new XCountDownTimer(30 * 1000, 1000, false) {\n    @Override\n    protected void onTick(long millisUntilFinished) {\n        Log.e(TAG, \"millisUntilFinished : \" + millisUntilFinished / 1000);\n    }\n\n    @Override\n    protected void onFinish() {\n        Log.e(TAG, \"onFinish\" + \" , thread:\" + Thread.currentThread().getName());\n    }\n};\nxCountDownTimer.start();\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzzyyppqq%2Fcountdowntimerlist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzzyyppqq%2Fcountdowntimerlist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzzyyppqq%2Fcountdowntimerlist/lists"}