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

After filtering events in Search, Action bar title is incorrect #1896

Closed
anhanh11001 opened this issue Jun 4, 2019 · 9 comments · Fixed by #1936
Closed

After filtering events in Search, Action bar title is incorrect #1896

anhanh11001 opened this issue Jun 4, 2019 · 9 comments · Fixed by #1936

Comments

@anhanh11001
Copy link
Contributor

Describe the bug
After filtering events in Search, Action bar title is incorrect

Screenshots
ezgif-2-6f02c7e62f71 ezgif-2-74b99c2ef8a1

Would you like to work on the issue?
Yes

@anhanh11001 anhanh11001 added the bug label Jun 4, 2019
@anhanh11001
Copy link
Contributor Author

When I tick on the tick icon in FilterFragment (redirect to SearchResultsFragment) -> Here is the log from SearchResultsFragment and SearchFragment. It shows that SearchFragment still calls its method in the backstack... You have any ideas on this??

@liveHarshit

2019-06-04 15:11:03.721 23936-23936/com.eventyay.attendee D/SearchResultsFragment: DEBUGGING onCreate SearchResultsFragment
2019-06-04 15:11:03.848 23936-23936/com.eventyay.attendee D/Utils: DEBUGGING TITLE: Search results
2019-06-04 15:11:03.852 23936-23936/com.eventyay.attendee D/SearchResultsFragment: DEBUGGING onCreateView SearchResultsFragment
2019-06-04 15:11:03.878 23936-23936/com.eventyay.attendee D/SearchFragment: DEBUGGING onCreateView SearchFragment
2019-06-04 15:11:03.901 23936-23936/com.eventyay.attendee D/Utils: DEBUGGING TITLE: Search
2019-06-04 15:11:03.905 23936-23936/com.eventyay.attendee D/SearchFragment: DEBUGGING onViewCreated SearchFragment
2019-06-04 15:11:03.907 23936-23936/com.eventyay.attendee D/SearchFragment: DEBUGGING onResume SearchFragment
2019-06-04 15:11:03.997 23936-23936/com.eventyay.attendee D/SearchResultsFragment: DEBUGGING onResume SearchResultFragment

@liveHarshit
Copy link
Member

@anhanh11001 Search fragment is still running in the background. When we open search fragment, onCreate and onCreateView called. After redirecting to search results, onDestroyView is called, so after returning onCreateView is called not onCreate again. So the fragment is running in the back stack because of onDestroy of the fragment never calls.

@anhanh11001
Copy link
Contributor Author

I need some helps here as I couldn't find way to solve this issue, I'm not sure if you understand the logs above. So when I make a filter from SearchFilterFragment (clicking tick icon), this action is taken

<action
            android:id="@+id/action_search_filter_to_search_results"
            app:popUpTo="@id/searchResultsFragment"
            app:popUpToInclusive="true"
            app:destination="@id/searchResultsFragment"/>

here is what happens:

  1. onCreated() of SearchResultFragment is called
  2. onCreateView() of SearchResultFragment is called -> setting Action Bar title to "Search Results"
  3. onCreate() of SearchFragment is called, even though SearchFragment is in the backstack.
  4. onCreateView() of SearchFragment is called -> setting Action Bar title to "Search" // Bug here
    ...
  5. onResume() of SearchResultFragment is called here

@liveHarshit
Copy link
Member

app:popUpToInclusive="true"

Set it to false. And use SearchFilterFragmentDirection to navigate.

@anhanh11001
Copy link
Contributor Author

It is using SearchFilterFragmentDirection already. If popUpToInclusive is set to false, there would be 2 SearchResultFragment in the backstack

@liveHarshit
Copy link
Member

If popUpToInclusive is set to false, there would be 2 SearchResultFragment in the backstack

Have you tried?

@liveHarshit
Copy link
Member

The same problem is fixed in PR #1922

@anhanh11001
Copy link
Contributor Author

Have you tried?

I have tried.

The same problem is fixed in PR #1922

I'll take a look at that

@liveHarshit
Copy link
Member

4. onCreateView() of SearchFragment is called -> setting Action Bar title to "Search" // Bug here

Yes I also got the same problem while using .popBackStack(destinationId) but it was solved with using navigation fragment directions.

@mariobehling mariobehling added this to the Milestone 3: Summer 2019 milestone Jun 7, 2019
iamareebjamal pushed a commit that referenced this issue Jun 9, 2019
Details:
- This is just a dirty fix. The cause of the issue is due to methods (onCreate(), onCreateView(),...) of the fragment in backstack is somehow called.

Fixes: #1896
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants