mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-21 20:47:03 -05:00
Fix tracking search layout
This commit is contained in:
parent
b37685542d
commit
6de36a88c0
3 changed files with 47 additions and 52 deletions
|
@ -8,9 +8,9 @@ import com.jakewharton.rxbinding.widget.itemClicks
|
||||||
import com.jakewharton.rxbinding.widget.textChanges
|
import com.jakewharton.rxbinding.widget.textChanges
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.data.database.models.Track
|
import eu.kanade.tachiyomi.data.database.models.Track
|
||||||
import eu.kanade.tachiyomi.data.track.model.TrackSearch
|
|
||||||
import eu.kanade.tachiyomi.data.track.TrackManager
|
import eu.kanade.tachiyomi.data.track.TrackManager
|
||||||
import eu.kanade.tachiyomi.data.track.TrackService
|
import eu.kanade.tachiyomi.data.track.TrackService
|
||||||
|
import eu.kanade.tachiyomi.data.track.model.TrackSearch
|
||||||
import eu.kanade.tachiyomi.ui.base.controller.DialogController
|
import eu.kanade.tachiyomi.ui.base.controller.DialogController
|
||||||
import eu.kanade.tachiyomi.util.plusAssign
|
import eu.kanade.tachiyomi.util.plusAssign
|
||||||
import kotlinx.android.synthetic.main.track_search_dialog.view.*
|
import kotlinx.android.synthetic.main.track_search_dialog.view.*
|
||||||
|
@ -114,14 +114,14 @@ class TrackSearchDialog : DialogController {
|
||||||
private fun search(query: String) {
|
private fun search(query: String) {
|
||||||
val view = dialogView ?: return
|
val view = dialogView ?: return
|
||||||
view.progress.visibility = View.VISIBLE
|
view.progress.visibility = View.VISIBLE
|
||||||
view.track_search_list.visibility = View.GONE
|
view.track_search_list.visibility = View.INVISIBLE
|
||||||
trackController.presenter.search(query, service)
|
trackController.presenter.search(query, service)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onSearchResults(results: List<TrackSearch>) {
|
fun onSearchResults(results: List<TrackSearch>) {
|
||||||
selectedItem = null
|
selectedItem = null
|
||||||
val view = dialogView ?: return
|
val view = dialogView ?: return
|
||||||
view.progress.visibility = View.GONE
|
view.progress.visibility = View.INVISIBLE
|
||||||
view.track_search_list.visibility = View.VISIBLE
|
view.track_search_list.visibility = View.VISIBLE
|
||||||
adapter?.setItems(results)
|
adapter?.setItems(results)
|
||||||
}
|
}
|
||||||
|
@ -129,7 +129,7 @@ class TrackSearchDialog : DialogController {
|
||||||
fun onSearchResultsError() {
|
fun onSearchResultsError() {
|
||||||
val view = dialogView ?: return
|
val view = dialogView ?: return
|
||||||
view.progress.visibility = View.VISIBLE
|
view.progress.visibility = View.VISIBLE
|
||||||
view.track_search_list.visibility = View.GONE
|
view.track_search_list.visibility = View.INVISIBLE
|
||||||
adapter?.setItems(emptyList())
|
adapter?.setItems(emptyList())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,4 +141,4 @@ class TrackSearchDialog : DialogController {
|
||||||
const val KEY_SERVICE = "service_id"
|
const val KEY_SERVICE = "service_id"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<android.support.constraint.ConstraintLayout
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
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"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
|
@ -14,52 +13,49 @@
|
||||||
android:hint="@string/title"
|
android:hint="@string/title"
|
||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="16dp"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
android:maxLines="1"
|
android:inputType="text"
|
||||||
app:layout_constraintTop_toTopOf="parent"/>
|
android:maxLines="1"/>
|
||||||
|
|
||||||
<ProgressBar
|
<FrameLayout
|
||||||
android:id="@+id/progress"
|
|
||||||
style="?android:attr/progressBarStyle"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginBottom="32dp"
|
|
||||||
android:layout_marginTop="32dp"
|
|
||||||
android:visibility="gone"
|
|
||||||
app:layout_constraintBottom_toTopOf="@id/divider1"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/track_search"
|
|
||||||
tools:visibility="visible"/>
|
|
||||||
|
|
||||||
<ListView
|
|
||||||
android:id="@+id/track_search_list"
|
|
||||||
style="@style/Theme.Widget.CardView"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="0dp"
|
||||||
android:layout_marginTop="40dp"
|
android:layout_weight="1">
|
||||||
android:choiceMode="singleChoice"
|
|
||||||
android:clipToPadding="false"
|
<ProgressBar
|
||||||
android:divider="@null"
|
android:id="@+id/progress"
|
||||||
android:dividerHeight="10dp"
|
style="?android:attr/progressBarStyle"
|
||||||
android:footerDividersEnabled="true"
|
android:layout_width="wrap_content"
|
||||||
android:headerDividersEnabled="true"
|
android:layout_height="wrap_content"
|
||||||
android:listSelector="?attr/selectable_list_drawable"
|
android:layout_marginBottom="32dp"
|
||||||
android:paddingBottom="4dp"
|
android:layout_marginTop="32dp"
|
||||||
android:paddingTop="4dp"
|
android:layout_gravity="center"
|
||||||
android:scrollbars="none"
|
android:visibility="invisible"
|
||||||
android:visibility="gone"
|
tools:visibility="visible"/>
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
<ListView
|
||||||
app:layout_constraintTop_toTopOf="@+id/track_search"
|
android:id="@+id/track_search_list"
|
||||||
tools:listitem="@layout/track_search_item"
|
style="@style/Theme.Widget.CardView"
|
||||||
tools:visibility="visible"/>
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:clipToPadding="false"
|
||||||
|
android:choiceMode="singleChoice"
|
||||||
|
android:divider="@null"
|
||||||
|
android:dividerHeight="10dp"
|
||||||
|
android:footerDividersEnabled="true"
|
||||||
|
android:headerDividersEnabled="true"
|
||||||
|
android:listSelector="?attr/selectable_list_drawable"
|
||||||
|
android:paddingBottom="4dp"
|
||||||
|
android:paddingTop="4dp"
|
||||||
|
android:scrollbars="none"
|
||||||
|
android:visibility="invisible"
|
||||||
|
tools:listitem="@layout/track_search_item"
|
||||||
|
tools:visibility="visible"/>
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:id="@+id/divider1"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="1dp"
|
android:layout_height="1dp"
|
||||||
android:background="?android:attr/divider"
|
android:background="?android:attr/divider"/>
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/track_search_list"/>
|
|
||||||
|
|
||||||
</android.support.constraint.ConstraintLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
android:layout_height="216dp"
|
android:layout_height="216dp"
|
||||||
android:background="?attr/selectable_list_drawable"
|
android:background="?attr/selectable_list_drawable"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
>
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/track_search_cover"
|
android:id="@+id/track_search_cover"
|
||||||
|
@ -161,4 +160,4 @@
|
||||||
app:layout_constraintGuide_begin="150dp"/>
|
app:layout_constraintGuide_begin="150dp"/>
|
||||||
|
|
||||||
</android.support.constraint.ConstraintLayout>
|
</android.support.constraint.ConstraintLayout>
|
||||||
</android.support.v7.widget.CardView>
|
</android.support.v7.widget.CardView>
|
||||||
|
|
Loading…
Reference in a new issue