Tracking: replace tick with button (#5768)

* make check only visible after selecting an item

* replace tick with button and send to bottom

* fixed button visibility

* grey btn out

* resolving some bits

* removing the tick from appbar

* remove useless lines, appl insetter
This commit is contained in:
OncePunchedMan 2021-08-28 17:13:09 +02:00 committed by GitHub
parent 2cd8733212
commit c666dd623d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 13 deletions

View File

@ -64,23 +64,18 @@ class TrackSearchDialog : DialogController {
// Toolbar stuff
binding!!.toolbar.setNavigationOnClickListener { dialog?.dismiss() }
binding!!.toolbar.setOnMenuItemClickListener {
when (it.itemId) {
R.id.done -> {
val adapter = adapter ?: return@setOnMenuItemClickListener true
val item = adapter.items.getOrNull(adapter.selectedItemPosition)
if (item != null) {
trackController.presenter.registerTracking(item, service)
dialog?.dismiss()
}
}
binding!!.trackBtn.setOnClickListener {
val adapter = adapter ?: return@setOnClickListener
val item = adapter.items.getOrNull(adapter.selectedItemPosition)
if (item != null) {
trackController.presenter.registerTracking(item, service)
dialog?.dismiss()
}
true
}
// Create adapter
adapter = TrackSearchAdapter(currentTrackUrl) { which ->
binding!!.toolbar.menu.findItem(R.id.done).isEnabled = which != null
binding!!.trackBtn.isEnabled = which != null
}
binding!!.trackSearchRecyclerview.adapter = adapter
@ -142,6 +137,11 @@ class TrackSearchDialog : DialogController {
margin(horizontal = true)
}
}
binding!!.trackBtn.applyInsetter {
type(navigationBars = true) {
margin()
}
}
return AppCompatDialog(activity!!, R.style.ThemeOverlay_Tachiyomi_Dialog_Fullscreen).apply {
setContentView(binding!!.root)

View File

@ -17,7 +17,6 @@
android:layout_height="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
app:contentInsetStartWithNavigation="0dp"
app:menu="@menu/track_search"
app:navigationIcon="@drawable/ic_close_24dp"
app:title="@string/add_tracking" />
@ -86,6 +85,15 @@
</FrameLayout>
<Button
android:id="@+id/track_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
android:layout_marginVertical="4dp"
android:text="@string/action_track"
android:enabled="false" />
</LinearLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -400,6 +400,7 @@
<string name="tracking_info">One-way sync to update the chapter progress in tracking services. Set up tracking for individual manga entries from their tracking button.</string>
<string name="enhanced_services">Enhanced services</string>
<string name="enhanced_tracking_info">Services that provide enhanced features for specific sources. Manga are automatically tracked when added to your library.</string>
<string name="action_track">Track</string>
<!-- Browse section -->
<string name="pref_enable_automatic_extension_updates">Check for extension updates</string>