45 lines
781 B
Java
45 lines
781 B
Java
package com.gh.gamecenter.manager;
|
|
|
|
import java.util.List;
|
|
|
|
import android.content.Context;
|
|
|
|
import com.gh.gamecenter.db.GameDao;
|
|
import com.gh.gamecenter.db.info.GameInfo;
|
|
|
|
public class GameManager {
|
|
|
|
private GameDao dao;
|
|
|
|
public GameManager(Context context) {
|
|
dao = new GameDao(context);
|
|
}
|
|
|
|
public void addOrUpdate(GameInfo entity) {
|
|
if (dao.find(entity.getPackageName()) == null) {
|
|
dao.add(entity);
|
|
}
|
|
}
|
|
|
|
public void addGame(GameInfo entity) {
|
|
dao.add(entity);
|
|
}
|
|
|
|
public GameInfo findGame(String packageName) {
|
|
return dao.find(packageName);
|
|
}
|
|
|
|
public void deleteGame(String packageName) {
|
|
dao.delete(packageName);
|
|
}
|
|
|
|
public List<GameInfo> getAllGame() {
|
|
return dao.getAll();
|
|
}
|
|
|
|
public void updateGame(GameInfo entity) {
|
|
dao.update(entity);
|
|
}
|
|
|
|
}
|