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

This commit is contained in:
LucasGGamerM 2023-01-04 21:54:03 -03:00
parent 0f85be7114
commit ee0737c9c7
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){
Fragment newFragment=fragmentForTab(tab);
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)
scrollable.scrollToTop();
return;
}
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);
}
@ -239,10 +247,11 @@ public class HomeFragment extends AppKitFragment implements OnBackPressedListene
return true;
}
if(tab==R.id.tab_search){
searchFragment.selectSearch();
onTabSelected(R.id.tab_search);
tabBar.selectTab(R.id.tab_search);
searchFragment.selectSearch();
return true;
}
return false;
}

View File

@ -2,8 +2,6 @@ package org.joinmastodon.android.fragments.discover;
import android.app.Fragment;
import android.app.FragmentTransaction;
import android.content.Context;
import android.hardware.input.InputManager;
import android.os.Build;
import android.os.Bundle;
import android.text.Editable;
@ -19,7 +17,6 @@ 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;