mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-22 19:41:50 +01:00
Replace TagGroup library with Material chips
This commit is contained in:
parent
879fa484f6
commit
912629c2dc
@ -212,7 +212,6 @@ dependencies {
|
||||
implementation 'com.afollestad.material-dialogs:core:0.9.6.0'
|
||||
implementation 'com.nightlynexus.viewstatepageradapter:viewstatepageradapter:1.1.0'
|
||||
implementation 'com.github.mthli:Slice:v1.3'
|
||||
implementation 'me.gujun.android.taggroup:library:1.4@aar'
|
||||
implementation 'com.github.chrisbanes:PhotoView:2.3.0'
|
||||
implementation 'com.github.carlosesco:DirectionalViewPager:a844dbca0a'
|
||||
|
||||
|
@ -5,9 +5,9 @@ import eu.kanade.tachiyomi.data.database.models.Chapter
|
||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||
import eu.kanade.tachiyomi.data.download.DownloadStore
|
||||
import eu.kanade.tachiyomi.source.model.Page
|
||||
import java.util.concurrent.CopyOnWriteArrayList
|
||||
import rx.Observable
|
||||
import rx.subjects.PublishSubject
|
||||
import java.util.concurrent.CopyOnWriteArrayList
|
||||
|
||||
class DownloadQueue(
|
||||
private val store: DownloadStore,
|
||||
|
@ -25,6 +25,7 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
|
||||
import com.bumptech.glide.request.target.CustomTarget
|
||||
import com.bumptech.glide.request.transition.Transition
|
||||
import com.google.android.material.chip.Chip
|
||||
import com.jakewharton.rxbinding.support.v4.widget.refreshes
|
||||
import com.jakewharton.rxbinding.view.clicks
|
||||
import com.jakewharton.rxbinding.view.longClicks
|
||||
@ -142,8 +143,6 @@ class MangaInfoController : NucleusController<MangaInfoPresenter>(),
|
||||
copyToClipboard(view.context.getString(R.string.description), manga_summary.text.toString())
|
||||
}
|
||||
|
||||
manga_genres_tags.setOnTagClickListener { tag -> performLocalSearch(tag) }
|
||||
|
||||
manga_cover.longClicks().subscribeUntilDestroy {
|
||||
copyToClipboard(view.context.getString(R.string.title), presenter.manga.title)
|
||||
}
|
||||
@ -218,8 +217,15 @@ class MangaInfoController : NucleusController<MangaInfoPresenter>(),
|
||||
manga_source.text = source?.toString() ?: view.context.getString(R.string.unknown)
|
||||
|
||||
// Update genres list
|
||||
if (manga.genre.isNullOrBlank().not()) {
|
||||
manga_genres_tags.setTags(manga.genre?.split(", "))
|
||||
if (!manga.genre.isNullOrBlank()) {
|
||||
manga.genre?.split(", ")?.forEach { genre ->
|
||||
val chip = Chip(view.context).apply {
|
||||
text = genre
|
||||
setOnClickListener { performLocalSearch(genre) }
|
||||
}
|
||||
|
||||
manga_genres_tags.addView(chip)
|
||||
}
|
||||
}
|
||||
|
||||
// Update description TextView.
|
||||
@ -258,11 +264,6 @@ class MangaInfoController : NucleusController<MangaInfoPresenter>(),
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroyView(view: View) {
|
||||
manga_genres_tags.setOnTagClickListener(null)
|
||||
super.onDestroyView(view)
|
||||
}
|
||||
|
||||
/**
|
||||
* Update chapter count TextView.
|
||||
*
|
||||
|
@ -226,17 +226,13 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/manga_summary_label" />
|
||||
|
||||
<me.gujun.android.taggroup.TagGroup
|
||||
<com.google.android.material.chip.ChipGroup
|
||||
android:id="@+id/manga_genres_tags"
|
||||
style="@style/TagGroup"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="64dp"
|
||||
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:chipSpacingHorizontal="4dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/manga_summary" />
|
||||
|
@ -274,19 +274,15 @@
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
<me.gujun.android.taggroup.TagGroup
|
||||
<com.google.android.material.chip.ChipGroup
|
||||
android:id="@+id/manga_genres_tags"
|
||||
style="@style/TagGroup"
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
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:chipSpacingHorizontal="4dp"
|
||||
app:layout_constrainedHeight="true"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
@ -205,6 +205,22 @@
|
||||
</style>
|
||||
|
||||
|
||||
<style name="Theme.Widget.Chip" parent="Widget.MaterialComponents.Chip.Action">
|
||||
<item name="chipStrokeWidth">1dp</item>
|
||||
<item name="chipStrokeColor">?attr/colorAccent</item>
|
||||
<item name="chipBackgroundColor">@android:color/transparent</item>
|
||||
<item name="android:textColor">?attr/colorAccent</item>
|
||||
|
||||
<!-- Smaller text/height -->
|
||||
<item name="chipCornerRadius">12dp</item>
|
||||
<item name="chipMinHeight">24dp</item>
|
||||
<item name="android:textAppearance">@style/TextAppearance.Regular.Caption</item>
|
||||
|
||||
<!-- Collapse horizontal margin -->
|
||||
<item name="chipMinTouchTargetSize">30dp</item>
|
||||
</style>
|
||||
|
||||
|
||||
<!--=======================-->
|
||||
<!--Widgets.TextInputLayout-->
|
||||
<!--=======================-->
|
||||
|
@ -50,6 +50,7 @@
|
||||
<item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
|
||||
<item name="dialogTheme">@style/Theme.AlertDialog.Light</item>
|
||||
<item name="alertDialogTheme">@style/Theme.AlertDialog.Dark</item>
|
||||
<item name="chipStyle">@style/Theme.Widget.Chip</item>
|
||||
<item name="buttonStyle">@style/Theme.Widget.Button.Outlined.Accent</item>
|
||||
<item name="snackbarButtonStyle">@style/Theme.Widget.Button</item>
|
||||
<item name="textAppearanceButton">@style/TextAppearance.Widget.Button</item>
|
||||
@ -128,6 +129,7 @@
|
||||
<item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
|
||||
<item name="dialogTheme">@style/Theme.AlertDialog.Dark</item>
|
||||
<item name="alertDialogTheme">@style/Theme.AlertDialog.Dark</item>
|
||||
<item name="chipStyle">@style/Theme.Widget.Chip</item>
|
||||
<item name="buttonStyle">@style/Theme.Widget.Button.Outlined.Accent</item>
|
||||
<item name="snackbarButtonStyle">@style/Theme.Widget.Button</item>
|
||||
<item name="textAppearanceButton">@style/TextAppearance.Widget.Button</item>
|
||||
|
Loading…
Reference in New Issue
Block a user