{"id":13476144,"url":"https://github.com/happysingh23828/HappyTimer","last_synced_at":"2025-03-27T02:31:32.235Z","repository":{"id":117886066,"uuid":"231823177","full_name":"happysingh23828/HappyTimer","owner":"happysingh23828","description":"This is an android lib which helps you to implement Timer in your android app. This is 100% written in Kotlin.","archived":false,"fork":false,"pushed_at":"2021-10-10T09:30:46.000Z","size":862,"stargazers_count":53,"open_issues_count":2,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-08-01T16:44:09.635Z","etag":null,"topics":["android","android-app","android-countdown","android-countdownview","android-library","android-timer","android-timeview","androidtimer","timer-application"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/happysingh23828.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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-04T20:21:05.000Z","updated_at":"2024-03-26T19:15:39.000Z","dependencies_parsed_at":"2024-02-02T15:45:56.482Z","dependency_job_id":null,"html_url":"https://github.com/happysingh23828/HappyTimer","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/happysingh23828%2FHappyTimer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/happysingh23828%2FHappyTimer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/happysingh23828%2FHappyTimer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/happysingh23828%2FHappyTimer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/happysingh23828","download_url":"https://codeload.github.com/happysingh23828/HappyTimer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245769360,"owners_count":20669164,"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","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","android-app","android-countdown","android-countdownview","android-library","android-timer","android-timeview","androidtimer","timer-application"],"created_at":"2024-07-31T16:01:26.990Z","updated_at":"2025-03-27T02:31:32.219Z","avatar_url":"https://github.com/happysingh23828.png","language":"Kotlin","funding_links":["https://www.buymeacoffee.com/UE8o2WT"],"categories":["Kotlin"],"sub_categories":[],"readme":"# HappyTimer- An Android Timer UI Library\n[![platform](https://img.shields.io/badge/platform-Android-yellow.svg)](https://www.android.com)\n[![API](https://img.shields.io/badge/API-21%2B-brightgreen.svg?style=plastic)](https://android-arsenal.com/api?level=21)\n[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg?style=flat-square)](https://www.apache.org/licenses/LICENSE-2.0.html)\n[![](https://jitpack.io/v/happysingh23828/HappyTimer.svg)](https://jitpack.io/#happysingh23828/HappyTimer)\n\n\u003cp align=\"center\"\u003e\n \u003ccenter\u003e\u003cimg width=\"100%%\"  src=\"screenshots/Happytimer.png\"\u003e\u003c/a\u003e\u003c/center\u003e\n\u003c/p\u003e\n\n\n## Prerequisites\n\nAdd this in your root `build.gradle` file (**not** your module `build.gradle` file):\n```gradle\nallprojects {\n\trepositories {\n\t\t...\n\t\tmaven { url \"https://jitpack.io\" }\n\t}\n}\n```\n\n## Dependency\n\nAdd this to your module's `build.gradle` file (make sure the version matches the JitPack badge above):\n\n```gradle\ndependencies {\n\t...\n\timplementation 'com.github.happysingh23828:HappyTimer:1.0.1'\n}\n```\n\n## Demo Video\n[Click here to see demo video](https://www.youtube.com/watch?v=ItdbO-yLDnY)\n\n## Usage\nIn this library all the UI widgets are using a common [HappyTimer](https://github.com/happysingh23828/HappyTimer/blob/master/HappyTimer/src/main/java/com/androchef/happytimer/countdowntimer/HappyTimer.kt) class for implementing timer.\n\n### HappyTimer.kt \n```kotlin\n        //Initialize Timer with seconds\n        val happyTimer = HappyTimer(60)\n        \n        //set OnTickListener for getting updates on time. [Optional]\n        happyTimer.setOnTickListener(object :HappyTimer.OnTickListener{\n\n            //OnTick\n            override fun onTick(completedSeconds: Int, remainingSeconds: Int) {\n\n            }\n\n            //OnTimeUp\n            override fun onTimeUp() {\n\n            }\n        })\n\n        //set OnStateChangeListener [RUNNING, FINISHED, PAUSED, RESUMED, UNKNOWN, RESET, STOPPED] [Optional]\n        happyTimer.setOnStateChangeListener(object : HappyTimer.OnStateChangeListener{\n            override fun onStateChange(state: HappyTimer.State, completedSeconds: Int, remainingSeconds: Int) {\n                // write your code here for State Changes\n            }\n        })\n\n        //Start Timer\n        happyTimer.start()\n\n        //Pause Timer\n        happyTimer.pause()\n\n        //Resume Timer\n        happyTimer.resume()\n\n        //Stop Timer\n        happyTimer.stop()\n\n        //Reset Timer\n        happyTimer.resetTimer()\n\n```\n\n### Note : To avoid MemoryLeaks always stop the timer in onDestroy().\n\n### CircularCountDownView\n\n#### Layout(XML)\n```xml\n\u003ccom.androchef.happytimer.countdowntimer.CircularCountDownView\n            android:id=\"@+id/circularCountDownView\"\n            android:layout_width=\"200dp\"\n            android:layout_height=\"200dp\"\n            app:stroke_foreground_color=\"@color/colorLightBlue\"\n            app:stroke_background_color=\"@color/colorPrimaryDark\"\n            app:stroke_background_thickness=\"31dp\"\n            app:stroke_foreground_thickness=\"40dp\"\n            app:timer_text_color=\"@color/colorLightBlue\"\n            app:timer_text_shown=\"true\"\n            app:timer_text_isBold=\"true\"\n            app:timer_text_format=\"HOUR_MINUTE_SECOND\"\n            app:timer_text_size=\"20sp\"\n            app:timer_type=\"COUNT_UP\"\n            /\u003e\n\n```\n#### Activity Or Fragment\n\n**You can set these properties in your java or kotlin code as well.**\n```kotlin\nclass DemoCircularCountDownActivity : AppCompatActivity() {\n\n    override fun onCreate(savedInstanceState: Bundle?) {\n        super.onCreate(savedInstanceState)\n        setContentView(R.layout.activity_demo_circular_count_down)\n\n        //Set configuration for timer UI\n        circularCountDownView.isTimerTextShown = true\n        circularCountDownView.timerType = HappyTimer.Type.COUNT_UP\n        circularCountDownView.timerTextFormat = CircularCountDownView.TextFormat.HOUR_MINUTE_SECOND\n        circularCountDownView.strokeThicknessForeground = 10f\n        circularCountDownView.strokeThicknessBackground = 10f\n        circularCountDownView.strokeColorBackground = ContextCompat.getColor(this, R.color.colorGrey)\n        circularCountDownView.strokeColorForeground = ContextCompat.getColor(this, R.color.colorLightBlue)\n        circularCountDownView.timerTextColor = ContextCompat.getColor(this, R.color.colorPrimaryDark)\n        circularCountDownView.timerTextIsBold = true\n        circularCountDownView.timerTextSize = 13f //this will automatically converted to sp value.\n\n        //Initialize Your Timer with seconds\n        circularCountDownView.initTimer(60)\n\n        //set OnTickListener for getting updates on time. [Optional]\n        circularCountDownView.setOnTickListener(object : HappyTimer.OnTickListener {\n\n            //OnTick\n            override fun onTick(completedSeconds: Int, remainingSeconds: Int) {\n\n            }\n\n            //OnTimeUp\n            override fun onTimeUp() {\n\n            }\n        })\n\n        //set OnStateChangeListener [RUNNING, FINISHED, PAUSED, RESUMED, UNKNOWN, RESET, STOPPED] [Optional]\n        circularCountDownView.setStateChangeListener(object : HappyTimer.OnStateChangeListener {\n            override fun onStateChange(\n                state: HappyTimer.State,\n                completedSeconds: Int,\n                remainingSeconds: Int\n            ) {\n                // write your code here for State Changes\n            }\n        })\n        \n        //Call these functions to perform actions\n        //Start Timer\n        circularCountDownView.startTimer()\n\n        //Pause Timer\n        circularCountDownView.pauseTimer()\n\n        //Resume Timer\n        circularCountDownView.resumeTimer()\n\n        //Stop Timer\n        circularCountDownView.stopTimer()\n\n        //Reset Timer\n        circularCountDownView.resetTimer()\n\n        //get Total Seconds\n        val totalSeconds = circularCountDownView.getTotalSeconds()\n\n    }\n\n}\n\n```\n\n### DynamicCountDownView\n\n#### Layout(XML)\n```xml\n\u003ccom.androchef.happytimer.countdowntimer.DynamicCountDownView\n            android:id=\"@+id/dynamicCountDownView\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            app:dynamic_timer_text_color=\"@android:color/white\"\n            app:dynamic_timer_text_separator_color=\"@color/colorGrey\"\n            app:dynamic_timer_text_size=\"12sp\"\n            app:dynamic_timer_separator_text_size=\"15sp\"\n            app:dynamic_timer_text_isBold=\"true\"\n            app:dynamic_timer_text__separator_isBold=\"true\"\n            app:dynamic_timer_text_separator=\":\"\n            app:dynamic_show_hour=\"true\"\n            app:dynamic_show_labels=\"true\"\n            app:dynamic_show_minutes=\"true\"\n            app:dynamic_show_seconds=\"true\"\n            /\u003e\n```\n\n#### Activity Or Fragment\n**You can set these properties in your java or kotlin code as well.**\n```kotlin\nclass DemoDynamicCountDownActivity : AppCompatActivity() {\n\n    override fun onCreate(savedInstanceState: Bundle?) {\n        super.onCreate(savedInstanceState)\n        setContentView(R.layout.activity_demo_dynamic_count_down)\n\n        dynamicCountDownView.separatorString = \":\"\n        dynamicCountDownView.timerTextColor = ContextCompat.getColor(this, R.color.colorGrey)\n        dynamicCountDownView.timerTextSeparatorColor = ContextCompat.getColor(this, R.color.colorAccent)\n        dynamicCountDownView.timerTextSeparatorSize = 15f //this will automatically converted to sp value.\n        dynamicCountDownView.timerTextSize = 15f //this will automatically converted to sp value.\n        dynamicCountDownView.showHour = true\n        dynamicCountDownView.showMinutes = true\n        dynamicCountDownView.showSeconds = true\n        dynamicCountDownView.showSeparators = true\n        dynamicCountDownView.timerTextIsBold = true\n        dynamicCountDownView.timerTextSeparatorIsBold = true\n        dynamicCountDownView.timerType = HappyTimer.Type.COUNT_UP\n\n        //Set timer text background as a rectangle\n        dynamicCountDownView.setRectangularBackground()\n\n        //Set timer text background as a circle\n        dynamicCountDownView.setRoundedBackground()\n\n        //set custom background for timer text\n        dynamicCountDownView.customBackgroundDrawable =\n            ContextCompat.getDrawable(this, R.drawable.bg_textview_count_down_circle)\n\n        //Initialize Your Timer with seconds\n        dynamicCountDownView.initTimer(60)\n\n        //set OnTickListener for getting updates on time. [Optional]\n        dynamicCountDownView.setOnTickListener(object : HappyTimer.OnTickListener {\n\n            //OnTick\n            override fun onTick(completedSeconds: Int, remainingSeconds: Int) {\n\n            }\n\n            //OnTimeUp\n            override fun onTimeUp() {\n\n            }\n        })\n\n        //set OnStateChangeListener [RUNNING, FINISHED, PAUSED, RESUMED, UNKNOWN, RESET, STOPPED] [Optional]\n        dynamicCountDownView.setStateChangeListener(object : HappyTimer.OnStateChangeListener {\n            override fun onStateChange(\n                state: HappyTimer.State,\n                completedSeconds: Int,\n                remainingSeconds: Int\n            ) {\n                // write your code here for State Changes\n            }\n        })\n\n        //Call these functions to perform actions\n        //Start Timer\n        dynamicCountDownView.startTimer()\n\n        //Pause Timer\n        dynamicCountDownView.pauseTimer()\n\n        //Resume Timer\n        dynamicCountDownView.resumeTimer()\n\n        //Stop Timer\n        dynamicCountDownView.stopTimer()\n\n        //Reset Timer\n        dynamicCountDownView.resetTimer()\n\n    }\n\n}\n```\n\n### NormalCountDownView\n\n#### Layout(XML)\n```xml\n\u003ccom.androchef.happytimer.countdowntimer.NormalCountDownView\n            android:id=\"@+id/normalCountDownView\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            app:normal_timer_text_size=\"30sp\"\n            app:normal_timer_label_text_size=\"18sp\"\n            app:normal_timer_text_color=\"@color/colorLightBlue\"\n            app:normal_timer_text_label_color=\"@color/colorGrey\"\n            app:normal_timer_text__label_isBold=\"true\"\n            app:normal_timer_text_isBold=\"true\"\n            app:show_labels=\"true\"\n            app:show_hour=\"true\"\n            app:show_minutes=\"true\"\n            app:show_seconds=\"true\"\n            /\u003e\n```\n\n#### Activity Or Fragment\n**You can set these properties in your java or kotlin code as well.**\n```kotlin\nclass NormalCountDownActivity : AppCompatActivity() {\n\n    override fun onCreate(savedInstanceState: Bundle?) {\n        super.onCreate(savedInstanceState)\n        setContentView(R.layout.activity_normal_count_down)\n\n\n        normalCountDownView.timerTextColor = ContextCompat.getColor(this, R.color.colorLightBlue)\n        normalCountDownView.timerTextLabelColor = ContextCompat.getColor(this, R.color.colorLightBlue)\n        normalCountDownView.timerTextIsBold = false\n        normalCountDownView.timerTextLabelIsBold = false\n        normalCountDownView.timerTextSize = 15f //this will automatically converted to sp value.\n        normalCountDownView.timerTextLabelSize = 12f //this will automatically converted to sp value.\n        normalCountDownView.showHour = true\n        normalCountDownView.showMinutes = true\n        normalCountDownView.showSeconds = true\n        normalCountDownView.timerType = HappyTimer.Type.COUNT_DOWN\n\n\n        //Initialize Your Timer with seconds\n        normalCountDownView.initTimer(60)\n\n        //set OnTickListener for getting updates on time. [Optional]\n        normalCountDownView.setOnTickListener(object : HappyTimer.OnTickListener {\n\n            //OnTick\n            override fun onTick(completedSeconds: Int, remainingSeconds: Int) {\n\n            }\n\n            //OnTimeUp\n            override fun onTimeUp() {\n\n            }\n        })\n\n        //set OnStateChangeListener [RUNNING, FINISHED, PAUSED, RESUMED, UNKNOWN, RESET, STOPPED] [Optional]\n        normalCountDownView.setStateChangeListener(object : HappyTimer.OnStateChangeListener {\n            override fun onStateChange(\n                state: HappyTimer.State,\n                completedSeconds: Int,\n                remainingSeconds: Int\n            ) {\n                // write your code here for State Changes\n            }\n        })\n\n        //Call these functions to perform actions\n        //Start Timer\n        normalCountDownView.startTimer()\n\n        //Pause Timer\n        normalCountDownView.pauseTimer()\n\n        //Resume Timer\n        normalCountDownView.resumeTimer()\n\n        //Stop Timer\n        normalCountDownView.stopTimer()\n\n        //Reset Timer\n        normalCountDownView.resetTimer()\n\n    }\n}\n```\n\n\n\n\n## If this project helps you in anyway, show your love :heart: by putting a :star: on this project :v:\n\n## Donation\nIf this project help you reduce time to develop, you can give me a cup of coffee :) \n\n\u003ca href=\"https://www.buymeacoffee.com/UE8o2WT\" target=\"_blank\"\u003e\u003cimg src=\"https://bmc-cdn.nyc3.digitaloceanspaces.com/BMC-button-images/custom_images/orange_img.png\" alt=\"Buy Me A Coffee\" style=\"height: auto !important;width: auto !important;\" \u003e\u003c/a\u003e\n\n## Contributing\n\nPlease fork this repository and contribute back using\n[pull requests](https://github.com/happysingh23828/HappyTimer/pulls).\n\nAny contributions, large or small, major features, bug fixes, are welcomed and appreciated\nbut will be thoroughly reviewed .\n\n### - Contact - Let's become friend\n- [Blog](http://happysingh.dev/)\n- [Youtube](https://www.youtube.com/channel/UCILhpbLSFkGzsiCYAeR30DA)\n- [Github](https://github.com/happysingh23828)\n- [Linkedin](https://www.linkedin.com/in/happpysingh23828/)\n\n## License\n\n* [Apache Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html)\n\n```\nCopyright 2019 Happy Singh\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhappysingh23828%2FHappyTimer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhappysingh23828%2FHappyTimer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhappysingh23828%2FHappyTimer/lists"}