diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2017-12-12 23:18:50 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-12-12 23:18:50 +0000 |
commit | 888e6b1499f7be68f2d33f870a57cd7e2a58dd93 (patch) | |
tree | 85148446a15528867fba0d7353b024081d9e0a5a /java/com/android/dialer/voicemail/listui/NewVoicemailFragment.java | |
parent | ab544521b21566b12a42e539d119c76dd5243a2d (diff) | |
parent | 75d67f5d83bdb28c6254cf064d09ac24fc9ae928 (diff) |
Merge changes I45978ea4,Ia85b1008,I9e68c561,I9255dd3c
* changes:
BEGIN_PUBLIC Automated rollback of changelist 172683494
BEGIN_PUBLIC Automated rollback of changelist 172956409
Download and play voicemails from server when not locally available.
Updated writing of PhoneLookup columns in annotated call log.
Diffstat (limited to 'java/com/android/dialer/voicemail/listui/NewVoicemailFragment.java')
-rw-r--r-- | java/com/android/dialer/voicemail/listui/NewVoicemailFragment.java | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/java/com/android/dialer/voicemail/listui/NewVoicemailFragment.java b/java/com/android/dialer/voicemail/listui/NewVoicemailFragment.java index 9a89dbe3e..82e704d39 100644 --- a/java/com/android/dialer/voicemail/listui/NewVoicemailFragment.java +++ b/java/com/android/dialer/voicemail/listui/NewVoicemailFragment.java @@ -38,6 +38,7 @@ public final class NewVoicemailFragment extends Fragment implements LoaderCallba @Override public View onCreateView( LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + LogUtil.enterBlock("NewVoicemailFragment.onCreateView"); View view = inflater.inflate(R.layout.new_voicemail_call_log_fragment, container, false); recyclerView = view.findViewById(R.id.new_voicemail_call_log_recycler_view); getLoaderManager().restartLoader(0, null, this); @@ -52,11 +53,24 @@ public final class NewVoicemailFragment extends Fragment implements LoaderCallba @Override public void onLoadFinished(Loader<Cursor> loader, Cursor data) { - LogUtil.i("NewVoicemailFragment.onCreateLoader", "cursor size is %d", data.getCount()); - recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); - recyclerView.setAdapter( - new NewVoicemailAdapter( - data, System::currentTimeMillis, getActivity().getFragmentManager())); + LogUtil.i("NewVoicemailFragment.onLoadFinished", "cursor size is %d", data.getCount()); + if (recyclerView.getAdapter() == null) { + recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); + recyclerView.setAdapter( + new NewVoicemailAdapter( + data, System::currentTimeMillis, getActivity().getFragmentManager())); + } else { + // This would only be called in cases such as when voicemail has been fetched from the server + // or a changed occurred in the annotated table changed (e.g deletes). To check if the change + // was due to a voicemail download, + // NewVoicemailAdapter.mediaPlayer.getVoicemailRequestedToDownload() is called. + LogUtil.i( + "NewVoicemailFragment.onLoadFinished", + "adapter: %s was not null, checking and playing the voicemail if conditions met", + recyclerView.getAdapter()); + ((NewVoicemailAdapter) recyclerView.getAdapter()).updateCursor(data); + ((NewVoicemailAdapter) recyclerView.getAdapter()).checkAndPlayVoicemail(); + } } @Override |