Fix over scroll effect
This commit is contained in:
parent
5502e32815
commit
adf339deaa
|
|
@ -30,7 +30,7 @@ public class AboutActivity extends BaseActivity {
|
|||
if (bar != null) {
|
||||
bar.setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
setupWindowInsets(binding.snackbar, binding.nestedScrollView);
|
||||
setupWindowInsets(binding.snackbar, null);
|
||||
|
||||
String packageName = getPackageName();
|
||||
String translator = getResources().getString(R.string.translator);
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public class MainActivity extends BaseActivity implements RepoLoader.RepoListene
|
|||
binding.downloads.setElevation(12);
|
||||
}
|
||||
});
|
||||
setupWindowInsets(binding.snackbar, binding.nestedScrollView);
|
||||
setupWindowInsets(binding.snackbar, null);
|
||||
repoLoader = RepoLoader.getInstance();
|
||||
ModuleUtil.getInstance().addListener(this);
|
||||
repoLoader.addListener(this, false);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ import androidx.annotation.NonNull;
|
|||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreferenceCompat;
|
||||
|
||||
|
|
@ -74,7 +73,6 @@ public class SettingsActivity extends BaseActivity {
|
|||
getSupportFragmentManager().beginTransaction()
|
||||
.add(R.id.container, new SettingsFragment()).commit();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void restart() {
|
||||
|
|
@ -628,12 +626,6 @@ public class SettingsActivity extends BaseActivity {
|
|||
((LinearLayout) view).setClipChildren(false);
|
||||
((FrameLayout) getListView().getParent()).setClipChildren(false);
|
||||
((FrameLayout) getListView().getParent()).setClipToPadding(false);
|
||||
ViewCompat.setOnApplyWindowInsetsListener(view, (v, insets) -> {
|
||||
if (insets.getTappableElementInsets().bottom != insets.getSystemWindowInsetBottom()) {
|
||||
getListView().setPadding(0, 0, 0, insets.getSystemWindowInsetBottom());
|
||||
}
|
||||
return insets;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,81 @@
|
|||
package org.meowcat.edxposed.manager.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.EdgeEffect;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
public class RecyclerViewBugFixed extends RecyclerView {
|
||||
|
||||
|
||||
public RecyclerViewBugFixed(@NonNull Context context) {
|
||||
super(context);
|
||||
setEdgeEffectFactory(getClipToPadding() ? new EdgeEffectFactory() : new AlwaysClipToPaddingEdgeEffectFactory());
|
||||
}
|
||||
|
||||
public RecyclerViewBugFixed(@NonNull Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
setEdgeEffectFactory(getClipToPadding() ? new EdgeEffectFactory() : new AlwaysClipToPaddingEdgeEffectFactory());
|
||||
}
|
||||
|
||||
public RecyclerViewBugFixed(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
setEdgeEffectFactory(getClipToPadding() ? new EdgeEffectFactory() : new AlwaysClipToPaddingEdgeEffectFactory());
|
||||
}
|
||||
|
||||
public static class AlwaysClipToPaddingEdgeEffectFactory extends RecyclerView.EdgeEffectFactory {
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
protected EdgeEffect createEdgeEffect(@NonNull RecyclerView view, int direction) {
|
||||
return new EdgeEffect(view.getContext()) {
|
||||
private boolean ensureSize = false;
|
||||
|
||||
private void ensureSize() {
|
||||
if (ensureSize) return;
|
||||
ensureSize = true;
|
||||
switch (direction) {
|
||||
case DIRECTION_LEFT:
|
||||
case DIRECTION_RIGHT:
|
||||
setSize(view.getMeasuredHeight() - view.getPaddingTop() - view.getPaddingBottom(),
|
||||
view.getMeasuredWidth() - view.getPaddingLeft() - view.getPaddingRight());
|
||||
break;
|
||||
case DIRECTION_TOP:
|
||||
case DIRECTION_BOTTOM:
|
||||
setSize(view.getMeasuredWidth() - view.getPaddingLeft() - view.getPaddingRight(),
|
||||
view.getMeasuredHeight() - view.getPaddingTop() - view.getPaddingBottom());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean draw(Canvas c) {
|
||||
ensureSize();
|
||||
|
||||
int restore = c.save();
|
||||
switch (direction) {
|
||||
case DIRECTION_LEFT:
|
||||
c.translate(view.getPaddingBottom(), 0f);
|
||||
break;
|
||||
case DIRECTION_TOP:
|
||||
c.translate(view.getPaddingLeft(), view.getPaddingTop());
|
||||
break;
|
||||
case DIRECTION_RIGHT:
|
||||
c.translate(-view.getPaddingTop(), 0f);
|
||||
break;
|
||||
case DIRECTION_BOTTOM:
|
||||
c.translate(view.getPaddingRight(), view.getPaddingBottom());
|
||||
break;
|
||||
}
|
||||
boolean res = super.draw(c);
|
||||
c.restoreToCount(restore);
|
||||
return res;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
android:orientation="vertical"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
<org.meowcat.edxposed.manager.widget.RecyclerViewBugFixed
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
android:orientation="vertical"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
<org.meowcat.edxposed.manager.widget.RecyclerViewBugFixed
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
android:clipToPadding="false"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
<org.meowcat.edxposed.manager.widget.RecyclerViewBugFixed
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
android:orientation="vertical"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
<org.meowcat.edxposed.manager.widget.RecyclerViewBugFixed
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
android:orientation="vertical"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
<org.meowcat.edxposed.manager.widget.RecyclerViewBugFixed
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
android:clipChildren="false"
|
||||
android:clipToPadding="false">
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
|||
Loading…
Reference in New Issue