Improve tablet ui
This commit is contained in:
@@ -11,6 +11,7 @@ import android.view.Gravity
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.ViewGroup.MarginLayoutParams
|
||||
import android.view.animation.AccelerateDecelerateInterpolator
|
||||
import android.widget.Toast
|
||||
import androidx.activity.viewModels
|
||||
@@ -18,6 +19,7 @@ import androidx.appcompat.widget.PopupMenu
|
||||
import androidx.core.graphics.Insets
|
||||
import androidx.core.view.isGone
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import androidx.core.view.updatePadding
|
||||
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
||||
import com.google.android.material.snackbar.BaseTransientBottomBar
|
||||
@@ -238,6 +240,9 @@ class DetailsActivity :
|
||||
if (insets.bottom > 0) {
|
||||
window.setNavigationBarTransparentCompat(this, viewBinding.layoutBottom?.elevation ?: 0f, 0.9f)
|
||||
}
|
||||
viewBinding.cardChapters?.updateLayoutParams<MarginLayoutParams> {
|
||||
bottomMargin = insets.bottom + marginEnd
|
||||
}
|
||||
}
|
||||
|
||||
private fun onHistoryChanged(info: HistoryInfo) {
|
||||
|
||||
@@ -10,6 +10,9 @@ class FilterHeaderModel(
|
||||
val hasSelectedTags: Boolean,
|
||||
) : ListModel {
|
||||
|
||||
val textSummary: String
|
||||
get() = chips.mapNotNull { if (it.isChecked) it.title else null }.joinToString()
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
@@ -11,6 +11,9 @@ import androidx.core.view.updatePadding
|
||||
import androidx.fragment.app.commit
|
||||
import com.google.android.material.appbar.AppBarLayout
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.flow.flowOn
|
||||
import kotlinx.coroutines.flow.map
|
||||
import org.koitharu.kotatsu.R
|
||||
import org.koitharu.kotatsu.core.model.parcelable.ParcelableMangaTags
|
||||
import org.koitharu.kotatsu.core.ui.BaseActivity
|
||||
@@ -106,11 +109,19 @@ class MangaListActivity :
|
||||
}
|
||||
}
|
||||
}
|
||||
val filterOwner = FilterOwner.from(this)
|
||||
val chipSort = viewBinding.chipSort
|
||||
if (chipSort != null) {
|
||||
FilterOwner.from(this).header.observe(this) {
|
||||
filterOwner.header.observe(this) {
|
||||
chipSort.setTextAndVisible(it.sortOrder?.titleRes ?: 0)
|
||||
}
|
||||
} else {
|
||||
filterOwner.header.map {
|
||||
it.textSummary
|
||||
}.flowOn(Dispatchers.Default)
|
||||
.observe(this) {
|
||||
supportActionBar?.subtitle = it
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user