From 82d7555eeed2f9147b8e4cec558ed73d38a29c2e Mon Sep 17 00:00:00 2001 From: Ammar Githam Date: Tue, 6 Jul 2021 06:50:18 +0900 Subject: [PATCH] Change input setup flow. Fixes austinhuang0131/barinsta#1529 --- .../directmessages/DirectMessageThreadFragment.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageThreadFragment.java b/app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageThreadFragment.java index fe274d57..5c74e2a8 100644 --- a/app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageThreadFragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageThreadFragment.java @@ -586,7 +586,6 @@ public class DirectMessageThreadFragment extends Fragment implements DirectReact if (getArguments() == null) return; actionBar = fragmentActivity.getSupportActionBar(); setupList(); - root.post(this::setupInput); } private void setupList() { @@ -642,10 +641,11 @@ public class DirectMessageThreadFragment extends Fragment implements DirectReact inputModeLiveData.observe(getViewLifecycleOwner(), inputMode -> { final Boolean isPending = viewModel.isPending().getValue(); if (isPending != null && isPending || inputMode == null) return; - if (inputMode != 1) { + setupInput(inputMode); + if (inputMode == 0) { setupTouchHelper(); + return; } - if (inputMode == 0) return; if (inputMode == 1) { hideInput(); } @@ -1052,8 +1052,7 @@ public class DirectMessageThreadFragment extends Fragment implements DirectReact }); } - private void setupInput() { - final Integer inputMode = viewModel.getInputMode().getValue(); + private void setupInput(@Nullable final Integer inputMode) { if (inputMode != null && inputMode == 1) return; final Context context = getContext(); if (context == null) return;