Adding the ability to long click or to double click the search icon to bring up the keyboard

(cherry picked from commit ee0737c9c7)
This commit is contained in:
LucasGGamerM 2023-01-04 21:54:03 -03:00
parent 34ba4ceb16
commit 708331fca1
2 changed files with 14 additions and 8 deletions

View File

@ -202,15 +202,23 @@ public class HomeFragment extends AppKitFragment implements OnBackPressedListene
private void onTabSelected(@IdRes int tab){ private void onTabSelected(@IdRes int tab){
Fragment newFragment=fragmentForTab(tab); Fragment newFragment=fragmentForTab(tab);
if(tab==currentTab){ if(tab==currentTab){
if(tab == R.id.tab_search){
if(newFragment instanceof ScrollableToTop scrollable)
scrollable.scrollToTop();
searchFragment.selectSearch();
return;
}
if(newFragment instanceof ScrollableToTop scrollable)
scrollable.scrollToTop();
return;
}
if(tab==currentTab && tab == R.id.tab_search){
if(newFragment instanceof ScrollableToTop scrollable) if(newFragment instanceof ScrollableToTop scrollable)
scrollable.scrollToTop(); scrollable.scrollToTop();
return; return;
} }
getChildFragmentManager().beginTransaction().hide(fragmentForTab(currentTab)).show(newFragment).commit(); getChildFragmentManager().beginTransaction().hide(fragmentForTab(currentTab)).show(newFragment).commit();
maybeTriggerLoading(newFragment); maybeTriggerLoading(newFragment);
// if(tab == currentTab && tab == R.id.tab_search){
// searchFragment.selectSearch();
// }
currentTab=tab; currentTab=tab;
((FragmentStackActivity)getActivity()).invalidateSystemBarColors(this); ((FragmentStackActivity)getActivity()).invalidateSystemBarColors(this);
} }
@ -239,10 +247,11 @@ public class HomeFragment extends AppKitFragment implements OnBackPressedListene
return true; return true;
} }
if(tab==R.id.tab_search){ if(tab==R.id.tab_search){
searchFragment.selectSearch();
onTabSelected(R.id.tab_search); onTabSelected(R.id.tab_search);
tabBar.selectTab(R.id.tab_search);
searchFragment.selectSearch();
return true;
} }
return false; return false;
} }

View File

@ -2,8 +2,6 @@ package org.joinmastodon.android.fragments.discover;
import android.app.Fragment; import android.app.Fragment;
import android.app.FragmentTransaction; import android.app.FragmentTransaction;
import android.content.Context;
import android.hardware.input.InputManager;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.text.Editable; import android.text.Editable;
@ -19,7 +17,6 @@ import android.widget.ImageButton;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast;
import org.joinmastodon.android.BuildConfig; import org.joinmastodon.android.BuildConfig;
import org.joinmastodon.android.GlobalUserPreferences; import org.joinmastodon.android.GlobalUserPreferences;