• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2018 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.glidephotomanager;
18 
19 import android.support.annotation.Nullable;
20 import com.google.auto.value.AutoValue;
21 
22 /** The number information used to create the photo.. */
23 @AutoValue
24 public abstract class PhotoInfo {
25 
26   /** The display name of the number */
27   @Nullable
name()28   public abstract String name();
29 
30   /** The number displayed to the user. */
31   @Nullable
formattedNumber()32   public abstract String formattedNumber();
33 
34   /** The URI to the photo */
35   @Nullable
photoUri()36   public abstract String photoUri();
37 
38   /** Value of {@link android.provider.ContactsContract.CommonDataKinds.Photo#_ID} */
photoId()39   public abstract long photoId();
40 
41   /** The contacts provider lookup URI for the contact associated with the number */
42   @Nullable
lookupUri()43   public abstract String lookupUri();
44 
45   /** Should a business icon be displayed */
isBusiness()46   public abstract boolean isBusiness();
47 
48   /** Should a voicemail icon be displayed */
isVoicemail()49   public abstract boolean isVoicemail();
50 
51   /** Should a blocked icon be displayed */
isBlocked()52   public abstract boolean isBlocked();
53 
54   /** Should a spam icon be displayed */
isSpam()55   public abstract boolean isSpam();
56 
57   /**
58    * Should the photo be badged as video call.
59    *
60    * <p>Defaults to false.
61    */
isVideo()62   public abstract boolean isVideo();
63 
64   /** Builder for {@link PhotoInfo} */
65   @AutoValue.Builder
66   public abstract static class Builder {
67 
setName(@ullable String name)68     public abstract Builder setName(@Nullable String name);
69 
setFormattedNumber(@ullable String formattedNumber)70     public abstract Builder setFormattedNumber(@Nullable String formattedNumber);
71 
setPhotoUri(@ullable String uri)72     public abstract Builder setPhotoUri(@Nullable String uri);
73 
setPhotoId(long id)74     public abstract Builder setPhotoId(long id);
75 
setLookupUri(@ullable String uri)76     public abstract Builder setLookupUri(@Nullable String uri);
77 
setIsBusiness(boolean isBusiness)78     public abstract Builder setIsBusiness(boolean isBusiness);
79 
setIsVoicemail(boolean isVoicemail)80     public abstract Builder setIsVoicemail(boolean isVoicemail);
81 
setIsBlocked(boolean isBlocked)82     public abstract Builder setIsBlocked(boolean isBlocked);
83 
setIsSpam(boolean isSpam)84     public abstract Builder setIsSpam(boolean isSpam);
85 
setIsVideo(boolean isVideo)86     public abstract Builder setIsVideo(boolean isVideo);
87 
build()88     public abstract PhotoInfo build();
89   }
90 
builder()91   public static PhotoInfo.Builder builder() {
92     return new AutoValue_PhotoInfo.Builder()
93         .setPhotoId(0)
94         .setIsBusiness(false)
95         .setIsVoicemail(false)
96         .setIsBlocked(false)
97         .setIsSpam(false)
98         .setIsVideo(false);
99   }
100 }
101