From b69015a25ab580c0655ea6d2bc807b84d3b385fc Mon Sep 17 00:00:00 2001 From: LucasGGamerM Date: Tue, 3 Jan 2023 15:18:34 -0300 Subject: [PATCH] Its closer to working --- .../org/joinmastodon/android/fragments/HomeFragment.java | 7 +++++-- .../android/fragments/discover/DiscoverFragment.java | 8 +++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/HomeFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/HomeFragment.java index adc75c615..c1d95b4f6 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/HomeFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/HomeFragment.java @@ -208,6 +208,9 @@ public class HomeFragment extends AppKitFragment implements OnBackPressedListene } getChildFragmentManager().beginTransaction().hide(fragmentForTab(currentTab)).show(newFragment).commit(); maybeTriggerLoading(newFragment); +// if(tab == currentTab && tab == R.id.tab_search){ +// searchFragment.selectSearch(); +// } currentTab=tab; ((FragmentStackActivity)getActivity()).invalidateSystemBarColors(this); } @@ -236,8 +239,8 @@ public class HomeFragment extends AppKitFragment implements OnBackPressedListene return true; } if(tab==R.id.tab_search){ - searchFragment.selectSearch(true); - onTabSelected(tab); + searchFragment.selectSearch(); + onTabSelected(R.id.tab_search); } return false; diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/DiscoverFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/DiscoverFragment.java index eb0df0052..c13c98c6c 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/DiscoverFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/DiscoverFragment.java @@ -19,6 +19,7 @@ import android.widget.ImageButton; import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.TextView; +import android.widget.Toast; import org.joinmastodon.android.BuildConfig; import org.joinmastodon.android.GlobalUserPreferences; @@ -48,7 +49,6 @@ public class DiscoverFragment extends AppKitFragment implements ScrollableToTop, private TabLayoutMediator tabLayoutMediator; private EditText searchEdit; private boolean searchActive; - public boolean wasTriggeredByLongPress = false; private FrameLayout searchView; private ImageButton searchBack, searchClear; private ProgressBar searchProgress; @@ -362,11 +362,9 @@ public class DiscoverFragment extends AppKitFragment implements ScrollableToTop, } } - public void selectSearch(boolean selectSearch){ - wasTriggeredByLongPress=selectSearch; + public void selectSearch(){ searchEdit.requestFocus(); - onSearchEditFocusChanged(searchEdit, selectSearch); + onSearchEditFocusChanged(searchEdit, true); getActivity().getSystemService(InputMethodManager.class).showSoftInput(searchEdit, 0); } - }