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 */ 16package com.android.dialer.historyitemactions; 17 18import android.content.Intent; 19import android.support.annotation.NonNull; 20import android.support.annotation.Nullable; 21import com.android.dialer.DialerPhoneNumber; 22import com.android.dialer.glidephotomanager.PhotoInfo; 23import 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 31public abstract class HistoryItemPrimaryActionInfo { 32 33 @Nullable 34 public abstract DialerPhoneNumber number(); 35 36 @NonNull 37 public abstract PhotoInfo photoInfo(); 38 39 @Nullable 40 public abstract CharSequence primaryText(); 41 42 @Nullable 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 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 { 57 public abstract Builder setNumber(@Nullable DialerPhoneNumber dialerPhoneNumber); 58 59 public abstract Builder setPhotoInfo(@NonNull PhotoInfo photoInfo); 60 61 public abstract Builder setPrimaryText(@Nullable CharSequence primaryText); 62 63 public abstract Builder setSecondaryText(@Nullable CharSequence secondaryText); 64 65 public abstract Builder setIntent(@Nullable Intent intent); 66 67 public abstract HistoryItemPrimaryActionInfo build(); 68 } 69 70 public static Builder builder() { 71 return new AutoValue_HistoryItemPrimaryActionInfo.Builder(); 72 } 73} 74