Fixed missing compose/answer button

pull/208/head
M66B 3 years ago
parent 8d7ee2d0d2
commit 5c5792b9b1

@ -950,6 +950,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
}
});
itemView.addOnLayoutChangeListener(this);
ibAvatar.setOnClickListener(this);
ibVerified.setOnClickListener(this);
ibAuth.setOnClickListener(this);
@ -1063,6 +1064,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
final View touch = (viewType == ViewType.THREAD ? ibExpander : header);
touch.setOnClickListener(null);
itemView.removeOnLayoutChangeListener(this);
ibAvatar.setOnClickListener(null);
ibVerified.setOnClickListener(null);
ibAuth.setOnClickListener(null);
@ -3782,6 +3784,11 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
@Override
public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
if (itemView.getId() == v.getId()) {
properties.layoutChanged();
return;
}
TupleMessageEx message = getMessage();
if (message != null) {
int h = bottom - top;
@ -7971,6 +7978,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
void lock(long id);
void layoutChanged();
void refresh();
void finish();

@ -753,6 +753,16 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
Log.w(ex);
}
}
@Override
public void onItemsAdded(@NonNull RecyclerView recyclerView, int positionStart, int itemCount) {
iProperties.layoutChanged();
}
@Override
public void onItemsRemoved(@NonNull RecyclerView recyclerView, int positionStart, int itemCount) {
iProperties.layoutChanged();
}
};
rvMessage.setLayoutManager(llm);
@ -1005,16 +1015,10 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override
public void onScrolled(@NonNull RecyclerView rv, int dx, int dy) {
if (dy != 0) {
boolean down = (dy > 0 && rv.canScrollVertically(RecyclerView.FOCUS_DOWN));
boolean down = (dy > 0 && rv.canScrollVertically(1));
if (scrolling != down) {
scrolling = down;
if (!accessibility &&
(viewType == AdapterMessage.ViewType.UNIFIED ||
viewType == AdapterMessage.ViewType.FOLDER))
if (down)
fabCompose.hide();
else
fabCompose.show();
updateCompose();
updateExpanded();
}
}
@ -2126,11 +2130,6 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
}
});
}
if ("headers".equals(name)) {
scrolling = false;
updateExpanded();
}
}
@Override
@ -2210,9 +2209,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
}
}
if (value)
scrolling = false;
scrolling = false;
updateExpanded();
if (value)
handleExpand(message.id);
@ -2412,6 +2409,24 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
}.execute(FragmentMessages.this, args, "message:lock");
}
@Override
public void layoutChanged() {
rvMessage.post(new Runnable() {
@Override
public void run() {
try {
if (scrolling && !rvMessage.canScrollVertically(-1)) {
scrolling = false;
updateCompose();
updateExpanded();
}
} catch (Throwable ex) {
Log.e(ex);
}
}
});
}
@Override
public void refresh() {
rvMessage.post(new Runnable() {
@ -4437,7 +4452,6 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
positions.remove(id);
attachments.remove(id);
}
updateExpanded();
}
}
});
@ -6570,6 +6584,16 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
return false;
}
private void updateCompose() {
if (!accessibility &&
(viewType == AdapterMessage.ViewType.UNIFIED ||
viewType == AdapterMessage.ViewType.FOLDER))
if (scrolling)
fabCompose.hide();
else
fabCompose.show();
}
private void updateExpanded() {
if (!getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
return;

Loading…
Cancel
Save