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