Hide the title for single categories

Updates to swiping to to otehr categories
Started framework of merging manga info/chapters
This commit is contained in:
Jay 2020-02-29 18:58:55 -08:00
parent e842db3bca
commit 2d66185a02
5 changed files with 366 additions and 6 deletions

View File

@ -95,7 +95,8 @@ class LibraryHeaderItem(private val categoryF: (Int) -> Category, val catId: Int
topMargin = (if (category.isFirst == true) 2 else 32).dpToPx topMargin = (if (category.isFirst == true) 2 else 32).dpToPx
} }
sectionText.text = category.name if (category.isFirst == true && category.isLast == true) sectionText.text = ""
else sectionText.text = category.name
sortText.text = itemView.context.getString(R.string.sort_by_, sortText.text = itemView.context.getString(R.string.sort_by_,
itemView.context.getString( itemView.context.getString(
when (category.sortingMode()) { when (category.sortingMode()) {

View File

@ -68,7 +68,8 @@ class LibraryListController(bundle: Bundle? = null) : LibraryController(bundle),
private var lastItem:IFlexible<*>? = null private var lastItem:IFlexible<*>? = null
private lateinit var customTitleSpinner: LinearLayout private lateinit var customTitleSpinner: LinearLayout
private lateinit var titlePopupMenu:PopupMenu private lateinit var titlePopupMenu:PopupMenu
var switchingCategories = false
private var switchingCategories = false
/** /**
* Recycler view of the list of manga. * Recycler view of the list of manga.
@ -589,10 +590,13 @@ class LibraryListController(bundle: Bundle? = null) : LibraryController(bundle),
override fun onSwipeRight(x: Float, y: Float) = goToNextCategory(x, y,1) override fun onSwipeRight(x: Float, y: Float) = goToNextCategory(x, y,1)
private fun goToNextCategory(x: Float, y: Float, offset: Int) { private fun goToNextCategory(x: Float, y: Float, offset: Int) {
val editTextRect = Rect() val sheetRect = Rect()
bottom_sheet.getGlobalVisibleRect(editTextRect) val recyclerRect = Rect()
bottom_sheet.getGlobalVisibleRect(sheetRect)
recycler.getGlobalVisibleRect(recyclerRect)
if (editTextRect.contains(x.toInt(), y.toInt())) { if (sheetRect.contains(x.toInt(), y.toInt()) ||
!recyclerRect.contains(x.toInt(), y.toInt())) {
return return
} }
val position = val position =

View File

@ -589,6 +589,7 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
override fun onFling( override fun onFling(
e1: MotionEvent, e2: MotionEvent, velocityX: Float, velocityY: Float e1: MotionEvent, e2: MotionEvent, velocityX: Float, velocityY: Float
): Boolean { ): Boolean {
if (currentGestureDelegate == null) return false
var result = false var result = false
try { try {
val diffY = e2.y - e1.y val diffY = e2.y - e1.y
@ -596,7 +597,7 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
if (abs(diffX) > abs(diffY)) { if (abs(diffX) > abs(diffY)) {
if (abs(diffX) > Companion.SWIPE_THRESHOLD && if (abs(diffX) > Companion.SWIPE_THRESHOLD &&
abs(velocityX) > Companion.SWIPE_VELOCITY_THRESHOLD abs(velocityX) > Companion.SWIPE_VELOCITY_THRESHOLD
&& abs(diffY) <= Companion.SWIPE_THRESHOLD / 2 && abs(diffY) <= Companion.SWIPE_THRESHOLD * 0.75f
) { ) {
if (diffX > 0) { if (diffX > 0) {
currentGestureDelegate?.onSwipeRight(e1.x, e1.y) currentGestureDelegate?.onSwipeRight(e1.x, e1.y)

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<gradient
android:angle="180"
android:startColor="#ff000000"
android:centerColor="#ff000000"
android:endColor="#00000000"/>
<corners android:radius="0dp" />
</shape>

View File

@ -0,0 +1,342 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout 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:id="@id/swipe_refresh"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="eu.kanade.tachiyomi.ui.catalogue.browse.BrowseCatalogueController">
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/manga_info_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<View
android:id="@+id/guideline"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="32dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/backdrop" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.35" />
<ImageView
android:id="@+id/backdrop"
android:layout_width="0dp"
android:layout_height="0dp"
android:alpha="0.2"
android:translationY="-40dp"
app:layout_constraintBottom_toBottomOf="@id/manga_cover"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:background="@color/material_red_400" />
<View
android:layout_width="match_parent"
android:layout_height="50dp"
android:alpha="0.25"
android:background="@drawable/gradient_shape"
android:backgroundTint="@color/material_red_400"
android:scaleY="-1"
android:translationY="-40dp"
app:layout_constraintTop_toBottomOf="@+id/backdrop" />
<ImageView
android:id="@+id/manga_cover"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
android:adjustViewBounds="true"
android:contentDescription="@string/description_cover"
android:src="@mipmap/ic_launcher"
app:layout_constraintBottom_toBottomOf="@id/guideline"
app:layout_constraintEnd_toStartOf="@+id/guideline2"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:background="@color/material_grey_700" />
<TextView
android:id="@+id/manga_full_title"
style="@style/TextAppearance.MaterialComponents.Headline5"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_marginStart="12dp"
android:maxLines="2"
android:text="@string/manga_info_full_title_label"
android:textIsSelectable="false"
android:textSize="20sp"
app:autoSizeTextType="uniform"
app:layout_constraintStart_toEndOf="@id/manga_cover"
app:layout_constraintTop_toTopOf="@id/manga_cover"
tools:text="Title Example" />
<TextView
android:id="@+id/manga_author_label"
style="@style/TextAppearance.Medium.Body2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/manga_info_author_label"
android:textIsSelectable="false"
app:layout_constraintStart_toStartOf="@id/manga_full_title"
app:layout_constraintTop_toBottomOf="@+id/manga_full_title" />
<TextView
android:id="@+id/manga_author"
style="@style/TextAppearance.Regular.Body1.Secondary"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:ellipsize="end"
android:maxLines="1"
android:textIsSelectable="false"
app:layout_constraintBaseline_toBaselineOf="@+id/manga_author_label"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/manga_author_label" />
<TextView
android:id="@+id/manga_last_update_label"
style="@style/TextAppearance.Medium.Body2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/manga_info_latest_data_label"
android:textIsSelectable="false"
app:layout_constraintStart_toStartOf="@id/manga_full_title"
app:layout_constraintTop_toBottomOf="@+id/manga_author_label" />
<TextView
android:id="@+id/manga_last_update"
style="@style/TextAppearance.Regular.Body1.Secondary"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:ellipsize="end"
android:maxLines="1"
android:textIsSelectable="false"
app:layout_constraintBaseline_toBaselineOf="@+id/manga_last_update_label"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/manga_last_update_label" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/manga_status_source"
style="@style/TextAppearance.Regular.Body1.Secondary"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:textIsSelectable="false"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@id/manga_full_title"
app:layout_constraintTop_toBottomOf="@id/manga_last_update_label"
tools:text="Completed • Mangadex (EN)" />
<LinearLayout
android:id="@+id/button_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="14dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/manga_cover"
app:layout_constraintBottom_toTopOf="@id/start_reading_button">
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:tint="@color/gray_button"
android:src="@drawable/ic_add_to_library_24dp"/>
<View
android:layout_width="1dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:background="@color/gray_button"/>
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:tint="@color/gray_button"
android:src="@drawable/ic_add_to_library_24dp"/>
<View
android:layout_width="1dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:background="@color/gray_button"/>
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:tint="@color/gray_button"
android:src="@drawable/ic_sync_black_24dp"/>
</LinearLayout>
<com.google.android.material.button.MaterialButton
android:id="@+id/start_reading_button"
android:layout_width="0dp"
app:backgroundTint="?colorAccent"
android:layout_height="wrap_content"
android:textAllCaps="false"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/button_layout"
app:layout_constraintBottom_toTopOf="@id/manga_summary_label"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="Start Reading"/>
<com.google.android.material.textview.MaterialTextView
android:id="@+id/manga_summary_label"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="@string/description"
android:textIsSelectable="false"
style="@style/TextAppearance.MaterialComponents.Headline6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:textSize="17sp"
tools:text="About this manga"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/start_reading_button" />
<TextView
android:id="@+id/manga_summary"
style="@style/TextAppearance.Regular.Body1.Secondary"
android:layout_width="match_parent"
android:layout_height="55dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:textIsSelectable="false"
app:layout_constraintBottom_toTopOf="@id/manga_genres_tags"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/manga_summary_label"
tools:text="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." />
<View
android:layout_width="75dp"
android:layout_height="20dp"
android:layout_marginEnd="30dp"
android:background="@drawable/full_gradient"
android:backgroundTint="@color/md_white_1000"
app:layout_constraintBottom_toBottomOf="@id/manga_summary"
app:layout_constraintEnd_toEndOf="@id/more_button" />
<View
android:layout_width="0dp"
android:layout_height="20dp"
android:background="@color/md_white_1000"
android:layout_marginStart="20dp"
app:layout_constraintStart_toStartOf="@id/more_button"
app:layout_constraintBottom_toBottomOf="@id/manga_summary"
app:layout_constraintEnd_toEndOf="@id/more_button" />
<com.google.android.material.button.MaterialButton
android:id="@+id/more_button"
style="@style/Widget.MaterialComponents.Button.TextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20sp"
android:text="More"
android:textAllCaps="false"
android:textColor="?colorAccent"
app:layout_constraintEnd_toEndOf="@id/manga_summary"
app:layout_constraintTop_toTopOf="@id/manga_summary"
app:rippleColor="@color/gray_button" />
<me.gujun.android.taggroup.TagGroup
android:id="@+id/manga_genres_tags"
style="@style/TagGroup"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
app:atg_backgroundColor="@android:color/transparent"
app:atg_borderColor="@color/md_blue_A400"
app:atg_borderStrokeWidth="1dp"
app:atg_textColor="@color/md_blue_A400"
app:layout_constrainedHeight="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/manga_summary" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/chapters_title"
style="@style/TextAppearance.MaterialComponents.Headline6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/chapters"
android:textSize="17sp"
app:layout_constraintBottom_toTopOf="@id/recycler"
app:layout_constraintStart_toStartOf="@id/manga_summary_label"
app:layout_constraintTop_toBottomOf="@id/manga_genres_tags" />
<com.google.android.material.button.MaterialButton
android:id="@+id/show_all_button"
style="@style/Widget.MaterialComponents.Button.TextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Show All"
android:textAllCaps="false"
android:textColor="?colorAccent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/chapters_title"
app:layout_constraintBottom_toBottomOf="@id/chapters_title"
app:rippleColor="@color/gray_button" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler"
android:layout_width="0dp"
android:layout_height="0dp"
android:clipToPadding="false"
android:descendantFocusability="blocksDescendants"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/chapters_title"
tools:listitem="@layout/chapters_item">
</androidx.recyclerview.widget.RecyclerView>
</androidx.constraintlayout.widget.ConstraintLayout>
<View
android:id="@+id/full_backdrop"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0"
android:clickable="true"
android:focusable="true"
android:foreground="@color/md_black_1000"
android:visibility="invisible"
tools:background="@color/md_black_1000" />
<ImageView
android:id="@+id/manga_cover_full"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
android:contentDescription="@string/description_cover"
android:visibility="invisible" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>