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 package com.android.tv.data.api; 17 18 import android.content.Context; 19 import android.content.Intent; 20 import android.net.Uri; 21 import android.support.annotation.Nullable; 22 import com.android.tv.util.images.ImageLoader.ImageLoaderCallback; 23 24 /** 25 * Interface for {@link com.android.tv.data.ChannelImpl}. 26 * 27 * <p><b>NOTE</b> Normally you should not use an interface for a data object like {@code 28 * ChannelImpl}, however there are many circular dependencies. An interface is the easiest way to 29 * break the cycles. 30 */ 31 public interface Channel { 32 33 long INVALID_ID = -1; 34 int LOAD_IMAGE_TYPE_CHANNEL_LOGO = 1; 35 int LOAD_IMAGE_TYPE_APP_LINK_ICON = 2; 36 int LOAD_IMAGE_TYPE_APP_LINK_POSTER_ART = 3; 37 /** 38 * When a TIS doesn't provide any information about app link, and it doesn't have a leanback 39 * launch intent, there will be no app link card for the TIS. 40 */ 41 int APP_LINK_TYPE_NONE = -1; 42 /** 43 * When a TIS provide a specific app link information, the app link card will be {@code 44 * APP_LINK_TYPE_CHANNEL} which contains all the provided information. 45 */ 46 int APP_LINK_TYPE_CHANNEL = 1; 47 /** 48 * When a TIS doesn't provide a specific app link information, but the app has a leanback launch 49 * intent, the app link card will be {@code APP_LINK_TYPE_APP} which launches the application. 50 */ 51 int APP_LINK_TYPE_APP = 2; 52 /** Channel number delimiter between major and minor parts. */ 53 char CHANNEL_NUMBER_DELIMITER = '-'; 54 getId()55 long getId(); 56 getUri()57 Uri getUri(); 58 getPackageName()59 String getPackageName(); 60 getInputId()61 String getInputId(); 62 getType()63 String getType(); 64 getDisplayNumber()65 String getDisplayNumber(); 66 67 @Nullable getDisplayName()68 String getDisplayName(); 69 getDescription()70 String getDescription(); 71 getVideoFormat()72 String getVideoFormat(); 73 isPassthrough()74 boolean isPassthrough(); 75 getDisplayText()76 String getDisplayText(); 77 getAppLinkText()78 String getAppLinkText(); 79 getAppLinkColor()80 int getAppLinkColor(); 81 getAppLinkIconUri()82 String getAppLinkIconUri(); 83 getAppLinkPosterArtUri()84 String getAppLinkPosterArtUri(); 85 getAppLinkIntentUri()86 String getAppLinkIntentUri(); 87 getLogoUri()88 String getLogoUri(); 89 isRecordingProhibited()90 boolean isRecordingProhibited(); 91 isPhysicalTunerChannel()92 boolean isPhysicalTunerChannel(); 93 isBrowsable()94 boolean isBrowsable(); 95 isSearchable()96 boolean isSearchable(); 97 isLocked()98 boolean isLocked(); 99 hasSameReadOnlyInfo(Channel mCurrentChannel)100 boolean hasSameReadOnlyInfo(Channel mCurrentChannel); 101 setChannelLogoExist(boolean result)102 void setChannelLogoExist(boolean result); 103 setBrowsable(boolean browsable)104 void setBrowsable(boolean browsable); 105 setLocked(boolean locked)106 void setLocked(boolean locked); 107 copyFrom(Channel channel)108 void copyFrom(Channel channel); 109 setLogoUri(String logoUri)110 void setLogoUri(String logoUri); 111 channelLogoExists()112 boolean channelLogoExists(); 113 loadBitmap( Context context, int loadImageTypeChannelLogo, int mChannelLogoImageViewWidth, int mChannelLogoImageViewHeight, ImageLoaderCallback<?> channelLogoCallback)114 void loadBitmap( 115 Context context, 116 int loadImageTypeChannelLogo, 117 int mChannelLogoImageViewWidth, 118 int mChannelLogoImageViewHeight, 119 ImageLoaderCallback<?> channelLogoCallback); 120 getAppLinkType(Context context)121 int getAppLinkType(Context context); 122 getAppLinkIntent(Context context)123 Intent getAppLinkIntent(Context context); 124 prefetchImage( Context mContext, int loadImageTypeChannelLogo, int mPosterArtWidth, int mPosterArtHeight)125 void prefetchImage( 126 Context mContext, 127 int loadImageTypeChannelLogo, 128 int mPosterArtWidth, 129 int mPosterArtHeight); 130 } 131