{"id":18976266,"url":"https://github.com/takumi314/android-kotlin-countdown-timer","last_synced_at":"2026-05-15T20:04:39.195Z","repository":{"id":94579515,"uuid":"235361542","full_name":"takumi314/android-kotlin-countdown-timer","owner":"takumi314","description":"Android学習用のサンプルアプリ - AppTheme・ベクタ形式の画像・FloatingActionButton・CountDownTimer・SoundPool・非推奨API処理","archived":false,"fork":false,"pushed_at":"2020-01-25T12:54:48.000Z","size":978,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-01T08:02:23.717Z","etag":null,"topics":["android","countdowntimer","depricated","floatingactionbutton","kotlin","soundpool"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","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/takumi314.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":"2020-01-21T14:27:57.000Z","updated_at":"2020-01-25T12:54:50.000Z","dependencies_parsed_at":"2023-03-06T06:30:20.565Z","dependency_job_id":null,"html_url":"https://github.com/takumi314/android-kotlin-countdown-timer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/takumi314/android-kotlin-countdown-timer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takumi314%2Fandroid-kotlin-countdown-timer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takumi314%2Fandroid-kotlin-countdown-timer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takumi314%2Fandroid-kotlin-countdown-timer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takumi314%2Fandroid-kotlin-countdown-timer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/takumi314","download_url":"https://codeload.github.com/takumi314/android-kotlin-countdown-timer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takumi314%2Fandroid-kotlin-countdown-timer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33078003,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-15T11:35:32.926Z","status":"ssl_error","status_checked_at":"2026-05-15T11:35:31.362Z","response_time":103,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["android","countdowntimer","depricated","floatingactionbutton","kotlin","soundpool"],"created_at":"2024-11-08T15:23:19.863Z","updated_at":"2026-05-15T20:04:39.180Z","avatar_url":"https://github.com/takumi314.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# android-kotlin-countdown-timer\n## Goal\nカウントダウンタイマーを作る\n\n## 必要な知識\n- AppTheme\n- ベクタ形式の画像\n- FloatingActionButton\n- CountDownTimer\n- SoundPool\n- 非推奨API処理\n\n## CountDownTimerクラス\n- [CountDownTimer - android developers](https://developer.android.com/reference/android/os/CountDownTimer)\n\n**Constructor**\n\n```\npublic CountDownTimer (long millisInFuture, long countDownInterval)\n```\n- `millisInFuture`  long型:  `start()`がコールされてからカウントダウン終了で`onFinished()` が呼び出されるまでの時間をミリ秒で指定する。\n- `countDownInterval`  long型:  `onTick(long)` でコールバックを受け取る時間間隔を指定する。\n\n\n**Methods**\n\n 返り値 | メソッド | 説明\n:---- | :---- | :----\nfinal void | `cancel()` | カウントダウンをかキャンセルする。\nabstract void | `onFinish()` | カウントダウンが終了したらコールされる。\nabstract void | `onTick(millisUntilFinished: Long)` | 一定時間が経過するとコールされる。\nfinal CountDownTimer | `onStart()` | カウントダウンを開始する。\n\n### 注意点\n- カウントダウン終了時刻にずれはないが、カウントダウンの `onTick(millisUntilFinished: Long)` がコールバックされるタイミングに誤差がある。\n- 端末がディープスリープするとカウントが止まる。\n\n\n## 非推奨APIを処理する\n- 実行中のOSバージョン番号は `Build.VERSION.SDK_INT` で取得できる。\n- 今までリリースされたすべてのAndroid OSのバージョン番号は `Build.VERSION_CODES` で定義されている。\n\n### Ex. AaPI21(Lollipop)以降で非推奨である対応例\n\nSoundPoolのコンストラクタは, API21以降では非推奨となるため, SoundPool.Builderでインスタンスを生成して各種属性を設定する対応が必要となる。\n\n```kt:\nif (Build.VERSION.SDK_INT \u003c Build.VERSION_CODES.LOLLIPOP) {\n    @Suppress(\"DEPRECATION\")\n    soundPool = SoundPool(2, AudioManager.STREAM_ALARM, 0)\n} else {\n    val audioAttributes\n            = AudioAttributes.Builder()\n        .setUsage(AudioAttributes.USAGE_ALARM)\n        .build()\n    soundPool = SoundPool.Builder()\n        .setAudioAttributes(audioAttributes)\n        .build()\n}\n```\n\n※ `@Suppress(\"DEPRECATION\")`というアノテーションは、「非推奨のメソッドを使っているが、対応済みなので検査不要だよ〜」ってことを明示的に示すもの。\n\n### Build.VERSION_CODES の定数\n\n定数名 | OSバージョン | バージョン番号\n:---- | :---- | :----:\nKITKAT | Android 4.4 | 19\nLOLLIPOP | Android 5.0 | 21\nLOLLIPOP_MR1 | Android 5.1 | 22\nM | Android 6.0 | 23\nN | Android 7.0 | 24\nN_MR1 | Android 7.1 | 25\nO | Android 8.0 | 26\nO_MR1 | Android 8.1 | 27\nP | Android 9.0 | 28\nQ | Android 10.0 | 29\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftakumi314%2Fandroid-kotlin-countdown-timer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftakumi314%2Fandroid-kotlin-countdown-timer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftakumi314%2Fandroid-kotlin-countdown-timer/lists"}