CallLogListItemViews.java revision 82b7c07b33fe5f3e2bfdee1d5f4c68060a337028
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
19371d5f97d0b87ea0c9d8e8e178c04df34336a29eFlavio Lerdaimport com.android.contacts.PhoneCallDetailsViews;
20371d5f97d0b87ea0c9d8e8e178c04df34336a29eFlavio Lerdaimport com.android.contacts.R;
21371d5f97d0b87ea0c9d8e8e178c04df34336a29eFlavio Lerda
22405695664582b4989cffcf054bf1aceb83dec437Flavio Lerdaimport android.content.Context;
23371d5f97d0b87ea0c9d8e8e178c04df34336a29eFlavio Lerdaimport android.view.View;
249b81f1d888772086e49fa39bfa3304f9e072614cFlavio Lerdaimport android.widget.ImageView;
25bcb5f514cff58300fdb48ca883f08876076b23faFlavio Lerdaimport android.widget.QuickContactBadge;
2676921903290ba9229e0238395c35569cbadecb20Flavio Lerdaimport android.widget.TextView;
27d2031e0c809580219faa55a27c237c7bdf8505a5Flavio Lerda
28d2031e0c809580219faa55a27c237c7bdf8505a5Flavio Lerda/**
29d2031e0c809580219faa55a27c237c7bdf8505a5Flavio Lerda * Simple value object containing the various views within a call log entry.
30d2031e0c809580219faa55a27c237c7bdf8505a5Flavio Lerda */
31d2031e0c809580219faa55a27c237c7bdf8505a5Flavio Lerdapublic final class CallLogListItemViews {
324d44e6233858a8d3ad9019ac69ec8102ce3fcb3eFlavio Lerda    /** The quick contact badge for the contact. */
334d44e6233858a8d3ad9019ac69ec8102ce3fcb3eFlavio Lerda    public final QuickContactBadge quickContactView;
3482b7c07b33fe5f3e2bfdee1d5f4c68060a337028Flavio Lerda    /** The primary action view of the entry. */
3582b7c07b33fe5f3e2bfdee1d5f4c68060a337028Flavio Lerda    public final View primaryActionView;
369b81f1d888772086e49fa39bfa3304f9e072614cFlavio Lerda    /** The secondary action button on the entry. */
379b81f1d888772086e49fa39bfa3304f9e072614cFlavio Lerda    public final ImageView secondaryActionView;
38405695664582b4989cffcf054bf1aceb83dec437Flavio Lerda    /** The icon used for unheard voicemail. */
39405695664582b4989cffcf054bf1aceb83dec437Flavio Lerda    public final View unheardView;
409b81f1d888772086e49fa39bfa3304f9e072614cFlavio Lerda    /** The divider between the primary and secondary actions. */
4133b28a1fc0e8ca5c2c285655d0ed8bd0dc275600Flavio Lerda    public final View dividerView;
42371d5f97d0b87ea0c9d8e8e178c04df34336a29eFlavio Lerda    /** The details of the phone call. */
43371d5f97d0b87ea0c9d8e8e178c04df34336a29eFlavio Lerda    public final PhoneCallDetailsViews phoneCallDetailsViews;
4476921903290ba9229e0238395c35569cbadecb20Flavio Lerda    /** The item view for a stand-alone row, or null for other types of rows. */
457594d799dc8b4486148cdcd586b5dcd24a679211Flavio Lerda    public final View listItemView;
4676921903290ba9229e0238395c35569cbadecb20Flavio Lerda    /** The text of the header in a stand-alone row, or null for other types of rows. */
477594d799dc8b4486148cdcd586b5dcd24a679211Flavio Lerda    public final TextView listHeaderTextView;
48371d5f97d0b87ea0c9d8e8e178c04df34336a29eFlavio Lerda
4982b7c07b33fe5f3e2bfdee1d5f4c68060a337028Flavio Lerda    private CallLogListItemViews(QuickContactBadge quickContactView, View primaryActionView,
509b81f1d888772086e49fa39bfa3304f9e072614cFlavio Lerda            ImageView secondaryActionView, View unheardView, View dividerView,
51f513860e0d64d88585d4aa13150b045c19fcd42aDaniel Lehmann            PhoneCallDetailsViews phoneCallDetailsViews, View listItemView,
52405695664582b4989cffcf054bf1aceb83dec437Flavio Lerda            TextView listHeaderTextView) {
534d44e6233858a8d3ad9019ac69ec8102ce3fcb3eFlavio Lerda        this.quickContactView = quickContactView;
5482b7c07b33fe5f3e2bfdee1d5f4c68060a337028Flavio Lerda        this.primaryActionView = primaryActionView;
559b81f1d888772086e49fa39bfa3304f9e072614cFlavio Lerda        this.secondaryActionView = secondaryActionView;
56405695664582b4989cffcf054bf1aceb83dec437Flavio Lerda        this.unheardView = unheardView;
5733b28a1fc0e8ca5c2c285655d0ed8bd0dc275600Flavio Lerda        this.dividerView = dividerView;
58371d5f97d0b87ea0c9d8e8e178c04df34336a29eFlavio Lerda        this.phoneCallDetailsViews = phoneCallDetailsViews;
597594d799dc8b4486148cdcd586b5dcd24a679211Flavio Lerda        this.listItemView = listItemView;
607594d799dc8b4486148cdcd586b5dcd24a679211Flavio Lerda        this.listHeaderTextView = listHeaderTextView;
61371d5f97d0b87ea0c9d8e8e178c04df34336a29eFlavio Lerda    }
62371d5f97d0b87ea0c9d8e8e178c04df34336a29eFlavio Lerda
63371d5f97d0b87ea0c9d8e8e178c04df34336a29eFlavio Lerda    public static CallLogListItemViews fromView(View view) {
644d44e6233858a8d3ad9019ac69ec8102ce3fcb3eFlavio Lerda        return new CallLogListItemViews(
654d44e6233858a8d3ad9019ac69ec8102ce3fcb3eFlavio Lerda                (QuickContactBadge) view.findViewById(R.id.quick_contact_photo),
6682b7c07b33fe5f3e2bfdee1d5f4c68060a337028Flavio Lerda                view.findViewById(R.id.primary_action_view),
679b81f1d888772086e49fa39bfa3304f9e072614cFlavio Lerda                (ImageView) view.findViewById(R.id.secondary_action_icon),
68405695664582b4989cffcf054bf1aceb83dec437Flavio Lerda                view.findViewById(R.id.unheard_icon),
6933b28a1fc0e8ca5c2c285655d0ed8bd0dc275600Flavio Lerda                view.findViewById(R.id.divider),
7076921903290ba9229e0238395c35569cbadecb20Flavio Lerda                PhoneCallDetailsViews.fromView(view),
7176921903290ba9229e0238395c35569cbadecb20Flavio Lerda                view.findViewById(R.id.call_log_item),
7276921903290ba9229e0238395c35569cbadecb20Flavio Lerda                (TextView) view.findViewById(R.id.call_log_header_text));
73371d5f97d0b87ea0c9d8e8e178c04df34336a29eFlavio Lerda    }
74371d5f97d0b87ea0c9d8e8e178c04df34336a29eFlavio Lerda
75405695664582b4989cffcf054bf1aceb83dec437Flavio Lerda    public static CallLogListItemViews createForTest(Context context) {
76405695664582b4989cffcf054bf1aceb83dec437Flavio Lerda        return new CallLogListItemViews(
77405695664582b4989cffcf054bf1aceb83dec437Flavio Lerda                new QuickContactBadge(context),
7882b7c07b33fe5f3e2bfdee1d5f4c68060a337028Flavio Lerda                new View(context),
799b81f1d888772086e49fa39bfa3304f9e072614cFlavio Lerda                new ImageView(context),
80405695664582b4989cffcf054bf1aceb83dec437Flavio Lerda                new View(context),
81405695664582b4989cffcf054bf1aceb83dec437Flavio Lerda                new View(context),
82405695664582b4989cffcf054bf1aceb83dec437Flavio Lerda                PhoneCallDetailsViews.createForTest(context),
83405695664582b4989cffcf054bf1aceb83dec437Flavio Lerda                new View(context),
84405695664582b4989cffcf054bf1aceb83dec437Flavio Lerda                new TextView(context));
85371d5f97d0b87ea0c9d8e8e178c04df34336a29eFlavio Lerda    }
86bcb5f514cff58300fdb48ca883f08876076b23faFlavio Lerda}
87