Select e-hentai for skipping signing in
This commit is contained in:
1 parent
d4a39990ed
commit
2160deb34a
8 files changed
+32
-11
No files matched your search
@@ -198,6 +198,17 @@ public class Settings {
|
||||
return sEhConfig;
|
||||
}
|
||||
|
||||
private static final String KEY_NEED_SIGN_IN = "need_sign_in";
|
||||
private static final boolean DEFAULT_NEED_SIGN_IN = true;
|
||||
|
||||
public static boolean getNeedSignIn() {
|
||||
return getBoolean(KEY_NEED_SIGN_IN, DEFAULT_NEED_SIGN_IN);
|
||||
}
|
||||
|
||||
public static void putNeedSignIn(boolean value) {
|
||||
putBoolean(KEY_NEED_SIGN_IN, value);
|
||||
}
|
||||
|
||||
/********************
|
||||
****** Eh
|
||||
********************/
|
||||
|
||||
@@ -119,10 +119,11 @@ public class EhUtils {
|
||||
EhApplication.getEhCookieStore(context).signOut();
|
||||
Settings.putAvatar(null);
|
||||
Settings.putDisplayName(null);
|
||||
Settings.putNeedSignIn(true);
|
||||
}
|
||||
|
||||
public static boolean hasSignedIn(Context context) {
|
||||
return EhApplication.getEhCookieStore(context).hasSignedIn();
|
||||
public static boolean needSignedIn(Context context) {
|
||||
return Settings.getNeedSignIn() && !EhApplication.getEhCookieStore(context).hasSignedIn();
|
||||
}
|
||||
|
||||
public static String getSuitableTitle(GalleryInfo gi) {
|
||||
|
||||
@@ -136,7 +136,7 @@ public final class MainActivity extends StageActivity
|
||||
break;
|
||||
}
|
||||
case CHECK_STEP_CRASH:
|
||||
if (!EhUtils.hasSignedIn(this)) {
|
||||
if (EhUtils.needSignedIn(this)) {
|
||||
startScene(new Announcer(SignInScene.class).setArgs(args));
|
||||
break;
|
||||
}
|
||||
@@ -182,7 +182,7 @@ public final class MainActivity extends StageActivity
|
||||
return new Announcer(AnalyticsScene.class);
|
||||
} else if (Crash.hasCrashFile()) {
|
||||
return new Announcer(CrashScene.class);
|
||||
} else if (!EhUtils.hasSignedIn(this)) {
|
||||
} else if (EhUtils.needSignedIn(this)) {
|
||||
return new Announcer(SignInScene.class);
|
||||
} else {
|
||||
Bundle args = new Bundle();
|
||||
@@ -209,7 +209,7 @@ public final class MainActivity extends StageActivity
|
||||
newArgs.putString(KEY_TARGET_SCENE, announcer.getClazz().getName());
|
||||
newArgs.putBundle(KEY_TARGET_ARGS, announcer.getArgs());
|
||||
return new Announcer(CrashScene.class).setArgs(newArgs);
|
||||
} else if (!EhUtils.hasSignedIn(this)) {
|
||||
} else if (EhUtils.needSignedIn(this)) {
|
||||
Bundle newArgs = new Bundle();
|
||||
newArgs.putString(KEY_TARGET_SCENE, announcer.getClazz().getName());
|
||||
newArgs.putBundle(KEY_TARGET_ARGS, announcer.getArgs());
|
||||
|
||||
@@ -224,6 +224,8 @@ public final class SignInScene extends BaseScene implements EditText.OnEditorAct
|
||||
} else if (mSignInViaCookies == v) {
|
||||
startScene(new Announcer(CookieSignInScene.class).setRequestCode(this, REQUEST_CODE_COOKIE));
|
||||
} else if (mSkipSigningIn == v) {
|
||||
// Set gallery size SITE_G if skip sign in
|
||||
Settings.putGallerySite(EhUrl.SITE_G);
|
||||
redirectTo();
|
||||
}
|
||||
}
|
||||
@@ -293,6 +295,7 @@ public final class SignInScene extends BaseScene implements EditText.OnEditorAct
|
||||
}
|
||||
|
||||
private void redirectTo() {
|
||||
Settings.putNeedSignIn(false);
|
||||
((MainActivity) getActivity()).startSceneForCheckStep(
|
||||
MainActivity.CHECK_STEP_SIGN_IN, getArguments());
|
||||
finish();
|
||||
@@ -300,8 +303,8 @@ public final class SignInScene extends BaseScene implements EditText.OnEditorAct
|
||||
|
||||
private void whetherToSkip() {
|
||||
new AlertDialog.Builder(getContext())
|
||||
.setTitle(R.string.skip_signing_in)
|
||||
.setMessage(R.string.skip_signing_in_plain)
|
||||
.setTitle(R.string.sign_in_failed)
|
||||
.setMessage(R.string.sign_in_failed_plain)
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.setPositiveButton(R.string.get_it, null)
|
||||
.show();
|
||||
|
||||
Reference in new issue
Block a user