mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
Add button in tracker searches to directly go to tracking link
This commit is contained in:
parent
257b91ce70
commit
f53561c796
4 changed files with 39 additions and 6 deletions
|
@ -30,7 +30,7 @@ class TrackSearchItem(val trackSearch: TrackSearch) : AbstractItem<TrackSearchIt
|
|||
|
||||
class ViewHolder(view: View) : FastAdapter.ViewHolder<TrackSearchItem>(view) {
|
||||
|
||||
private val binding = TrackSearchItemBinding.bind(view)
|
||||
val binding = TrackSearchItemBinding.bind(view)
|
||||
|
||||
init {
|
||||
binding.trackSearchCover.shapeAppearanceModel =
|
||||
|
|
|
@ -39,6 +39,7 @@ import com.afollestad.materialdialogs.MaterialDialog
|
|||
import com.afollestad.materialdialogs.list.listItems
|
||||
import com.mikepenz.fastadapter.FastAdapter
|
||||
import com.mikepenz.fastadapter.adapters.ItemAdapter
|
||||
import com.mikepenz.fastadapter.listeners.addClickListener
|
||||
import eu.kanade.tachiyomi.ui.manga.MangaDetailsDivider
|
||||
import eu.kanade.tachiyomi.util.lang.indexesOf
|
||||
import eu.kanade.tachiyomi.util.system.openInBrowser
|
||||
|
@ -94,6 +95,10 @@ class TrackingBottomSheet(private val controller: MangaDetailsController) :
|
|||
true
|
||||
}
|
||||
|
||||
searchAdapter.addClickListener<TrackSearchItem.ViewHolder, TrackSearchItem>({ it.binding.linkButton }) { _, _, _, item ->
|
||||
activity.openInBrowser(item.trackSearch.tracking_url)
|
||||
}
|
||||
|
||||
binding.trackSearch.setOnEditorActionListener { _, actionId, _ ->
|
||||
if (actionId == EditorInfo.IME_ACTION_DONE || actionId == EditorInfo.IME_ACTION_SEARCH) {
|
||||
val text = binding.trackSearch.text?.toString() ?: ""
|
||||
|
|
11
app/src/main/res/drawable/ic_open_in_new_24dp.xml
Normal file
11
app/src/main/res/drawable/ic_open_in_new_24dp.xml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:autoMirrored="true">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M19,19H5V5h7V3H5c-1.11,0 -2,0.9 -2,2v14c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2v-7h-2v7zM14,3v2h3.59l-9.83,9.83 1.41,1.41L19,6.41V10h2V3h-7z"/>
|
||||
</vector>
|
|
@ -30,7 +30,7 @@
|
|||
android:maxLines="3"
|
||||
android:textSize="18sp"
|
||||
android:textAppearance="@style/TextAppearance.MaterialComponents.Headline6"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/link_button"
|
||||
app:layout_constraintStart_toEndOf="@id/track_search_cover"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="One Piece"/>
|
||||
|
@ -141,15 +141,32 @@
|
|||
|
||||
<ImageView
|
||||
android:id="@+id/checkbox"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:background="@drawable/oval"
|
||||
android:backgroundTint="?colorOnAccent"
|
||||
android:contentDescription="@string/selection"
|
||||
android:src="@drawable/ic_check_circle_24dp"
|
||||
app:tint="?attr/colorAccent"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="12dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/link_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintWidth_max="wrap"
|
||||
android:background="?selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/stop"
|
||||
android:padding="12dp"
|
||||
android:tooltipText="@string/open_in_browser"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_chainStyle="spread"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/ic_open_in_new_24dp"
|
||||
app:tint="?android:textColorPrimary" />
|
||||
|
||||
<androidx.constraintlayout.widget.Barrier
|
||||
android:id="@+id/cover_barrier"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue