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

#104 Fixed navigationbar on detail screen. #542

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import androidx.core.view.doOnNextLayout
import androidx.fragment.app.Fragment
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.LiveData
import androidx.lifecycle.distinctUntilChanged
import androidx.lifecycle.observe
import androidx.navigation.NavOptions
import androidx.navigation.fragment.findNavController
Expand Down Expand Up @@ -44,6 +45,7 @@ import io.github.droidkaigi.confsched2020.session.ui.widget.SessionDetailItemDec
import io.github.droidkaigi.confsched2020.system.ui.viewmodel.SystemViewModel
import io.github.droidkaigi.confsched2020.ui.animation.MEDIUM_EXPAND_DURATION
import io.github.droidkaigi.confsched2020.ui.transition.fadeThrough
import io.github.droidkaigi.confsched2020.ui.widget.SystemUiManager
import javax.inject.Inject
import javax.inject.Provider

Expand Down Expand Up @@ -83,11 +85,20 @@ class SessionDetailFragment : Fragment(R.layout.fragment_session_detail), Inject
@Inject
lateinit var sessionDetailMaterialItemFactory: SessionDetailMaterialItem.Factory

private val navigationBarColors: SystemUiManager by lazy {
SystemUiManager(context!!)
}

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
sharedElementEnterTransition = fadeThrough().apply {
duration = MEDIUM_EXPAND_DURATION
}

navigationBarColors.systemUiVisibility.distinctUntilChanged().observe(this) {
activity?.window?.decorView?.systemUiVisibility =
Copy link
Member

@takahirom takahirom Jan 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!
We are using SystemUiManager class. can you check it? 🙏

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@takahirom
sorry. I was busy working and couldn't help.
Unfortunately I couldn't call SystemUiManager.
Could you give me any advice?

Copy link
Member

@takahirom takahirom Feb 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course!
How about moving SystemUiManager to corecomponet?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@takahirom
This is solved using SystemUiManager! Thank you for the advice!
commit a08be2a

View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR or View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Field requires API level 23 (current min is 21): android.view.View#SYSTEM_UI_FLAG_LIGHT_STATUS_BAR

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Field requires API level 26 (current min is 21): android.view.View#SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR

}
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
Expand Down