Tune ui
This commit is contained in:
@@ -36,8 +36,7 @@ class ListItemTextView @JvmOverloads constructor(
|
||||
|
||||
init {
|
||||
context.withStyledAttributes(attrs, R.styleable.ListItemTextView, defStyleAttr) {
|
||||
val itemRippleColor = getColorStateList(R.styleable.ListItemTextView_rippleColor)
|
||||
?: getRippleColorFallback(context)
|
||||
val itemRippleColor = getRippleColor(context)
|
||||
val shape = createShapeDrawable(this)
|
||||
background = RippleDrawable(
|
||||
RippleUtils.sanitizeRippleDrawableColor(itemRippleColor),
|
||||
@@ -108,7 +107,7 @@ class ListItemTextView @JvmOverloads constructor(
|
||||
ta.getResourceId(R.styleable.ListItemTextView_shapeAppearanceOverlay, 0),
|
||||
).build()
|
||||
val shapeDrawable = MaterialShapeDrawable(shapeAppearance)
|
||||
shapeDrawable.fillColor = ta.getColorStateList(R.styleable.ListItemTextView_backgroundTint)
|
||||
shapeDrawable.fillColor = ta.getColorStateList(R.styleable.ListItemTextView_backgroundFillColor)
|
||||
return InsetDrawable(
|
||||
shapeDrawable,
|
||||
ta.getDimensionPixelOffset(R.styleable.ListItemTextView_android_insetLeft, 0),
|
||||
@@ -118,7 +117,7 @@ class ListItemTextView @JvmOverloads constructor(
|
||||
)
|
||||
}
|
||||
|
||||
private fun getRippleColorFallback(context: Context): ColorStateList {
|
||||
private fun getRippleColor(context: Context): ColorStateList {
|
||||
return context.getThemeColorStateList(android.R.attr.colorControlHighlight)
|
||||
?: ColorStateList.valueOf(Color.TRANSPARENT)
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ class FavouriteCategoriesBottomSheet :
|
||||
BaseBottomSheet<DialogFavoriteCategoriesBinding>(),
|
||||
OnListItemClickListener<MangaCategoryItem>,
|
||||
CategoriesEditDelegate.CategoriesEditCallback,
|
||||
Toolbar.OnMenuItemClickListener {
|
||||
Toolbar.OnMenuItemClickListener, View.OnClickListener {
|
||||
|
||||
private val viewModel by viewModel<MangaCategoriesViewModel> {
|
||||
parametersOf(requireNotNull(arguments?.getParcelableArrayList<ParcelableManga>(KEY_MANGA_LIST)).map { it.manga })
|
||||
@@ -46,6 +46,7 @@ class FavouriteCategoriesBottomSheet :
|
||||
adapter = MangaCategoriesAdapter(this)
|
||||
binding.recyclerViewCategories.adapter = adapter
|
||||
binding.toolbar.setOnMenuItemClickListener(this)
|
||||
binding.itemCreate.setOnClickListener(this)
|
||||
|
||||
viewModel.content.observe(viewLifecycleOwner, this::onContentChanged)
|
||||
viewModel.onError.observe(viewLifecycleOwner, ::onError)
|
||||
@@ -58,14 +59,20 @@ class FavouriteCategoriesBottomSheet :
|
||||
|
||||
override fun onMenuItemClick(item: MenuItem): Boolean {
|
||||
return when (item.itemId) {
|
||||
R.id.action_create -> {
|
||||
startActivity(FavouritesCategoryEditActivity.newIntent(requireContext()))
|
||||
R.id.action_done -> {
|
||||
dismiss()
|
||||
true
|
||||
}
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
|
||||
override fun onClick(v: View) {
|
||||
when (v.id) {
|
||||
R.id.item_create -> startActivity(FavouritesCategoryEditActivity.newIntent(requireContext()))
|
||||
}
|
||||
}
|
||||
|
||||
override fun onItemClick(item: MangaCategoryItem, view: View) {
|
||||
viewModel.setChecked(item.id, !item.isChecked)
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import androidx.core.view.updatePadding
|
||||
import androidx.recyclerview.widget.ItemTouchHelper
|
||||
import org.koin.android.ext.android.get
|
||||
import org.koin.androidx.viewmodel.ext.android.sharedViewModel
|
||||
import org.koitharu.kotatsu.R
|
||||
import org.koitharu.kotatsu.base.ui.BaseFragment
|
||||
import org.koitharu.kotatsu.databinding.FragmentSearchSuggestionBinding
|
||||
import org.koitharu.kotatsu.main.ui.AppBarOwner
|
||||
@@ -43,11 +44,10 @@ class SearchSuggestionFragment :
|
||||
|
||||
override fun onWindowInsetsChanged(insets: Insets) {
|
||||
val headerHeight = (activity as? AppBarOwner)?.appBar?.measureHeight() ?: insets.top
|
||||
val extraPadding = resources.getDimensionPixelOffset(R.dimen.list_spacing)
|
||||
binding.root.updatePadding(
|
||||
top = headerHeight,
|
||||
// left = insets.left,
|
||||
// right = insets.right,
|
||||
bottom = insets.bottom,
|
||||
top = headerHeight + extraPadding,
|
||||
bottom = insets.bottom + extraPadding,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -5,13 +5,14 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/list_spacing">
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
app:menu="@menu/opt_favourites_bs"
|
||||
app:menu="@menu/opt_config"
|
||||
app:title="@string/add_to_favourites" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
@@ -20,9 +21,19 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:overScrollMode="never"
|
||||
android:paddingBottom="@dimen/list_spacing"
|
||||
android:scrollbars="vertical"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
tools:listitem="@layout/item_checkable_new" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item_create"
|
||||
style="?listItemTextViewStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?android:listPreferredItemHeightSmall"
|
||||
android:background="?selectableItemBackground"
|
||||
android:paddingStart="?android:listPreferredItemPaddingStart"
|
||||
android:paddingEnd="?android:listPreferredItemPaddingEnd"
|
||||
android:text="@string/create_category"
|
||||
android:textAppearance="?attr/textAppearanceButton" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<org.koitharu.kotatsu.base.ui.widgets.ListItemTextView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?android:listPreferredItemHeightSmall"
|
||||
@@ -9,5 +8,4 @@
|
||||
android:paddingStart="?android:listPreferredItemPaddingStart"
|
||||
android:paddingEnd="?android:listPreferredItemPaddingEnd"
|
||||
android:textAppearance="?attr/textAppearanceButton"
|
||||
app:rippleColor="?colorSecondaryContainer"
|
||||
tools:text="@tools:sample/full_names" />
|
||||
@@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/action_create"
|
||||
android:icon="@drawable/ic_list_add"
|
||||
android:title="@string/add_new_category"
|
||||
android:titleCondensed="@string/add"
|
||||
app:showAsAction="ifRoom|withText" />
|
||||
|
||||
</menu>
|
||||
@@ -3,5 +3,6 @@
|
||||
<style name="ThemeOverlay.Kotatsu.BottomSheetDialog" parent="ThemeOverlay.Material3.DayNight.BottomSheetDialog">
|
||||
<item name="android:navigationBarColor">@color/navigation_bar_scrim</item>
|
||||
<item name="android:windowLightNavigationBar">@bool/light_navigation_bar</item>
|
||||
<item name="colorControlHighlight">?colorSecondary</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -26,8 +26,7 @@
|
||||
<declare-styleable name="ListItemTextView">
|
||||
<attr name="shapeAppearance" />
|
||||
<attr name="shapeAppearanceOverlay" />
|
||||
<attr name="backgroundTint" />
|
||||
<attr name="rippleColor" />
|
||||
<attr name="backgroundFillColor" format="color" />
|
||||
<attr name="checkedDrawableStart" format="reference" />
|
||||
<attr name="checkedDrawableEnd" format="reference" />
|
||||
<attr name="android:insetTop" />
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
<style name="ThemeOverlay.Kotatsu.BottomSheetDialog" parent="ThemeOverlay.Material3.DayNight.BottomSheetDialog">
|
||||
<item name="android:statusBarColor">@color/dim</item>
|
||||
<item name="colorControlHighlight">?colorSecondary</item>
|
||||
</style>
|
||||
|
||||
<!-- Widget styles -->
|
||||
@@ -86,7 +87,7 @@
|
||||
|
||||
<style name="Widget.Kotatsu.ListItemTextView" parent="">
|
||||
<item name="android:textColor">@color/list_item_text_color</item>
|
||||
<item name="backgroundTint">@color/list_item_background_color</item>
|
||||
<item name="backgroundFillColor">@color/list_item_background_color</item>
|
||||
<item name="checkedDrawableStart">@drawable/ic_check</item>
|
||||
<item name="shapeAppearanceOverlay">@style/ShapeAppearanceOverlay.Material3.NavigationView.Item</item>
|
||||
<item name="android:gravity">center_vertical|start</item>
|
||||
|
||||
Reference in New Issue
Block a user