blob: 6ab47aade6815297378e7087876f8c29401d7aac [file] [log] [blame]
Flavio Lerda9de38682011-07-08 20:38:07 +01001/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.contacts;
18
19import android.provider.CallLog.Calls;
20import android.provider.ContactsContract.CommonDataKinds.Phone;
21
22/**
23 * The details of a phone call to be shown in the UI.
24 */
25public class PhoneCallDetails {
26 /** The number of the other party involved in the call. */
27 public final CharSequence number;
Flavio Lerda371d5f92011-07-09 19:45:32 +010028 /** The formatted version of {@link #number}. */
29 public final CharSequence formattedNumber;
Flavio Lerda223a8432011-07-11 18:40:25 +010030 /**
31 * The type of calls, as defined in the call log table, e.g., {@link Calls#INCOMING_TYPE}.
32 * <p>
33 * There might be multiple types if this represents a set of entries grouped together.
34 */
35 public final int[] callTypes;
Flavio Lerda9de38682011-07-08 20:38:07 +010036 /** The date of the call, in milliseconds since the epoch. */
37 public final long date;
Flavio Lerda9a208cc2011-07-12 21:05:47 +010038 /** The duration of the call in milliseconds, or 0 for missed calls. */
39 public final long duration;
Flavio Lerda9de38682011-07-08 20:38:07 +010040 /** The name of the contact, or the empty string. */
41 public final CharSequence name;
42 /** The type of phone, e.g., {@link Phone#TYPE_HOME}, 0 if not available. */
43 public final int numberType;
44 /** The custom label associated with the phone number in the contact, or the empty string. */
45 public final CharSequence numberLabel;
Flavio Lerda178eeeb2011-07-11 19:51:40 +010046 /** The id of the contact associated with this phone call. */
47 public final long personId;
48 /** The photo id of the contact associated with this phone call. */
49 public final long photoId;
Flavio Lerda9de38682011-07-08 20:38:07 +010050
51 /** Create the details for a call with a number not associated with a contact. */
Flavio Lerda223a8432011-07-11 18:40:25 +010052 public PhoneCallDetails(CharSequence number, CharSequence formattedNumber, int[] callTypes,
Flavio Lerda9a208cc2011-07-12 21:05:47 +010053 long date, long duration) {
Flavio Lerda178eeeb2011-07-11 19:51:40 +010054 this(number, formattedNumber, callTypes, date, duration, "", 0, "", -1L, 0L);
Flavio Lerda9de38682011-07-08 20:38:07 +010055 }
56
57 /** Create the details for a call with a number associated with a contact. */
Flavio Lerda223a8432011-07-11 18:40:25 +010058 public PhoneCallDetails(CharSequence number, CharSequence formattedNumber, int[] callTypes,
Flavio Lerda178eeeb2011-07-11 19:51:40 +010059 long date, long duration, CharSequence name, int numberType, CharSequence numberLabel,
60 long personId, long photoId) {
Flavio Lerda9de38682011-07-08 20:38:07 +010061 this.number = number;
Flavio Lerda371d5f92011-07-09 19:45:32 +010062 this.formattedNumber = formattedNumber;
Flavio Lerda223a8432011-07-11 18:40:25 +010063 this.callTypes = callTypes;
Flavio Lerda9de38682011-07-08 20:38:07 +010064 this.date = date;
Flavio Lerda9a208cc2011-07-12 21:05:47 +010065 this.duration = duration;
Flavio Lerda9de38682011-07-08 20:38:07 +010066 this.name = name;
67 this.numberType = numberType;
68 this.numberLabel = numberLabel;
Flavio Lerda178eeeb2011-07-11 19:51:40 +010069 this.personId = personId;
70 this.photoId = photoId;
Flavio Lerda9de38682011-07-08 20:38:07 +010071 }
72}