Merge remote-tracking branch 'origin/master'

This commit is contained in:
zlzw 2022-10-06 18:12:39 +08:00
commit f10316bf57
2 changed files with 11 additions and 1 deletions

View File

@ -389,7 +389,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
* @param recyclerView * @param recyclerView
* @return * @return
*/ */
public static boolean isSlideToBottom(RecyclerView recyclerView) { public boolean isSlideToBottom(RecyclerView recyclerView) {
if (recyclerView == null) return false; if (recyclerView == null) return false;
if (recyclerView.computeVerticalScrollExtent() + recyclerView.computeVerticalScrollOffset() if (recyclerView.computeVerticalScrollExtent() + recyclerView.computeVerticalScrollOffset()
>= recyclerView.computeVerticalScrollRange()) >= recyclerView.computeVerticalScrollRange())

View File

@ -31,6 +31,7 @@ import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import android.widget.ViewFlipper; import android.widget.ViewFlipper;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout; import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
@ -826,6 +827,15 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
} }
}); });
mChatRecyclerView.setAdapter(mLiveChatAdapter); mChatRecyclerView.setAdapter(mLiveChatAdapter);
mChatRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
if (mLiveChatAdapter.isSlideToBottom(recyclerView)) {
newMessage.setVisibility(View.GONE);
}
}
});
mBtnFollow.setOnClickListener(this); mBtnFollow.setOnClickListener(this);
mViewMedal.setOnClickListener(this); mViewMedal.setOnClickListener(this);
findViewById(R.id.btn_close).setOnClickListener(this); findViewById(R.id.btn_close).setOnClickListener(this);