move pass login to the site setup controller

multisite
Floens 8 years ago
parent 9137f5f32f
commit 839ab5d55b
  1. 5
      Clover/app/src/main/assets/captcha/captcha.html
  2. 2
      Clover/app/src/main/java/org/floens/chan/core/di/AppModule.java
  3. 19
      Clover/app/src/main/java/org/floens/chan/core/presenter/ReplyPresenter.java
  4. 14
      Clover/app/src/main/java/org/floens/chan/core/presenter/SiteSetupPresenter.java
  5. 14
      Clover/app/src/main/java/org/floens/chan/core/site/Site.java
  6. 5
      Clover/app/src/main/java/org/floens/chan/core/site/SiteBase.java
  7. 5
      Clover/app/src/main/java/org/floens/chan/core/site/sites/chan4/Chan4.java
  8. 4
      Clover/app/src/main/java/org/floens/chan/core/site/sites/chan8/Chan8ReplyHttpCall.java
  9. 2
      Clover/app/src/main/java/org/floens/chan/ui/captcha/AuthenticationLayoutCallback.java
  10. 3
      Clover/app/src/main/java/org/floens/chan/ui/captcha/CaptchaLayout.java
  11. 31
      Clover/app/src/main/java/org/floens/chan/ui/controller/LoginController.java
  12. 18
      Clover/app/src/main/java/org/floens/chan/ui/controller/MainSettingsController.java
  13. 41
      Clover/app/src/main/java/org/floens/chan/ui/controller/SiteSetupController.java
  14. 18
      Clover/app/src/main/java/org/floens/chan/ui/controller/SitesSetupController.java
  15. 62
      Clover/app/src/main/java/org/floens/chan/ui/layout/ReplyLayout.java
  16. 7
      Clover/app/src/main/res/values/strings.xml

@ -13,6 +13,7 @@
text-align: center; text-align: center;
margin: 40px auto 0 auto; margin: 40px auto 0 auto;
} }
</style> </style>
</head> </head>
<body> <body>
@ -38,9 +39,11 @@ window.globalOnCaptchaLoaded = function() {
window.onerror = function(message, url, line) { window.onerror = function(message, url, line) {
document.getElementById('captcha-loading').style.display = 'none'; document.getElementById('captcha-loading').style.display = 'none';
document.getElementById('captcha-error').appendChild(document.createTextNode(line + ': ' + message + ' @ ' + url)); document.getElementById('captcha-error').appendChild(document.createTextNode(
'Captcha error at ' + line + ': ' + message + ' @ ' + url));
} }
})(); })();
</script> </script>
<script src='https://www.google.com/recaptcha/api.js?onload=globalOnCaptchaLoaded&render=explicit'></script> <script src='https://www.google.com/recaptcha/api.js?onload=globalOnCaptchaLoaded&render=explicit'></script>

@ -36,7 +36,6 @@ import org.floens.chan.ui.controller.FiltersController;
import org.floens.chan.ui.controller.HistoryController; import org.floens.chan.ui.controller.HistoryController;
import org.floens.chan.ui.controller.ImageViewerController; import org.floens.chan.ui.controller.ImageViewerController;
import org.floens.chan.ui.controller.MainSettingsController; import org.floens.chan.ui.controller.MainSettingsController;
import org.floens.chan.ui.controller.PassSettingsController;
import org.floens.chan.ui.controller.SiteSetupController; import org.floens.chan.ui.controller.SiteSetupController;
import org.floens.chan.ui.controller.SitesSetupController; import org.floens.chan.ui.controller.SitesSetupController;
import org.floens.chan.ui.controller.ViewThreadController; import org.floens.chan.ui.controller.ViewThreadController;
@ -80,7 +79,6 @@ import dagger.Provides;
WatchNotifier.class, WatchNotifier.class,
WatchUpdateReceiver.class, WatchUpdateReceiver.class,
ImagePickDelegate.class, ImagePickDelegate.class,
PassSettingsController.class,
FiltersController.class, FiltersController.class,
PostsFilter.class, PostsFilter.class,
ChanLoader.class, ChanLoader.class,

@ -74,7 +74,6 @@ public class ReplyPresenter implements AuthenticationLayoutCallback, ImagePickDe
private boolean moreOpen; private boolean moreOpen;
private boolean previewOpen; private boolean previewOpen;
private boolean pickingFile; private boolean pickingFile;
private boolean authenticationInited;
private int selectedQuote = -1; private int selectedQuote = -1;
@Inject @Inject
@ -114,10 +113,6 @@ public class ReplyPresenter implements AuthenticationLayoutCallback, ImagePickDe
showPreview(draft.fileName, draft.file); showPreview(draft.fileName, draft.file);
} }
if (authenticationInited) {
callback.resetAuthentication();
}
switchPage(Page.INPUT, false); switchPage(Page.INPUT, false);
} }
@ -204,7 +199,7 @@ public class ReplyPresenter implements AuthenticationLayoutCallback, ImagePickDe
draft.spoilerImage = draft.spoilerImage && board.spoilers; draft.spoilerImage = draft.spoilerImage && board.spoilers;
draft.captchaResponse = null; draft.captchaResponse = null;
if (false) { if (loadable.site.postRequiresAuthentication()) {
switchPage(Page.AUTHENTICATION, true); switchPage(Page.AUTHENTICATION, true);
} else { } else {
makeSubmitCall(); makeSubmitCall();
@ -258,10 +253,6 @@ public class ReplyPresenter implements AuthenticationLayoutCallback, ImagePickDe
callback.openMessage(true, false, getString(R.string.reply_error), true); callback.openMessage(true, false, getString(R.string.reply_error), true);
} }
@Override
public void onAuthenticationLoaded(AuthenticationLayoutInterface authenticationLayout) {
}
@Override @Override
public void onAuthenticationComplete(AuthenticationLayoutInterface authenticationLayout, String challenge, String response) { public void onAuthenticationComplete(AuthenticationLayoutInterface authenticationLayout, String challenge, String response) {
draft.captchaChallenge = challenge; draft.captchaChallenge = challenge;
@ -377,13 +368,9 @@ public class ReplyPresenter implements AuthenticationLayoutCallback, ImagePickDe
callback.setPage(Page.INPUT, animate); callback.setPage(Page.INPUT, animate);
break; break;
case AUTHENTICATION: case AUTHENTICATION:
if (!authenticationInited) { Authentication authentication = loadable.site.postAuthenticate();
authenticationInited = true;
Authentication authentication = loadable.site.postAuthenticate();
callback.initializeAuthentication(loadable.site, authentication, this);
}
callback.initializeAuthentication(loadable.site, authentication, this);
callback.setPage(Page.AUTHENTICATION, true); callback.setPage(Page.AUTHENTICATION, true);
break; break;

@ -9,6 +9,7 @@ public class SiteSetupPresenter {
private Callback callback; private Callback callback;
private Site site; private Site site;
private DatabaseManager databaseManager; private DatabaseManager databaseManager;
private boolean hasLogin;
@Inject @Inject
public SiteSetupPresenter(DatabaseManager databaseManager) { public SiteSetupPresenter(DatabaseManager databaseManager) {
@ -18,10 +19,19 @@ public class SiteSetupPresenter {
public void create(Callback callback, Site site) { public void create(Callback callback, Site site) {
this.callback = callback; this.callback = callback;
this.site = site; this.site = site;
hasLogin = site.feature(Site.Feature.LOGIN);
if (hasLogin) {
callback.showLogin();
}
} }
public void show() { public void show() {
setBoardCount(callback, site); setBoardCount(callback, site);
if (hasLogin) {
callback.setIsLoggedIn(site.isLoggedIn());
}
} }
private void setBoardCount(Callback callback, Site site) { private void setBoardCount(Callback callback, Site site) {
@ -34,5 +44,9 @@ public class SiteSetupPresenter {
public interface Callback { public interface Callback {
void setBoardCount(int boardCount); void setBoardCount(int boardCount);
void showLogin();
void setIsLoggedIn(boolean isLoggedIn);
} }
} }

@ -173,11 +173,25 @@ public interface Site {
void post(Reply reply, PostListener postListener); void post(Reply reply, PostListener postListener);
interface PostListener { interface PostListener {
void onPostComplete(HttpCall httpCall, ReplyResponse replyResponse); void onPostComplete(HttpCall httpCall, ReplyResponse replyResponse);
void onPostError(HttpCall httpCall); void onPostError(HttpCall httpCall);
} }
boolean postRequiresAuthentication();
/**
* If {@link ReplyResponse#requireAuthentication} was {@code true}, or if
* {@link #postRequiresAuthentication()} is {@code true}, get the authentication
* required to post.
* <p>
* <p>Some sites know beforehand if you need to authenticate, some sites only report it
* after posting. That's why there are two methods.</p>
*
* @return an {@link Authentication} model that describes the way to authenticate.
*/
Authentication postAuthenticate(); Authentication postAuthenticate();
void delete(DeleteRequest deleteRequest, DeleteListener deleteListener); void delete(DeleteRequest deleteRequest, DeleteListener deleteListener);

@ -82,4 +82,9 @@ public abstract class SiteBase implements Site {
boardManager.createAll(Collections.singletonList(board)); boardManager.createAll(Collections.singletonList(board));
return board; return board;
} }
@Override
public boolean postRequiresAuthentication() {
return false;
}
} }

@ -373,6 +373,11 @@ public class Chan4 extends SiteBase {
}); });
} }
@Override
public boolean postRequiresAuthentication() {
return !isLoggedIn();
}
@Override @Override
public Authentication postAuthenticate() { public Authentication postAuthenticate() {
if (isLoggedIn()) { if (isLoggedIn()) {

@ -93,8 +93,8 @@ public class Chan8ReplyHttpCall extends CommonReplyHttpCall {
} else if (errorMessageMatcher.find()) { } else if (errorMessageMatcher.find()) {
replyResponse.errorMessage = Jsoup.parse(errorMessageMatcher.group(1)).body().text(); replyResponse.errorMessage = Jsoup.parse(errorMessageMatcher.group(1)).body().text();
} else { } else {
// TODO: 8ch redirects us, but the result is a 404. // TODO(multisite): 8ch redirects us, but the result is a 404, and we need that
// stop redirecting. // redirect url to figure out what we posted.
HttpUrl url = response.request().url(); HttpUrl url = response.request().url();
List<String> segments = url.pathSegments(); List<String> segments = url.pathSegments();

@ -18,8 +18,6 @@
package org.floens.chan.ui.captcha; package org.floens.chan.ui.captcha;
public interface AuthenticationLayoutCallback { public interface AuthenticationLayoutCallback {
void onAuthenticationLoaded(AuthenticationLayoutInterface authenticationLayout);
void onAuthenticationComplete(AuthenticationLayoutInterface authenticationLayout, void onAuthenticationComplete(AuthenticationLayoutInterface authenticationLayout,
String challenge, String response); String challenge, String response);
} }

@ -70,6 +70,8 @@ public class CaptchaLayout extends WebView implements AuthenticationLayoutInterf
this.siteKey = authentication.siteKey; this.siteKey = authentication.siteKey;
this.baseUrl = authentication.baseUrl; this.baseUrl = authentication.baseUrl;
requestDisallowInterceptTouchEvent(true);
AndroidUtils.hideKeyboard(this); AndroidUtils.hideKeyboard(this);
WebSettings settings = getSettings(); WebSettings settings = getSettings();
@ -119,7 +121,6 @@ public class CaptchaLayout extends WebView implements AuthenticationLayoutInterf
} }
private void onCaptchaLoaded() { private void onCaptchaLoaded() {
callback.onAuthenticationLoaded(this);
} }
private void onCaptchaEntered(String challenge, String response) { private void onCaptchaEntered(String challenge, String response) {

@ -28,28 +28,16 @@ import android.widget.TextView;
import org.floens.chan.R; import org.floens.chan.R;
import org.floens.chan.controller.Controller; import org.floens.chan.controller.Controller;
import org.floens.chan.core.manager.ReplyManager;
import org.floens.chan.core.site.Site; import org.floens.chan.core.site.Site;
import org.floens.chan.core.site.Sites;
import org.floens.chan.core.site.http.HttpCall; import org.floens.chan.core.site.http.HttpCall;
import org.floens.chan.core.site.http.HttpCallManager;
import org.floens.chan.core.site.http.LoginRequest; import org.floens.chan.core.site.http.LoginRequest;
import org.floens.chan.core.site.http.LoginResponse; import org.floens.chan.core.site.http.LoginResponse;
import org.floens.chan.ui.view.CrossfadeView; import org.floens.chan.ui.view.CrossfadeView;
import org.floens.chan.utils.AndroidUtils; import org.floens.chan.utils.AndroidUtils;
import javax.inject.Inject;
import static org.floens.chan.Chan.getGraph;
import static org.floens.chan.utils.AndroidUtils.getString; import static org.floens.chan.utils.AndroidUtils.getString;
public class PassSettingsController extends Controller implements View.OnClickListener, Site.LoginListener { public class LoginController extends Controller implements View.OnClickListener, Site.LoginListener {
@Inject
ReplyManager replyManager;
@Inject
HttpCallManager httpCallManager;
private LinearLayout container; private LinearLayout container;
private CrossfadeView crossfadeView; private CrossfadeView crossfadeView;
private TextView errors; private TextView errors;
@ -61,17 +49,17 @@ public class PassSettingsController extends Controller implements View.OnClickLi
private Site site; private Site site;
public PassSettingsController(Context context) { public LoginController(Context context) {
super(context); super(context);
} }
public void setSite(Site site) {
this.site = site;
}
@Override @Override
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
getGraph().inject(this);
// TODO(multi-site) some selector of some sorts
site = Sites.defaultSite();
navigationItem.setTitle(R.string.settings_screen_pass); navigationItem.setTitle(R.string.settings_screen_pass);
@ -123,7 +111,6 @@ public class PassSettingsController extends Controller implements View.OnClickLi
crossfadeView.toggle(true, true); crossfadeView.toggle(true, true);
button.setText(R.string.setting_pass_login); button.setText(R.string.setting_pass_login);
hideError(); hideError();
((PassSettingControllerListener) previousSiblingController).onPassEnabledChanged(false);
} else { } else {
auth(); auth();
} }
@ -151,7 +138,6 @@ public class PassSettingsController extends Controller implements View.OnClickLi
crossfadeView.toggle(false, true); crossfadeView.toggle(false, true);
button.setText(R.string.setting_pass_logout); button.setText(R.string.setting_pass_logout);
authenticated.setText(response.message); authenticated.setText(response.message);
((PassSettingControllerListener) previousSiblingController).onPassEnabledChanged(true);
} }
private void authFail(LoginResponse response) { private void authFail(LoginResponse response) {
@ -178,7 +164,6 @@ public class PassSettingsController extends Controller implements View.OnClickLi
button.setText(R.string.setting_pass_logging_in); button.setText(R.string.setting_pass_logging_in);
hideError(); hideError();
// TODO(multi-site)
String user = inputToken.getText().toString(); String user = inputToken.getText().toString();
String pass = inputPin.getText().toString(); String pass = inputPin.getText().toString();
site.login(new LoginRequest(user, pass), this); site.login(new LoginRequest(user, pass), this);
@ -201,8 +186,4 @@ public class PassSettingsController extends Controller implements View.OnClickLi
private boolean loggedIn() { private boolean loggedIn() {
return site.isLoggedIn(); return site.isLoggedIn();
} }
public interface PassSettingControllerListener {
void onPassEnabledChanged(boolean enabled);
}
} }

@ -32,7 +32,6 @@ import org.floens.chan.R;
import org.floens.chan.core.database.DatabaseManager; import org.floens.chan.core.database.DatabaseManager;
import org.floens.chan.core.manager.BoardManager; import org.floens.chan.core.manager.BoardManager;
import org.floens.chan.core.settings.ChanSettings; import org.floens.chan.core.settings.ChanSettings;
import org.floens.chan.core.site.Sites;
import org.floens.chan.ui.activity.StartActivity; import org.floens.chan.ui.activity.StartActivity;
import org.floens.chan.ui.helper.HintPopup; import org.floens.chan.ui.helper.HintPopup;
import org.floens.chan.ui.helper.RefreshUIMessage; import org.floens.chan.ui.helper.RefreshUIMessage;
@ -60,14 +59,13 @@ import static org.floens.chan.Chan.getGraph;
import static org.floens.chan.ui.theme.ThemeHelper.theme; import static org.floens.chan.ui.theme.ThemeHelper.theme;
import static org.floens.chan.utils.AndroidUtils.getString; import static org.floens.chan.utils.AndroidUtils.getString;
public class MainSettingsController extends SettingsController implements ToolbarMenuItem.ToolbarMenuItemCallback, WatchSettingsController.WatchSettingControllerListener, PassSettingsController.PassSettingControllerListener { public class MainSettingsController extends SettingsController implements ToolbarMenuItem.ToolbarMenuItemCallback, WatchSettingsController.WatchSettingControllerListener {
private static final int ADVANCED_SETTINGS = 1; private static final int ADVANCED_SETTINGS = 1;
private ListSettingView<ChanSettings.MediaAutoLoadMode> imageAutoLoadView; private ListSettingView<ChanSettings.MediaAutoLoadMode> imageAutoLoadView;
private ListSettingView<ChanSettings.MediaAutoLoadMode> videoAutoLoadView; private ListSettingView<ChanSettings.MediaAutoLoadMode> videoAutoLoadView;
private LinkSettingView saveLocation; private LinkSettingView saveLocation;
private LinkSettingView watchLink; private LinkSettingView watchLink;
private LinkSettingView passLink;
private int clickCount; private int clickCount;
private SettingView developerView; private SettingView developerView;
private SettingView fontView; private SettingView fontView;
@ -112,8 +110,6 @@ public class MainSettingsController extends SettingsController implements Toolba
populatePreferences(); populatePreferences();
onWatchEnabledChanged(ChanSettings.watchEnabled.get()); onWatchEnabledChanged(ChanSettings.watchEnabled.get());
// TODO(multi-site)
onPassEnabledChanged(Sites.defaultSite().isLoggedIn());
buildPreferences(); buildPreferences();
@ -188,11 +184,6 @@ public class MainSettingsController extends SettingsController implements Toolba
watchLink.setDescription(enabled ? R.string.setting_watch_summary_enabled : R.string.setting_watch_summary_disabled); watchLink.setDescription(enabled ? R.string.setting_watch_summary_enabled : R.string.setting_watch_summary_disabled);
} }
@Override
public void onPassEnabledChanged(boolean enabled) {
passLink.setDescription(enabled ? R.string.setting_pass_summary_enabled : R.string.setting_pass_summary_disabled);
}
private void populatePreferences() { private void populatePreferences() {
// General group // General group
SettingsGroup general = new SettingsGroup(R.string.settings_group_general); SettingsGroup general = new SettingsGroup(R.string.settings_group_general);
@ -319,13 +310,6 @@ public class MainSettingsController extends SettingsController implements Toolba
// Posting group // Posting group
SettingsGroup posting = new SettingsGroup(R.string.settings_group_posting); SettingsGroup posting = new SettingsGroup(R.string.settings_group_posting);
passLink = (LinkSettingView) posting.add(new LinkSettingView(this, R.string.settings_pass, 0, new View.OnClickListener() {
@Override
public void onClick(View v) {
navigationController.pushController(new PassSettingsController(context));
}
}));
posting.add(new BooleanSettingView(this, ChanSettings.postPinThread, R.string.setting_post_pin, 0)); posting.add(new BooleanSettingView(this, ChanSettings.postPinThread, R.string.setting_post_pin, 0));
posting.add(new StringSettingView(this, ChanSettings.postDefaultName, R.string.setting_post_default_name, R.string.setting_post_default_name)); posting.add(new StringSettingView(this, ChanSettings.postDefaultName, R.string.setting_post_default_name, R.string.setting_post_default_name));

@ -18,7 +18,6 @@
package org.floens.chan.ui.controller; package org.floens.chan.ui.controller;
import android.content.Context; import android.content.Context;
import android.view.View;
import org.floens.chan.R; import org.floens.chan.R;
import org.floens.chan.core.presenter.SiteSetupPresenter; import org.floens.chan.core.presenter.SiteSetupPresenter;
@ -37,6 +36,7 @@ public class SiteSetupController extends SettingsController implements SiteSetup
private Site site; private Site site;
private LinkSettingView boardsLink; private LinkSettingView boardsLink;
private LinkSettingView loginLink;
public SiteSetupController(Context context) { public SiteSetupController(Context context) {
super(context); super(context);
@ -84,6 +84,34 @@ public class SiteSetupController extends SettingsController implements SiteSetup
boardsLink.setDescription(descriptionText); boardsLink.setDescription(descriptionText);
} }
@Override
public void setIsLoggedIn(boolean isLoggedIn) {
String text = context.getString(isLoggedIn ?
R.string.setup_site_login_description_enabled :
R.string.setup_site_login_description_enabled);
loginLink.setDescription(text);
}
@Override
public void showLogin() {
SettingsGroup login = new SettingsGroup(R.string.setup_site_group_login);
loginLink = new LinkSettingView(
this,
context.getString(R.string.setup_site_login),
"",
v -> {
LoginController loginController = new LoginController(context);
loginController.setSite(site);
navigationController.pushController(loginController);
}
);
login.add(loginLink);
groups.add(login);
}
private void populatePreferences() { private void populatePreferences() {
SettingsGroup general = new SettingsGroup(R.string.setup_site_group_general); SettingsGroup general = new SettingsGroup(R.string.setup_site_group_general);
@ -91,13 +119,10 @@ public class SiteSetupController extends SettingsController implements SiteSetup
this, this,
context.getString(R.string.setup_site_boards), context.getString(R.string.setup_site_boards),
"", "",
new View.OnClickListener() { v -> {
@Override BoardSetupController boardSetupController = new BoardSetupController(context);
public void onClick(View v) { boardSetupController.setSite(site);
BoardSetupController boardSetupController = new BoardSetupController(context); navigationController.pushController(boardSetupController);
boardSetupController.setSite(site);
navigationController.pushController(boardSetupController);
}
}); });
general.add(boardsLink); general.add(boardsLink);

@ -21,7 +21,6 @@ package org.floens.chan.ui.controller;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.graphics.drawable.Drawable;
import android.support.design.widget.FloatingActionButton; import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
@ -228,13 +227,17 @@ public class SitesSetupController extends StyledToolbarNavigationController impl
public SiteCell(View itemView) { public SiteCell(View itemView) {
super(itemView); super(itemView);
// Bind views
image = itemView.findViewById(R.id.image); image = itemView.findViewById(R.id.image);
text = itemView.findViewById(R.id.text); text = itemView.findViewById(R.id.text);
description = itemView.findViewById(R.id.description); description = itemView.findViewById(R.id.description);
settings = itemView.findViewById(R.id.settings); settings = itemView.findViewById(R.id.settings);
// Setup views
itemView.setOnClickListener(this);
setRoundItemBackground(settings); setRoundItemBackground(settings);
theme().settingsDrawable.apply(settings); theme().settingsDrawable.apply(settings);
settings.setOnClickListener(this);
} }
private void setSite(Site site) { private void setSite(Site site) {
@ -243,19 +246,16 @@ public class SitesSetupController extends StyledToolbarNavigationController impl
private void setSiteIcon(Site site) { private void setSiteIcon(Site site) {
siteIcon = site.icon(); siteIcon = site.icon();
siteIcon.get(new SiteIcon.SiteIconResult() { siteIcon.get((siteIcon, icon) -> {
@Override if (SiteCell.this.siteIcon == siteIcon) {
public void onSiteIcon(SiteIcon siteIcon, Drawable icon) { image.setImageDrawable(icon);
if (SiteCell.this.siteIcon == siteIcon) {
image.setImageDrawable(icon);
}
} }
}); });
} }
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (v == settings) { if (v == itemView) {
onSiteCellSettingsClicked(site); onSiteCellSettingsClicked(site);
} }
} }

@ -253,29 +253,6 @@ public class ReplyLayout extends LoadView implements View.OnClickListener, Reply
return true; return true;
} }
@Override
public void setPage(ReplyPresenter.Page page, boolean animate) {
switch (page) {
case LOADING:
setWrap(true);
View progressBar = setView(null);
progressBar.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, dp(100)));
break;
case INPUT:
setView(replyInputLayout);
setWrap(!presenter.isExpanded());
break;
case AUTHENTICATION:
setWrap(false);
setView(captchaContainer);
captchaContainer.requestFocus(View.FOCUS_DOWN);
break;
}
}
@Override @Override
public void initializeAuthentication(Site site, Authentication authentication, public void initializeAuthentication(Site site, Authentication authentication,
AuthenticationLayoutCallback callback) { AuthenticationLayoutCallback callback) {
@ -292,7 +269,16 @@ public class ReplyLayout extends LoadView implements View.OnClickListener, Reply
break; break;
} }
case GENERIC_WEBVIEW: { case GENERIC_WEBVIEW: {
authenticationLayout = new GenericWebViewAuthenticationLayout(getContext()); GenericWebViewAuthenticationLayout view = new GenericWebViewAuthenticationLayout(getContext());
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
LayoutParams.MATCH_PARENT,
LayoutParams.MATCH_PARENT
);
// params.setMargins(dp(8), dp(8), dp(8), dp(200));
view.setLayoutParams(params);
authenticationLayout = view;
break; break;
} }
case NONE: case NONE:
@ -312,6 +298,34 @@ public class ReplyLayout extends LoadView implements View.OnClickListener, Reply
authenticationLayout.reset(); authenticationLayout.reset();
} }
@Override
public void setPage(ReplyPresenter.Page page, boolean animate) {
switch (page) {
case LOADING:
setWrap(true);
View progressBar = setView(null);
progressBar.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, dp(100)));
break;
case INPUT:
setView(replyInputLayout);
setWrap(!presenter.isExpanded());
break;
case AUTHENTICATION:
setWrap(false);
setView(captchaContainer);
captchaContainer.requestFocus(View.FOCUS_DOWN);
break;
}
if (page != ReplyPresenter.Page.AUTHENTICATION && authenticationLayout != null) {
AndroidUtils.removeFromParentView((View) authenticationLayout);
authenticationLayout = null;
}
}
@Override @Override
public void resetAuthentication() { public void resetAuthentication() {
authenticationLayout.reset(); authenticationLayout.reset();

@ -179,6 +179,11 @@ Re-enable this permission in the app settings if you permanently disabled it."</
<string name="setup_site_boards">Setup boards</string> <string name="setup_site_boards">Setup boards</string>
<string name="setup_site_boards_description">%s added</string> <string name="setup_site_boards_description">%s added</string>
<string name="setup_site_group_login">Authentication</string>
<string name="setup_site_login">Login</string>
<string name="setup_site_login_description_enabled">Logged in</string>
<string name="setup_site_login_description_disabled">Off</string>
<string name="setup_board_title">Configure boards of %s</string> <string name="setup_board_title">Configure boards of %s</string>
<string name="setup_board_add">Add board</string> <string name="setup_board_add">Add board</string>
<string name="setup_board_removed">Removed \'%s\'</string> <string name="setup_board_removed">Removed \'%s\'</string>
@ -501,8 +506,6 @@ Re-enable this permission in the app settings if you permanently disabled it."</
<a href=\"https://www.4chan.org/pass\">Click here to learn more.</a> <a href=\"https://www.4chan.org/pass\">Click here to learn more.</a>
]]> ]]>
"</string> "</string>
<string name="setting_pass_summary_enabled">Using 4chan pass</string>
<string name="setting_pass_summary_disabled">Off</string>
<string name="settings_screen_theme">Themes</string> <string name="settings_screen_theme">Themes</string>
</resources> </resources>

Loading…
Cancel
Save