mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-22 06:37:30 +00:00
Fix tapping search input not showing keyboard the first time
This commit is contained in:
parent
67b8bd9a2f
commit
6df5bc056c
@ -22,7 +22,6 @@ import androidx.navigation.fragment.NavHostFragment;
|
||||
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.google.android.material.tabs.TabLayoutMediator;
|
||||
import com.google.android.material.textfield.TextInputLayout;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@ -45,8 +44,6 @@ public class SearchFragment extends Fragment implements SearchCategoryFragment.O
|
||||
private LinearLayoutCompat root;
|
||||
private boolean shouldRefresh = true;
|
||||
@Nullable
|
||||
private TextInputLayout searchInputLayout;
|
||||
@Nullable
|
||||
private EditText searchInput;
|
||||
@Nullable
|
||||
private MainActivity mainActivity;
|
||||
@ -122,15 +119,14 @@ public class SearchFragment extends Fragment implements SearchCategoryFragment.O
|
||||
if (mainActivity != null) {
|
||||
mainActivity.showSearchView();
|
||||
}
|
||||
if (searchInputLayout != null) {
|
||||
searchInputLayout.requestFocus();
|
||||
}
|
||||
// if (searchInputLayout != null) {
|
||||
// searchInputLayout.requestFocus();
|
||||
// }
|
||||
}
|
||||
|
||||
private void init(@Nullable final Bundle savedInstanceState) {
|
||||
if (mainActivity == null) return;
|
||||
searchInputLayout = mainActivity.showSearchView();
|
||||
searchInput = searchInputLayout.getEditText();
|
||||
searchInput = mainActivity.showSearchView().getEditText();
|
||||
setupObservers();
|
||||
setupViewPager();
|
||||
setupSearchInput(savedInstanceState);
|
||||
@ -151,7 +147,7 @@ public class SearchFragment extends Fragment implements SearchCategoryFragment.O
|
||||
searchInput.setText(savedQuery);
|
||||
triggerEmptyQuery = false;
|
||||
}
|
||||
searchInput.requestFocus();
|
||||
// searchInput.requestFocus();
|
||||
if (triggerEmptyQuery) {
|
||||
viewModel.submitQuery("");
|
||||
}
|
||||
@ -235,7 +231,7 @@ public class SearchFragment extends Fragment implements SearchCategoryFragment.O
|
||||
liveData.removeObserver(this);
|
||||
break;
|
||||
case ERROR:
|
||||
Snackbar.make(binding.getRoot(), R.string.error, Snackbar.LENGTH_SHORT);
|
||||
Snackbar.make(binding.getRoot(), R.string.error, Snackbar.LENGTH_SHORT).show();
|
||||
liveData.removeObserver(this);
|
||||
break;
|
||||
case LOADING:
|
||||
|
Loading…
Reference in New Issue
Block a user