CallLogListItemViews.java revision 405695664582b4989cffcf054bf1aceb83dec437
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; 24bcb5f514cff58300fdb48ca883f08876076b23faFlavio Lerdaimport android.widget.QuickContactBadge; 2576921903290ba9229e0238395c35569cbadecb20Flavio Lerdaimport android.widget.TextView; 26d2031e0c809580219faa55a27c237c7bdf8505a5Flavio Lerda 27d2031e0c809580219faa55a27c237c7bdf8505a5Flavio Lerda/** 28d2031e0c809580219faa55a27c237c7bdf8505a5Flavio Lerda * Simple value object containing the various views within a call log entry. 29d2031e0c809580219faa55a27c237c7bdf8505a5Flavio Lerda */ 30d2031e0c809580219faa55a27c237c7bdf8505a5Flavio Lerdapublic final class CallLogListItemViews { 31bcb5f514cff58300fdb48ca883f08876076b23faFlavio Lerda /** The quick contact badge for the contact. Only present for group and stand alone entries. */ 32371d5f97d0b87ea0c9d8e8e178c04df34336a29eFlavio Lerda public final QuickContactBadge photoView; 33371d5f97d0b87ea0c9d8e8e178c04df34336a29eFlavio Lerda /** The main action button on the entry. */ 34405695664582b4989cffcf054bf1aceb83dec437Flavio Lerda public final View callView; 35a113689156ac38177fb8fdf82e5327c3f916d331Flavio Lerda /** The play action button used for voicemail. */ 36405695664582b4989cffcf054bf1aceb83dec437Flavio Lerda public final View playView; 37405695664582b4989cffcf054bf1aceb83dec437Flavio Lerda /** The icon used for unheard voicemail. */ 38405695664582b4989cffcf054bf1aceb83dec437Flavio Lerda public final View unheardView; 3933b28a1fc0e8ca5c2c285655d0ed8bd0dc275600Flavio Lerda /** The divider between callView and playView. */ 4033b28a1fc0e8ca5c2c285655d0ed8bd0dc275600Flavio Lerda public final View dividerView; 41371d5f97d0b87ea0c9d8e8e178c04df34336a29eFlavio Lerda /** The details of the phone call. */ 42371d5f97d0b87ea0c9d8e8e178c04df34336a29eFlavio Lerda public final PhoneCallDetailsViews phoneCallDetailsViews; 4376921903290ba9229e0238395c35569cbadecb20Flavio Lerda /** The item view for a stand-alone row, or null for other types of rows. */ 447594d799dc8b4486148cdcd586b5dcd24a679211Flavio Lerda public final View listItemView; 4576921903290ba9229e0238395c35569cbadecb20Flavio Lerda /** The header view for a stand-alone row, or null for other types of rows. */ 467594d799dc8b4486148cdcd586b5dcd24a679211Flavio Lerda public final View listHeaderView; 4776921903290ba9229e0238395c35569cbadecb20Flavio Lerda /** The text of the header in a stand-alone row, or null for other types of rows. */ 487594d799dc8b4486148cdcd586b5dcd24a679211Flavio Lerda public final TextView listHeaderTextView; 49371d5f97d0b87ea0c9d8e8e178c04df34336a29eFlavio Lerda 50405695664582b4989cffcf054bf1aceb83dec437Flavio Lerda private CallLogListItemViews(QuickContactBadge photoView, View callView, 51405695664582b4989cffcf054bf1aceb83dec437Flavio Lerda View playView, View unheardView, View dividerView, 52405695664582b4989cffcf054bf1aceb83dec437Flavio Lerda PhoneCallDetailsViews phoneCallDetailsViews, View listItemView, View listHeaderView, 53405695664582b4989cffcf054bf1aceb83dec437Flavio Lerda TextView listHeaderTextView) { 54371d5f97d0b87ea0c9d8e8e178c04df34336a29eFlavio Lerda this.photoView = photoView; 55371d5f97d0b87ea0c9d8e8e178c04df34336a29eFlavio Lerda this.callView = callView; 56a113689156ac38177fb8fdf82e5327c3f916d331Flavio Lerda this.playView = playView; 57405695664582b4989cffcf054bf1aceb83dec437Flavio Lerda this.unheardView = unheardView; 5833b28a1fc0e8ca5c2c285655d0ed8bd0dc275600Flavio Lerda this.dividerView = dividerView; 59371d5f97d0b87ea0c9d8e8e178c04df34336a29eFlavio Lerda this.phoneCallDetailsViews = phoneCallDetailsViews; 607594d799dc8b4486148cdcd586b5dcd24a679211Flavio Lerda this.listItemView = listItemView; 617594d799dc8b4486148cdcd586b5dcd24a679211Flavio Lerda this.listHeaderView = listHeaderView; 627594d799dc8b4486148cdcd586b5dcd24a679211Flavio Lerda this.listHeaderTextView = listHeaderTextView; 63371d5f97d0b87ea0c9d8e8e178c04df34336a29eFlavio Lerda } 64371d5f97d0b87ea0c9d8e8e178c04df34336a29eFlavio Lerda 65371d5f97d0b87ea0c9d8e8e178c04df34336a29eFlavio Lerda public static CallLogListItemViews fromView(View view) { 66371d5f97d0b87ea0c9d8e8e178c04df34336a29eFlavio Lerda return new CallLogListItemViews((QuickContactBadge) view.findViewById(R.id.contact_photo), 67405695664582b4989cffcf054bf1aceb83dec437Flavio Lerda view.findViewById(R.id.call_icon), 68405695664582b4989cffcf054bf1aceb83dec437Flavio Lerda view.findViewById(R.id.play_icon), 69405695664582b4989cffcf054bf1aceb83dec437Flavio Lerda view.findViewById(R.id.unheard_icon), 7033b28a1fc0e8ca5c2c285655d0ed8bd0dc275600Flavio Lerda view.findViewById(R.id.divider), 7176921903290ba9229e0238395c35569cbadecb20Flavio Lerda PhoneCallDetailsViews.fromView(view), 7276921903290ba9229e0238395c35569cbadecb20Flavio Lerda view.findViewById(R.id.call_log_item), 7376921903290ba9229e0238395c35569cbadecb20Flavio Lerda view.findViewById(R.id.call_log_header), 7476921903290ba9229e0238395c35569cbadecb20Flavio Lerda (TextView) view.findViewById(R.id.call_log_header_text)); 75371d5f97d0b87ea0c9d8e8e178c04df34336a29eFlavio Lerda } 76371d5f97d0b87ea0c9d8e8e178c04df34336a29eFlavio Lerda 77405695664582b4989cffcf054bf1aceb83dec437Flavio Lerda public static CallLogListItemViews createForTest(Context context) { 78405695664582b4989cffcf054bf1aceb83dec437Flavio Lerda return new CallLogListItemViews( 79405695664582b4989cffcf054bf1aceb83dec437Flavio Lerda new QuickContactBadge(context), 80405695664582b4989cffcf054bf1aceb83dec437Flavio Lerda new View(context), 81405695664582b4989cffcf054bf1aceb83dec437Flavio Lerda new View(context), 82405695664582b4989cffcf054bf1aceb83dec437Flavio Lerda new View(context), 83405695664582b4989cffcf054bf1aceb83dec437Flavio Lerda new View(context), 84405695664582b4989cffcf054bf1aceb83dec437Flavio Lerda PhoneCallDetailsViews.createForTest(context), 85405695664582b4989cffcf054bf1aceb83dec437Flavio Lerda new View(context), 86405695664582b4989cffcf054bf1aceb83dec437Flavio Lerda new View(context), 87405695664582b4989cffcf054bf1aceb83dec437Flavio Lerda new TextView(context)); 88371d5f97d0b87ea0c9d8e8e178c04df34336a29eFlavio Lerda } 89bcb5f514cff58300fdb48ca883f08876076b23faFlavio Lerda} 90