{"id":21650684,"url":"https://github.com/czy1121/systembars","last_synced_at":"2025-04-11T20:22:12.005Z","repository":{"id":199057650,"uuid":"320200627","full_name":"czy1121/systembars","owner":"czy1121","description":"系统栏工具库 - 状态栏/导航栏/沉浸式","archived":false,"fork":false,"pushed_at":"2024-05-28T10:29:19.000Z","size":7814,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-11T20:21:57.640Z","etag":null,"topics":["android","immersive","kotlin","navigationbar","statusbar","systembar"],"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/czy1121.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-12-10T07:59:15.000Z","updated_at":"2024-06-25T03:22:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"972feae8-13eb-4083-a5a8-04d0fd4d4102","html_url":"https://github.com/czy1121/systembars","commit_stats":null,"previous_names":["czy1121/systembars"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/czy1121%2Fsystembars","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/czy1121%2Fsystembars/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/czy1121%2Fsystembars/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/czy1121%2Fsystembars/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/czy1121","download_url":"https://codeload.github.com/czy1121/systembars/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248473079,"owners_count":21109629,"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","immersive","kotlin","navigationbar","statusbar","systembar"],"created_at":"2024-11-25T07:42:01.266Z","updated_at":"2025-04-11T20:22:11.977Z","avatar_url":"https://github.com/czy1121.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SystemBars\n\n系统栏工具库\n\n- 设置系统栏背景色\n- 设置系统栏覆盖在应用内容上\n- 设置系统栏浅色模式\n- 设置是否在系统栏颜色为0时，显示默认的系统栏半透明背景\n- 设置沉浸式系统栏\n    - 向后倾斜模式 - 触摸屏幕重新显示系统栏\n    - 沉浸模式 - 滑过屏幕边缘重新显示系统栏\n    - 粘性沉浸模式 - 滑过屏幕边缘重新显示系统栏并在数秒后重新隐藏，此方式无法收到系统栏的可见性变化事件\n- 适配 Android R(API30)\n- 最低要求 API21+\n\n系统栏与沉浸式\nhttps://juejin.cn/post/6904545697552007181\n\n![screenshot](screenshot1.png)\n\n## Gradle\n\n``` groovy\nrepositories { \n    maven { url \"https://gitee.com/ezy/repo/raw/cosmo/\"}\n} \ndependencies {\n    implementation \"me.reezy.cosmo:systembars:0.8.0\"\n}\n```\n\n## API\n\n```kotlin \ninterface Bar {\n    // 设置系统栏背景色\n    fun color(@ColorInt color: Int): Bar\n\n    // 设置系统栏覆盖在应用内容上\n    fun overlay(value: Boolean = true): Bar\n    \n    // 设置系统栏浅色模式\n    fun light(value: Boolean = true): Bar\n\n    // 设置是否在系统纺栏颜色为0时，显示默认的系统栏半透明背景\n    fun contrast(value: Boolean = true): Bar\n}\n\n\nfun Activity.systemBars(): Bar = SystemBars(window)\nfun Fragment.systemBars(): Bar = SystemBars(requireActivity().window)\nfun Dialog.systemBars(): Bar = SystemBars(window!!)\n\nfun Activity.statusBar(): Bar = StatusBar(window)\nfun Fragment.statusBar(): Bar = StatusBar(requireActivity().window)\nfun Dialog.statusBar(): Bar = StatusBar(window!!)\n\nfun Activity.navigationBar(): Bar = NavigationBar(window)\nfun Fragment.navigationBar(): Bar = NavigationBar(requireActivity().window)\nfun Dialog.navigationBar(): Bar = NavigationBar(window!!)\n\n// 进入沉浸式\nfun Window.immersive(barsBehavior: Int = WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE)\n\n// 退出沉浸式\nfun Window.immersiveExit()\n\nvar Window.isDrawsSystemBarBackgrounds: Boolean\n\nvar Window.isStatusBarOverlay: Boolean\nvar Window.isStatusBarLight: Boolean\n\nvar Window.isNavigationBarOverlay: Boolean \nvar Window.isNavigationBarLight: Boolean\n\n\n```\n\n\n## LICENSE\n\nThe Component is open-sourced software licensed under the [Apache license](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fczy1121%2Fsystembars","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fczy1121%2Fsystembars","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fczy1121%2Fsystembars/lists"}