Use EhCallback
This commit is contained in:
1 parent
3566d3ea90
commit
a585c7cd20
8 files changed
+165
-173
No files matched your search
@@ -28,6 +28,7 @@ public class EhUrl {
|
||||
public static final String HOST_EX = "http://" + DOMAIN_EX + "/";
|
||||
|
||||
public static final String API_SIGN_IN = "http://forums.e-hentai.org/index.php?act=Login&CODE=01";
|
||||
public static final String API_REGISTER = "http://forums.e-hentai.org/index.php?act=Reg&CODE=00";
|
||||
|
||||
public static final String API_EX = HOST_EX + "api.php";
|
||||
|
||||
|
||||
@@ -37,6 +37,10 @@ public abstract class EhCallback<E extends SceneFragment, T> implements EhClient
|
||||
|
||||
public abstract boolean isInstance(SceneFragment scene);
|
||||
|
||||
public EhApplication getApplication() {
|
||||
return mApplication;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public E getScene() {
|
||||
StageActivity stage = mApplication.findStageActivityById(mStageId);
|
||||
|
||||
@@ -408,37 +408,23 @@ public final class GalleryCommentsScene extends ToolbarScene
|
||||
Bundle re = new Bundle();
|
||||
re.putParcelableArray(KEY_COMMENTS, result);
|
||||
setResult(SceneFragment.RESULT_OK, re);
|
||||
|
||||
// Remove text
|
||||
if (mEditText != null) {
|
||||
mEditText.setText("");
|
||||
}
|
||||
}
|
||||
|
||||
private static class CommentGalleryListener implements EhClient.Callback<GalleryComment[]> {
|
||||
|
||||
private EhApplication mApplication;
|
||||
private int mStageId;
|
||||
private String mSceneTag;
|
||||
private static class CommentGalleryListener extends EhCallback<GalleryCommentsScene, GalleryComment[]> {
|
||||
|
||||
public CommentGalleryListener(Context context, int stageId, String sceneTag) {
|
||||
mApplication = (EhApplication) context.getApplicationContext();
|
||||
mStageId = stageId;
|
||||
mSceneTag = sceneTag;
|
||||
}
|
||||
|
||||
private GalleryCommentsScene getScene() {
|
||||
StageActivity stage = mApplication.findStageActivityById(mStageId);
|
||||
if (stage == null) {
|
||||
return null;
|
||||
}
|
||||
SceneFragment scene = stage.findSceneByTag(mSceneTag);
|
||||
if (scene instanceof GalleryCommentsScene) {
|
||||
return (GalleryCommentsScene) scene;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
super(context, stageId, sceneTag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(GalleryComment[] result) {
|
||||
// Show toast
|
||||
Toast.makeText(mApplication, R.string.comment_successfully, Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(getApplication(), R.string.comment_successfully, Toast.LENGTH_SHORT).show();
|
||||
|
||||
GalleryCommentsScene scene = getScene();
|
||||
if (scene != null) {
|
||||
@@ -449,11 +435,16 @@ public final class GalleryCommentsScene extends ToolbarScene
|
||||
@Override
|
||||
public void onFailure(Exception e) {
|
||||
// Show toast
|
||||
Toast.makeText(mApplication, R.string.comment_failed, Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(getApplication(), R.string.comment_failed, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInstance(SceneFragment scene) {
|
||||
return scene instanceof GalleryCommentsScene;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1036,40 +1036,21 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
}
|
||||
}
|
||||
|
||||
private static class GetGalleryDetailListener implements EhClient.Callback<GalleryDetail> {
|
||||
|
||||
private EhApplication mApplication;
|
||||
private int mStageId;
|
||||
private String mSceneTag;
|
||||
private static class GetGalleryDetailListener extends EhCallback<GalleryDetailScene, GalleryDetail> {
|
||||
|
||||
public GetGalleryDetailListener(Context context, int stageId, String sceneTag) {
|
||||
mApplication = (EhApplication) context.getApplicationContext();
|
||||
mStageId = stageId;
|
||||
mSceneTag = sceneTag;
|
||||
}
|
||||
|
||||
private GalleryDetailScene getScene() {
|
||||
StageActivity stage = mApplication.findStageActivityById(mStageId);
|
||||
if (stage == null) {
|
||||
return null;
|
||||
}
|
||||
SceneFragment scene = stage.findSceneByTag(mSceneTag);
|
||||
if (scene instanceof GalleryDetailScene) {
|
||||
return (GalleryDetailScene) scene;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
super(context, stageId, sceneTag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(GalleryDetail result) {
|
||||
mApplication.removeGlobalStuff(this);
|
||||
getApplication().removeGlobalStuff(this);
|
||||
|
||||
// Put gallery detail to cache
|
||||
EhApplication.getGalleryDetailCache(mApplication).put(result.gid, result);
|
||||
EhApplication.getLargePreviewSetCache(mApplication).put(
|
||||
EhApplication.getGalleryDetailCache(getApplication()).put(result.gid, result);
|
||||
EhApplication.getLargePreviewSetCache(getApplication()).put(
|
||||
EhCacheKeyFactory.getLargePreviewSetKey(result.gid, 0), result.previewSet);
|
||||
EhApplication.getPreviewPagesCache(mApplication).put(result.gid, result.previewPages);
|
||||
EhApplication.getPreviewPagesCache(getApplication()).put(result.gid, result.previewPages);
|
||||
|
||||
// Notify success
|
||||
GalleryDetailScene scene = getScene();
|
||||
@@ -1080,7 +1061,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
|
||||
@Override
|
||||
public void onFailure(Exception e) {
|
||||
mApplication.removeGlobalStuff(this);
|
||||
getApplication().removeGlobalStuff(this);
|
||||
GalleryDetailScene scene = getScene();
|
||||
if (scene != null) {
|
||||
scene.onGetGalleryDetailFailure(e);
|
||||
@@ -1089,7 +1070,12 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
|
||||
@Override
|
||||
public void onCancel() {
|
||||
mApplication.removeGlobalStuff(this);
|
||||
getApplication().removeGlobalStuff(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInstance(SceneFragment scene) {
|
||||
return scene instanceof GalleryDetailScene;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1130,44 +1116,26 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
}
|
||||
}
|
||||
|
||||
private static class RateGalleryListener implements EhClient.Callback<RateGalleryParser.Result> {
|
||||
private static class RateGalleryListener extends EhCallback<GalleryDetailScene, RateGalleryParser.Result> {
|
||||
|
||||
private EhApplication mApplication;
|
||||
private int mStageId;
|
||||
private String mSceneTag;
|
||||
private int mGid;
|
||||
|
||||
public RateGalleryListener(Context context, int stageId, String sceneTag, int gid) {
|
||||
mApplication = (EhApplication) context.getApplicationContext();
|
||||
mStageId = stageId;
|
||||
mSceneTag = sceneTag;
|
||||
super(context, stageId, sceneTag);
|
||||
mGid = gid;
|
||||
}
|
||||
|
||||
private GalleryDetailScene getScene() {
|
||||
StageActivity stage = mApplication.findStageActivityById(mStageId);
|
||||
if (stage == null) {
|
||||
return null;
|
||||
}
|
||||
SceneFragment scene = stage.findSceneByTag(mSceneTag);
|
||||
if (scene instanceof GalleryDetailScene) {
|
||||
return (GalleryDetailScene) scene;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(RateGalleryParser.Result result) {
|
||||
// Show toast
|
||||
Toast.makeText(mApplication, R.string.rate_successfully, Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(getApplication(), R.string.rate_successfully, Toast.LENGTH_SHORT).show();
|
||||
|
||||
GalleryDetailScene scene = getScene();
|
||||
if (scene != null) {
|
||||
scene.onRateGallerySuccess(result);
|
||||
} else {
|
||||
// Update rating in cache
|
||||
GalleryDetail gd = EhApplication.getGalleryDetailCache(mApplication).get(mGid);
|
||||
GalleryDetail gd = EhApplication.getGalleryDetailCache(getApplication()).get(mGid);
|
||||
if (gd != null) {
|
||||
gd.rating = result.rating;
|
||||
gd.ratedTimes = result.ratedTimes;
|
||||
@@ -1179,11 +1147,16 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
public void onFailure(Exception e) {
|
||||
e.printStackTrace();
|
||||
// Show toast
|
||||
Toast.makeText(mApplication, R.string.rate_failed, Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(getApplication(), R.string.rate_failed, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInstance(SceneFragment scene) {
|
||||
return scene instanceof GalleryDetailScene;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,6 @@ import com.hippo.ehviewer.widget.SearchLayout;
|
||||
import com.hippo.ehviewer.widget.SimpleRatingView;
|
||||
import com.hippo.rippleold.RippleSalon;
|
||||
import com.hippo.scene.Announcer;
|
||||
import com.hippo.scene.SceneApplication;
|
||||
import com.hippo.scene.SceneFragment;
|
||||
import com.hippo.scene.StageActivity;
|
||||
import com.hippo.scene.TransitionHelper;
|
||||
@@ -1052,33 +1051,15 @@ public final class GalleryListScene extends BaseScene
|
||||
}
|
||||
}
|
||||
|
||||
private static class GetGalleryListListener implements EhClient.Callback<GalleryListParser.Result> {
|
||||
private static class GetGalleryListListener extends EhCallback<GalleryListScene, GalleryListParser.Result> {
|
||||
|
||||
private SceneApplication mApplication;
|
||||
private int mStageId;
|
||||
private String mSceneTag;
|
||||
private int mTaskId;
|
||||
|
||||
public GetGalleryListListener(Context context, int stageId, String sceneTag, int taskId) {
|
||||
mApplication = (SceneApplication) context.getApplicationContext();
|
||||
mStageId = stageId;
|
||||
mSceneTag = sceneTag;
|
||||
super(context, stageId, sceneTag);
|
||||
mTaskId = taskId;
|
||||
}
|
||||
|
||||
private GalleryListScene getScene() {
|
||||
StageActivity stage = mApplication.findStageActivityById(mStageId);
|
||||
if (stage == null) {
|
||||
return null;
|
||||
}
|
||||
SceneFragment scene = stage.findSceneByTag(mSceneTag);
|
||||
if (scene instanceof GalleryListScene) {
|
||||
return (GalleryListScene) scene;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(GalleryListParser.Result result) {
|
||||
GalleryListScene scene = getScene();
|
||||
@@ -1097,5 +1078,10 @@ public final class GalleryListScene extends BaseScene
|
||||
|
||||
@Override
|
||||
public void onCancel() {}
|
||||
|
||||
@Override
|
||||
public boolean isInstance(SceneFragment scene) {
|
||||
return scene instanceof GalleryListScene;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,6 @@ import com.hippo.ehviewer.client.EhUrl;
|
||||
import com.hippo.ehviewer.client.data.GalleryPreview;
|
||||
import com.hippo.ehviewer.client.data.LargePreviewSet;
|
||||
import com.hippo.ehviewer.client.exception.EhException;
|
||||
import com.hippo.scene.SceneApplication;
|
||||
import com.hippo.scene.SceneFragment;
|
||||
import com.hippo.scene.StageActivity;
|
||||
import com.hippo.util.ActivityHelper;
|
||||
@@ -299,42 +298,24 @@ public class GalleryPreviewsScene extends ToolbarScene {
|
||||
}
|
||||
}
|
||||
|
||||
private static class GetLargePreviewSetListener implements EhClient.Callback<Pair<LargePreviewSet, Integer>> {
|
||||
private static class GetLargePreviewSetListener extends EhCallback<GalleryPreviewsScene, Pair<LargePreviewSet, Integer>> {
|
||||
|
||||
private SceneApplication mApplication;
|
||||
private int mStageId;
|
||||
private String mSceneTag;
|
||||
private int mTaskId;
|
||||
private int mGid;
|
||||
private int mPage;
|
||||
|
||||
public GetLargePreviewSetListener(Context context, int stageId, String sceneTag, int taskId, int gid, int page) {
|
||||
mApplication = (SceneApplication) context.getApplicationContext();
|
||||
mStageId = stageId;
|
||||
mSceneTag = sceneTag;
|
||||
super(context, stageId, sceneTag);
|
||||
mTaskId = taskId;
|
||||
mGid = gid;
|
||||
mPage = page;
|
||||
}
|
||||
|
||||
private GalleryPreviewsScene getScene() {
|
||||
StageActivity stage = mApplication.findStageActivityById(mStageId);
|
||||
if (stage == null) {
|
||||
return null;
|
||||
}
|
||||
SceneFragment scene = stage.findSceneByTag(mSceneTag);
|
||||
if (scene instanceof GalleryPreviewsScene) {
|
||||
return (GalleryPreviewsScene) scene;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Pair<LargePreviewSet, Integer> result) {
|
||||
EhApplication.getLargePreviewSetCache(mApplication).put(
|
||||
EhApplication.getLargePreviewSetCache(getApplication()).put(
|
||||
EhCacheKeyFactory.getLargePreviewSetKey(mGid, mPage), result.first);
|
||||
EhApplication.getPreviewPagesCache(mApplication).put(mGid, result.second);
|
||||
EhApplication.getPreviewPagesCache(getApplication()).put(mGid, result.second);
|
||||
|
||||
GalleryPreviewsScene scene = getScene();
|
||||
if (scene != null) {
|
||||
@@ -354,6 +335,11 @@ public class GalleryPreviewsScene extends ToolbarScene {
|
||||
public void onCancel() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInstance(SceneFragment scene) {
|
||||
return scene instanceof GalleryPreviewsScene;
|
||||
}
|
||||
}
|
||||
|
||||
private class GoToDialogHelper implements View.OnClickListener,
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.hippo.ehviewer.ui.scene;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Paint;
|
||||
import android.os.Bundle;
|
||||
@@ -35,17 +36,22 @@ import android.widget.Toast;
|
||||
import com.hippo.ehviewer.EhApplication;
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.ehviewer.Settings;
|
||||
import com.hippo.ehviewer.UrlOpener;
|
||||
import com.hippo.ehviewer.client.EhClient;
|
||||
import com.hippo.ehviewer.client.EhCookieStore;
|
||||
import com.hippo.ehviewer.client.EhRequest;
|
||||
import com.hippo.ehviewer.client.EhUrl;
|
||||
import com.hippo.rippleold.RippleSalon;
|
||||
import com.hippo.scene.Announcer;
|
||||
import com.hippo.scene.SceneFragment;
|
||||
import com.hippo.scene.StageActivity;
|
||||
import com.hippo.util.ActivityHelper;
|
||||
import com.hippo.util.ExceptionUtils;
|
||||
|
||||
public final class LoginScene extends BaseScene implements EditText.OnEditorActionListener,
|
||||
View.OnClickListener {
|
||||
|
||||
private static final String KEY_REQUEST_ID = "request_id";
|
||||
|
||||
private View mProgress;
|
||||
private TextInputLayout mUsernameLayout;
|
||||
private TextInputLayout mPasswordLayout;
|
||||
@@ -57,9 +63,7 @@ public final class LoginScene extends BaseScene implements EditText.OnEditorActi
|
||||
private TextView mSignInViaCookies;
|
||||
private TextView mSkipSigningIn;
|
||||
|
||||
private EhClient mClient;
|
||||
private EhCookieStore mCookieStore;
|
||||
private EhRequest mSignInRequest;
|
||||
private int mRequestId;
|
||||
|
||||
@Override
|
||||
public int getSoftInputMode() {
|
||||
@@ -71,10 +75,27 @@ public final class LoginScene extends BaseScene implements EditText.OnEditorActi
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
mClient = EhApplication.getEhClient(getContext());
|
||||
mCookieStore = EhApplication.getEhCookieStore(getContext());
|
||||
if (savedInstanceState == null) {
|
||||
onInit();
|
||||
} else {
|
||||
onRestore(savedInstanceState);
|
||||
}
|
||||
}
|
||||
|
||||
private void onInit() {
|
||||
}
|
||||
|
||||
private void onRestore(Bundle savedInstanceState) {
|
||||
mRequestId = savedInstanceState.getInt(KEY_REQUEST_ID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putInt(KEY_REQUEST_ID, mRequestId);
|
||||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@@ -108,6 +129,13 @@ public final class LoginScene extends BaseScene implements EditText.OnEditorActi
|
||||
RippleSalon.addRipple(mRegister, true);
|
||||
RippleSalon.addRipple(mSignIn, true);
|
||||
|
||||
EhApplication application = (EhApplication) getContext().getApplicationContext();
|
||||
if (application.containGlobalStuff(mRequestId)) {
|
||||
// request exist
|
||||
mProgress.setAlpha(1.0f);
|
||||
mProgress.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@@ -119,20 +147,10 @@ public final class LoginScene extends BaseScene implements EditText.OnEditorActi
|
||||
ActivityHelper.showSoftInput(getActivity(), mUsername);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
if (mSignInRequest != null) {
|
||||
mSignInRequest.cancel();
|
||||
mSignInRequest = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mRegister == v) {
|
||||
|
||||
UrlOpener.openUrl(getActivity(), EhUrl.API_REGISTER, false, true);
|
||||
} else if (mSignIn == v) {
|
||||
signIn();
|
||||
} else if (mSignInViaWebview == v) {
|
||||
@@ -157,10 +175,6 @@ public final class LoginScene extends BaseScene implements EditText.OnEditorActi
|
||||
}
|
||||
|
||||
private void signIn() {
|
||||
if (mSignInRequest != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
String username = mUsername.getText().toString();
|
||||
String password = mPassword.getText().toString();
|
||||
|
||||
@@ -185,44 +199,16 @@ public final class LoginScene extends BaseScene implements EditText.OnEditorActi
|
||||
mProgress.animate().alpha(1.0f).setDuration(500).start();
|
||||
|
||||
// Clean up for sign in
|
||||
mCookieStore.cleanUpForSignIn();
|
||||
EhApplication.getEhCookieStore(getContext()).cleanUpForSignIn();
|
||||
|
||||
// TODO Make callback static
|
||||
mSignInRequest = new EhRequest()
|
||||
EhCallback callback = new SignInListener(getContext(),
|
||||
((StageActivity) getActivity()).getStageId(), getTag());
|
||||
mRequestId = ((EhApplication) getContext().getApplicationContext()).putGlobalStuff(callback);
|
||||
EhRequest request = new EhRequest()
|
||||
.setMethod(EhClient.METHOD_SIGN_IN)
|
||||
.setArgs(username, password)
|
||||
.setCallback(new EhClient.Callback<String>() {
|
||||
@Override
|
||||
public void onSuccess(String result) {
|
||||
mSignInRequest = null;
|
||||
Settings.putDisplayName(result);
|
||||
|
||||
if (mCookieStore.hasSignedIn()) {
|
||||
// Has signed in
|
||||
redirectTo();
|
||||
} else {
|
||||
mProgress.setVisibility(View.GONE);
|
||||
whetherToSkip();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Exception e) {
|
||||
e.printStackTrace();
|
||||
mSignInRequest = null;
|
||||
mProgress.setVisibility(View.GONE);
|
||||
Toast.makeText(getContext(), ExceptionUtils.getReadableString(getContext(), e),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
whetherToSkip();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel() {
|
||||
mSignInRequest = null;
|
||||
// User close this Scene
|
||||
}
|
||||
});
|
||||
mClient.execute(mSignInRequest);
|
||||
.setCallback(callback);
|
||||
EhApplication.getEhClient(getContext()).execute(request);
|
||||
}
|
||||
|
||||
private void redirectTo() {
|
||||
@@ -248,4 +234,61 @@ public final class LoginScene extends BaseScene implements EditText.OnEditorActi
|
||||
}
|
||||
}).show();
|
||||
}
|
||||
|
||||
|
||||
public void onSignInSuccess() {
|
||||
if (EhApplication.getEhCookieStore(getContext()).hasSignedIn()) {
|
||||
// Has signed in
|
||||
redirectTo();
|
||||
} else {
|
||||
mProgress.setVisibility(View.GONE);
|
||||
whetherToSkip();
|
||||
}
|
||||
}
|
||||
|
||||
public void onSignInFailure(Exception e) {
|
||||
mProgress.setVisibility(View.GONE);
|
||||
Toast.makeText(getContext(), ExceptionUtils.getReadableString(getContext(), e),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
whetherToSkip();
|
||||
}
|
||||
|
||||
private class SignInListener extends EhCallback<LoginScene, String> {
|
||||
|
||||
public SignInListener(Context context, int stageId, String sceneTag) {
|
||||
super(context, stageId, sceneTag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String result) {
|
||||
getApplication().removeGlobalStuff(this);
|
||||
Settings.putDisplayName(result);
|
||||
|
||||
LoginScene scene = getScene();
|
||||
if (scene != null) {
|
||||
scene.onSignInSuccess();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Exception e) {
|
||||
getApplication().removeGlobalStuff(this);
|
||||
e.printStackTrace();
|
||||
|
||||
LoginScene scene = getScene();
|
||||
if (scene != null) {
|
||||
scene.onSignInFailure(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel() {
|
||||
getApplication().removeGlobalStuff(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInstance(SceneFragment scene) {
|
||||
return scene instanceof LoginScene;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -67,6 +67,14 @@ public final class WarningScene extends BaseScene implements View.OnClickListene
|
||||
ActivityHelper.hideSoftInput(getActivity());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
|
||||
mCancel = null;
|
||||
mOk = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mCancel == v) {
|
||||
|
||||
Reference in new issue
Block a user