-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set My site fragment title to 'My site' instead of using site title #11691
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -377,7 +377,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, | |
setupClickListeners(rootView); | ||
|
||
mToolbar = rootView.findViewById(R.id.toolbar_main); | ||
mToolbar.setTitle(mToolbarTitle); | ||
mToolbar.setTitle(R.string.my_site_section_screen_title); | ||
|
||
mToolbar.inflateMenu(R.menu.my_site_menu); | ||
|
||
|
@@ -955,9 +955,6 @@ private void refreshSelectedSiteDetails(SiteModel site) { | |
} else { | ||
mQuickActionButtonsContainer.setWeightSum(75f); | ||
} | ||
|
||
// Refresh the title | ||
setTitle(site.getName()); | ||
} | ||
|
||
private void toggleAdminVisibility(@Nullable final SiteModel site) { | ||
|
@@ -1009,12 +1006,9 @@ public void onStart() { | |
|
||
@Override | ||
public void setTitle(@NonNull final String title) { | ||
if (isAdded()) { | ||
mToolbarTitle = (title.isEmpty()) ? getString(R.string.wordpress) : title; | ||
|
||
if (mToolbar != null) { | ||
mToolbar.setTitle(mToolbarTitle); | ||
} | ||
mToolbarTitle = title; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Out of scope of this PR: I'm actually wondering if we need the body of this method at all since the toolbar title is a constant and we set it in the |
||
if (mToolbar != null) { | ||
mToolbar.setTitle(title); | ||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -808,17 +808,9 @@ public void handleNewPostAction(PagePostCreationSourcesDetail source) { | |
ActivityLauncher.addNewPostForResult(this, getSelectedSite(), false, source); | ||
} | ||
|
||
private void updateTitle() { | ||
updateTitle(mBottomNav.getCurrentSelectedPage()); | ||
} | ||
|
||
private void updateTitle(PageType pageType) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't it still used from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I meant the one above this one, without parameters. I couldn't comment there :-) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done 👍 |
||
if (pageType == PageType.MY_SITE && mSelectedSite != null) { | ||
((MainToolbarFragment) mBottomNav.getActiveFragment()).setTitle(mSelectedSite.getName()); | ||
} else { | ||
((MainToolbarFragment) mBottomNav.getActiveFragment()) | ||
.setTitle(mBottomNav.getTitleForPageType(pageType).toString()); | ||
} | ||
((MainToolbarFragment) mBottomNav.getActiveFragment()) | ||
.setTitle(mBottomNav.getTitleForPageType(pageType).toString()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's out of scope of this PR but this whole logic is strange (and wrong). We don't actually need to update the title anywhere else than in the Bottom nav component since this is a callback triggered by the bottom nav. What we do here is that the bottom nav tells us that a tab was selected and we react to it by asking bottom nav for the active fragment and setting its title from the bottom nav. |
||
} | ||
|
||
private void trackLastVisiblePage(PageType pageType, boolean trackAnalytics) { | ||
|
@@ -1192,8 +1184,6 @@ public void setSelectedSite(@Nullable SiteModel selectedSite) { | |
// Make selected site visible | ||
selectedSite.setIsVisible(true); | ||
AppPrefs.setSelectedSite(selectedSite.getId()); | ||
|
||
updateTitle(); | ||
} | ||
|
||
/** | ||
|
@@ -1209,7 +1199,6 @@ public void initSelectedSite() { | |
mSelectedSite = mSiteStore.getSiteByLocalId(siteLocalId); | ||
// If saved site exist, then return, else (site has been removed?) try to select another site | ||
if (mSelectedSite != null) { | ||
updateTitle(); | ||
return; | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you remove the
isAdded
check because we no longer need context when setting the title?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the
isAdded
check because I simplified this implementation using theMe
fragment as reference – I have no idea whether it's necessary, so happy to take your lead here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it isn't necessary :-).