use of com.hippo.ehviewer.ui.MainActivity in project EhViewer by seven332.
the class SignInScene method signIn.
private void signIn() {
if (mSigningIn) {
return;
}
Context context = getContext2();
MainActivity activity = getActivity2();
if (null == context || null == activity || null == mUsername || null == mPassword || null == mUsernameLayout || null == mPasswordLayout) {
return;
}
String username = mUsername.getText().toString();
String password = mPassword.getText().toString();
if (username.isEmpty()) {
mUsernameLayout.setError(getString(R.string.error_username_cannot_empty));
return;
} else {
mUsernameLayout.setError(null);
}
if (password.isEmpty()) {
mPasswordLayout.setError(getString(R.string.error_password_cannot_empty));
return;
} else {
mPasswordLayout.setError(null);
}
hideSoftInput();
showProgress(true);
// Clean up for sign in
EhUtils.signOut(context);
String challenge = mRecaptchaView.getChallenge();
String response = mRecaptcha.getText().toString();
EhCallback callback = new SignInListener(context, activity.getStageId(), getTag());
mRequestId = ((EhApplication) context.getApplicationContext()).putGlobalStuff(callback);
EhRequest request = new EhRequest().setMethod(EhClient.METHOD_SIGN_IN).setArgs(username, password, challenge, response).setCallback(callback);
EhApplication.getEhClient(context).execute(request);
mSigningIn = true;
}
use of com.hippo.ehviewer.ui.MainActivity in project EhViewer by seven332.
the class SignInScene method redirectTo.
private void redirectTo() {
Settings.putNeedSignIn(false);
MainActivity activity = getActivity2();
if (null != activity) {
startSceneForCheckStep(CHECK_STEP_SIGN_IN, getArguments());
}
finish();
}
use of com.hippo.ehviewer.ui.MainActivity 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) {
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).setCallback(new CommentGalleryListener(context, activity.getStageId(), getTag()));
EhApplication.getEhClient(context).execute(request);
hideSoftInput();
hideEditPanel(true);
}
}
}
use of com.hippo.ehviewer.ui.MainActivity 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.ui.MainActivity in project EhViewer by seven332.
the class AnalyticsScene method onClick.
@Override
public void onClick(View v) {
Context context = getContext2();
if (null == context) {
return;
}
if (mReject == v) {
Settings.putEnableAnalytics(false);
} else if (mAccept == v) {
Settings.putEnableAnalytics(true);
// Start Analytics
Analytics.start(context);
}
Settings.putAskAnalytics(false);
// Start new scene and finish it self
MainActivity activity = getActivity2();
if (null != activity) {
startSceneForCheckStep(CHECK_STEP_ANALYTICS, getArguments());
}
finish();
}
Aggregations