blob: d4786d920ddcc451ac85b3ae501385a2c585ebdf [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
Daniel Lehmann362654a2011-07-17 14:16:47 -070019import android.net.Uri;
Flavio Lerda9de38682011-07-08 20:38:07 +010020import android.provider.CallLog.Calls;
21import android.provider.ContactsContract.CommonDataKinds.Phone;
22
23/**
24 * The details of a phone call to be shown in the UI.
25 */
26public class PhoneCallDetails {
27 /** The number of the other party involved in the call. */
28 public final CharSequence number;
Flavio Lerda371d5f92011-07-09 19:45:32 +010029 /** The formatted version of {@link #number}. */
30 public final CharSequence formattedNumber;
Flavio Lerda223a8432011-07-11 18:40:25 +010031 /**
32 * The type of calls, as defined in the call log table, e.g., {@link Calls#INCOMING_TYPE}.
33 * <p>
34 * There might be multiple types if this represents a set of entries grouped together.
35 */
36 public final int[] callTypes;
Flavio Lerda9de38682011-07-08 20:38:07 +010037 /** The date of the call, in milliseconds since the epoch. */
38 public final long date;
Flavio Lerda9a208cc2011-07-12 21:05:47 +010039 /** The duration of the call in milliseconds, or 0 for missed calls. */
40 public final long duration;
Flavio Lerda9de38682011-07-08 20:38:07 +010041 /** The name of the contact, or the empty string. */
42 public final CharSequence name;
43 /** The type of phone, e.g., {@link Phone#TYPE_HOME}, 0 if not available. */
44 public final int numberType;
45 /** The custom label associated with the phone number in the contact, or the empty string. */
46 public final CharSequence numberLabel;
Flavio Lerda178eeeb2011-07-11 19:51:40 +010047 /** The id of the contact associated with this phone call. */
48 public final long personId;
Daniel Lehmann362654a2011-07-17 14:16:47 -070049 /**
50 * The photo uri of the picture of the contact that is associated with this phone call or
51 * null if there is none.
52 */
53 public final Uri photoUri;
Flavio Lerda9de38682011-07-08 20:38:07 +010054
55 /** Create the details for a call with a number not associated with a contact. */
Flavio Lerda223a8432011-07-11 18:40:25 +010056 public PhoneCallDetails(CharSequence number, CharSequence formattedNumber, int[] callTypes,
Flavio Lerda9a208cc2011-07-12 21:05:47 +010057 long date, long duration) {
Daniel Lehmann362654a2011-07-17 14:16:47 -070058 this(number, formattedNumber, callTypes, date, duration, "", 0, "", -1L, null);
Flavio Lerda9de38682011-07-08 20:38:07 +010059 }
60
61 /** Create the details for a call with a number associated with a contact. */
Flavio Lerda223a8432011-07-11 18:40:25 +010062 public PhoneCallDetails(CharSequence number, CharSequence formattedNumber, int[] callTypes,
Flavio Lerda178eeeb2011-07-11 19:51:40 +010063 long date, long duration, CharSequence name, int numberType, CharSequence numberLabel,
Daniel Lehmann362654a2011-07-17 14:16:47 -070064 long personId, Uri photoUri) {
Flavio Lerda9de38682011-07-08 20:38:07 +010065 this.number = number;
Flavio Lerda371d5f92011-07-09 19:45:32 +010066 this.formattedNumber = formattedNumber;
Flavio Lerda223a8432011-07-11 18:40:25 +010067 this.callTypes = callTypes;
Flavio Lerda9de38682011-07-08 20:38:07 +010068 this.date = date;
Flavio Lerda9a208cc2011-07-12 21:05:47 +010069 this.duration = duration;
Flavio Lerda9de38682011-07-08 20:38:07 +010070 this.name = name;
71 this.numberType = numberType;
72 this.numberLabel = numberLabel;
Flavio Lerda178eeeb2011-07-11 19:51:40 +010073 this.personId = personId;
Daniel Lehmann362654a2011-07-17 14:16:47 -070074 this.photoUri = photoUri;
Flavio Lerda9de38682011-07-08 20:38:07 +010075 }
76}