Improve tablet ui
This commit is contained in:
@@ -11,6 +11,7 @@ import android.view.Gravity
|
|||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import android.view.ViewGroup.MarginLayoutParams
|
||||||
import android.view.animation.AccelerateDecelerateInterpolator
|
import android.view.animation.AccelerateDecelerateInterpolator
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.activity.viewModels
|
import androidx.activity.viewModels
|
||||||
@@ -18,6 +19,7 @@ import androidx.appcompat.widget.PopupMenu
|
|||||||
import androidx.core.graphics.Insets
|
import androidx.core.graphics.Insets
|
||||||
import androidx.core.view.isGone
|
import androidx.core.view.isGone
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
|
import androidx.core.view.updateLayoutParams
|
||||||
import androidx.core.view.updatePadding
|
import androidx.core.view.updatePadding
|
||||||
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
||||||
import com.google.android.material.snackbar.BaseTransientBottomBar
|
import com.google.android.material.snackbar.BaseTransientBottomBar
|
||||||
@@ -238,6 +240,9 @@ class DetailsActivity :
|
|||||||
if (insets.bottom > 0) {
|
if (insets.bottom > 0) {
|
||||||
window.setNavigationBarTransparentCompat(this, viewBinding.layoutBottom?.elevation ?: 0f, 0.9f)
|
window.setNavigationBarTransparentCompat(this, viewBinding.layoutBottom?.elevation ?: 0f, 0.9f)
|
||||||
}
|
}
|
||||||
|
viewBinding.cardChapters?.updateLayoutParams<MarginLayoutParams> {
|
||||||
|
bottomMargin = insets.bottom + marginEnd
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onHistoryChanged(info: HistoryInfo) {
|
private fun onHistoryChanged(info: HistoryInfo) {
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ class FilterHeaderModel(
|
|||||||
val hasSelectedTags: Boolean,
|
val hasSelectedTags: Boolean,
|
||||||
) : ListModel {
|
) : ListModel {
|
||||||
|
|
||||||
|
val textSummary: String
|
||||||
|
get() = chips.mapNotNull { if (it.isChecked) it.title else null }.joinToString()
|
||||||
|
|
||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
if (this === other) return true
|
if (this === other) return true
|
||||||
if (javaClass != other?.javaClass) return false
|
if (javaClass != other?.javaClass) return false
|
||||||
|
|||||||
@@ -11,6 +11,9 @@ import androidx.core.view.updatePadding
|
|||||||
import androidx.fragment.app.commit
|
import androidx.fragment.app.commit
|
||||||
import com.google.android.material.appbar.AppBarLayout
|
import com.google.android.material.appbar.AppBarLayout
|
||||||
import dagger.hilt.android.AndroidEntryPoint
|
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.R
|
||||||
import org.koitharu.kotatsu.core.model.parcelable.ParcelableMangaTags
|
import org.koitharu.kotatsu.core.model.parcelable.ParcelableMangaTags
|
||||||
import org.koitharu.kotatsu.core.ui.BaseActivity
|
import org.koitharu.kotatsu.core.ui.BaseActivity
|
||||||
@@ -106,11 +109,19 @@ class MangaListActivity :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
val filterOwner = FilterOwner.from(this)
|
||||||
val chipSort = viewBinding.chipSort
|
val chipSort = viewBinding.chipSort
|
||||||
if (chipSort != null) {
|
if (chipSort != null) {
|
||||||
FilterOwner.from(this).header.observe(this) {
|
filterOwner.header.observe(this) {
|
||||||
chipSort.setTextAndVisible(it.sortOrder?.titleRes ?: 0)
|
chipSort.setTextAndVisible(it.sortOrder?.titleRes ?: 0)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
filterOwner.header.map {
|
||||||
|
it.textSummary
|
||||||
|
}.flowOn(Dispatchers.Default)
|
||||||
|
.observe(this) {
|
||||||
|
supportActionBar?.subtitle = it
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
47
app/src/main/res/layout-land/item_empty_state.xml
Normal file
47
app/src/main/res/layout-land/item_empty_state.xml
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingHorizontal="32dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/icon"
|
||||||
|
android:layout_width="192dp"
|
||||||
|
android:layout_height="192dp"
|
||||||
|
android:contentDescription="@null"
|
||||||
|
android:scaleType="fitCenter"
|
||||||
|
tools:src="@drawable/ic_empty_favourites" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textPrimary"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/margin_normal"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textAppearance="?attr/textAppearanceTitleLarge"
|
||||||
|
tools:text="@tools:sample/lorem[3]" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textSecondary"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/margin_normal"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textAppearance="?attr/textAppearanceBodyMedium"
|
||||||
|
tools:text="@tools:sample/lorem[15]" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button_retry"
|
||||||
|
style="@style/Widget.Material3.Button.TonalButton"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/margin_normal"
|
||||||
|
android:visibility="gone"
|
||||||
|
tools:text="@string/try_again"
|
||||||
|
tools:visibility="visible" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
@@ -12,22 +12,11 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:fitsSystemWindows="true">
|
android:fitsSystemWindows="true">
|
||||||
|
|
||||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
<com.google.android.material.appbar.MaterialToolbar
|
||||||
android:id="@+id/collapsingToolbarLayout"
|
android:id="@id/toolbar"
|
||||||
style="?attr/collapsingToolbarLayoutLargeStyle"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?attr/collapsingToolbarLayoutLargeSize"
|
android:layout_height="?attr/actionBarSize"
|
||||||
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"
|
tools:title="Title" />
|
||||||
app:toolbarId="@id/toolbar">
|
|
||||||
|
|
||||||
<com.google.android.material.appbar.MaterialToolbar
|
|
||||||
android:id="@id/toolbar"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="?attr/actionBarSize"
|
|
||||||
app:layout_collapseMode="pin"
|
|
||||||
tools:title="Title" />
|
|
||||||
|
|
||||||
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
|
||||||
|
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -67,8 +67,8 @@
|
|||||||
android:id="@+id/group_header"
|
android:id="@+id/group_header"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="@id/card_chapters"
|
||||||
app:layout_constraintStart_toStartOf="@id/container_chapters"
|
app:layout_constraintStart_toStartOf="@id/card_chapters"
|
||||||
app:layout_constraintTop_toBottomOf="@id/appbar">
|
app:layout_constraintTop_toBottomOf="@id/appbar">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -113,27 +113,27 @@
|
|||||||
android:padding="@dimen/margin_small"
|
android:padding="@dimen/margin_small"
|
||||||
android:src="@drawable/ic_expand_more" />
|
android:src="@drawable/ic_expand_more" />
|
||||||
|
|
||||||
<View
|
|
||||||
android:id="@+id/divider"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="1dp"
|
|
||||||
android:layout_below="@id/textView_subtitle"
|
|
||||||
android:layout_alignParentStart="true"
|
|
||||||
android:layout_alignParentEnd="true"
|
|
||||||
android:layout_marginTop="4dp"
|
|
||||||
android:background="?colorSecondaryContainer" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<androidx.fragment.app.FragmentContainerView
|
<com.google.android.material.card.MaterialCardView
|
||||||
android:id="@+id/container_chapters"
|
android:id="@+id/card_chapters"
|
||||||
android:name="org.koitharu.kotatsu.details.ui.ChaptersFragment"
|
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginStart="@dimen/side_card_offset"
|
||||||
|
android:layout_marginEnd="@dimen/side_card_offset"
|
||||||
|
android:layout_marginBottom="@dimen/side_card_offset"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@id/container_details"
|
app:layout_constraintStart_toEndOf="@id/container_details"
|
||||||
app:layout_constraintTop_toBottomOf="@id/group_header"
|
app:layout_constraintTop_toBottomOf="@id/group_header">
|
||||||
tools:layout="@layout/fragment_chapters" />
|
|
||||||
|
<androidx.fragment.app.FragmentContainerView
|
||||||
|
android:id="@+id/container_chapters"
|
||||||
|
android:name="org.koitharu.kotatsu.details.ui.ChaptersFragment"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:layout="@layout/fragment_chapters" />
|
||||||
|
|
||||||
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -37,9 +37,10 @@
|
|||||||
android:id="@+id/card_filter"
|
android:id="@+id/card_filter"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_marginStart="12dp"
|
android:layout_marginStart="@dimen/side_card_offset"
|
||||||
android:layout_marginEnd="16dp"
|
android:layout_marginTop="@dimen/grid_spacing_outer_double"
|
||||||
android:layout_marginBottom="12dp"
|
android:layout_marginEnd="@dimen/side_card_offset"
|
||||||
|
android:layout_marginBottom="@dimen/side_card_offset"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@id/container"
|
app:layout_constraintStart_toEndOf="@id/container"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<dimen name="grid_spacing">6dp</dimen>
|
<dimen name="grid_spacing">6dp</dimen>
|
||||||
<dimen name="grid_spacing_outer">2dp</dimen>
|
<dimen name="grid_spacing_outer">2dp</dimen>
|
||||||
|
<dimen name="grid_spacing_outer_double">4dp</dimen>
|
||||||
<dimen name="preferred_grid_width">140dp</dimen>
|
<dimen name="preferred_grid_width">140dp</dimen>
|
||||||
<dimen name="bottom_sheet_width">420dp</dimen>
|
<dimen name="bottom_sheet_width">420dp</dimen>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
<dimen name="grid_spacing">8dp</dimen>
|
<dimen name="grid_spacing">8dp</dimen>
|
||||||
<dimen name="list_spacing">8dp</dimen>
|
<dimen name="list_spacing">8dp</dimen>
|
||||||
<dimen name="grid_spacing_outer">2dp</dimen>
|
<dimen name="grid_spacing_outer">2dp</dimen>
|
||||||
|
<dimen name="grid_spacing_outer_double">4dp</dimen>
|
||||||
<dimen name="manga_list_item_height">86dp</dimen>
|
<dimen name="manga_list_item_height">86dp</dimen>
|
||||||
<dimen name="manga_list_details_item_height">120dp</dimen>
|
<dimen name="manga_list_details_item_height">120dp</dimen>
|
||||||
<dimen name="bookmark_item_height">120dp</dimen>
|
<dimen name="bookmark_item_height">120dp</dimen>
|
||||||
@@ -32,6 +33,7 @@
|
|||||||
<dimen name="reader_bar_inset_fallback">8dp</dimen>
|
<dimen name="reader_bar_inset_fallback">8dp</dimen>
|
||||||
<dimen name="scrobbling_list_spacing">12dp</dimen>
|
<dimen name="scrobbling_list_spacing">12dp</dimen>
|
||||||
<dimen name="explore_grid_width">120dp</dimen>
|
<dimen name="explore_grid_width">120dp</dimen>
|
||||||
|
<dimen name="side_card_offset">8dp</dimen>
|
||||||
|
|
||||||
<dimen name="search_suggestions_manga_height">124dp</dimen>
|
<dimen name="search_suggestions_manga_height">124dp</dimen>
|
||||||
<dimen name="search_suggestions_manga_spacing">4dp</dimen>
|
<dimen name="search_suggestions_manga_spacing">4dp</dimen>
|
||||||
|
|||||||
Reference in New Issue
Block a user