feat(readd-home-tab-fragment): part 1: add HomeTabFragment references and rename HomeTimelineFragment references.

No major changes have been done yet. This will be a one hell of a pain in the arse :D
This commit is contained in:
LucasGGamerM 2024-12-05 10:24:35 -03:00
parent 547a2caa9c
commit ceb65b991f
2 changed files with 1025 additions and 12 deletions

View file

@ -60,7 +60,7 @@ import me.grishka.appkit.views.FragmentRootLinearLayout;
public class HomeFragment extends AppKitFragment implements AssistContentProviderFragment{ public class HomeFragment extends AppKitFragment implements AssistContentProviderFragment{
private FragmentRootLinearLayout content; private FragmentRootLinearLayout content;
private HomeTimelineFragment homeTimelineFragment; private HomeTabFragment homeTabFragment;
private NotificationsListFragment notificationsFragment; private NotificationsListFragment notificationsFragment;
private DiscoverFragment searchFragment; private DiscoverFragment searchFragment;
private ProfileFragment profileFragment; private ProfileFragment profileFragment;
@ -85,8 +85,8 @@ public class HomeFragment extends AppKitFragment implements AssistContentProvide
if(savedInstanceState==null){ if(savedInstanceState==null){
Bundle args=new Bundle(); Bundle args=new Bundle();
args.putString("account", accountID); args.putString("account", accountID);
homeTimelineFragment=new HomeTimelineFragment(); homeTabFragment=new HomeTabFragment();
homeTimelineFragment.setArguments(args); homeTabFragment.setArguments(args);
args=new Bundle(args); args=new Bundle(args);
args.putBoolean("noAutoLoad", true); args.putBoolean("noAutoLoad", true);
searchFragment=new DiscoverFragment(); searchFragment=new DiscoverFragment();
@ -135,7 +135,7 @@ public class HomeFragment extends AppKitFragment implements AssistContentProvide
if(savedInstanceState==null){ if(savedInstanceState==null){
getChildFragmentManager().beginTransaction() getChildFragmentManager().beginTransaction()
.add(me.grishka.appkit.R.id.fragment_wrap, homeTimelineFragment) .add(me.grishka.appkit.R.id.fragment_wrap, homeTabFragment)
.add(me.grishka.appkit.R.id.fragment_wrap, searchFragment).hide(searchFragment) .add(me.grishka.appkit.R.id.fragment_wrap, searchFragment).hide(searchFragment)
.add(me.grishka.appkit.R.id.fragment_wrap, notificationsFragment).hide(notificationsFragment) .add(me.grishka.appkit.R.id.fragment_wrap, notificationsFragment).hide(notificationsFragment)
.add(me.grishka.appkit.R.id.fragment_wrap, profileFragment).hide(profileFragment) .add(me.grishka.appkit.R.id.fragment_wrap, profileFragment).hide(profileFragment)
@ -162,9 +162,9 @@ public class HomeFragment extends AppKitFragment implements AssistContentProvide
@Override @Override
public void onViewStateRestored(Bundle savedInstanceState){ public void onViewStateRestored(Bundle savedInstanceState){
super.onViewStateRestored(savedInstanceState); super.onViewStateRestored(savedInstanceState);
if(savedInstanceState==null || homeTimelineFragment!=null) if(savedInstanceState==null || homeTabFragment!=null)
return; return;
homeTimelineFragment=(HomeTimelineFragment) getChildFragmentManager().getFragment(savedInstanceState, "homeTimelineFragment"); homeTabFragment=(HomeTabFragment) getChildFragmentManager().getFragment(savedInstanceState, "homeTimelineFragment");
searchFragment=(DiscoverFragment) getChildFragmentManager().getFragment(savedInstanceState, "searchFragment"); searchFragment=(DiscoverFragment) getChildFragmentManager().getFragment(savedInstanceState, "searchFragment");
notificationsFragment=(NotificationsListFragment) getChildFragmentManager().getFragment(savedInstanceState, "notificationsFragment"); notificationsFragment=(NotificationsListFragment) getChildFragmentManager().getFragment(savedInstanceState, "notificationsFragment");
profileFragment=(ProfileFragment) getChildFragmentManager().getFragment(savedInstanceState, "profileFragment"); profileFragment=(ProfileFragment) getChildFragmentManager().getFragment(savedInstanceState, "profileFragment");
@ -172,7 +172,7 @@ public class HomeFragment extends AppKitFragment implements AssistContentProvide
tabBar.selectTab(currentTab); tabBar.selectTab(currentTab);
Fragment current=fragmentForTab(currentTab); Fragment current=fragmentForTab(currentTab);
getChildFragmentManager().beginTransaction() getChildFragmentManager().beginTransaction()
.hide(homeTimelineFragment) .hide(homeTabFragment)
.hide(searchFragment) .hide(searchFragment)
.hide(notificationsFragment) .hide(notificationsFragment)
.hide(profileFragment) .hide(profileFragment)
@ -207,7 +207,7 @@ public class HomeFragment extends AppKitFragment implements AssistContentProvide
super.onApplyWindowInsets(insets.replaceSystemWindowInsets(insets.getSystemWindowInsetLeft(), 0, insets.getSystemWindowInsetRight(), insets.getSystemWindowInsetBottom())); super.onApplyWindowInsets(insets.replaceSystemWindowInsets(insets.getSystemWindowInsetLeft(), 0, insets.getSystemWindowInsetRight(), insets.getSystemWindowInsetBottom()));
} }
WindowInsets topOnlyInsets=insets.replaceSystemWindowInsets(0, insets.getSystemWindowInsetTop(), 0, 0); WindowInsets topOnlyInsets=insets.replaceSystemWindowInsets(0, insets.getSystemWindowInsetTop(), 0, 0);
homeTimelineFragment.onApplyWindowInsets(topOnlyInsets); homeTabFragment.onApplyWindowInsets(topOnlyInsets);
searchFragment.onApplyWindowInsets(topOnlyInsets); searchFragment.onApplyWindowInsets(topOnlyInsets);
notificationsFragment.onApplyWindowInsets(topOnlyInsets); notificationsFragment.onApplyWindowInsets(topOnlyInsets);
profileFragment.onApplyWindowInsets(topOnlyInsets); profileFragment.onApplyWindowInsets(topOnlyInsets);
@ -215,7 +215,7 @@ public class HomeFragment extends AppKitFragment implements AssistContentProvide
private Fragment fragmentForTab(@IdRes int tab){ private Fragment fragmentForTab(@IdRes int tab){
if(tab==R.id.tab_home){ if(tab==R.id.tab_home){
return homeTimelineFragment; return homeTabFragment;
}else if(tab==R.id.tab_search){ }else if(tab==R.id.tab_search){
return searchFragment; return searchFragment;
}else if(tab==R.id.tab_notifications){ }else if(tab==R.id.tab_notifications){
@ -297,7 +297,7 @@ public class HomeFragment extends AppKitFragment implements AssistContentProvide
public void onSaveInstanceState(Bundle outState){ public void onSaveInstanceState(Bundle outState){
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
outState.putInt("selectedTab", currentTab); outState.putInt("selectedTab", currentTab);
getChildFragmentManager().putFragment(outState, "homeTimelineFragment", homeTimelineFragment); getChildFragmentManager().putFragment(outState, "homeTimelineFragment", homeTabFragment);
getChildFragmentManager().putFragment(outState, "searchFragment", searchFragment); getChildFragmentManager().putFragment(outState, "searchFragment", searchFragment);
getChildFragmentManager().putFragment(outState, "notificationsFragment", notificationsFragment); getChildFragmentManager().putFragment(outState, "notificationsFragment", notificationsFragment);
getChildFragmentManager().putFragment(outState, "profileFragment", profileFragment); getChildFragmentManager().putFragment(outState, "profileFragment", profileFragment);
@ -392,8 +392,8 @@ public class HomeFragment extends AppKitFragment implements AssistContentProvide
public void onStatusDisplaySettingsChanged(StatusDisplaySettingsChangedEvent ev){ public void onStatusDisplaySettingsChanged(StatusDisplaySettingsChangedEvent ev){
if(!ev.accountID.equals(accountID)) if(!ev.accountID.equals(accountID))
return; return;
if(homeTimelineFragment.loaded) if(homeTabFragment.loaded)
homeTimelineFragment.rebuildAllDisplayItems(); homeTabFragment.rebuildAllDisplayItems();
if(notificationsFragment.loaded) if(notificationsFragment.loaded)
notificationsFragment.rebuildAllDisplayItems(); notificationsFragment.rebuildAllDisplayItems();
} }

File diff suppressed because it is too large Load diff