Search in sources :

Example 6 with EhRequest

use of com.hippo.ehviewer.client.EhRequest in project EhViewer by seven332.

the class CommonOperations method removeFromFavorites.

public static void removeFromFavorites(Activity activity, GalleryInfo galleryInfo, final EhClient.Callback<Void> listener) {
    EhClient client = EhApplication.getEhClient(activity);
    EhRequest request = new EhRequest();
    request.setMethod(EhClient.METHOD_ADD_FAVORITES);
    request.setArgs(galleryInfo.gid, galleryInfo.token, -1, "");
    request.setCallback(listener);
    client.execute(request);
}
Also used : EhClient(com.hippo.ehviewer.client.EhClient) EhRequest(com.hippo.ehviewer.client.EhRequest)

Example 7 with EhRequest

use of com.hippo.ehviewer.client.EhRequest in project EhViewer by seven332.

the class SignInScene method getProfile.

private void getProfile() {
    Context context = getContext2();
    MainActivity activity = getActivity2();
    if (null == context || null == activity) {
        return;
    }
    hideSoftInput();
    showProgress(true);
    EhCallback callback = new GetProfileListener(context, activity.getStageId(), getTag());
    mRequestId = ((EhApplication) context.getApplicationContext()).putGlobalStuff(callback);
    EhRequest request = new EhRequest().setMethod(EhClient.METHOD_GET_PROFILE).setCallback(callback);
    EhApplication.getEhClient(context).execute(request);
}
Also used : Context(android.content.Context) MainActivity(com.hippo.ehviewer.ui.MainActivity) EhRequest(com.hippo.ehviewer.client.EhRequest)

Example 8 with EhRequest

use of com.hippo.ehviewer.client.EhRequest 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());
    }
}
Also used : JSONException(org.json.JSONException) IOException(java.io.IOException) EhClient(com.hippo.ehviewer.client.EhClient) EhRequest(com.hippo.ehviewer.client.EhRequest)

Aggregations

EhRequest (com.hippo.ehviewer.client.EhRequest)8 Context (android.content.Context)6 MainActivity (com.hippo.ehviewer.ui.MainActivity)6 EhClient (com.hippo.ehviewer.client.EhClient)3 SpannableString (android.text.SpannableString)1 IOException (java.io.IOException)1 JSONException (org.json.JSONException)1