UI tuning
This commit is contained in:
@@ -353,6 +353,7 @@ class AppRouter private constructor(
|
||||
|
||||
fun showTagDialog(tag: MangaTag) {
|
||||
buildAlertDialog(contextOrNull() ?: return) {
|
||||
setIcon(R.drawable.ic_tag)
|
||||
setTitle(tag.title)
|
||||
setItems(
|
||||
arrayOf(
|
||||
@@ -372,6 +373,7 @@ class AppRouter private constructor(
|
||||
|
||||
fun showAuthorDialog(author: String, source: MangaSource) {
|
||||
buildAlertDialog(contextOrNull() ?: return) {
|
||||
setIcon(R.drawable.ic_user)
|
||||
setTitle(author)
|
||||
setItems(
|
||||
arrayOf(
|
||||
|
||||
@@ -29,6 +29,7 @@ import androidx.core.view.GravityCompat
|
||||
import androidx.core.view.ancestors
|
||||
import androidx.core.view.isGone
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import org.koitharu.kotatsu.R
|
||||
import org.koitharu.kotatsu.core.util.ext.getThemeColor
|
||||
@@ -245,8 +246,8 @@ class FastScroller @JvmOverloads constructor(
|
||||
*/
|
||||
fun setLayoutParams(viewGroup: ViewGroup) {
|
||||
val recyclerViewId = recyclerView?.id ?: NO_ID
|
||||
val marginTop = resources.getDimensionPixelSize(R.dimen.fastscroll_scrollbar_margin_top)
|
||||
val marginBottom = resources.getDimensionPixelSize(R.dimen.fastscroll_scrollbar_margin_bottom)
|
||||
val offsetTop = resources.getDimensionPixelSize(R.dimen.fastscroll_scrollbar_margin_top)
|
||||
val offsetBottom = resources.getDimensionPixelSize(R.dimen.fastscroll_scrollbar_margin_bottom)
|
||||
|
||||
require(recyclerViewId != NO_ID) { "RecyclerView must have a view ID" }
|
||||
|
||||
@@ -263,31 +264,43 @@ class FastScroller @JvmOverloads constructor(
|
||||
applyTo(viewGroup)
|
||||
}
|
||||
|
||||
layoutParams = (layoutParams as ConstraintLayout.LayoutParams).apply {
|
||||
updateLayoutParams<ConstraintLayout.LayoutParams> {
|
||||
height = 0
|
||||
setMargins(offset, marginTop, offset, marginBottom)
|
||||
marginStart = offset
|
||||
marginEnd = offset
|
||||
topMargin = offsetTop
|
||||
bottomMargin = offsetBottom
|
||||
}
|
||||
}
|
||||
|
||||
is CoordinatorLayout -> layoutParams = (layoutParams as CoordinatorLayout.LayoutParams).apply {
|
||||
is CoordinatorLayout -> updateLayoutParams<CoordinatorLayout.LayoutParams> {
|
||||
height = LayoutParams.MATCH_PARENT
|
||||
anchorGravity = GravityCompat.END
|
||||
anchorId = recyclerViewId
|
||||
setMargins(offset, marginTop, offset, marginBottom)
|
||||
marginStart = offset
|
||||
marginEnd = offset
|
||||
topMargin = offsetTop
|
||||
bottomMargin = offsetBottom
|
||||
}
|
||||
|
||||
is FrameLayout -> layoutParams = (layoutParams as FrameLayout.LayoutParams).apply {
|
||||
is FrameLayout -> updateLayoutParams<FrameLayout.LayoutParams> {
|
||||
height = LayoutParams.MATCH_PARENT
|
||||
gravity = GravityCompat.END
|
||||
setMargins(offset, marginTop, offset, marginBottom)
|
||||
marginStart = offset
|
||||
marginEnd = offset
|
||||
topMargin = offsetTop
|
||||
bottomMargin = offsetBottom
|
||||
}
|
||||
|
||||
is RelativeLayout -> layoutParams = (layoutParams as RelativeLayout.LayoutParams).apply {
|
||||
is RelativeLayout -> updateLayoutParams<RelativeLayout.LayoutParams> {
|
||||
height = 0
|
||||
addRule(RelativeLayout.ALIGN_TOP, recyclerViewId)
|
||||
addRule(RelativeLayout.ALIGN_BOTTOM, recyclerViewId)
|
||||
addRule(RelativeLayout.ALIGN_END, recyclerViewId)
|
||||
setMargins(offset, marginTop, offset, marginBottom)
|
||||
marginStart = offset
|
||||
marginEnd = offset
|
||||
topMargin = offsetTop
|
||||
bottomMargin = offsetBottom
|
||||
}
|
||||
|
||||
else -> throw IllegalArgumentException("Parent ViewGroup must be a ConstraintLayout, CoordinatorLayout, FrameLayout, or RelativeLayout")
|
||||
|
||||
@@ -31,6 +31,7 @@ class FavouriteTabPopupMenuProvider(
|
||||
R.id.action_hide -> viewModel.hide(categoryId)
|
||||
R.id.action_edit -> router.openFavoriteCategoryEdit(categoryId)
|
||||
R.id.action_delete -> confirmDelete()
|
||||
R.id.action_manage -> router.openFavoriteCategories()
|
||||
else -> return false
|
||||
}
|
||||
return true
|
||||
|
||||
@@ -16,6 +16,8 @@ class FavouritesTabConfigurationStrategy(
|
||||
val item = adapter.getItem(position)
|
||||
tab.text = item.title ?: tab.view.context.getString(R.string.all_favourites)
|
||||
tab.tag = item
|
||||
PopupMenuMediator(FavouriteTabPopupMenuProvider(tab.view.context, router, viewModel, item.id)).attach(tab.view)
|
||||
PopupMenuMediator(
|
||||
FavouriteTabPopupMenuProvider(tab.view.context, router, viewModel, item.id)
|
||||
).attach(tab.view)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,12 +88,12 @@ class FeedFragment :
|
||||
override fun onApplyWindowInsets(v: View, insets: WindowInsetsCompat): WindowInsetsCompat {
|
||||
val typeMask = WindowInsetsCompat.Type.systemBars()
|
||||
val barsInsets = insets.getInsets(typeMask)
|
||||
val basePadding = v.resources.getDimensionPixelOffset(R.dimen.list_spacing_normal)
|
||||
val paddingVertical = resources.getDimensionPixelSize(R.dimen.list_spacing_normal)
|
||||
viewBinding?.recyclerView?.setPadding(
|
||||
left = barsInsets.left + basePadding,
|
||||
top = basePadding,
|
||||
right = barsInsets.right + basePadding,
|
||||
bottom = barsInsets.bottom + basePadding,
|
||||
left = barsInsets.left,
|
||||
top = paddingVertical,
|
||||
right = barsInsets.right,
|
||||
bottom = barsInsets.bottom + paddingVertical,
|
||||
)
|
||||
return insets.consumeAll(typeMask)
|
||||
}
|
||||
|
||||
@@ -73,8 +73,10 @@
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?attr/textAppearanceBodySmall"
|
||||
android:theme="@style/ThemeOverlay.Material3.Dark"
|
||||
android:visibility="gone"
|
||||
app:layout_dodgeInsetEdges="bottom"
|
||||
tools:text="@string/loading_" />
|
||||
tools:text="@string/loading_"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_loading"
|
||||
|
||||
@@ -82,8 +82,10 @@
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?attr/textAppearanceBodySmall"
|
||||
android:theme="@style/ThemeOverlay.Material3.Dark"
|
||||
android:visibility="gone"
|
||||
app:layout_dodgeInsetEdges="bottom"
|
||||
tools:text="@string/loading_" />
|
||||
tools:text="@string/loading_"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_loading"
|
||||
|
||||
@@ -40,7 +40,8 @@
|
||||
app:tabIndicatorGravity="stretch"
|
||||
app:tabInlineLabel="true"
|
||||
app:tabMinWidth="0dp"
|
||||
app:tabMode="scrollable" />
|
||||
app:tabMode="scrollable"
|
||||
app:tabUnboundedRipple="true" />
|
||||
|
||||
<com.google.android.material.button.MaterialSplitButton
|
||||
android:id="@+id/split_button_read"
|
||||
|
||||
@@ -6,4 +6,8 @@
|
||||
android:id="@+id/action_hide"
|
||||
android:title="@string/hide" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_manage"
|
||||
android:title="@string/manage" />
|
||||
|
||||
</menu>
|
||||
|
||||
Reference in New Issue
Block a user