fix fab being hidden when scrolling to top
closes sk22#528
This commit is contained in:
parent
6684311ec5
commit
056bfaacfe
|
@ -16,7 +16,6 @@ import android.text.TextPaint;
|
|||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.WindowInsets;
|
||||
import android.view.animation.TranslateAnimation;
|
||||
import android.widget.ImageButton;
|
||||
|
@ -95,7 +94,6 @@ public abstract class BaseStatusListFragment<T extends DisplayItemsParent> exten
|
|||
@Override
|
||||
public void onCreate(Bundle savedInstanceState){
|
||||
super.onCreate(savedInstanceState);
|
||||
UiUtils.loadMaxWidth(getContext());
|
||||
if(GlobalUserPreferences.disableMarquee){
|
||||
setTitleMarqueeEnabled(false);
|
||||
setSubtitleMarqueeEnabled(false);
|
||||
|
@ -319,7 +317,7 @@ public abstract class BaseStatusListFragment<T extends DisplayItemsParent> exten
|
|||
currentPhotoViewer.offsetView(-dx, -dy);
|
||||
|
||||
View fab = getFab();
|
||||
if (fab!=null && GlobalUserPreferences.autoHideFab) {
|
||||
if (fab!=null && GlobalUserPreferences.autoHideFab && dy != UiUtils.SCROLL_TO_TOP_DELTA) {
|
||||
if (dy > 0 && fab.getVisibility() == View.VISIBLE) {
|
||||
hideFab();
|
||||
} else if (dy < 0 && fab.getVisibility() != View.VISIBLE) {
|
||||
|
|
|
@ -3,7 +3,8 @@ package org.joinmastodon.android.fragments;
|
|||
import android.view.ViewTreeObserver;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import me.grishka.appkit.utils.V;
|
||||
|
||||
import org.joinmastodon.android.ui.utils.UiUtils;
|
||||
|
||||
public interface ScrollableToTop{
|
||||
void scrollToTop();
|
||||
|
@ -21,7 +22,7 @@ public interface ScrollableToTop{
|
|||
@Override
|
||||
public boolean onPreDraw(){
|
||||
list.getViewTreeObserver().removeOnPreDrawListener(this);
|
||||
list.scrollBy(0, V.dp(300));
|
||||
list.scrollBy(0, UiUtils.SCROLL_TO_TOP_DELTA);
|
||||
list.smoothScrollToPosition(0);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -65,7 +65,6 @@ public class TextStatusDisplayItem extends StatusDisplayItem{
|
|||
spoilerEmojiHelper.setText(parsedSpoilerText);
|
||||
}
|
||||
session = AccountSessionManager.getInstance().getAccount(parentFragment.getAccountID());
|
||||
UiUtils.loadMaxWidth(parentFragment.getContext());
|
||||
}
|
||||
|
||||
public void setTranslationShown(boolean translationShown) {
|
||||
|
|
|
@ -17,6 +17,7 @@ import android.content.DialogInterface;
|
|||
import android.content.Intent;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.Bitmap;
|
||||
|
@ -141,15 +142,11 @@ public class UiUtils {
|
|||
private static Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||
private static final DateTimeFormatter DATE_FORMATTER_SHORT_WITH_YEAR = DateTimeFormatter.ofPattern("d MMM uuuu"), DATE_FORMATTER_SHORT = DateTimeFormatter.ofPattern("d MMM");
|
||||
public static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.LONG, FormatStyle.SHORT);
|
||||
public static int MAX_WIDTH;
|
||||
public static int MAX_WIDTH, SCROLL_TO_TOP_DELTA;
|
||||
|
||||
private UiUtils() {
|
||||
}
|
||||
|
||||
public static void loadMaxWidth(Context ctx) {
|
||||
if (MAX_WIDTH == 0) MAX_WIDTH = (int) ctx.getResources().getDimension(R.dimen.layout_max_width);
|
||||
}
|
||||
|
||||
public static void launchWebBrowser(Context context, String url) {
|
||||
try {
|
||||
if (GlobalUserPreferences.useCustomTabs) {
|
||||
|
@ -898,6 +895,10 @@ public class UiUtils {
|
|||
|
||||
ColorPalette palette = ColorPalette.palettes.get(GlobalUserPreferences.color);
|
||||
if (palette != null) palette.apply(context);
|
||||
|
||||
Resources res = context.getResources();
|
||||
MAX_WIDTH = (int) res.getDimension(R.dimen.layout_max_width);
|
||||
SCROLL_TO_TOP_DELTA = (int) res.getDimension(R.dimen.scroll_to_top_delta);
|
||||
}
|
||||
|
||||
public static boolean isDarkTheme() {
|
||||
|
|
|
@ -23,7 +23,6 @@ public class ComposeMediaLayout extends ViewGroup{
|
|||
|
||||
public ComposeMediaLayout(Context context, AttributeSet attrs, int defStyle){
|
||||
super(context, attrs, defStyle);
|
||||
UiUtils.loadMaxWidth(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -27,7 +27,6 @@ public class MediaGridLayout extends ViewGroup{
|
|||
|
||||
public MediaGridLayout(Context context, AttributeSet attrs, int defStyle){
|
||||
super(context, attrs, defStyle);
|
||||
UiUtils.loadMaxWidth(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,4 +3,5 @@
|
|||
<dimen name="text_max_height">220dp</dimen>
|
||||
<dimen name="text_collapsed_height">145dp</dimen>
|
||||
<dimen name="layout_max_width">450dp</dimen>
|
||||
<dimen name="scroll_to_top_delta">300dp</dimen>
|
||||
</resources>
|
Loading…
Reference in New Issue