• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 package com.android.dialer.historyitemactions;
17 
18 import android.content.Intent;
19 import android.support.annotation.NonNull;
20 import android.support.annotation.Nullable;
21 import com.android.dialer.DialerPhoneNumber;
22 import com.android.dialer.glidephotomanager.PhotoInfo;
23 import com.google.auto.value.AutoValue;
24 
25 /**
26  * Contains information necessary to construct the primary action for a history item's bottom sheet.
27  *
28  * <p>A history item is one that is displayed in the call log or the voicemail fragment.
29  */
30 @AutoValue
31 public abstract class HistoryItemPrimaryActionInfo {
32 
33   @Nullable
number()34   public abstract DialerPhoneNumber number();
35 
36   @NonNull
photoInfo()37   public abstract PhotoInfo photoInfo();
38 
39   @Nullable
primaryText()40   public abstract CharSequence primaryText();
41 
42   @Nullable
secondaryText()43   public abstract CharSequence secondaryText();
44 
45   /**
46    * The intent to fire when the user clicks the top row of the bottom sheet. Null if no action
47    * should occur (e.g. if the number is unknown).
48    */
49   @Nullable
intent()50   public abstract Intent intent();
51 
52   // TODO(zachh): Add SIM info here if should be shown in bottom sheet.
53 
54   /** Builder for {@link HistoryItemPrimaryActionInfo}. */
55   @AutoValue.Builder
56   public abstract static class Builder {
setNumber(@ullable DialerPhoneNumber dialerPhoneNumber)57     public abstract Builder setNumber(@Nullable DialerPhoneNumber dialerPhoneNumber);
58 
setPhotoInfo(@onNull PhotoInfo photoInfo)59     public abstract Builder setPhotoInfo(@NonNull PhotoInfo photoInfo);
60 
setPrimaryText(@ullable CharSequence primaryText)61     public abstract Builder setPrimaryText(@Nullable CharSequence primaryText);
62 
setSecondaryText(@ullable CharSequence secondaryText)63     public abstract Builder setSecondaryText(@Nullable CharSequence secondaryText);
64 
setIntent(@ullable Intent intent)65     public abstract Builder setIntent(@Nullable Intent intent);
66 
build()67     public abstract HistoryItemPrimaryActionInfo build();
68   }
69 
builder()70   public static Builder builder() {
71     return new AutoValue_HistoryItemPrimaryActionInfo.Builder();
72   }
73 }
74