use of org.aisen.weibo.sina.sinasdk.bean.Friendship in project AisenWeiBo by wangdan.
the class FriendDB method addCacheData.
@Override
public void addCacheData(Setting action, Params params, IResult responseObj) {
boolean save = true;
if (params.containsKey("uid")) {
save = params.getParameter("uid").equals(AppContext.getAccount().getUser().getIdstr());
} else if (params.containsKey("screen_name")) {
save = params.getParameter("screen_name").equals(AppContext.getAccount().getUser().getScreen_name());
}
if (save) {
Friendship users = (Friendship) responseObj;
if (users.getUsers().size() > 0) {
if (params.containsKey("cursor") && Integer.parseInt(params.getParameter("cursor")) == 0) {
CacheTimeUtils.saveTime("Friends", AppContext.getAccount().getUser());
clear();
}
insertFriends(users.getUsers());
ActivityHelper.putIntShareData(GlobalContext.getInstance(), "Friends" + AppContext.getAccount().getUser().getIdstr(), users.getNext_cursor());
}
}
}
use of org.aisen.weibo.sina.sinasdk.bean.Friendship in project AisenWeiBo by wangdan.
the class FriendDB method findCacheData.
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public IResult findCacheData(Setting action, Params params) {
if (params.containsKey("uid")) {
if (!params.getParameter("uid").equals(AppContext.getAccount().getUser().getIdstr()))
return null;
} else if (params.containsKey("screen_name")) {
if (!params.getParameter("screen_name").equals(AppContext.getAccount().getUser().getScreen_name()))
return null;
}
List<WeiBoUser> userList = selectAll();
if (userList.size() > 0) {
Friendship users = new Friendship();
users.setUsers(userList);
users.setFromCache(true);
users.setOutofdate(CacheTimeUtils.isOutofdate("Friends", AppContext.getAccount().getUser()));
users.setNext_cursor(ActivityHelper.getIntShareData(GlobalContext.getInstance(), "Friends" + AppContext.getAccount().getUser().getIdstr(), 0));
return users;
}
return null;
}
use of org.aisen.weibo.sina.sinasdk.bean.Friendship in project AisenWeiBo by wangdan.
the class BilateralDB method addCacheData.
@Override
public void addCacheData(Setting action, Params params, IResult responseObj) {
boolean save = true;
if (params.containsKey("uid")) {
save = params.getParameter("uid").equals(AppContext.getAccount().getUser().getIdstr());
} else if (params.containsKey("screen_name")) {
save = params.getParameter("screen_name").equals(AppContext.getAccount().getUser().getScreen_name());
}
if (save) {
Friendship users = (Friendship) responseObj;
if (users.getUsers().size() > 0) {
if (params.containsKey("cursor") && Integer.parseInt(params.getParameter("cursor")) == 0) {
CacheTimeUtils.saveTime("Bilateral", AppContext.getAccount().getUser());
clear();
}
insertFriends(users.getUsers());
ActivityHelper.putIntShareData(GlobalContext.getInstance(), "Bilateral" + AppContext.getAccount().getUser().getIdstr(), users.getNext_cursor());
}
}
}
use of org.aisen.weibo.sina.sinasdk.bean.Friendship in project AisenWeiBo by wangdan.
the class BilateralDB method findCacheData.
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public IResult findCacheData(Setting action, Params params) {
List<WeiBoUser> userList = selectAll();
if (userList.size() > 0) {
Friendship users = new Friendship();
users.setUsers(userList);
users.setFromCache(true);
users.setOutofdate(CacheTimeUtils.isOutofdate("Bilateral", AppContext.getAccount().getUser()));
users.setNext_cursor(ActivityHelper.getIntShareData(GlobalContext.getInstance(), "Bilateral" + AppContext.getAccount().getUser().getIdstr(), 0));
return users;
}
return null;
}
use of org.aisen.weibo.sina.sinasdk.bean.Friendship in project AisenWeiBo by wangdan.
the class FollowersDB method addCacheData.
@Override
public void addCacheData(Setting action, Params params, IResult responseObj) {
boolean save = true;
if (params.containsKey("uid")) {
save = params.getParameter("uid").equals(AppContext.getAccount().getUser().getIdstr());
} else if (params.containsKey("screen_name")) {
save = params.getParameter("screen_name").equals(AppContext.getAccount().getUser().getScreen_name());
}
if (save) {
Friendship users = (Friendship) responseObj;
if (users.getUsers().size() > 0) {
if (params.containsKey("cursor") && Integer.parseInt(params.getParameter("cursor")) == 0) {
CacheTimeUtils.saveTime("Followers", AppContext.getAccount().getUser());
clear();
}
insertFriends(users.getUsers());
ActivityHelper.putIntShareData(GlobalContext.getInstance(), "Followers" + AppContext.getAccount().getUser().getIdstr(), users.getNext_cursor());
}
}
}
Aggregations