Skip to content

Commit b73fbe8

Browse files
committed
fix : 소프트키 먹는 문제 해결
1 parent 0530067 commit b73fbe8

File tree

5 files changed

+22
-11
lines changed

5 files changed

+22
-11
lines changed

presentation/src/main/java/com/stop/MainActivity.kt

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import android.view.inputmethod.InputMethodManager
1212
import android.widget.EditText
1313
import androidx.appcompat.app.AppCompatActivity
1414
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
15+
import androidx.core.view.WindowCompat
1516
import androidx.navigation.fragment.NavHostFragment
1617
import com.stop.databinding.ActivityMainBinding
1718
import dagger.hilt.android.AndroidEntryPoint
@@ -35,24 +36,16 @@ class MainActivity : AppCompatActivity() {
3536

3637
override fun onCreate(savedInstanceState: Bundle?) {
3738
installSplashScreen()
38-
39+
WindowCompat.setDecorFitsSystemWindows(window, false)
3940
super.onCreate(savedInstanceState)
4041

4142
binding = ActivityMainBinding.inflate(layoutInflater)
4243
setContentView(binding.root)
4344

44-
hideStatusBar()
45+
binding.navHostFragment.setPadding(0, 0, 0, this.navigationHeight())
4546
showOverLockScreen()
4647
}
4748

48-
49-
private fun hideStatusBar() {
50-
window.setFlags(
51-
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
52-
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
53-
)
54-
}
55-
5649
override fun dispatchTouchEvent(event: MotionEvent): Boolean {
5750
if (event.action == MotionEvent.ACTION_DOWN) {
5851
val view = currentFocus
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.stop
2+
3+
import android.content.Context
4+
5+
fun Context.statusBarHeight(): Int {
6+
val resourceId = resources.getIdentifier("status_bar_height", "dimen", "android")
7+
8+
return if (resourceId > 0) resources.getDimensionPixelSize(resourceId)
9+
else 0
10+
}
11+
12+
fun Context.navigationHeight(): Int {
13+
val resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android")
14+
15+
return if (resourceId > 0) resources.getDimensionPixelSize(resourceId)
16+
else 0
17+
}

presentation/src/main/res/layout/activity_main.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
xmlns:tools="http://schemas.android.com/tools"
55
android:layout_width="match_parent"
66
android:layout_height="match_parent"
7-
android:fitsSystemWindows="true"
87
tools:context=".MainActivity">
98

109
<androidx.fragment.app.FragmentContainerView

presentation/src/main/res/values-v31/themes.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<item name="colorSecondaryVariant">@color/teal_700</item>
99
<item name="colorOnSecondary">@color/black</item>
1010

11+
<item name="android:statusBarColor">@android:color/transparent</item>
1112
<item name="android:windowLightStatusBar">true</item>
1213
</style>
1314

presentation/src/main/res/values/themes.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<item name="colorSecondaryVariant">@color/teal_700</item>
99
<item name="colorOnSecondary">@color/black</item>
1010

11+
<item name="android:statusBarColor">@android:color/transparent</item>
1112
<item name="android:windowLightStatusBar">true</item>
1213
</style>
1314
</resources>

0 commit comments

Comments
 (0)