1 /*
2  * Copyright (C) 2016 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 package com.android.contacts.logging;
17 
18 import com.google.common.base.MoreObjects;
19 
20 /**
21  * Describes how user view and use a list
22  */
23 public final class ListEvent {
24 
25     /** The type of action taken by the user. **/
26     public int actionType;
27 
28     /** The type of list the user is viewing. **/
29     public int listType;
30 
31     /** The number of contacts in the list. **/
32     public int count;
33 
34     /** The index of contact clicked by user. **/
35     public int clickedIndex = -1;
36 
37     /** The number of contact selected when user takes an action (link, delete, share, etc). **/
38     public int numSelected;
39 
40     // Should match ContactsExtension.ListEvent.ActionType values in
41     // http://cs/google3/logs/proto/wireless/android/contacts/contacts_extensions.proto
42     public static final class ActionType {
43         public static final int UNKNOWN = 0;
44         public static final int LOAD = 1;
45         public static final int CLICK = 2;
46         public static final int SELECT = 3;
47         public static final int SHARE = 4;
48         public static final int DELETE = 5;
49         public static final int LINK = 6;
50         public static final int REMOVE_LABEL = 7;
51 
ActionType()52         private ActionType() {
53         }
54     }
55 
56     // Should match ContactsExtension.ListEvent.ListType values in
57     // http://cs/google3/logs/proto/wireless/android/contacts/contacts_extensions.proto
58     public static final class ListType {
59         public static final int UNKNOWN_LIST = 0;
60         public static final int ALL_CONTACTS = 1;
61         public static final int ACCOUNT = 2;
62         public static final int GROUP = 3;
63         public static final int SEARCH_RESULT = 4;
64         public static final int DEVICE = 5;
65         public static final int CUSTOM = 6;
66         public static final int STARRED = 7;
67         public static final int PHONE_NUMBERS = 8;
68         public static final int SINGLE_CONTACT = 9;
69         public static final int PICK_CONTACT = 10;
70         public static final int PICK_CONTACT_FOR_SHORTCUT = 11;
71         public static final int PICK_PHONE = 12;
72         public static final int PICK_EMAIL = 13;
73         public static final int PICK_POSTAL = 14;
74         public static final int PICK_JOIN = 15;
75         public static final int PICK_GROUP_MEMBERS = 16;
76 
ListType()77         private ListType() {
78         }
79     }
80 
ListEvent()81     public ListEvent() {
82     }
83 
84     @Override
toString()85     public String toString() {
86         return MoreObjects.toStringHelper(this)
87                 .add("actionType", actionType)
88                 .add("listType", listType)
89                 .add("count", count)
90                 .add("clickedIndex", clickedIndex)
91                 .add("numSelected", numSelected)
92                 .toString();
93     }
94 }
95