use of com.hippo.ehviewer.client.EhRequest in project EhViewer by seven332.
the class GalleryCommentsScene method voteComment.
private void voteComment(long id, int vote) {
Context context = getContext2();
MainActivity activity = getActivity2();
if (null == context || null == activity) {
return;
}
EhRequest request = new EhRequest().setMethod(EhClient.METHOD_VOTE_COMMENT).setArgs(mApiUid, mApiKey, mGid, mToken, id, vote).setCallback(new VoteCommentListener(context, activity.getStageId(), getTag()));
EhApplication.getEhClient(context).execute(request);
}
use of com.hippo.ehviewer.client.EhRequest in project EhViewer by seven332.
the class GalleryCommentsScene method onClick.
@Override
public void onClick(View v) {
Context context = getContext2();
MainActivity activity = getActivity2();
if (null == context || null == activity || null == mEditText) {
return;
}
if (mFab == v) {
if (!mInAnimation) {
prepareNewComment();
showEditPanel(true);
}
} else if (mSendImage == v) {
if (!mInAnimation) {
String comment = mEditText.getText().toString();
if (TextUtils.isEmpty(comment)) {
// Comment is empty
return;
}
String url = getGalleryDetailUrl();
if (url == null) {
return;
}
// Request
EhRequest request = new EhRequest().setMethod(EhClient.METHOD_GET_COMMENT_GALLERY).setArgs(url, comment, mCommentId != 0 ? Long.toString(mCommentId) : null).setCallback(new CommentGalleryListener(context, activity.getStageId(), getTag(), mCommentId));
EhApplication.getEhClient(context).execute(request);
hideSoftInput();
hideEditPanel(true);
}
}
}
use of com.hippo.ehviewer.client.EhRequest in project EhViewer by seven332.
the class GalleryDetailScene method request.
private boolean request() {
Context context = getContext2();
MainActivity activity = getActivity2();
String url = getGalleryDetailUrl(false);
if (null == context || null == activity || null == url) {
return false;
}
EhClient.Callback callback = new GetGalleryDetailListener(context, activity.getStageId(), getTag());
mRequestId = ((EhApplication) context.getApplicationContext()).putGlobalStuff(callback);
EhRequest request = new EhRequest().setMethod(EhClient.METHOD_GET_GALLERY_DETAIL).setArgs(url).setCallback(callback);
EhApplication.getEhClient(context).execute(request);
return true;
}
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) {
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.EhRequest in project EhViewer by seven332.
the class ProgressScene method doJobs.
private boolean doJobs() {
Context context = getContext2();
MainActivity activity = getActivity2();
if (null == context || null == activity) {
return false;
}
if (ACTION_GALLERY_TOKEN.equals(mAction)) {
if (mGid == -1 || mPToken == null || mPage == -1) {
return false;
}
EhRequest request = new EhRequest().setMethod(EhClient.METHOD_GET_GALLERY_TOKEN).setArgs(mGid, mPToken, mPage).setCallback(new GetGalleryTokenListener(context, activity.getStageId(), getTag()));
EhApplication.getEhClient(context).execute(request);
return true;
}
return false;
}
Aggregations