From 259c569c371f6b24ab940a90a9a4c504f0b6fe3b Mon Sep 17 00:00:00 2001 From: uabdullah Date: Fri, 29 Sep 2017 15:38:38 -0700 Subject: Create UI support for voicemail transcription, location, date and duration. Screenshot:http://screen/dwihQaaeaQC Bug: 64882313,33006245 Test: NewVoicemailCallLogViewHolderTest, NewVoicemailCallLogAdapterTest PiperOrigin-RevId: 170542645 Change-Id: I00c145c5856c3f1f53d12b0fd7bd80c63bb8a094 --- .../voicemail/datasources/VoicemailData.java | 53 ++++++++++++ .../listui/NewVoicemailCallLogAdapter.java | 15 ++-- .../listui/NewVoicemailCallLogViewHolder.java | 19 ++++- .../voicemail/listui/NewVoicemailFragment.java | 20 ++++- .../res/layout/new_voicemail_call_log_entry.xml | 96 ++++++++++++++++++++++ .../listui/res/layout/voicemail_call_log_entry.xml | 71 ---------------- .../dialer/voicemail/listui/res/values/dimens.xml | 2 + 7 files changed, 191 insertions(+), 85 deletions(-) create mode 100644 java/com/android/dialer/voicemail/datasources/VoicemailData.java create mode 100644 java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_call_log_entry.xml delete mode 100644 java/com/android/dialer/voicemail/listui/res/layout/voicemail_call_log_entry.xml (limited to 'java') diff --git a/java/com/android/dialer/voicemail/datasources/VoicemailData.java b/java/com/android/dialer/voicemail/datasources/VoicemailData.java new file mode 100644 index 000000000..c3c1ff51b --- /dev/null +++ b/java/com/android/dialer/voicemail/datasources/VoicemailData.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +package com.android.dialer.voicemail.datasources; + +import com.google.auto.value.AutoValue; + +/** Dummy voicemail data class to allow us to work on the UI for the new voicemail tab. */ +@AutoValue +public abstract class VoicemailData { + public abstract String name(); + + public abstract String location(); + + public abstract String date(); + + public abstract String duration(); + + public abstract String transcription(); + + public static Builder builder() { + return new AutoValue_VoicemailData.Builder(); + } + + /** Creates instances of {@link VoicemailData}. */ + @AutoValue.Builder + public abstract static class Builder { + public abstract Builder setName(String value); + + public abstract Builder setLocation(String value); + + public abstract Builder setDate(String value); + + public abstract Builder setDuration(String value); + + public abstract Builder setTranscription(String value); + + public abstract VoicemailData build(); + } +} diff --git a/java/com/android/dialer/voicemail/listui/NewVoicemailCallLogAdapter.java b/java/com/android/dialer/voicemail/listui/NewVoicemailCallLogAdapter.java index 63dae20d9..b40c8630e 100644 --- a/java/com/android/dialer/voicemail/listui/NewVoicemailCallLogAdapter.java +++ b/java/com/android/dialer/voicemail/listui/NewVoicemailCallLogAdapter.java @@ -20,23 +20,23 @@ 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.List; /** {@link RecyclerView.Adapter} for the new voicemail call log fragment. */ final class NewVoicemailCallLogAdapter extends RecyclerView.Adapter { - private final List values; + private final List voicemailData; - NewVoicemailCallLogAdapter(List myDataset) { - values = myDataset; + NewVoicemailCallLogAdapter(List dataSet) { + voicemailData = dataSet; } @Override public NewVoicemailCallLogViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) { LayoutInflater inflater = LayoutInflater.from(viewGroup.getContext()); - View v = inflater.inflate(R.layout.voicemail_call_log_entry, viewGroup, false); - + View v = inflater.inflate(R.layout.new_voicemail_call_log_entry, viewGroup, false); NewVoicemailCallLogViewHolder newVoicemailCallLogViewHolder = new NewVoicemailCallLogViewHolder(v); return newVoicemailCallLogViewHolder; @@ -45,12 +45,11 @@ final class NewVoicemailCallLogAdapter extends RecyclerView.Adapter input = new ArrayList<>(); + List voicemailData = new ArrayList<>(); + Random rand = new Random(); for (int i = 0; i < 50; i++) { - input.add("Umer Abdullah " + 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); } - LogUtil.i("onCreateView", "size of input:" + input.size()); - recyclerView.setAdapter(new NewVoicemailCallLogAdapter(input)); + LogUtil.i("onCreateView", "size of input:" + voicemailData.size()); + recyclerView.setAdapter(new NewVoicemailCallLogAdapter(voicemailData)); return view; } } diff --git a/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_call_log_entry.xml b/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_call_log_entry.xml new file mode 100644 index 000000000..01c0ee12e --- /dev/null +++ b/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_call_log_entry.xml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/com/android/dialer/voicemail/listui/res/layout/voicemail_call_log_entry.xml b/java/com/android/dialer/voicemail/listui/res/layout/voicemail_call_log_entry.xml deleted file mode 100644 index 3986a0e8c..000000000 --- a/java/com/android/dialer/voicemail/listui/res/layout/voicemail_call_log_entry.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/java/com/android/dialer/voicemail/listui/res/values/dimens.xml b/java/com/android/dialer/voicemail/listui/res/values/dimens.xml index 4ef0fc1a4..3df5827a5 100644 --- a/java/com/android/dialer/voicemail/listui/res/values/dimens.xml +++ b/java/com/android/dialer/voicemail/listui/res/values/dimens.xml @@ -25,4 +25,6 @@ 8dp 48dp + 12dp + 16dp -- cgit v1.2.3