Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c071dc49 authored by Flavio Lerda's avatar Flavio Lerda
Browse files

Maintain the current view (voicemail only or all calls) on updates.

When the underlying content provider content changes, keep the same view
(voicemail only or all calls) as the one the user is looking at.

The underlying data may change because we updated some of the cached
columns, which currently causes the view to be updated for what seems to
the user no valid reason.

The only events we want to be sure to communicate to the user are new
voicemail and missed calls, but the notification bar takes care of those
cases, and if the application is currently open, we will refresh the
content anyway when resumed.

Bug: 5247042
Change-Id: I6db0a980aaafed5990f8e84bf4a9a1d0f44efb36
parent ea0a8a2f
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ public class CallLogAdapter extends GroupingListAdapter
        implements Runnable, ViewTreeObserver.OnPreDrawListener, CallLogGroupBuilder.GroupCreator {
    /** Interface used to initiate a refresh of the content. */
    public interface CallFetcher {
        public void startCallsQuery();
        public void fetchCalls();
    }

    /** The time in millis to delay starting the thread processing requests. */
@@ -183,9 +183,7 @@ public class CallLogAdapter extends GroupingListAdapter
     */
    @Override
    protected void onContentChanged() {
        // When the content changes, always fetch all the calls, in case a new missed call came
        // in and we were filtering over voicemail only, so that we see the missed call.
        mCallFetcher.startCallsQuery();
        mCallFetcher.fetchCalls();
    }

    void setLoading(boolean loading) {
+8 −0
Original line number Diff line number Diff line
@@ -220,6 +220,14 @@ public class CallLogFragment extends ListFragment implements ViewPagerVisibility
    }

    @Override
    public void fetchCalls() {
        if (mShowingVoicemailOnly) {
            mCallLogQueryHandler.fetchVoicemailOnly();
        } else {
            mCallLogQueryHandler.fetchAllCalls();
        }
    }

    public void startCallsQuery() {
        mAdapter.setLoading(true);
        mCallLogQueryHandler.fetchAllCalls();
+1 −1
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@ public class CallLogAdapterTest extends AndroidTestCase {
        // Use a call fetcher that does not do anything.
        CallLogAdapter.CallFetcher fakeCallFetcher = new CallLogAdapter.CallFetcher() {
            @Override
            public void startCallsQuery() {}
            public void fetchCalls() {}
        };

        mAdapter = new TestCallLogAdapter(getContext(), fakeCallFetcher, TEST_COUNTRY_ISO,