1 /* 2 * Copyright (C) 2020 Google Inc. 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.car.carlauncher.homescreen.ui; 18 19 import android.graphics.drawable.Drawable; 20 21 /** 22 * Defines the content displayed below the header on a home app's card. 23 */ 24 public abstract class CardContent { 25 26 /** 27 * The finite set of layouts supported by the home app each of which corresponds to an XML file. 28 * DESCRIPTIVE_TEXT: card_content_descriptive_text_only.xml 29 * DESCRIPTIVE_TEXT_WITH_CONTROLS: card_content_descriptive_text_with_controls.xml 30 * TEXT_BLOCK: card_content_text_block.xml 31 */ 32 public enum HomeCardContentType { 33 DESCRIPTIVE_TEXT, 34 DESCRIPTIVE_TEXT_WITH_CONTROLS, 35 TEXT_BLOCK, 36 } 37 38 /** 39 * Returns the type of content layout 40 */ getType()41 public abstract HomeCardContentType getType(); 42 43 /** 44 * Defines contents of Card background Image. 45 */ 46 public static class CardBackgroundImage { 47 48 private Drawable mBackground; 49 private Drawable mForeground; 50 CardBackgroundImage(Drawable foreground, Drawable background)51 public CardBackgroundImage(Drawable foreground, Drawable background) { 52 mForeground = foreground; 53 mBackground = background; 54 } 55 56 /** 57 * Returns the drawable to use as background for the Image. 58 */ getBackground()59 public Drawable getBackground() { 60 return mBackground; 61 } 62 63 /** 64 * Returns the drawable to use as content for the Image. 65 */ getForeground()66 public Drawable getForeground() { 67 return mForeground; 68 } 69 } 70 } 71