本文整理汇总了Java中android.media.tv.TvInputInfo.canRecord方法的典型用法代码示例。如果您正苦于以下问题:Java TvInputInfo.canRecord方法的具体用法?Java TvInputInfo.canRecord怎么用?Java TvInputInfo.canRecord使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.media.tv.TvInputInfo
的用法示例。
在下文中一共展示了TvInputInfo.canRecord方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isChannelRecordable
import android.media.tv.TvInputInfo; //导入方法依赖的package包/类
/**
* Returns {@code true} if the channel can be recorded.
* <p>
* Note that this method doesn't check the conflict of the schedule or available tuners.
* This can be called from the UI before the schedules are loaded.
*/
public boolean isChannelRecordable(Channel channel) {
if (!mDataManager.isDvrScheduleLoadFinished() || channel == null) {
return false;
}
TvInputInfo info = Utils.getTvInputInfoForChannelId(mAppContext, channel.getId());
if (info == null) {
Log.w(TAG, "Could not find TvInputInfo for " + channel);
return false;
}
if (!info.canRecord()) {
return false;
}
Program program = TvApplication.getSingletons(mAppContext).getProgramDataManager()
.getCurrentProgram(channel.getId());
return program == null || !program.isRecordingProhibited();
}
示例2: getConflictingSchedules
import android.media.tv.TvInputInfo; //导入方法依赖的package包/类
/**
* Returns a sorted list of all scheduled recordings that will not be recorded if
* this program is going to be recorded, with their priorities in decending order.
* <p>
* An empty list means there is no conflicts. If there is conflict, a priority higher than
* the first recording in the returned list should be assigned to the new schedule of this
* program to guarantee the program would be completely recorded.
*/
public List<ScheduledRecording> getConflictingSchedules(Program program) {
SoftPreconditions.checkState(mInitialized, TAG, "Not initialized yet");
SoftPreconditions.checkState(Program.isValid(program), TAG,
"Program is invalid: " + program);
SoftPreconditions.checkState(
program.getStartTimeUtcMillis() < program.getEndTimeUtcMillis(), TAG,
"Program duration is empty: " + program);
if (!mInitialized || !Program.isValid(program)
|| program.getStartTimeUtcMillis() >= program.getEndTimeUtcMillis()) {
return Collections.emptyList();
}
TvInputInfo input = Utils.getTvInputInfoForProgram(mContext, program);
if (input == null || !input.canRecord() || input.getTunerCount() <= 0) {
return Collections.emptyList();
}
return getConflictingSchedules(input, Collections.singletonList(
ScheduledRecording.builder(input.getId(), program)
.setPriority(suggestHighestPriority())
.build()));
}
示例3: scheduleRecordingSoon
import android.media.tv.TvInputInfo; //导入方法依赖的package包/类
private void scheduleRecordingSoon(ScheduledRecording schedule) {
TvInputInfo input = Utils.getTvInputInfoForInputId(mContext, schedule.getInputId());
if (input == null) {
Log.e(TAG, "Can't find input for " + schedule);
mDataManager.changeState(schedule, ScheduledRecording.STATE_RECORDING_FAILED);
return;
}
if (!input.canRecord() || input.getTunerCount() <= 0) {
Log.e(TAG, "TV input doesn't support recording: " + input);
mDataManager.changeState(schedule, ScheduledRecording.STATE_RECORDING_FAILED);
return;
}
InputTaskScheduler scheduler = mInputSchedulerMap.get(input.getId());
if (scheduler == null) {
scheduler = new InputTaskScheduler(mContext, input, mLooper, mChannelDataManager,
mDvrManager, mDataManager, mSessionManager, mClock);
mInputSchedulerMap.put(input.getId(), scheduler);
}
scheduler.addSchedule(schedule);
if (mLastStartTimePendingMs < schedule.getStartTimeMs()) {
mLastStartTimePendingMs = schedule.getStartTimeMs();
}
}
示例4: isProgramRecordable
import android.media.tv.TvInputInfo; //导入方法依赖的package包/类
/**
* Returns {@code true} if the program can be recorded.
* <p>
* Note that this method doesn't check the conflict of the schedule or available tuners.
* This can be called from the UI before the schedules are loaded.
*/
public boolean isProgramRecordable(Program program) {
if (!mDataManager.isInitialized()) {
return false;
}
TvInputInfo info = Utils.getTvInputInfoForProgram(mAppContext, program);
if (info == null) {
Log.w(TAG, "Could not find TvInputInfo for " + program);
return false;
}
return info.canRecord() && !program.isRecordingProhibited();
}
示例5: tune
import android.media.tv.TvInputInfo; //导入方法依赖的package包/类
/**
* Tunes to the channel.
*/
public void tune(Channel channel, Bundle params, OnTuneListener listener) {
if (DEBUG) {
Log.d(TAG, "tune: {session=" + this + ", channel=" + channel + ", params=" + params
+ ", listener=" + listener + ", mTuned=" + mTuned + "}");
}
mChannel = channel;
mInputId = channel.getInputId();
mChannelUri = channel.getUri();
mParams = params;
mOnTuneListener = listener;
TvInputInfo input = mInputManager.getTvInputInfo(mInputId);
if (input == null || (input.canRecord() && !isTunedForRecording(mChannelUri)
&& getTunedRecordingSessionCount(mInputId) >= input.getTunerCount())) {
if (DEBUG) {
if (input == null) {
Log.d(TAG, "Can't find input for input ID: " + mInputId);
} else {
Log.d(TAG, "No more tuners to tune for input: " + input);
}
}
mCallback.onConnectionFailed(mInputId);
// Release the previous session to not to hold the unnecessary session.
resetByRecording();
return;
}
mTuned = true;
mNeedToBeRetuned = false;
mTvView.tune(mInputId, mChannelUri, params);
notifyTvViewChannelChange(mChannelUri);
}
示例6: update
import android.media.tv.TvInputInfo; //导入方法依赖的package包/类
@Override
public void update() {
List<Channel> channelList = new ArrayList<>();
Channel dummyChannel = new Channel.Builder().build();
// For guide item
channelList.add(dummyChannel);
// For setup item
TvInputManagerHelper inputManager = TvApplication.getSingletons(mContext)
.getTvInputManagerHelper();
boolean showSetupCard = SetupUtils.getInstance(mContext).hasNewInput(inputManager);
Channel currentChannel = getMainActivity().getCurrentChannel();
boolean showAppLinkCard = currentChannel != null
&& currentChannel.getAppLinkType(mContext) != Channel.APP_LINK_TYPE_NONE
// Sometimes applicationInfo can be null. b/28932537
&& inputManager.getTvInputAppInfo(currentChannel.getInputId()) != null;
boolean showDvrCard = false;
if (mDvrDataManager != null) {
for (TvInputInfo info : inputManager.getTvInputInfos(true, true)) {
if (info.canRecord()) {
showDvrCard = true;
break;
}
}
}
mViewType[0] = R.layout.menu_card_guide;
int index = 1;
if (showSetupCard) {
channelList.add(dummyChannel);
mViewType[index++] = R.layout.menu_card_setup;
}
if (showDvrCard) {
channelList.add(dummyChannel);
mViewType[index++] = R.layout.menu_card_dvr;
}
if (showAppLinkCard) {
channelList.add(currentChannel);
mViewType[index++] = R.layout.menu_card_app_link;
}
for ( ; index < mViewType.length; ++index) {
mViewType[index] = R.layout.menu_card_channel;
}
channelList.addAll(getRecentChannels());
setItemList(channelList);
}