Fix add favourites
This commit is contained in:
1 parent
a5c05bd2f3
commit
6c2989a4d3
4 files changed
+17
-17
No files matched your search
@@ -41,12 +41,12 @@ import com.hippo.ehviewer.download.DownloadManager as downloadManager
|
||||
object CommonOperations {
|
||||
private fun doAddToFavorites(
|
||||
activity: Activity, galleryInfo: GalleryInfo,
|
||||
slot: Int, listener: EhClient.Callback<Void?>
|
||||
slot: Int, listener: EhClient.Callback<Unit>
|
||||
) {
|
||||
when (slot) {
|
||||
-1 -> {
|
||||
EhDB.putLocalFavorites(galleryInfo)
|
||||
listener.onSuccess(null)
|
||||
listener.onSuccess(Unit)
|
||||
}
|
||||
|
||||
in 0..9 -> {
|
||||
@@ -66,7 +66,7 @@ object CommonOperations {
|
||||
@JvmOverloads
|
||||
fun addToFavorites(
|
||||
activity: Activity, galleryInfo: GalleryInfo,
|
||||
listener: EhClient.Callback<Void?>, select: Boolean = false
|
||||
listener: EhClient.Callback<Unit>, select: Boolean = false
|
||||
) {
|
||||
val slot = Settings.defaultFavSlot
|
||||
val localFav = activity.getString(R.string.local_favorites)
|
||||
@@ -106,7 +106,7 @@ object CommonOperations {
|
||||
|
||||
fun removeFromFavorites(
|
||||
activity: Activity?, galleryInfo: GalleryInfo,
|
||||
listener: EhClient.Callback<Void?>
|
||||
listener: EhClient.Callback<Unit>
|
||||
) {
|
||||
EhDB.removeLocalFavorites(galleryInfo.gid)
|
||||
val request = EhRequest()
|
||||
@@ -249,10 +249,10 @@ object CommonOperations {
|
||||
}
|
||||
|
||||
private class DelegateFavoriteCallback(
|
||||
private val delegate: EhClient.Callback<Void?>, private val info: GalleryInfo,
|
||||
private val delegate: EhClient.Callback<Unit>, private val info: GalleryInfo,
|
||||
private val newFavoriteName: String?, private val slot: Int
|
||||
) : EhClient.Callback<Void?> {
|
||||
override fun onSuccess(result: Void?) {
|
||||
) : EhClient.Callback<Unit> {
|
||||
override fun onSuccess(result: Unit) {
|
||||
info.favoriteName = newFavoriteName
|
||||
info.favoriteSlot = slot
|
||||
delegate.onSuccess(result)
|
||||
|
||||
@@ -1413,8 +1413,8 @@ class GalleryDetailScene : CollapsingToolbarScene(), View.OnClickListener, Downl
|
||||
context: Context,
|
||||
private val mAddOrRemove: Boolean
|
||||
) :
|
||||
EhCallback<GalleryDetailScene?, Void?>(context) {
|
||||
override fun onSuccess(result: Void?) {
|
||||
EhCallback<GalleryDetailScene?, Unit>(context) {
|
||||
override fun onSuccess(result: Unit) {
|
||||
showTip(
|
||||
if (mAddOrRemove) R.string.remove_from_favorite_success else R.string.add_to_favorite_success,
|
||||
LENGTH_SHORT
|
||||
|
||||
@@ -1088,8 +1088,8 @@ class GalleryListScene : SearchBarScene(), OnDragHandlerListener, SearchLayout.H
|
||||
}
|
||||
|
||||
private class AddToFavoriteListener(context: Context) :
|
||||
EhCallback<GalleryListScene, Void?>(context) {
|
||||
override fun onSuccess(result: Void?) {
|
||||
EhCallback<GalleryListScene, Unit>(context) {
|
||||
override fun onSuccess(result: Unit) {
|
||||
showTip(R.string.add_to_favorite_success, LENGTH_SHORT)
|
||||
}
|
||||
|
||||
@@ -1101,8 +1101,8 @@ class GalleryListScene : SearchBarScene(), OnDragHandlerListener, SearchLayout.H
|
||||
}
|
||||
|
||||
private class RemoveFromFavoriteListener(context: Context) :
|
||||
EhCallback<GalleryListScene, Void?>(context) {
|
||||
override fun onSuccess(result: Void?) {
|
||||
EhCallback<GalleryListScene, Unit>(context) {
|
||||
override fun onSuccess(result: Unit) {
|
||||
showTip(R.string.remove_from_favorite_success, LENGTH_SHORT)
|
||||
}
|
||||
|
||||
|
||||
@@ -321,8 +321,8 @@ class HistoryScene : BaseToolbarScene() {
|
||||
}
|
||||
|
||||
private class AddToFavoriteListener(context: Context) :
|
||||
EhCallback<GalleryListScene?, Void?>(context) {
|
||||
override fun onSuccess(result: Void?) {
|
||||
EhCallback<GalleryListScene?, Unit>(context) {
|
||||
override fun onSuccess(result: Unit) {
|
||||
showTip(R.string.add_to_favorite_success, LENGTH_SHORT)
|
||||
}
|
||||
|
||||
@@ -334,8 +334,8 @@ class HistoryScene : BaseToolbarScene() {
|
||||
}
|
||||
|
||||
private class RemoveFromFavoriteListener(context: Context) :
|
||||
EhCallback<GalleryListScene?, Void?>(context) {
|
||||
override fun onSuccess(result: Void?) {
|
||||
EhCallback<GalleryListScene?, Unit>(context) {
|
||||
override fun onSuccess(result: Unit) {
|
||||
showTip(R.string.remove_from_favorite_success, LENGTH_SHORT)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user