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 getNetworkAffiliation()88 String getNetworkAffiliation(); 89 getLogoUri()90 String getLogoUri(); 91 isRecordingProhibited()92 boolean isRecordingProhibited(); 93 isPhysicalTunerChannel()94 boolean isPhysicalTunerChannel(); 95 isBrowsable()96 boolean isBrowsable(); 97 isSearchable()98 boolean isSearchable(); 99 isLocked()100 boolean isLocked(); 101 hasSameReadOnlyInfo(Channel mCurrentChannel)102 boolean hasSameReadOnlyInfo(Channel mCurrentChannel); 103 setChannelLogoExist(boolean result)104 void setChannelLogoExist(boolean result); 105 setBrowsable(boolean browsable)106 void setBrowsable(boolean browsable); 107 setLocked(boolean locked)108 void setLocked(boolean locked); 109 copyFrom(Channel channel)110 void copyFrom(Channel channel); 111 setLogoUri(String logoUri)112 void setLogoUri(String logoUri); 113 setNetworkAffiliation(String networkAffiliation)114 void setNetworkAffiliation(String networkAffiliation); 115 channelLogoExists()116 boolean channelLogoExists(); 117 loadBitmap( Context context, int loadImageTypeChannelLogo, int mChannelLogoImageViewWidth, int mChannelLogoImageViewHeight, ImageLoaderCallback<?> channelLogoCallback)118 void loadBitmap( 119 Context context, 120 int loadImageTypeChannelLogo, 121 int mChannelLogoImageViewWidth, 122 int mChannelLogoImageViewHeight, 123 ImageLoaderCallback<?> channelLogoCallback); 124 getAppLinkType(Context context)125 int getAppLinkType(Context context); 126 getAppLinkIntent(Context context)127 Intent getAppLinkIntent(Context context); 128 prefetchImage( Context mContext, int loadImageTypeChannelLogo, int mPosterArtWidth, int mPosterArtHeight)129 void prefetchImage( 130 Context mContext, 131 int loadImageTypeChannelLogo, 132 int mPosterArtWidth, 133 int mPosterArtHeight); 134 } 135