Skip to content
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

Merged
merged 4 commits into from
Apr 17, 2020

Conversation

frosty
Copy link
Contributor

@frosty frosty commented Apr 17, 2020

IANAAD (I Am Not An Android Developer), so please let me know if I did anything wrong! This PR is a small tweak the title of the My Site screen to always read "My site" instead of duplicating the site name, which is shown in the screen header anyway.

site-title-android

To test:

  • Build and run, and ensure the My Site fragment has the title "My site"
  • Try selecting a different site and ensure the title stays the same

PR submission checklist:

  • I have considered adding unit tests where possible.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Apr 17, 2020

You can trigger optional UI/connected tests for these changes by visiting CircleCI here.

@@ -1009,12 +1006,9 @@ public void onStart() {

@Override
public void setTitle(@NonNull final String title) {
if (isAdded()) {
Copy link
Contributor

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?

Copy link
Contributor Author

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 the Me fragment as reference – I have no idea whether it's necessary, so happy to take your lead here.

Copy link
Contributor

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 :-).

@frosty frosty changed the title Set MySiteFragment title to be "My site", instead of using site title Set My site fragment title to 'My site' instead of using site title Apr 17, 2020
@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Apr 17, 2020

You can test the changes on this Pull Request by downloading the APK here.

@@ -813,12 +813,8 @@ private void updateTitle() {
}

private void updateTitle(PageType pageType) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the updateTitle() method is no longer used so you can remove it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it still used from onPageChanged()?

Copy link
Contributor

Choose a reason for hiding this comment

The 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 :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 👍

.setTitle(mBottomNav.getTitleForPageType(pageType).toString());
}
((MainToolbarFragment) mBottomNav.getActiveFragment())
.setTitle(mBottomNav.getTitleForPageType(pageType).toString());
Copy link
Contributor

Choose a reason for hiding this comment

The 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.

if (mToolbar != null) {
mToolbar.setTitle(mToolbarTitle);
}
mToolbarTitle = title;
Copy link
Contributor

@planarvoid planarvoid Apr 17, 2020

Choose a reason for hiding this comment

The 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 onCreate method

Copy link
Contributor

@planarvoid planarvoid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes! It looks good 👍 . The other comments I had are about the general architecture so they are out of scope for this PR :-)

@planarvoid planarvoid merged commit fe66baa into develop Apr 17, 2020
@planarvoid planarvoid deleted the feature/my-site-title branch April 17, 2020 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants