• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package com.android.car.carlauncher;
2 
3 import android.content.Intent;
4 import android.graphics.drawable.Drawable;
5 
6 import androidx.annotation.Nullable;
7 
8 final class ContextualInfo {
9     private final Drawable mIcon;
10     private final CharSequence mTopLine;
11     private final @Nullable CharSequence mBottomLine;
12     private final boolean mShowClock;
13     private final Intent mOnClickActivity;
14 
ContextualInfo( Drawable icon, CharSequence topLine, @Nullable CharSequence bottomLine, boolean showClock, @Nullable Intent onClickActivity)15     public ContextualInfo(
16             Drawable icon,
17             CharSequence topLine,
18             @Nullable CharSequence bottomLine,
19             boolean showClock,
20             @Nullable Intent onClickActivity) {
21         mIcon = icon;
22         mTopLine = topLine;
23         mBottomLine = bottomLine;
24         mShowClock = showClock;
25         mOnClickActivity = onClickActivity;
26     }
27 
28     /** Gets the icon to be shown in the contextual space. */
getIcon()29     public Drawable getIcon() {
30         return mIcon;
31     }
32 
33     /** Gets the top line of the text to be shown in the contextual space. */
getTopLine()34     public CharSequence getTopLine() {
35         return mTopLine;
36     }
37 
38     /**
39      * Gets the bottom line of the text to be shown in the contextual space.
40      *
41      * If null, no bottom-line text will be shown in the contextual space.
42      */
43     @Nullable
getBottomLine()44     public CharSequence getBottomLine() {
45         return mBottomLine;
46     }
47 
48     /** Gets whether to show the date in the contextual space. */
getShowClock()49     public boolean getShowClock() {
50         return mShowClock;
51     }
52 
53     /**
54      * Gets the {@link Intent} for the activity to be started when the contextual space is tapped.
55      *
56      * If null, the contextual space will not be tappable.
57      */
58     @Nullable
getOnClickActivity()59     public Intent getOnClickActivity() {
60         return mOnClickActivity;
61     }
62 }
63