1 /* 2 * Copyright (C) 2017 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 17 package com.android.dialer.calllog.model; 18 19 import android.support.annotation.ColorInt; 20 import android.support.annotation.Nullable; 21 import com.android.dialer.CoalescedIds; 22 import com.android.dialer.DialerPhoneNumber; 23 import com.android.dialer.NumberAttributes; 24 import com.google.auto.value.AutoValue; 25 26 /** Data class containing the contents of a row from the CoalescedAnnotatedCallLog. */ 27 @AutoValue 28 public abstract class CoalescedRow { 29 builder()30 public static Builder builder() { 31 return new AutoValue_CoalescedRow.Builder() 32 .setId(0) 33 .setTimestamp(0) 34 .setNumber(DialerPhoneNumber.getDefaultInstance()) 35 .setNumberPresentation(0) 36 .setIsRead(false) 37 .setIsNew(false) 38 .setPhoneAccountColor(0) 39 .setFeatures(0) 40 .setCallType(0) 41 .setNumberAttributes(NumberAttributes.getDefaultInstance()) 42 .setCoalescedIds(CoalescedIds.getDefaultInstance()); 43 } 44 toBuilder()45 public abstract Builder toBuilder(); 46 id()47 public abstract int id(); 48 timestamp()49 public abstract long timestamp(); 50 number()51 public abstract DialerPhoneNumber number(); 52 53 @Nullable formattedNumber()54 public abstract String formattedNumber(); 55 numberPresentation()56 public abstract int numberPresentation(); 57 isRead()58 public abstract boolean isRead(); 59 isNew()60 public abstract boolean isNew(); 61 62 @Nullable geocodedLocation()63 public abstract String geocodedLocation(); 64 65 @Nullable phoneAccountComponentName()66 public abstract String phoneAccountComponentName(); 67 68 @Nullable phoneAccountId()69 public abstract String phoneAccountId(); 70 71 @Nullable phoneAccountLabel()72 public abstract String phoneAccountLabel(); 73 74 @ColorInt phoneAccountColor()75 public abstract int phoneAccountColor(); 76 features()77 public abstract int features(); 78 callType()79 public abstract int callType(); 80 numberAttributes()81 public abstract NumberAttributes numberAttributes(); 82 coalescedIds()83 public abstract CoalescedIds coalescedIds(); 84 85 /** Builder for {@link CoalescedRow}. */ 86 @AutoValue.Builder 87 public abstract static class Builder { 88 setId(int id)89 public abstract Builder setId(int id); 90 setTimestamp(long timestamp)91 public abstract Builder setTimestamp(long timestamp); 92 setNumber(DialerPhoneNumber number)93 public abstract Builder setNumber(DialerPhoneNumber number); 94 setFormattedNumber(@ullable String formattedNumber)95 public abstract Builder setFormattedNumber(@Nullable String formattedNumber); 96 setNumberPresentation(int presentation)97 public abstract Builder setNumberPresentation(int presentation); 98 setIsRead(boolean isRead)99 public abstract Builder setIsRead(boolean isRead); 100 setIsNew(boolean isNew)101 public abstract Builder setIsNew(boolean isNew); 102 setGeocodedLocation(@ullable String geocodedLocation)103 public abstract Builder setGeocodedLocation(@Nullable String geocodedLocation); 104 setPhoneAccountComponentName( @ullable String phoneAccountComponentName)105 public abstract Builder setPhoneAccountComponentName( 106 @Nullable String phoneAccountComponentName); 107 setPhoneAccountId(@ullable String phoneAccountId)108 public abstract Builder setPhoneAccountId(@Nullable String phoneAccountId); 109 setPhoneAccountLabel(@ullable String phoneAccountLabel)110 public abstract Builder setPhoneAccountLabel(@Nullable String phoneAccountLabel); 111 setPhoneAccountColor(@olorInt int phoneAccountColor)112 public abstract Builder setPhoneAccountColor(@ColorInt int phoneAccountColor); 113 setFeatures(int features)114 public abstract Builder setFeatures(int features); 115 setCallType(int callType)116 public abstract Builder setCallType(int callType); 117 setNumberAttributes(NumberAttributes numberAttributes)118 public abstract Builder setNumberAttributes(NumberAttributes numberAttributes); 119 setCoalescedIds(CoalescedIds coalescedIds)120 public abstract Builder setCoalescedIds(CoalescedIds coalescedIds); 121 build()122 public abstract CoalescedRow build(); 123 } 124 } 125