Skip to content

Commit

Permalink
Feat: Today 화면 Full Screen 구현 (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaemin-Yoo committed May 10, 2023
1 parent 80705e5 commit fab6e98
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 7 deletions.
1 change: 0 additions & 1 deletion app/src/main/java/com/infinity/omos/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.core.view.isVisible
import androidx.databinding.DataBindingUtil
import androidx.navigation.NavController
import androidx.navigation.fragment.NavHostFragment
import androidx.navigation.ui.AppBarConfiguration
Expand Down
27 changes: 24 additions & 3 deletions app/src/main/java/com/infinity/omos/ui/main/today/TodayFragment.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.infinity.omos.ui.main.today

import android.content.Intent
import android.os.Build
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
Expand All @@ -12,8 +12,6 @@ import com.infinity.omos.BuildConfig
import com.infinity.omos.adapters.dj.RecommendedDjListAdapter
import com.infinity.omos.adapters.record.HorizontalRecordListAdapter
import com.infinity.omos.databinding.FragmentTodayBinding
import com.infinity.omos.ui.record.DetailRecordActivity
import com.infinity.omos.ui.write.SelectCategoryActivity
import com.infinity.omos.utils.repeatOnStarted
import dagger.hilt.android.AndroidEntryPoint
import java.util.*
Expand Down Expand Up @@ -41,12 +39,21 @@ class TodayFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

onFullScreen()
setAdapter()
setMainImage()
initListener()
collectData()
}

private fun onFullScreen() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
requireActivity().window.setDecorFitsSystemWindows(false)
} else {
requireActivity().window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
}
}

private fun setAdapter() {
binding.rvFamousRecords.adapter = horizontalRecordAdapter
binding.rvDj.adapter = recommendedDjAdapter
Expand Down Expand Up @@ -101,4 +108,18 @@ class TodayFragment : Fragment() {
.load(BuildConfig.S3_BASE_URL + "main/$day.png")
.into(binding.ivMain)
}

override fun onStop() {
super.onStop()

offFullScreen()
}

private fun offFullScreen() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
requireActivity().window.setDecorFitsSystemWindows(true)
} else {
requireActivity().window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_VISIBLE
}
}
}
2 changes: 1 addition & 1 deletion app/src/main/res/navigation/nav_graph.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/nav_graph"
app:startDestination="@id/nav_on_boarding">
app:startDestination="@id/nav_main">

<include
android:id="@+id/nav_on_boarding"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-night/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<item name="colorSecondary">@color/white</item>
<item name="colorSecondaryVariant">@color/gray_04</item>

<item name="android:statusBarColor">?android:colorBackground</item>
<item name="android:statusBarColor">@android:color/transparent</item>
</style>

<style name="Theme.Omos.Splash" parent="Theme.SplashScreen">
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<item name="colorSecondary">@color/white</item>
<item name="colorSecondaryVariant">@color/gray_04</item>

<item name="android:statusBarColor">?android:colorBackground</item>
<item name="android:statusBarColor">@android:color/transparent</item>
</style>

<style name="Theme.Omos.Splash" parent="Theme.SplashScreen">
Expand Down

0 comments on commit fab6e98

Please sign in to comment.