diff --git a/app/src/main/java/org/pixeldroid/app/posts/AlbumActivity.kt b/app/src/main/java/org/pixeldroid/app/posts/AlbumActivity.kt index c13fe7f7..78995fc5 100644 --- a/app/src/main/java/org/pixeldroid/app/posts/AlbumActivity.kt +++ b/app/src/main/java/org/pixeldroid/app/posts/AlbumActivity.kt @@ -3,13 +3,15 @@ package org.pixeldroid.app.posts import android.os.Bundle import android.view.View import androidx.activity.viewModels +import androidx.core.view.WindowCompat +import androidx.core.view.WindowInsetsCompat +import androidx.core.view.WindowInsetsControllerCompat import org.pixeldroid.app.databinding.ActivityAlbumBinding import org.pixeldroid.app.utils.BaseActivity class AlbumActivity : BaseActivity() { private lateinit var model: AlbumViewModel - private var isActionBarHidden = false override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -42,19 +44,19 @@ class AlbumActivity : BaseActivity() { supportActionBar?.setDisplayShowTitleEnabled(false) supportActionBar?.setBackgroundDrawable(null) - // TODO: Move from StatusViewHolder (877-893) to here - // TODO: Issue is that albumPager does not listen to the clicks - /*binding.albumPager.setOnClickListener { + // TODO: Remove from StatusViewHolder (877-893) + // TODO: Issue is that albumPager does not listen to the clicks here + binding.albumPager.setOnClickListener { val windowInsetsController = WindowCompat.getInsetsController(this.window, it) // Configure the behavior of the hidden system bars - if (isActionBarHidden) { + if (model.uiState.value.isActionBarHidden) { windowInsetsController.systemBarsBehavior = WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE // Hide both the status bar and the navigation bar supportActionBar?.show() windowInsetsController.show(WindowInsetsCompat.Type.systemBars()) - isActionBarHidden = false + model.uiState.value.isActionBarHidden = false } else { // Configure the behavior of the hidden system bars windowInsetsController.systemBarsBehavior = @@ -62,9 +64,9 @@ class AlbumActivity : BaseActivity() { // Hide both the status bar and the navigation bar supportActionBar?.hide() windowInsetsController.hide(WindowInsetsCompat.Type.systemBars()) - isActionBarHidden = true + model.uiState.value.isActionBarHidden = true } - }*/ + } } } \ No newline at end of file diff --git a/app/src/main/java/org/pixeldroid/app/posts/AlbumViewModel.kt b/app/src/main/java/org/pixeldroid/app/posts/AlbumViewModel.kt index 77d4888b..9000ab84 100644 --- a/app/src/main/java/org/pixeldroid/app/posts/AlbumViewModel.kt +++ b/app/src/main/java/org/pixeldroid/app/posts/AlbumViewModel.kt @@ -13,7 +13,8 @@ import org.pixeldroid.app.utils.api.objects.Attachment data class AlbumUiState( val mediaAttachments: ArrayList = arrayListOf(), - val index: Int = 0 + val index: Int = 0, + var isActionBarHidden: Boolean = false ) class AlbumViewModel(application: Application, intent: Intent) : AndroidViewModel(application) {