use of com.hippo.ehviewer.client.EhClient in project EhViewer by seven332.
the class CommonOperations method removeFromFavorites.
public static void removeFromFavorites(Activity activity, GalleryInfo galleryInfo, final EhClient.Callback<Void> listener) {
EhDB.removeLocalFavorites(galleryInfo.gid);
EhClient client = EhApplication.getEhClient(activity);
EhRequest request = new EhRequest();
request.setMethod(EhClient.METHOD_ADD_FAVORITES);
request.setArgs(galleryInfo.gid, galleryInfo.token, -1, "");
request.setCallback(new DelegateFavoriteCallback(listener, galleryInfo, null, -2));
client.execute(request);
}
use of com.hippo.ehviewer.client.EhClient in project EhViewer by seven332.
the class CommonOperations method doAddToFavorites.
private static void doAddToFavorites(Activity activity, GalleryInfo galleryInfo, int slot, EhClient.Callback<Void> listener) {
if (slot == -1) {
EhDB.putLocalFavorites(galleryInfo);
listener.onSuccess(null);
} else if (slot >= 0 && slot <= 9) {
EhClient client = EhApplication.getEhClient(activity);
EhRequest request = new EhRequest();
request.setMethod(EhClient.METHOD_ADD_FAVORITES);
request.setArgs(galleryInfo.gid, galleryInfo.token, slot, "");
request.setCallback(listener);
client.execute(request);
} else {
// TODO Add text
listener.onFailure(new Exception());
}
}
Aggregations