summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/voicemail/listui/NewVoicemailFragment.java
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2017-10-18 02:50:55 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2017-10-18 02:50:55 +0000
commitef7a7eb0f103d41df55385267ac52dc3dcf603cb (patch)
tree8bb6b163a88cf321073913c2b0b7dad5ecbd854e /java/com/android/dialer/voicemail/listui/NewVoicemailFragment.java
parentc2590357cf857e714f875f2a7c222d1bd128c2c5 (diff)
parent6f78d935ff64f178e9fe8891082c18578d4e4b74 (diff)
Merge changes Ida554313,Ie7187b02,I7a7c23b4
* changes: Stop showing partially matched numbers that are not global phone numbers. Display Voicemail Contact Name and Photo in Voicemail Fragment. Add temporary assisted dialing setting to Dialer.
Diffstat (limited to 'java/com/android/dialer/voicemail/listui/NewVoicemailFragment.java')
-rw-r--r--java/com/android/dialer/voicemail/listui/NewVoicemailFragment.java53
1 files changed, 27 insertions, 26 deletions
diff --git a/java/com/android/dialer/voicemail/listui/NewVoicemailFragment.java b/java/com/android/dialer/voicemail/listui/NewVoicemailFragment.java
index 3629b7551..1912e1e3f 100644
--- a/java/com/android/dialer/voicemail/listui/NewVoicemailFragment.java
+++ b/java/com/android/dialer/voicemail/listui/NewVoicemailFragment.java
@@ -16,49 +16,50 @@
package com.android.dialer.voicemail.listui;
+import android.database.Cursor;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
+import android.support.v4.app.LoaderManager.LoaderCallbacks;
+import android.support.v4.content.Loader;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.android.dialer.common.LogUtil;
-import com.android.dialer.voicemail.datasources.VoicemailData;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Random;
/** Fragment for Dialer Voicemail Tab. */
-public final class NewVoicemailFragment extends Fragment {
+public final class NewVoicemailFragment extends Fragment implements LoaderCallbacks<Cursor> {
+
+ private RecyclerView recyclerView;
+
@Nullable
@Override
public View onCreateView(
LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.new_voicemail_call_log_fragment, container, false);
- RecyclerView recyclerView =
- (RecyclerView) view.findViewById(R.id.new_voicemail_call_log_recycler_view);
- recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
+ recyclerView = view.findViewById(R.id.new_voicemail_call_log_recycler_view);
+ getLoaderManager().restartLoader(0, null, this);
+ return view;
+ }
- // TODO(uabdullah): To be removed once we hook up the UI to the voicemail backend
- List<VoicemailData> voicemailData = new ArrayList<>();
- Random rand = new Random();
- for (int i = 0; i < 50; i++) {
- VoicemailData mocked =
- VoicemailData.builder()
- .setName("Fatima Abdullah " + i)
- .setLocation("San Francisco, CA")
- .setDate("March " + (rand.nextInt(30) + 1))
- .setDuration("00:" + (rand.nextInt(50) + 10))
- .setTranscription(
- "This is a transcription text message that literally means nothing.")
- .build();
- voicemailData.add(mocked);
- }
+ @Override
+ public Loader<Cursor> onCreateLoader(int id, Bundle args) {
+ LogUtil.enterBlock("NewVoicemailFragment.onCreateLoader");
+ return new VoicemailCursorLoader(getContext());
+ }
- LogUtil.i("onCreateView", "size of input:" + voicemailData.size());
- recyclerView.setAdapter(new NewVoicemailCallLogAdapter(voicemailData));
- return view;
+ @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));
+ }
+
+ @Override
+ public void onLoaderReset(Loader<Cursor> loader) {
+ LogUtil.enterBlock("NewVoicemailFragment.onLoaderReset");
+ recyclerView.setAdapter(null);
}
}