Skip to content
This repository was archived by the owner on Jul 25, 2024. It is now read-only.

Commit 703b0c7

Browse files
committed
Rename hideFABBlocked to make it more clear and stop recyclerView scroll on FAB button press
1 parent edecb88 commit 703b0c7

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

app/src/main/java/com/zulip/android/activities/MessageListFragment.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,10 @@ public void onMessageError(LoadPosition pos) {
431431
// successful
432432
}
433433

434+
public void stopRecyclerViewScroll() {
435+
recyclerView.stopScroll();
436+
}
437+
434438
private void loadMoreMessages(final LoadPosition pos) {
435439
int above = 0;
436440
int below = 0;

app/src/main/java/com/zulip/android/activities/ZulipActivity.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public class ZulipActivity extends AppCompatActivity implements
124124
private LinearLayout chatBox;
125125
public FloatingActionButton fab;
126126
private CountDownTimer fabHidder;
127-
private boolean hideFABBlocked = false;
127+
private boolean isTextFieldFocused = false;
128128
private static final int HIDE_FAB_AFTER_SEC = 5;
129129

130130
private HashMap<String, Bitmap> gravatars = new HashMap<>();
@@ -238,8 +238,9 @@ public void muteTopic(Message message) {
238238

239239
@Override
240240
public void recyclerViewScrolled() {
241-
if (chatBox.getVisibility() == View.VISIBLE && hideFABBlocked) {
241+
if (chatBox.getVisibility() == View.VISIBLE && !isTextFieldFocused) {
242242
displayChatBox(false);
243+
displayFAB(true);
243244
}
244245
}
245246

@@ -416,7 +417,7 @@ public void onClick(View v) {
416417
View.OnFocusChangeListener focusChangeListener = new View.OnFocusChangeListener() {
417418
@Override
418419
public void onFocusChange(View view, boolean focus) {
419-
hideFABBlocked = focus;
420+
isTextFieldFocused = focus;
420421
}
421422
};
422423
messageEt.setOnFocusChangeListener(focusChangeListener);
@@ -528,13 +529,14 @@ private Cursor makePeopleNameCursor(CharSequence name) throws SQLException {
528529

529530
private void setupFab() {
530531
fab = (FloatingActionButton) findViewById(R.id.fab);
531-
chatBox = (LinearLayout) findViewById(R.id.messageBoxContainer);
532+
chatBox = (SwipeRemoveLinearLayout) findViewById(R.id.messageBoxContainer);
533+
chatBox.registerToSwipeEvents(this);
532534
fabHidder = new CountDownTimer(HIDE_FAB_AFTER_SEC * 1000, HIDE_FAB_AFTER_SEC * 1000) {
533535
public void onTick(long millisUntilFinished) {
534536
}
535537

536538
public void onFinish() {
537-
if (!hideFABBlocked) {
539+
if (!isTextFieldFocused) {
538540
displayFAB(true);
539541
displayChatBox(false);
540542
} else {
@@ -545,6 +547,7 @@ public void onFinish() {
545547
fab.setOnClickListener(new View.OnClickListener() {
546548
@Override
547549
public void onClick(View view) {
550+
currentList.stopRecyclerViewScroll();
548551
displayChatBox(true);
549552
displayFAB(false);
550553
fabHidder.start();

0 commit comments

Comments
 (0)