Skip to content

Commit

Permalink
[feat] #69 뷰에 따라 statusBar 색상 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
l2zh committed Jan 18, 2024
1 parent e858649 commit dd5a61a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions app/src/main/java/sopt/motivoo/presentation/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import dagger.hilt.android.AndroidEntryPoint
import sopt.motivoo.R
import sopt.motivoo.data.datasource.remote.listener.AuthTokenRefreshListenerImpl
import sopt.motivoo.databinding.ActivityMainBinding
import sopt.motivoo.util.extension.colorOf
import sopt.motivoo.util.extension.hideKeyboard
import sopt.motivoo.util.extension.setOnSingleClickListener
import javax.inject.Inject
Expand Down Expand Up @@ -47,10 +48,25 @@ class MainActivity : AppCompatActivity() {
bnvMain.setOnItemReselectedListener(null)
}
navController?.let { setBottomVisible(it) }
navController?.let { setStatusBarColor(it) }

binding.includeToolbar.tvToolbarBack.setOnSingleClickListener { navController?.popBackStack() }
}

private fun setStatusBarColor(navController: NavController) {
navController.addOnDestinationChangedListener { _, destination, _ ->
if (destination.id in listOf(
R.id.myPageFragment,
R.id.myInfoFragment
)
) {
window.statusBarColor = (this.colorOf(R.color.gray_100_F4F5F9))
} else {
window.statusBarColor = (this.colorOf(R.color.white_FFFFFF))
}
}
}

private fun setBottomVisible(navController: NavController) {
navController.addOnDestinationChangedListener { _, destination, _ ->
binding.bnvMain.visibility = if (destination.id in listOf(
Expand Down

0 comments on commit dd5a61a

Please sign in to comment.