Minor fixes

dev
k1rakishou 6 years ago
parent d8aef6e333
commit 1109120061
  1. 5
      Clover/app/src/main/java/org/floens/chan/core/presenter/ReplyPresenter.java
  2. 50
      Clover/app/src/main/java/org/floens/chan/ui/view/WrappingGridView.java
  3. 7
      Clover/app/src/main/java/org/floens/chan/utils/BackgroundUtils.java
  4. 7
      Clover/app/src/main/res/values/strings.xml

@ -394,6 +394,7 @@ public class ReplyPresenter implements AuthenticationLayoutCallback, ImagePickDe
callback.openSpoiler(false, false);
callback.openPreview(false, null);
callback.openPreviewMessage(false, null);
callback.destroyCurrentAuthentication();
}
private void makeSubmitCall() {
@ -419,7 +420,9 @@ public class ReplyPresenter implements AuthenticationLayoutCallback, ImagePickDe
case AUTHENTICATION:
SiteAuthentication authentication = loadable.site.actions().postAuthenticate();
callback.initializeAuthentication(loadable.site, authentication, this);
// cleanup resources tied to the new captcha layout/presenter
callback.destroyCurrentAuthentication();
callback.initializeAuthentication(loadable.site, authentication, this, useV2NoJsCaptcha);
callback.setPage(Page.AUTHENTICATION, true);
break;

@ -0,0 +1,50 @@
/*
* Clover - 4chan browser https://github.com/Floens/Clover/
* Copyright (C) 2014 Floens
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.floens.chan.ui.view;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.GridView;
public class WrappingGridView extends GridView {
public WrappingGridView(Context context) {
super(context);
}
public WrappingGridView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public WrappingGridView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int heightSpec = heightMeasureSpec;
if (getLayoutParams().height == ViewGroup.LayoutParams.WRAP_CONTENT) {
heightSpec = View.MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, View.MeasureSpec.AT_MOST);
}
super.onMeasure(widthMeasureSpec, heightSpec);
}
}

@ -17,11 +17,18 @@
*/
package org.floens.chan.utils;
import android.os.Looper;
import java.util.concurrent.Callable;
import java.util.concurrent.Executor;
import java.util.concurrent.atomic.AtomicBoolean;
public class BackgroundUtils {
public static boolean isMainThread() {
return Thread.currentThread() == Looper.getMainLooper().getThread();
}
public static <T> Cancelable runWithExecutor(Executor executor, final Callable<T> background,
final BackgroundResult<T> result) {
final AtomicBoolean cancelled = new AtomicBoolean(false);

@ -577,4 +577,11 @@ Don't have a 4chan Pass?<br>
"</string>
<string name="settings_screen_theme">Themes</string>
<string name="captcha_layout_v2_verify_button_text" tools:ignore="MissingTranslation">Verify</string>
<string name="captcha_layout_v2_reload" tools:ignore="MissingTranslation">Reload</string>
<string name="captcha_layout_v2_use_old_captcha" tools:ignore="MissingTranslation">Use old captcha</string>
<string name="captcha_layout_v2_you_have_to_select_at_least_one_image" tools:ignore="MissingTranslation">You have to selected at least one image (if you see a captcha that does not have any matching images then it is probably a bug fill an issue and use old captcha for a while)</string>
<string name="captcha_layout_v2_verification_already_in_progress" tools:ignore="MissingTranslation">Verification is already in progress</string>
<string name="captcha_layout_v2_captcha_request_is_already_in_progress" tools:ignore="MissingTranslation">Captcha request is already in progress</string>
<string name="captcha_layout_v2_you_are_requesting_captcha_too_fast" translatable="false">You are requesting captcha too fast</string>
</resources>

Loading…
Cancel
Save