blob: 547695c11e5210148bd37ca0d8e0470e67cc60da [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 Lerda71fc6ec2011-08-09 17:24:29 +010033 /** The geocoded location for the phone number. */
34 public final String geocode;
Flavio Lerda223a8432011-07-11 18:40:25 +010035 /**
36 * The type of calls, as defined in the call log table, e.g., {@link Calls#INCOMING_TYPE}.
37 * <p>
38 * There might be multiple types if this represents a set of entries grouped together.
39 */
40 public final int[] callTypes;
Flavio Lerda9de38682011-07-08 20:38:07 +010041 /** The date of the call, in milliseconds since the epoch. */
42 public final long date;
Flavio Lerda9a208cc2011-07-12 21:05:47 +010043 /** The duration of the call in milliseconds, or 0 for missed calls. */
44 public final long duration;
Flavio Lerda9de38682011-07-08 20:38:07 +010045 /** The name of the contact, or the empty string. */
46 public final CharSequence name;
47 /** The type of phone, e.g., {@link Phone#TYPE_HOME}, 0 if not available. */
48 public final int numberType;
49 /** The custom label associated with the phone number in the contact, or the empty string. */
50 public final CharSequence numberLabel;
Flavio Lerda071aa0d2011-08-22 10:26:27 +010051 /** The URI of the contact associated with this phone call. */
52 public final Uri contactUri;
Daniel Lehmann362654a2011-07-17 14:16:47 -070053 /**
Flavio Lerda071aa0d2011-08-22 10:26:27 +010054 * The photo URI of the picture of the contact that is associated with this phone call or
Daniel Lehmann362654a2011-07-17 14:16:47 -070055 * null if there is none.
Flavio Lerda5ee899e2011-08-23 14:47:41 +010056 * <p>
57 * This is meant to store the high-res photo only.
Daniel Lehmann362654a2011-07-17 14:16:47 -070058 */
59 public final Uri photoUri;
Flavio Lerda9de38682011-07-08 20:38:07 +010060
61 /** Create the details for a call with a number not associated with a contact. */
Flavio Lerdacb805e82011-07-18 10:31:44 +010062 public PhoneCallDetails(CharSequence number, CharSequence formattedNumber,
Flavio Lerda71fc6ec2011-08-09 17:24:29 +010063 String countryIso, String geocode, int[] callTypes, long date, long duration) {
64 this(number, formattedNumber, countryIso, geocode, callTypes, date, duration, "", 0, "",
Flavio Lerda071aa0d2011-08-22 10:26:27 +010065 null, null);
Flavio Lerda9de38682011-07-08 20:38:07 +010066 }
67
68 /** Create the details for a call with a number associated with a contact. */
Flavio Lerdacb805e82011-07-18 10:31:44 +010069 public PhoneCallDetails(CharSequence number, CharSequence formattedNumber,
Flavio Lerda71fc6ec2011-08-09 17:24:29 +010070 String countryIso, String geocode, int[] callTypes, long date, long duration,
Flavio Lerda071aa0d2011-08-22 10:26:27 +010071 CharSequence name, int numberType, CharSequence numberLabel, Uri contactUri,
Flavio Lerdacb805e82011-07-18 10:31:44 +010072 Uri photoUri) {
Flavio Lerda9de38682011-07-08 20:38:07 +010073 this.number = number;
Flavio Lerda371d5f92011-07-09 19:45:32 +010074 this.formattedNumber = formattedNumber;
Flavio Lerda9c466372011-07-19 17:38:17 +010075 this.countryIso = countryIso;
Flavio Lerda71fc6ec2011-08-09 17:24:29 +010076 this.geocode = geocode;
Flavio Lerda223a8432011-07-11 18:40:25 +010077 this.callTypes = callTypes;
Flavio Lerda9de38682011-07-08 20:38:07 +010078 this.date = date;
Flavio Lerda9a208cc2011-07-12 21:05:47 +010079 this.duration = duration;
Flavio Lerda9de38682011-07-08 20:38:07 +010080 this.name = name;
81 this.numberType = numberType;
82 this.numberLabel = numberLabel;
Flavio Lerda071aa0d2011-08-22 10:26:27 +010083 this.contactUri = contactUri;
Daniel Lehmann362654a2011-07-17 14:16:47 -070084 this.photoUri = photoUri;
Flavio Lerda9de38682011-07-08 20:38:07 +010085 }
86}