Fix hide all tab

This commit is contained in:
NekoInverter 2021-01-06 12:52:33 +08:00 committed by 世界
parent 47e7c21f5d
commit 424fe8e585
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4
2 changed files with 8 additions and 3 deletions

View File

@ -1412,6 +1412,11 @@ public class FilterTabsView extends FrameLayout {
int idx1 = fromIndex - 1;
int idx2 = toIndex - 1;
int count = tabs.size() - 1;
if (NekoConfig.hideAllTab) {
idx1++;
idx2++;
count++;
}
if (idx1 < 0 || idx2 < 0 || idx1 >= count || idx2 >= count) {
return;
}
@ -1474,7 +1479,7 @@ public class FilterTabsView extends FrameLayout {
@Override
public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
if (!isEditing || viewHolder.getAdapterPosition() == 0) {
if (!isEditing || (!NekoConfig.hideAllTab && viewHolder.getAdapterPosition() == 0)) {
return makeMovementFlags(0, 0);
}
return makeMovementFlags(ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT, 0);
@ -1482,7 +1487,7 @@ public class FilterTabsView extends FrameLayout {
@Override
public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder source, RecyclerView.ViewHolder target) {
if (source.getAdapterPosition() == 0 || target.getAdapterPosition() == 0) {
if (!NekoConfig.hideAllTab && (source.getAdapterPosition() == 0 || target.getAdapterPosition() == 0)) {
return false;
}
adapter.swapElements(source.getAdapterPosition(), target.getAdapterPosition());

View File

@ -3509,7 +3509,7 @@ private int lastMeasuredTopPadding;
}
}
id = filterTabsView.getCurrentTabId();
boolean updateCurrentTab = false;
boolean updateCurrentTab = NekoConfig.hideAllTab;
if (id >= 0) {
if (viewPages[0].selectedType != id) {
updateCurrentTab = true;