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); } - }