mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-05 01:15:14 +01:00
Rewording/Working of track dialogs
This commit is contained in:
parent
2d80f6f26b
commit
905dc0caa4
@ -137,7 +137,7 @@ internal class DownloadNotifier(private val context: Context) {
|
||||
NotificationReceiver.resumeDownloadsPendingBroadcast(context))
|
||||
//Clear action
|
||||
addAction(R.drawable.ic_clear_grey_24dp_img,
|
||||
context.getString(R.string.action_clear),
|
||||
context.getString(R.string.action_cancel_all),
|
||||
NotificationReceiver.clearDownloadsPendingBroadcast(context))
|
||||
}
|
||||
|
||||
|
@ -34,14 +34,14 @@ class SetTrackStatusDialog<T> : DialogController
|
||||
override fun onCreateDialog(savedViewState: Bundle?): Dialog {
|
||||
val item = item
|
||||
val statusList = item.service.getStatusList()
|
||||
val statusString = statusList.mapNotNull { item.service.getStatus(it) }
|
||||
val statusString = statusList.map { item.service.getStatus(it) }
|
||||
val selectedIndex = statusList.indexOf(item.track?.status)
|
||||
|
||||
return MaterialDialog(activity!!)
|
||||
.title(R.string.status)
|
||||
.negativeButton(android.R.string.cancel)
|
||||
.positiveButton(android.R.string.ok)
|
||||
.listItemsSingleChoice(items = statusString, initialSelection = selectedIndex)
|
||||
.listItemsSingleChoice(items = statusString, initialSelection = selectedIndex,
|
||||
waitForPositiveButton = false)
|
||||
{ dialog, position, _ ->
|
||||
(targetController as? Listener)?.setStatus(item, position)
|
||||
dialog.dismiss()
|
||||
|
@ -98,7 +98,8 @@ class TrackController : NucleusController<TrackPresenter>(),
|
||||
|
||||
override fun onTitleClick(position: Int) {
|
||||
val item = adapter?.getItem(position) ?: return
|
||||
TrackSearchDialog(this, item.service).showDialog(router, TAG_SEARCH_CONTROLLER)
|
||||
TrackSearchDialog(this, item.service, item.track != null).showDialog(router,
|
||||
TAG_SEARCH_CONTROLLER)
|
||||
}
|
||||
|
||||
override fun onStatusClick(position: Int) {
|
||||
|
@ -4,6 +4,8 @@ import android.app.Dialog
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import com.afollestad.materialdialogs.WhichButton
|
||||
import com.afollestad.materialdialogs.actions.setActionButtonEnabled
|
||||
import com.afollestad.materialdialogs.customview.customView
|
||||
import com.jakewharton.rxbinding.widget.itemClicks
|
||||
import com.jakewharton.rxbinding.widget.textChanges
|
||||
@ -40,9 +42,13 @@ class TrackSearchDialog : DialogController {
|
||||
private val trackController
|
||||
get() = targetController as TrackController
|
||||
|
||||
constructor(target: TrackController, service: TrackService) : super(Bundle().apply {
|
||||
private var wasPreviouslyTracked:Boolean = false
|
||||
|
||||
constructor(target: TrackController, service: TrackService, wasTracked:Boolean) : super(Bundle()
|
||||
.apply {
|
||||
putInt(KEY_SERVICE, service.id)
|
||||
}) {
|
||||
wasPreviouslyTracked = wasTracked
|
||||
targetController = target
|
||||
this.service = service
|
||||
}
|
||||
@ -53,10 +59,14 @@ class TrackSearchDialog : DialogController {
|
||||
}
|
||||
|
||||
override fun onCreateDialog(savedViewState: Bundle?): Dialog {
|
||||
val dialog = MaterialDialog(activity!!)
|
||||
.customView(viewRes = R.layout.track_search_dialog, scrollable = false)
|
||||
.negativeButton(android.R.string.cancel)
|
||||
.positiveButton(android.R.string.ok) { onPositiveButtonClick() }
|
||||
val dialog = MaterialDialog(activity!!).apply {
|
||||
customView(viewRes = R.layout.track_search_dialog, scrollable = false)
|
||||
negativeButton(android.R.string.cancel)
|
||||
positiveButton(
|
||||
if (wasPreviouslyTracked) R.string.action_clear
|
||||
else R.string.action_track){ onPositiveButtonClick() }
|
||||
setActionButtonEnabled(WhichButton.POSITIVE, wasPreviouslyTracked)
|
||||
}
|
||||
|
||||
if (subscriptions.isUnsubscribed) {
|
||||
subscriptions = CompositeSubscription()
|
||||
@ -79,6 +89,8 @@ class TrackSearchDialog : DialogController {
|
||||
|
||||
subscriptions += view.track_search_list.itemClicks().subscribe { position ->
|
||||
selectedItem = adapter.getItem(position)
|
||||
(dialog as? MaterialDialog)?.positiveButton(R.string.action_track)
|
||||
(dialog as? MaterialDialog)?.setActionButtonEnabled(WhichButton.POSITIVE, true)
|
||||
}
|
||||
|
||||
// Do an initial search based on the manga's title
|
||||
|
@ -69,7 +69,8 @@
|
||||
<string name="action_start">Start</string>
|
||||
<string name="action_stop">Stop</string>
|
||||
<string name="action_pause">Pause</string>
|
||||
<string name="action_clear">Cancel all</string>
|
||||
<string name="action_cancel_all">Cancel all</string>
|
||||
<string name="action_clear">Clear</string>
|
||||
<string name="action_close">Close</string>
|
||||
<string name="action_previous_chapter">Previous chapter</string>
|
||||
<string name="action_next_chapter">Next chapter</string>
|
||||
@ -115,6 +116,7 @@
|
||||
<string name="action_oldest">Oldest</string>
|
||||
<string name="action_move_to_top">Move to top</string>
|
||||
<string name="action_move_to_bottom">Move to bottom</string>
|
||||
<string name="action_track">Track</string>
|
||||
|
||||
<!-- Operations -->
|
||||
<string name="deleting">Deleting…</string>
|
||||
|
Loading…
Reference in New Issue
Block a user