Home | History | Annotate | Download | only in logging
      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.common.logging;
     17 
     18 import android.app.Activity;
     19 import com.android.contacts.commonbind.analytics.AnalyticsUtil;
     20 
     21 /**
     22  * Stores constants identifying individual screens/dialogs/fragments in the application, and also
     23  * provides a mapping of integer id -> screen name mappings for analytics purposes.
     24  */
     25 public final class ScreenEvent {
     26 
     27     // Should match ContactsExtension.ScreenEvent.ScreenType values in
     28     // http://cs/google3/logs/proto/wireless/android/contacts/contacts_extensions.proto
     29     public static final class ScreenType {
     30         public static final int UNKNOWN = 0;
     31         public static final int SEARCH = 1;
     32         public static final int SEARCH_EXIT = 2;
     33         public static final int FAVORITES = 3;
     34         public static final int ALL_CONTACTS = 4;
     35         public static final int QUICK_CONTACT = 5;
     36         public static final int EDITOR = 6;
     37 
     38         private ScreenType() {
     39         }
     40 
     41         public static String getFriendlyName(int screenType) {
     42             switch (screenType) {
     43                 case SEARCH: // fall-through
     44                 case SEARCH_EXIT: return "Search";
     45                 case FAVORITES: return "Favorites";
     46                 case ALL_CONTACTS: return "AllContacts";
     47                 case QUICK_CONTACT: return "QuickContact";
     48                 case EDITOR: return "Editor";
     49                 case UNKNOWN: // fall-through
     50                 default: return null;
     51             }
     52         }
     53     }
     54 
     55     private ScreenEvent() {
     56     }
     57 }
     58