1d2031e0c809580219faa55a27c237c7bdf8505a5Flavio Lerda/*
2d2031e0c809580219faa55a27c237c7bdf8505a5Flavio Lerda * Copyright (C) 2011 The Android Open Source Project
3d2031e0c809580219faa55a27c237c7bdf8505a5Flavio Lerda *
4d2031e0c809580219faa55a27c237c7bdf8505a5Flavio Lerda * Licensed under the Apache License, Version 2.0 (the "License");
5d2031e0c809580219faa55a27c237c7bdf8505a5Flavio Lerda * you may not use this file except in compliance with the License.
6d2031e0c809580219faa55a27c237c7bdf8505a5Flavio Lerda * You may obtain a copy of the License at
7d2031e0c809580219faa55a27c237c7bdf8505a5Flavio Lerda *
8d2031e0c809580219faa55a27c237c7bdf8505a5Flavio Lerda *      http://www.apache.org/licenses/LICENSE-2.0
9d2031e0c809580219faa55a27c237c7bdf8505a5Flavio Lerda *
10d2031e0c809580219faa55a27c237c7bdf8505a5Flavio Lerda * Unless required by applicable law or agreed to in writing, software
11d2031e0c809580219faa55a27c237c7bdf8505a5Flavio Lerda * distributed under the License is distributed on an "AS IS" BASIS,
12d2031e0c809580219faa55a27c237c7bdf8505a5Flavio Lerda * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13d2031e0c809580219faa55a27c237c7bdf8505a5Flavio Lerda * See the License for the specific language governing permissions and
14d2031e0c809580219faa55a27c237c7bdf8505a5Flavio Lerda * limitations under the License.
15d2031e0c809580219faa55a27c237c7bdf8505a5Flavio Lerda */
16d2031e0c809580219faa55a27c237c7bdf8505a5Flavio Lerda
17d2031e0c809580219faa55a27c237c7bdf8505a5Flavio Lerdapackage com.android.contacts.calllog;
18d2031e0c809580219faa55a27c237c7bdf8505a5Flavio Lerda
19405695664582b4989cffcf054bf1aceb83dec437Flavio Lerdaimport android.content.Context;
20371d5f97d0b87ea0c9d8e8e178c04df34336a29eFlavio Lerdaimport android.view.View;
219b81f1d888772086e49fa39bfa3304f9e072614cFlavio Lerdaimport android.widget.ImageView;
22bcb5f514cff58300fdb48ca883f08876076b23faFlavio Lerdaimport android.widget.QuickContactBadge;
2376921903290ba9229e0238395c35569cbadecb20Flavio Lerdaimport android.widget.TextView;
24d2031e0c809580219faa55a27c237c7bdf8505a5Flavio Lerda
25e0b2f1e2d01d1ac52ba207dc7ce76971d853298eChiao Chengimport com.android.contacts.PhoneCallDetailsViews;
26e0b2f1e2d01d1ac52ba207dc7ce76971d853298eChiao Chengimport com.android.contacts.R;
27e0b2f1e2d01d1ac52ba207dc7ce76971d853298eChiao Chengimport com.android.contacts.test.NeededForTesting;
28e0b2f1e2d01d1ac52ba207dc7ce76971d853298eChiao Cheng
29d2031e0c809580219faa55a27c237c7bdf8505a5Flavio Lerda/**
30d2031e0c809580219faa55a27c237c7bdf8505a5Flavio Lerda * Simple value object containing the various views within a call log entry.
31d2031e0c809580219faa55a27c237c7bdf8505a5Flavio Lerda */
32d2031e0c809580219faa55a27c237c7bdf8505a5Flavio Lerdapublic final class CallLogListItemViews {
334d44e6233858a8d3ad9019ac69ec8102ce3fcb3eFlavio Lerda    /** The quick contact badge for the contact. */
344d44e6233858a8d3ad9019ac69ec8102ce3fcb3eFlavio Lerda    public final QuickContactBadge quickContactView;
3582b7c07b33fe5f3e2bfdee1d5f4c68060a337028Flavio Lerda    /** The primary action view of the entry. */
3682b7c07b33fe5f3e2bfdee1d5f4c68060a337028Flavio Lerda    public final View primaryActionView;
379b81f1d888772086e49fa39bfa3304f9e072614cFlavio Lerda    /** The secondary action button on the entry. */
389b81f1d888772086e49fa39bfa3304f9e072614cFlavio Lerda    public final ImageView secondaryActionView;
399b81f1d888772086e49fa39bfa3304f9e072614cFlavio Lerda    /** The divider between the primary and secondary actions. */
4033b28a1fc0e8ca5c2c285655d0ed8bd0dc275600Flavio Lerda    public final View dividerView;
41371d5f97d0b87ea0c9d8e8e178c04df34336a29eFlavio Lerda    /** The details of the phone call. */
42371d5f97d0b87ea0c9d8e8e178c04df34336a29eFlavio Lerda    public final PhoneCallDetailsViews phoneCallDetailsViews;
43be38b67e61d4b074614d41dc0b1179230c252270Flavio Lerda    /** The text of the header of a section. */
447594d799dc8b4486148cdcd586b5dcd24a679211Flavio Lerda    public final TextView listHeaderTextView;
45fca72fa1f2bf030b3e35635508132b5ad328eab6Flavio Lerda    /** The divider to be shown below items. */
46fca72fa1f2bf030b3e35635508132b5ad328eab6Flavio Lerda    public final View bottomDivider;
47371d5f97d0b87ea0c9d8e8e178c04df34336a29eFlavio Lerda
4882b7c07b33fe5f3e2bfdee1d5f4c68060a337028Flavio Lerda    private CallLogListItemViews(QuickContactBadge quickContactView, View primaryActionView,
496af176fa4156446c8522642575fc7c2f98c39e74Flavio Lerda            ImageView secondaryActionView, View dividerView,
5073215d678536d3b057a0f0dd1c045250dbe9ed65Flavio Lerda            PhoneCallDetailsViews phoneCallDetailsViews,
51f66d9f35879365c43adcd17549ad97e421123571Flavio Lerda            TextView listHeaderTextView, View bottomDivider) {
524d44e6233858a8d3ad9019ac69ec8102ce3fcb3eFlavio Lerda        this.quickContactView = quickContactView;
5382b7c07b33fe5f3e2bfdee1d5f4c68060a337028Flavio Lerda        this.primaryActionView = primaryActionView;
549b81f1d888772086e49fa39bfa3304f9e072614cFlavio Lerda        this.secondaryActionView = secondaryActionView;
5533b28a1fc0e8ca5c2c285655d0ed8bd0dc275600Flavio Lerda        this.dividerView = dividerView;
56371d5f97d0b87ea0c9d8e8e178c04df34336a29eFlavio Lerda        this.phoneCallDetailsViews = phoneCallDetailsViews;
577594d799dc8b4486148cdcd586b5dcd24a679211Flavio Lerda        this.listHeaderTextView = listHeaderTextView;
58fca72fa1f2bf030b3e35635508132b5ad328eab6Flavio Lerda        this.bottomDivider = bottomDivider;
59371d5f97d0b87ea0c9d8e8e178c04df34336a29eFlavio Lerda    }
60371d5f97d0b87ea0c9d8e8e178c04df34336a29eFlavio Lerda
61371d5f97d0b87ea0c9d8e8e178c04df34336a29eFlavio Lerda    public static CallLogListItemViews fromView(View view) {
624d44e6233858a8d3ad9019ac69ec8102ce3fcb3eFlavio Lerda        return new CallLogListItemViews(
634d44e6233858a8d3ad9019ac69ec8102ce3fcb3eFlavio Lerda                (QuickContactBadge) view.findViewById(R.id.quick_contact_photo),
6482b7c07b33fe5f3e2bfdee1d5f4c68060a337028Flavio Lerda                view.findViewById(R.id.primary_action_view),
659b81f1d888772086e49fa39bfa3304f9e072614cFlavio Lerda                (ImageView) view.findViewById(R.id.secondary_action_icon),
6633b28a1fc0e8ca5c2c285655d0ed8bd0dc275600Flavio Lerda                view.findViewById(R.id.divider),
6776921903290ba9229e0238395c35569cbadecb20Flavio Lerda                PhoneCallDetailsViews.fromView(view),
68f66d9f35879365c43adcd17549ad97e421123571Flavio Lerda                (TextView) view.findViewById(R.id.call_log_header),
69fca72fa1f2bf030b3e35635508132b5ad328eab6Flavio Lerda                view.findViewById(R.id.call_log_divider));
70371d5f97d0b87ea0c9d8e8e178c04df34336a29eFlavio Lerda    }
71371d5f97d0b87ea0c9d8e8e178c04df34336a29eFlavio Lerda
72a0290a4baab4297303cab3664c7abfd548f2e301Makoto Onuki    @NeededForTesting
73405695664582b4989cffcf054bf1aceb83dec437Flavio Lerda    public static CallLogListItemViews createForTest(Context context) {
74405695664582b4989cffcf054bf1aceb83dec437Flavio Lerda        return new CallLogListItemViews(
75405695664582b4989cffcf054bf1aceb83dec437Flavio Lerda                new QuickContactBadge(context),
7682b7c07b33fe5f3e2bfdee1d5f4c68060a337028Flavio Lerda                new View(context),
779b81f1d888772086e49fa39bfa3304f9e072614cFlavio Lerda                new ImageView(context),
78405695664582b4989cffcf054bf1aceb83dec437Flavio Lerda                new View(context),
79405695664582b4989cffcf054bf1aceb83dec437Flavio Lerda                PhoneCallDetailsViews.createForTest(context),
80fca72fa1f2bf030b3e35635508132b5ad328eab6Flavio Lerda                new TextView(context),
81fca72fa1f2bf030b3e35635508132b5ad328eab6Flavio Lerda                new View(context));
82371d5f97d0b87ea0c9d8e8e178c04df34336a29eFlavio Lerda    }
83bcb5f514cff58300fdb48ca883f08876076b23faFlavio Lerda}
84