/** * 添加评论 * * @param route 路线 * @param listener 回调 */ public void addComment(final Route route, final OnRouteListener listener) { int commentNum = 0; if (route.getCommentNum() != null) { commentNum = route.getCommentNum(); } commentNum++; route.setCommentNum(commentNum); route.update( mContext, route.getObjectId(), new UpdateListener() { @Override public void onSuccess() { UserManager.getInstance(mContext) .addComment( route, new UserManager.OnUpdateListener() { @Override public void onSuccess() { listener.onSuccess(null); } @Override public void onError() { listener.onError(null); } }); } @Override public void onFailure(int i, String s) { listener.onError(s); } }); }
/** * 取消路线 * * @param route 路线 * @param listener 回调 */ public void cancelRoute(Route route, final OnRouteListener listener) { route.update( mContext, route.getObjectId(), new UpdateListener() { @Override public void onSuccess() { UserManager.getInstance(mContext) .setStartRoute( false, new UserManager.OnUpdateListener() { @Override public void onSuccess() { listener.onSuccess(null); } @Override public void onError() { listener.onError(null); } }); } @Override public void onFailure(int i, String s) { listener.onError(s); } }); }
/** * 增加天数 * * @param route 路线 * @param listener 回调 */ public void addDay(Route route, final OnRouteListener listener) { Route r = new Route(); r.setDays(route.getDays()); r.update( mContext, route.getObjectId(), new UpdateListener() { @Override public void onSuccess() { listener.onSuccess(null); } @Override public void onFailure(int i, String s) { listener.onError(null); } }); }
/** * 查看路线 * * @param route 路线 * @param listener 回调 */ public void watch(Route route, final OnRouteListener listener) { int watchNum = 0; if (route.getWatchNum() != null) { watchNum = route.getWatchNum().intValue(); } watchNum++; route.setWatchNum(watchNum); route.update( mContext, new UpdateListener() { @Override public void onSuccess() { listener.onSuccess(null); } @Override public void onFailure(int i, String s) { listener.onError(s); } }); }
/** * 路线点赞 * * @param route 路线 * @param listener 回调 */ public void good(Route route, final OnRouteListener listener) { int favor = 0; if (route.getFavor() != null) { favor = route.getFavor().intValue(); } favor++; route.setFavor(favor); route.update( mContext, route.getObjectId(), new UpdateListener() { @Override public void onSuccess() { listener.onSuccess(null); } @Override public void onFailure(int i, String s) { listener.onError(s); } }); }