Closed Bug 1052563 Opened 10 years ago Closed 10 years ago

Refine interaction for exiting editing mode

Categories

(Firefox for Android Graveyard :: Search Activity, defect, P1)

All
Android
defect

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 34

People

(Reporter: Margaret, Assigned: Margaret)

References

Details

Attachments

(2 files, 1 obsolete file)

Splitting this off from bug 1045655.
This patch removed the main view click handler, as well as the suggestions container.

Because the click handler is gone, I had to add a focus change listener to make sure to exit editing mode when the search bar loses focus.

The edit state in MainActivity still keeps track of whether or not the suggestions fragment is shown, but the fragment itself makes sure to only show the list of suggestions when there are actually items in it. Without this check, the empty suggestions fragment view would cover up whatever is underneath it, preventing the user from doing things like clicking on search history terms while the search bar is active.

This patch also addresses bug 1051983 by updating the suggestions fragment to take up the whole screen.
Attachment #8473372 - Flags: review?(eric.edens)
Attached file NPE - onLoaderReset
This was thrown from a local build (against fx-team).

Repro steps:
  - Launch search activity
  - Click on settings button
Comment on attachment 8473372 [details] [diff] [review]
Don't capture clicks to dismiss search bar

Review of attachment 8473372 [details] [diff] [review]:
-----------------------------------------------------------------

::: mobile/android/search/java/org/mozilla/search/autocomplete/SuggestionsFragment.java
@@ +176,5 @@
>  
>          @Override
>          public void onLoaderReset(Loader<List<Suggestion>> loader) {
>              autoCompleteAdapter.update(null);
> +            suggestionsList.setVisibility(View.INVISIBLE);

Oh, autoCompleteAdapter and suggestionsList have different lifecycles.

I think I can just get rid of this call, since suggestionsList is destroyed in this case anyway.
(In reply to :Margaret Leibovic from comment #4)
> Comment on attachment 8473372 [details] [diff] [review]
> Don't capture clicks to dismiss search bar
> 
> Review of attachment 8473372 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> :::
> mobile/android/search/java/org/mozilla/search/autocomplete/
> SuggestionsFragment.java
> @@ +176,5 @@
> >  
> >          @Override
> >          public void onLoaderReset(Loader<List<Suggestion>> loader) {
> >              autoCompleteAdapter.update(null);
> > +            suggestionsList.setVisibility(View.INVISIBLE);
> 
> Oh, autoCompleteAdapter and suggestionsList have different lifecycles.
> 
> I think I can just get rid of this call, since suggestionsList is destroyed
> in this case anyway.

Actually, this is wrong. In fact, calling autoCompleteAdapter.update(null) is also wrong. onLoaderReset is just called when the loader wants to release its data. In other places in the code where we use CursorLoaders, we need to clean up references to the Cursor, but in our case, we're not actually holding onto the loader data anywhere, so we can remove the entire body of this method.
Flags: needinfo?(eric.edens)
Updated to address loader issue.
Attachment #8473372 - Attachment is obsolete: true
Attachment #8473372 - Flags: review?(eric.edens)
Attachment #8473966 - Flags: review?(eric.edens)
Comment on attachment 8473966 [details] [diff] [review]
Don't capture clicks to dismiss search bar

Review of attachment 8473966 [details] [diff] [review]:
-----------------------------------------------------------------

LGTM
Attachment #8473966 - Flags: review?(eric.edens) → review+
Flags: needinfo?(eric.edens)
https://hg.mozilla.org/mozilla-central/rev/35343a2e0abd
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 34
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: