mirror of https://github.com/M66B/FairEmail.git
Fixed disabling swipe refresh
This commit is contained in:
parent
50bcc79a0d
commit
6ff3264e63
|
@ -167,6 +167,7 @@ public class FragmentMessages extends FragmentBase {
|
||||||
private boolean loading = false;
|
private boolean loading = false;
|
||||||
private boolean manual = false;
|
private boolean manual = false;
|
||||||
private Integer lastUnseen = null;
|
private Integer lastUnseen = null;
|
||||||
|
private boolean swiping = false;
|
||||||
|
|
||||||
private AdapterMessage adapter;
|
private AdapterMessage adapter;
|
||||||
|
|
||||||
|
@ -443,7 +444,7 @@ public class FragmentMessages extends FragmentBase {
|
||||||
viewType, compact, zoom, sort, filter_duplicates, iProperties);
|
viewType, compact, zoom, sort, filter_duplicates, iProperties);
|
||||||
|
|
||||||
rvMessage.setAdapter(adapter);
|
rvMessage.setAdapter(adapter);
|
||||||
|
/*
|
||||||
rvMessage.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
rvMessage.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onScrolled(@NonNull RecyclerView rv, int dx, int dy) {
|
public void onScrolled(@NonNull RecyclerView rv, int dx, int dy) {
|
||||||
|
@ -451,7 +452,7 @@ public class FragmentMessages extends FragmentBase {
|
||||||
swipeRefresh.setEnabled(pull && pos >= 0);
|
swipeRefresh.setEnabled(pull && pos >= 0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
seekBar.setOnTouchListener(new View.OnTouchListener() {
|
seekBar.setOnTouchListener(new View.OnTouchListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouch(View v, MotionEvent event) {
|
public boolean onTouch(View v, MotionEvent event) {
|
||||||
|
@ -635,7 +636,6 @@ public class FragmentMessages extends FragmentBase {
|
||||||
addBackPressedListener(onBackPressedListener);
|
addBackPressedListener(onBackPressedListener);
|
||||||
|
|
||||||
// Initialize
|
// Initialize
|
||||||
swipeRefresh.setEnabled(pull);
|
|
||||||
tvNoEmail.setVisibility(View.GONE);
|
tvNoEmail.setVisibility(View.GONE);
|
||||||
seekBar.setVisibility(View.GONE);
|
seekBar.setVisibility(View.GONE);
|
||||||
ibDown.setVisibility(View.GONE);
|
ibDown.setVisibility(View.GONE);
|
||||||
|
@ -749,17 +749,17 @@ public class FragmentMessages extends FragmentBase {
|
||||||
if (activity != null)
|
if (activity != null)
|
||||||
activity.invalidateOptionsMenu();
|
activity.invalidateOptionsMenu();
|
||||||
|
|
||||||
if (selectionTracker != null && selectionTracker.hasSelection()) {
|
if (selectionTracker != null && selectionTracker.hasSelection())
|
||||||
swipeRefresh.setEnabled(false);
|
|
||||||
fabMore.show();
|
fabMore.show();
|
||||||
} else {
|
else
|
||||||
fabMore.hide();
|
fabMore.hide();
|
||||||
swipeRefresh.setEnabled(pull);
|
updateSwipeRefresh();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateSwipeRefresh();
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -768,6 +768,10 @@ public class FragmentMessages extends FragmentBase {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateSwipeRefresh() {
|
||||||
|
swipeRefresh.setEnabled(pull && !swiping && selectionTracker == null || !selectionTracker.hasSelection());
|
||||||
|
}
|
||||||
|
|
||||||
private void scrollToVisibleItem(LinearLayoutManager llm, boolean bottom) {
|
private void scrollToVisibleItem(LinearLayoutManager llm, boolean bottom) {
|
||||||
int pos = llm.findLastVisibleItemPosition();
|
int pos = llm.findLastVisibleItemPosition();
|
||||||
if (pos == RecyclerView.NO_POSITION)
|
if (pos == RecyclerView.NO_POSITION)
|
||||||
|
@ -1099,7 +1103,8 @@ public class FragmentMessages extends FragmentBase {
|
||||||
@Override
|
@Override
|
||||||
public void onSelectedChanged(@Nullable RecyclerView.ViewHolder viewHolder, int actionState) {
|
public void onSelectedChanged(@Nullable RecyclerView.ViewHolder viewHolder, int actionState) {
|
||||||
super.onSelectedChanged(viewHolder, actionState);
|
super.onSelectedChanged(viewHolder, actionState);
|
||||||
swipeRefresh.setEnabled(pull && actionState != ItemTouchHelper.ACTION_STATE_SWIPE);
|
swiping = (actionState == ItemTouchHelper.ACTION_STATE_SWIPE);
|
||||||
|
updateSwipeRefresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue