Search by author name

This commit is contained in:
Koitharu
2021-10-09 15:44:57 +03:00
parent a4e1381238
commit 0a8d677fe8
4 changed files with 30 additions and 9 deletions

View File

@@ -29,6 +29,7 @@ import org.koitharu.kotatsu.databinding.FragmentDetailsBinding
import org.koitharu.kotatsu.favourites.ui.categories.select.FavouriteCategoriesDialog
import org.koitharu.kotatsu.reader.ui.ReaderActivity
import org.koitharu.kotatsu.reader.ui.ReaderState
import org.koitharu.kotatsu.search.ui.SearchActivity
import org.koitharu.kotatsu.utils.FileSizeUtils
import org.koitharu.kotatsu.utils.ext.*
@@ -45,6 +46,10 @@ class DetailsFragment : BaseFragment<FragmentDetailsBinding>(), View.OnClickList
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
binding.textViewAuthor.setOnClickListener(this)
binding.buttonFavorite.setOnClickListener(this)
binding.buttonRead.setOnClickListener(this)
binding.buttonRead.setOnLongClickListener(this)
viewModel.manga.observe(viewLifecycleOwner, ::onMangaUpdated)
viewModel.isLoading.observe(viewLifecycleOwner, ::onLoadingStateChanged)
viewModel.favouriteCategories.observe(viewLifecycleOwner, ::onFavouriteChanged)
@@ -118,9 +123,6 @@ class DetailsFragment : BaseFragment<FragmentDetailsBinding>(), View.OnClickList
}
// Buttons
buttonFavorite.setOnClickListener(this@DetailsFragment)
buttonRead.setOnClickListener(this@DetailsFragment)
buttonRead.setOnLongClickListener(this@DetailsFragment)
buttonRead.isEnabled = !manga.chapters.isNullOrEmpty()
// Chips
@@ -178,6 +180,15 @@ class DetailsFragment : BaseFragment<FragmentDetailsBinding>(), View.OnClickList
)
}
}
R.id.textView_author -> {
startActivity(
SearchActivity.newIntent(
context = v.context,
source = manga.source,
query = manga.author ?: return,
)
)
}
}
}

View File

@@ -5,8 +5,8 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"
android:clipToPadding="false"
android:scrollbars="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<androidx.constraintlayout.widget.ConstraintLayout
@@ -37,7 +37,7 @@
<org.koitharu.kotatsu.base.ui.widgets.CoverImageView
android:id="@+id/imageView_cover"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
tools:background="@tools:sample/backgrounds/scenic"
tools:ignore="ContentDescription" />
@@ -81,12 +81,15 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:background="@drawable/list_selector"
android:requiresFadingEdge="horizontal"
android:textColor="?colorAccent"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="@id/textView_title"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintStart_toStartOf="@id/textView_title"
app:layout_constraintTop_toBottomOf="@id/textView_subtitle"
app:layout_constraintWidth_default="wrap"
tools:text="@tools:sample/full_names" />
<TextView

View File

@@ -5,8 +5,8 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"
android:clipToPadding="false"
android:scrollbars="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<androidx.constraintlayout.widget.ConstraintLayout
@@ -37,7 +37,7 @@
<org.koitharu.kotatsu.base.ui.widgets.CoverImageView
android:id="@+id/imageView_cover"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
tools:background="@tools:sample/backgrounds/scenic"
tools:ignore="ContentDescription" />
@@ -82,12 +82,15 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:background="@drawable/list_selector"
android:requiresFadingEdge="horizontal"
android:textColor="?colorAccent"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="@id/textView_title"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintStart_toStartOf="@id/textView_title"
app:layout_constraintTop_toBottomOf="@id/textView_subtitle"
app:layout_constraintWidth_default="wrap"
tools:text="@tools:sample/full_names" />
<TextView

View File

@@ -5,8 +5,8 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"
android:clipToPadding="false"
android:scrollbars="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<androidx.constraintlayout.widget.ConstraintLayout
@@ -37,7 +37,8 @@
<org.koitharu.kotatsu.base.ui.widgets.CoverImageView
android:id="@+id/imageView_cover"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:scaleType="centerCrop"
tools:background="@tools:sample/backgrounds/scenic"
tools:ignore="ContentDescription" />
@@ -81,12 +82,15 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:background="@drawable/list_selector"
android:requiresFadingEdge="horizontal"
android:textColor="?colorAccent"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="@id/textView_title"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintStart_toStartOf="@id/textView_title"
app:layout_constraintTop_toBottomOf="@id/textView_subtitle"
app:layout_constraintWidth_default="wrap"
tools:text="@tools:sample/full_names" />
<TextView