Prepare code for click listener in AlbumActivity
This commit is contained in:
parent
d9da842df7
commit
f15c23cceb
|
@ -3,13 +3,15 @@ package org.pixeldroid.app.posts
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.activity.viewModels
|
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.databinding.ActivityAlbumBinding
|
||||||
import org.pixeldroid.app.utils.BaseActivity
|
import org.pixeldroid.app.utils.BaseActivity
|
||||||
|
|
||||||
class AlbumActivity : BaseActivity() {
|
class AlbumActivity : BaseActivity() {
|
||||||
|
|
||||||
private lateinit var model: AlbumViewModel
|
private lateinit var model: AlbumViewModel
|
||||||
private var isActionBarHidden = false
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
@ -42,19 +44,19 @@ class AlbumActivity : BaseActivity() {
|
||||||
supportActionBar?.setDisplayShowTitleEnabled(false)
|
supportActionBar?.setDisplayShowTitleEnabled(false)
|
||||||
supportActionBar?.setBackgroundDrawable(null)
|
supportActionBar?.setBackgroundDrawable(null)
|
||||||
|
|
||||||
// TODO: Move from StatusViewHolder (877-893) to here
|
// TODO: Remove from StatusViewHolder (877-893)
|
||||||
// TODO: Issue is that albumPager does not listen to the clicks
|
// TODO: Issue is that albumPager does not listen to the clicks here
|
||||||
/*binding.albumPager.setOnClickListener {
|
binding.albumPager.setOnClickListener {
|
||||||
val windowInsetsController =
|
val windowInsetsController =
|
||||||
WindowCompat.getInsetsController(this.window, it)
|
WindowCompat.getInsetsController(this.window, it)
|
||||||
// Configure the behavior of the hidden system bars
|
// Configure the behavior of the hidden system bars
|
||||||
if (isActionBarHidden) {
|
if (model.uiState.value.isActionBarHidden) {
|
||||||
windowInsetsController.systemBarsBehavior =
|
windowInsetsController.systemBarsBehavior =
|
||||||
WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
|
WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
|
||||||
// Hide both the status bar and the navigation bar
|
// Hide both the status bar and the navigation bar
|
||||||
supportActionBar?.show()
|
supportActionBar?.show()
|
||||||
windowInsetsController.show(WindowInsetsCompat.Type.systemBars())
|
windowInsetsController.show(WindowInsetsCompat.Type.systemBars())
|
||||||
isActionBarHidden = false
|
model.uiState.value.isActionBarHidden = false
|
||||||
} else {
|
} else {
|
||||||
// Configure the behavior of the hidden system bars
|
// Configure the behavior of the hidden system bars
|
||||||
windowInsetsController.systemBarsBehavior =
|
windowInsetsController.systemBarsBehavior =
|
||||||
|
@ -62,9 +64,9 @@ class AlbumActivity : BaseActivity() {
|
||||||
// Hide both the status bar and the navigation bar
|
// Hide both the status bar and the navigation bar
|
||||||
supportActionBar?.hide()
|
supportActionBar?.hide()
|
||||||
windowInsetsController.hide(WindowInsetsCompat.Type.systemBars())
|
windowInsetsController.hide(WindowInsetsCompat.Type.systemBars())
|
||||||
isActionBarHidden = true
|
model.uiState.value.isActionBarHidden = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -13,7 +13,8 @@ import org.pixeldroid.app.utils.api.objects.Attachment
|
||||||
|
|
||||||
data class AlbumUiState(
|
data class AlbumUiState(
|
||||||
val mediaAttachments: ArrayList<Attachment> = arrayListOf(),
|
val mediaAttachments: ArrayList<Attachment> = arrayListOf(),
|
||||||
val index: Int = 0
|
val index: Int = 0,
|
||||||
|
var isActionBarHidden: Boolean = false
|
||||||
)
|
)
|
||||||
|
|
||||||
class AlbumViewModel(application: Application, intent: Intent) : AndroidViewModel(application) {
|
class AlbumViewModel(application: Application, intent: Intent) : AndroidViewModel(application) {
|
||||||
|
|
Loading…
Reference in New Issue