1/* 2 * Copyright (C) 2016 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 17package com.android.tv.dvr.ui.list; 18 19import com.android.tv.data.Program; 20import com.android.tv.dvr.data.SeriesRecording; 21 22import java.util.List; 23 24/** 25 * A base class for the rows for schedules' header. 26 */ 27abstract class SchedulesHeaderRow { 28 private String mTitle; 29 private String mDescription; 30 private int mItemCount; 31 32 public SchedulesHeaderRow(String title, String description, int itemCount) { 33 mTitle = title; 34 mItemCount = itemCount; 35 mDescription = description; 36 } 37 38 /** 39 * Sets title. 40 */ 41 public void setTitle(String title) { 42 mTitle = title; 43 } 44 45 /** 46 * Sets description. 47 */ 48 public void setDescription(String description) { 49 mDescription = description; 50 } 51 52 /** 53 * Sets count of items. 54 */ 55 public void setItemCount(int itemCount) { 56 mItemCount = itemCount; 57 } 58 59 /** 60 * Returns title. 61 */ 62 public String getTitle() { 63 return mTitle; 64 } 65 66 /** 67 * Returns description. 68 */ 69 public String getDescription() { 70 return mDescription; 71 } 72 73 /** 74 * Returns count of items. 75 */ 76 public int getItemCount() { 77 return mItemCount; 78 } 79 80 /** 81 * The header row which represent the date. 82 */ 83 public static class DateHeaderRow extends SchedulesHeaderRow { 84 private long mDeadLineMs; 85 86 public DateHeaderRow(String title, String description, int itemCount, long deadLineMs) { 87 super(title, description, itemCount); 88 mDeadLineMs = deadLineMs; 89 } 90 91 /** 92 * Returns the latest time of the list which belongs to the header row. 93 */ 94 public long getDeadLineMs() { 95 return mDeadLineMs; 96 } 97 } 98 99 /** 100 * The header row which represent the series recording. 101 */ 102 public static class SeriesRecordingHeaderRow extends SchedulesHeaderRow { 103 private SeriesRecording mSeriesRecording; 104 private List<Program> mPrograms; 105 106 public SeriesRecordingHeaderRow(String title, String description, int itemCount, 107 SeriesRecording series, List<Program> programs) { 108 super(title, description, itemCount); 109 mSeriesRecording = series; 110 mPrograms = programs; 111 } 112 113 /** 114 * Returns the list of programs which belong to the series. 115 */ 116 public List<Program> getPrograms() { 117 return mPrograms; 118 } 119 120 /** 121 * Returns the series recording, it is for series schedules list. 122 */ 123 public SeriesRecording getSeriesRecording() { 124 return mSeriesRecording; 125 } 126 127 /** 128 * Sets the series recording. 129 */ 130 public void setSeriesRecording(SeriesRecording seriesRecording) { 131 mSeriesRecording = seriesRecording; 132 } 133 } 134}