diff options
author | Thomas <tschneider.ac@gmail.com> | 2022-07-18 15:28:23 +0200 |
---|---|---|
committer | Thomas <tschneider.ac@gmail.com> | 2022-07-18 15:28:23 +0200 |
commit | 17f727fd9f058fbf4be20836f80f27d256451d04 (patch) | |
tree | 8d0d1e4780964edca18d3c624602c74ca5f7457c /app | |
parent | 65002bf2351ff5ec50c987369f9d8a0b764e9b33 (diff) |
Fix #258 - Wrong selection after a second search.
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/java/app/fedilab/android/activities/SearchResultTabActivity.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/app/src/main/java/app/fedilab/android/activities/SearchResultTabActivity.java b/app/src/main/java/app/fedilab/android/activities/SearchResultTabActivity.java index 7fee806a8..1cb92672d 100644 --- a/app/src/main/java/app/fedilab/android/activities/SearchResultTabActivity.java +++ b/app/src/main/java/app/fedilab/android/activities/SearchResultTabActivity.java @@ -53,6 +53,7 @@ public class SearchResultTabActivity extends BaseActivity { private String search; private ActivitySearchResultTabsBinding binding; + private TabLayout.Tab initial; @Override protected void onCreate(Bundle savedInstanceState) { @@ -77,7 +78,8 @@ public class SearchResultTabActivity extends BaseActivity { getSupportActionBar().setBackgroundDrawable(new ColorDrawable(ContextCompat.getColor(this, R.color.cyanea_primary))); } setTitle(search); - binding.searchTabLayout.addTab(binding.searchTabLayout.newTab().setText(getString(R.string.tags))); + initial = binding.searchTabLayout.newTab(); + binding.searchTabLayout.addTab(initial.setText(getString(R.string.tags))); binding.searchTabLayout.addTab(binding.searchTabLayout.newTab().setText(getString(R.string.accounts))); binding.searchTabLayout.addTab(binding.searchTabLayout.newTab().setText(getString(R.string.toots))); binding.searchTabLayout.addTab(binding.searchTabLayout.newTab().setText(getString(R.string.action_cache))); @@ -125,7 +127,6 @@ public class SearchResultTabActivity extends BaseActivity { @Override public boolean onQueryTextSubmit(String query) { InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE); - assert imm != null; imm.hideSoftInputFromWindow(binding.searchTabLayout.getWindowToken(), 0); query = query.replaceAll("^#+", ""); search = query.trim(); @@ -134,6 +135,7 @@ public class SearchResultTabActivity extends BaseActivity { searchView.clearFocus(); setTitle(search); searchView.setIconified(true); + binding.searchTabLayout.selectTab(initial); return false; } |