blob: 347a303f40cbc7f8e9249016596c1a189fce2c54 [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 Lerda9c466372011-07-19 17:38:17 +010031 /** The country corresponding with the phone number. */
32 public final String countryIso;
Flavio Lerda223a8432011-07-11 18:40:25 +010033 /**
34 * The type of calls, as defined in the call log table, e.g., {@link Calls#INCOMING_TYPE}.
35 * <p>
36 * There might be multiple types if this represents a set of entries grouped together.
37 */
38 public final int[] callTypes;
Flavio Lerda9de38682011-07-08 20:38:07 +010039 /** The date of the call, in milliseconds since the epoch. */
40 public final long date;
Flavio Lerda9a208cc2011-07-12 21:05:47 +010041 /** The duration of the call in milliseconds, or 0 for missed calls. */
42 public final long duration;
Flavio Lerda9de38682011-07-08 20:38:07 +010043 /** The name of the contact, or the empty string. */
44 public final CharSequence name;
45 /** The type of phone, e.g., {@link Phone#TYPE_HOME}, 0 if not available. */
46 public final int numberType;
47 /** The custom label associated with the phone number in the contact, or the empty string. */
48 public final CharSequence numberLabel;
Flavio Lerda178eeeb2011-07-11 19:51:40 +010049 /** The id of the contact associated with this phone call. */
50 public final long personId;
Daniel Lehmann362654a2011-07-17 14:16:47 -070051 /**
52 * The photo uri of the picture of the contact that is associated with this phone call or
53 * null if there is none.
54 */
55 public final Uri photoUri;
Flavio Lerda9de38682011-07-08 20:38:07 +010056
57 /** Create the details for a call with a number not associated with a contact. */
Flavio Lerdacb805e82011-07-18 10:31:44 +010058 public PhoneCallDetails(CharSequence number, CharSequence formattedNumber,
Flavio Lerda9c466372011-07-19 17:38:17 +010059 String countryIso, int[] callTypes, long date, long duration) {
60 this(number, formattedNumber, countryIso, callTypes, date, duration, "", 0, "", -1L, null);
Flavio Lerda9de38682011-07-08 20:38:07 +010061 }
62
63 /** Create the details for a call with a number associated with a contact. */
Flavio Lerdacb805e82011-07-18 10:31:44 +010064 public PhoneCallDetails(CharSequence number, CharSequence formattedNumber,
Flavio Lerda9c466372011-07-19 17:38:17 +010065 String countryIso, int[] callTypes, long date, long duration,
Flavio Lerdacb805e82011-07-18 10:31:44 +010066 CharSequence name, int numberType, CharSequence numberLabel, long personId,
67 Uri photoUri) {
Flavio Lerda9de38682011-07-08 20:38:07 +010068 this.number = number;
Flavio Lerda371d5f92011-07-09 19:45:32 +010069 this.formattedNumber = formattedNumber;
Flavio Lerda9c466372011-07-19 17:38:17 +010070 this.countryIso = countryIso;
Flavio Lerda223a8432011-07-11 18:40:25 +010071 this.callTypes = callTypes;
Flavio Lerda9de38682011-07-08 20:38:07 +010072 this.date = date;
Flavio Lerda9a208cc2011-07-12 21:05:47 +010073 this.duration = duration;
Flavio Lerda9de38682011-07-08 20:38:07 +010074 this.name = name;
75 this.numberType = numberType;
76 this.numberLabel = numberLabel;
Flavio Lerda178eeeb2011-07-11 19:51:40 +010077 this.personId = personId;
Daniel Lehmann362654a2011-07-17 14:16:47 -070078 this.photoUri = photoUri;
Flavio Lerda9de38682011-07-08 20:38:07 +010079 }
80}