-
-
Notifications
You must be signed in to change notification settings - Fork 402
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
38b176d
commit e5d9aa2
Showing
10 changed files
with
299 additions
and
441 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 13 additions & 23 deletions
36
app/src/main/java/com/battlelancer/seriesguide/jobs/episodes/EpisodeCollectedJob.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,20 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright 2017, 2018, 2020-2023 Uwe Trottmann | ||
// Copyright 2017, 2018, 2020-2024 Uwe Trottmann | ||
package com.battlelancer.seriesguide.jobs.episodes | ||
|
||
package com.battlelancer.seriesguide.jobs.episodes; | ||
import android.content.Context | ||
import com.battlelancer.seriesguide.provider.SgRoomDatabase | ||
|
||
import android.content.Context; | ||
import androidx.annotation.NonNull; | ||
import com.battlelancer.seriesguide.provider.SgRoomDatabase; | ||
|
||
public class EpisodeCollectedJob extends EpisodeBaseJob { | ||
|
||
private final boolean isCollected; | ||
|
||
public EpisodeCollectedJob(long episodeId, boolean isCollected) { | ||
super(episodeId, isCollected ? 1 : 0, JobAction.EPISODE_COLLECTION); | ||
this.isCollected = isCollected; | ||
} | ||
|
||
@Override | ||
protected boolean applyDatabaseChanges(@NonNull Context context) { | ||
int updated = SgRoomDatabase.getInstance(context).sgEpisode2Helper() | ||
.updateCollected(episodeId, isCollected); | ||
return updated == 1; | ||
class EpisodeCollectedJob( | ||
episodeId: Long, private val isCollected: Boolean | ||
) : EpisodeBaseJob(episodeId, if (isCollected) 1 else 0, JobAction.EPISODE_COLLECTION) { | ||
override fun applyDatabaseChanges(context: Context): Boolean { | ||
val updated = SgRoomDatabase.getInstance(context).sgEpisode2Helper() | ||
.updateCollected(episodeId, isCollected) | ||
return updated == 1 | ||
} | ||
|
||
@Override | ||
protected int getPlaysForNetworkJob(int plays) { | ||
return plays; // Collected change does not change plays. | ||
override fun getPlaysForNetworkJob(plays: Int): Int { | ||
return plays // Collected change does not change plays. | ||
} | ||
} |
Oops, something went wrong.