-
Notifications
You must be signed in to change notification settings - Fork 47
/
SyncGamesOldest.java
48 lines (39 loc) · 1.21 KB
/
SyncGamesOldest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package com.boardgamegeek.service;
import android.content.Context;
import android.support.annotation.NonNull;
import com.boardgamegeek.R;
import com.boardgamegeek.io.BggService;
import com.boardgamegeek.provider.BggContract.Games;
import com.boardgamegeek.util.ResolverUtils;
import java.util.List;
/**
* Syncs a number of games that haven't been updated in a long time.
*/
public class SyncGamesOldest extends SyncGames {
public SyncGamesOldest(Context context, BggService service) {
super(context, service);
}
@Override
public int getSyncType() {
return SyncService.FLAG_SYNC_COLLECTION_DOWNLOAD;
}
@NonNull
@Override
protected String getIntroLogMessage() {
return "Syncing oldest games in the collection...";
}
@NonNull
@Override
protected String getExitLogMessage() {
return "...found no old games to update (this should only happen with empty collections)";
}
@Override
protected List<String> getGameIds(int gamesPerFetch) {
return ResolverUtils.queryStrings(context.getContentResolver(), Games.CONTENT_URI,
Games.GAME_ID, null, null, "games." + Games.UPDATED + " LIMIT " + gamesPerFetch);
}
@Override
public int getNotification() {
return R.string.sync_notification_games_oldest;
}
}