Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transparent status bar and navbar #71

Merged
merged 3 commits into from
May 21, 2024
Merged

Transparent status bar and navbar #71

merged 3 commits into from
May 21, 2024

Conversation

DtHnAme
Copy link
Contributor

@DtHnAme DtHnAme commented May 20, 2024

支持高版本 Android 沉浸式状态栏和导航栏

@fumiama
Copy link
Owner

fumiama commented May 20, 2024

目前应该已经是沉浸的啊,我在安卓10和11都测过正常。不知你的环境是什么?

@DtHnAme
Copy link
Contributor Author

DtHnAme commented May 20, 2024

安卓13 准确说应该是从浅灰色遮罩 变为透明

@fumiama
Copy link
Owner

fumiama commented May 20, 2024

其实我之前是加过相关代码的,但是因为在显示上有其他问题所以取消了。另外浅灰遮罩我并不认为有什么问题,因为可以增加层次感,而且也是安卓官方的设计。不过还是感谢你的想法。

/*private fun translucentStatusBar() {
//添加Flag把状态栏设为可绘制模式
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
//如果为全透明模式,取消设置Window半透明的Flag
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
//设置状态栏为透明
window.statusBarColor = Color.TRANSPARENT
//设置window的状态栏不可见
window.decorView.systemUiVisibility =
View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
//view不根据系统窗口来调整自己的布局
val mContentView: ViewGroup = window.findViewById(Window.ID_ANDROID_CONTENT) as ViewGroup
val mChildView: View = mContentView.getChildAt(0)
ViewCompat.requestApplyInsets(mChildView)
coordiv.layoutParams.height = getStatusBarHeight()
}*/

@DtHnAme
Copy link
Contributor Author

DtHnAme commented May 20, 2024

好的 但感觉在较新安卓版本中还是纯色透明更有沉浸感

@fumiama
Copy link
Owner

fumiama commented May 20, 2024

关键目前toolbar并未做成collapse,所以就算是完全沉浸,其实也就是换了个颜色😂。不过你可以做一个开关,不要新增xml文件,一切都在代码中设置,然后在设置的“通用”条目里新增一项,启动时读取并应用到Main和Login。具体代码可以参考我上面发的。

@fumiama fumiama added the enhancement ✨功能增强 label May 20, 2024
@DtHnAme
Copy link
Contributor Author

DtHnAme commented May 20, 2024

现已支持设置控制

@fumiama fumiama merged commit b0e2f69 into fumiama:main May 21, 2024
@DtHnAme DtHnAme deleted the main branch May 21, 2024 06:31
fumiama added a commit that referenced this pull request May 21, 2024
新增
1. 设置“沉浸式系统栏”开关 (#71)
2. 旧版下载 删除所有空漫画 按钮
修复
1. 我的下载 反转排序失灵
升级
1. google material -> 1.12.0
2. google gson -> 2.11.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ✨功能增强
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants