Skip to content

Commit

Permalink
hidebottom
Browse files Browse the repository at this point in the history
  • Loading branch information
manondidi committed Mar 19, 2020
1 parent 2e82bce commit 847b1c1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ abstract class BaseActivity<T : IBasePrensenter> : AppCompatActivity(), IBaseVie
} else {
supportActionBar?.setDisplayHomeAsUpEnabled(true)
}
if (needHideBottomUiMenu()) {
hideBottomUIMenu()
}

initContentView()
initView()
mPresenter = createPresenter()
Expand All @@ -42,15 +40,8 @@ abstract class BaseActivity<T : IBasePrensenter> : AppCompatActivity(), IBaseVie
mPresenter.start()
}

fun needHideBottomUiMenu(): Boolean {
return false
}

fun hideBottomUIMenu() { //隐藏虚拟按键,并且全屏
// lower api
val v = window.decorView
v.systemUiVisibility = View.GONE
}



override fun autoDispose(): AndroidLifecycleScopeProvider {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.czq.kotlin_arch.common.util.ext

import android.content.res.Resources
import android.os.Build
import android.view.View
import androidx.appcompat.app.AppCompatActivity

fun AppCompatActivity.hideBottom() {
//隐藏虚拟按键,并且全屏
if (Build.VERSION.SDK_INT > 11 && Build.VERSION.SDK_INT < 19) { // lower api
val v = window.decorView
v.systemUiVisibility = View.GONE
} else if (Build.VERSION.SDK_INT >= 19) { //for new api versions.
val decorView = window.decorView
val uiOptions = (View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
or View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY or View.SYSTEM_UI_FLAG_FULLSCREEN)
decorView.systemUiVisibility = uiOptions
}
}

0 comments on commit 847b1c1

Please sign in to comment.