only auto-open search on pleroma instances
This commit is contained in:
parent
3a2ae1ce71
commit
4c379b67a3
|
@ -66,6 +66,7 @@ public class HomeFragment extends AppKitFragment implements OnBackPressedListene
|
||||||
private int currentTab=R.id.tab_home;
|
private int currentTab=R.id.tab_home;
|
||||||
|
|
||||||
private String accountID;
|
private String accountID;
|
||||||
|
private boolean isPleroma;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState){
|
public void onCreate(Bundle savedInstanceState){
|
||||||
|
@ -73,18 +74,20 @@ public class HomeFragment extends AppKitFragment implements OnBackPressedListene
|
||||||
E.register(this);
|
E.register(this);
|
||||||
accountID=getArguments().getString("account");
|
accountID=getArguments().getString("account");
|
||||||
setTitle(R.string.sk_app_name);
|
setTitle(R.string.sk_app_name);
|
||||||
|
Instance instance = AccountSessionManager.getInstance().getAccount(accountID).getInstance();
|
||||||
|
isPleroma = instance.isPleroma();
|
||||||
|
|
||||||
if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.N)
|
if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.N)
|
||||||
setRetainInstance(true);
|
setRetainInstance(true);
|
||||||
|
|
||||||
|
// TODO: clean up
|
||||||
if(savedInstanceState==null){
|
if(savedInstanceState==null){
|
||||||
Bundle args=new Bundle();
|
Bundle args=new Bundle();
|
||||||
args.putString("account", accountID);
|
args.putString("account", accountID);
|
||||||
homeTabFragment=new HomeTabFragment();
|
homeTabFragment=new HomeTabFragment();
|
||||||
homeTabFragment.setArguments(args);
|
homeTabFragment.setArguments(args);
|
||||||
args=new Bundle(args);
|
args=new Bundle(args);
|
||||||
Instance instance = AccountSessionManager.getInstance().getAccount(accountID).getInstance();
|
args.putBoolean("disableDiscover", isPleroma);
|
||||||
args.putBoolean("isPleroma", instance.isPleroma());
|
|
||||||
args.putBoolean("noAutoLoad", true);
|
args.putBoolean("noAutoLoad", true);
|
||||||
searchFragment=new DiscoverFragment();
|
searchFragment=new DiscoverFragment();
|
||||||
searchFragment.setArguments(args);
|
searchFragment.setArguments(args);
|
||||||
|
@ -233,8 +236,7 @@ public class HomeFragment extends AppKitFragment implements OnBackPressedListene
|
||||||
if (newFragment instanceof HasFab fabulous) fabulous.showFab();
|
if (newFragment instanceof HasFab fabulous) fabulous.showFab();
|
||||||
currentTab=tab;
|
currentTab=tab;
|
||||||
((FragmentStackActivity)getActivity()).invalidateSystemBarColors(this);
|
((FragmentStackActivity)getActivity()).invalidateSystemBarColors(this);
|
||||||
if (tab == R.id.tab_search)
|
if (tab == R.id.tab_search && isPleroma) searchFragment.selectSearch();
|
||||||
searchFragment.selectSearch();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void maybeTriggerLoading(Fragment newFragment){
|
private void maybeTriggerLoading(Fragment newFragment){
|
||||||
|
|
|
@ -273,7 +273,7 @@ public class DiscoverFragment extends AppKitFragment implements ScrollableToTop,
|
||||||
searchBack.setEnabled(false);
|
searchBack.setEnabled(false);
|
||||||
searchBack.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
|
searchBack.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
|
||||||
getActivity().getSystemService(InputMethodManager.class).hideSoftInputFromWindow(searchEdit.getWindowToken(), 0);
|
getActivity().getSystemService(InputMethodManager.class).hideSoftInputFromWindow(searchEdit.getWindowToken(), 0);
|
||||||
if (getArguments().getBoolean("isPleroma"))
|
if (getArguments().getBoolean("disableDiscover"))
|
||||||
((HomeFragment) getParentFragment()).onBackPressed();
|
((HomeFragment) getParentFragment()).onBackPressed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue