本文整理汇总了Java中android.media.tv.TvInputManager类的典型用法代码示例。如果您正苦于以下问题:Java TvInputManager类的具体用法?Java TvInputManager怎么用?Java TvInputManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TvInputManager类属于android.media.tv包,在下文中一共展示了TvInputManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.media.tv.TvInputManager; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
mHandlerThread = new HandlerThread(getClass().getSimpleName());
mHandlerThread.start();
mDbHandler = new Handler(mHandlerThread.getLooper());
mCaptioningManager = (CaptioningManager) getSystemService(Context.CAPTIONING_SERVICE);
setTheme(android.R.style.Theme_Holo_Light_NoActionBar);
mSessions = new ArrayList<>();
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(TvInputManager.ACTION_BLOCKED_RATINGS_CHANGED);
intentFilter.addAction(TvInputManager.ACTION_PARENTAL_CONTROLS_ENABLED_CHANGED);
registerReceiver(mParentalControlsBroadcastReceiver, intentFilter);
}
示例2: resumeToWatchedPositionIfNeeded
import android.media.tv.TvInputManager; //导入依赖的package包/类
private void resumeToWatchedPositionIfNeeded() {
if (mInitialSeekPositionMs != TvInputManager.TIME_SHIFT_INVALID_TIME) {
mTvView.timeShiftSeekTo(getRealSeekPosition(mInitialSeekPositionMs,
SEEK_POSITION_MARGIN_MS) + mStartPositionMs);
mInitialSeekPositionMs = TvInputManager.TIME_SHIFT_INVALID_TIME;
}
if (mPauseOnPrepared) {
mTvView.timeShiftPause();
mPlaybackState = PlaybackState.STATE_PAUSED;
mPauseOnPrepared = false;
} else {
mTvView.timeShiftResume();
mPlaybackState = PlaybackState.STATE_PLAYING;
}
mCallback.onPlaybackStateChanged(mPlaybackState, 1);
}
示例3: updateWatchAction
import android.media.tv.TvInputManager; //导入依赖的package包/类
private void updateWatchAction() {
List<RecordedProgram> programs = mDvrDataManager.getRecordedPrograms(mSeries.getId());
Collections.sort(programs, RecordedProgram.EPISODE_COMPARATOR);
mRecommendRecordedProgram = getRecommendProgram(programs);
if (mRecommendRecordedProgram == null) {
mActionsAdapter.clear(ACTION_WATCH);
} else {
String episodeStatus;
if(mDvrWatchedPositionManager.getWatchedStatus(mRecommendRecordedProgram)
== DvrWatchedPositionManager.DVR_WATCHED_STATUS_WATCHING) {
episodeStatus = mResumeLabel;
mInitialPlaybackPositionMs = mDvrWatchedPositionManager
.getWatchedPosition(mRecommendRecordedProgram.getId());
} else {
episodeStatus = mWatchLabel;
mInitialPlaybackPositionMs = TvInputManager.TIME_SHIFT_INVALID_TIME;
}
String episodeDisplayNumber = mRecommendRecordedProgram.getEpisodeDisplayNumber(
getContext());
mActionsAdapter.set(ACTION_WATCH, new Action(ACTION_WATCH,
episodeStatus, episodeDisplayNumber, mWatchDrawable));
}
}
示例4: onRecordedProgramsRemoved
import android.media.tv.TvInputManager; //导入依赖的package包/类
@Override
public void onRecordedProgramsRemoved(RecordedProgram... recordedPrograms) {
boolean needToUpdateCardView = false;
for (RecordedProgram recordedProgram : recordedPrograms) {
if (TextUtils.equals(recordedProgram.getSeriesId(),
mSeriesRecording.getSeriesId())) {
if (mWatchedPositionManager.getWatchedPosition(recordedProgram.getId())
== TvInputManager.TIME_SHIFT_INVALID_TIME) {
mWatchedPositionManager.removeListener(this, recordedProgram.getId());
}
needToUpdateCardView = true;
}
}
if (needToUpdateCardView) {
updateCardViewContent();
}
}
示例5: updateCardViewContent
import android.media.tv.TvInputManager; //导入依赖的package包/类
private void updateCardViewContent() {
int count = 0;
int quantityStringID;
List<RecordedProgram> recordedPrograms =
mDvrDataManager.getRecordedPrograms(mSeriesRecording.getId());
if (recordedPrograms.size() == 0) {
count = mDvrManager.getAvailableScheduledRecording(mSeriesRecording.getId()).size();
quantityStringID = R.plurals.dvr_count_scheduled_recordings;
} else {
for (RecordedProgram recordedProgram : recordedPrograms) {
if (mWatchedPositionManager.getWatchedPosition(recordedProgram.getId())
== TvInputManager.TIME_SHIFT_INVALID_TIME) {
count++;
}
}
if (count == 0) {
count = recordedPrograms.size();
quantityStringID = R.plurals.dvr_count_recordings;
} else {
quantityStringID = R.plurals.dvr_count_new_recordings;
}
}
mCardView.setContent(mCardView.getResources()
.getQuantityString(quantityStringID, count, count), null);
}
示例6: onCreateOnActionClickedListener
import android.media.tv.TvInputManager; //导入依赖的package包/类
@Override
protected OnActionClickedListener onCreateOnActionClickedListener() {
return new OnActionClickedListener() {
@Override
public void onActionClicked(Action action) {
if (action.getId() == ACTION_PLAY_FROM_BEGINNING) {
startPlayback(mRecordedProgram, TvInputManager.TIME_SHIFT_INVALID_TIME);
} else if (action.getId() == ACTION_RESUME_PLAYING) {
startPlayback(mRecordedProgram, mDvrWatchedPositionManager
.getWatchedPosition(mRecordedProgram.getId()));
} else if (action.getId() == ACTION_DELETE_RECORDING) {
DvrManager dvrManager = TvApplication
.getSingletons(getActivity()).getDvrManager();
dvrManager.removeRecordedProgram(mRecordedProgram);
getActivity().finish();
}
}
};
}
示例7: onStart
import android.media.tv.TvInputManager; //导入依赖的package包/类
private void onStart() {
if (!mStarted) {
mStarted = true;
mCancelLoadTask = false;
if (!PermissionUtils.hasAccessWatchedHistory(mContext)) {
mWatchedHistoryManager = new WatchedHistoryManager(mContext);
mWatchedHistoryManager.setListener(this);
mWatchedHistoryManager.start();
} else {
mContext.getContentResolver().registerContentObserver(
TvContract.WatchedPrograms.CONTENT_URI, true, mContentObserver);
mHandler.obtainMessage(MSG_UPDATE_WATCH_HISTORY,
TvContract.WatchedPrograms.CONTENT_URI)
.sendToTarget();
}
mTvInputManager = (TvInputManager) mContext.getSystemService(Context.TV_INPUT_SERVICE);
mTvInputManager.registerCallback(mInternalCallback, mHandler);
for (TvInputInfo input : mTvInputManager.getTvInputList()) {
mInputs.add(input.getId());
}
}
if (mChannelRecordMapLoaded) {
mHandler.sendEmptyMessage(MSG_NOTIFY_CHANNEL_RECORD_MAP_LOADED);
}
}
示例8: onStart
import android.media.tv.TvInputManager; //导入依赖的package包/类
@Override
protected void onStart() {
if (DEBUG) Log.d(TAG,"onStart()");
super.onStart();
mScreenOffIntentReceived = false;
mActivityStarted = true;
mTracker.sendMainStart();
mMainDurationTimer.start();
applyParentalControlSettings();
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(TvInputManager.ACTION_PARENTAL_CONTROLS_ENABLED_CHANGED);
intentFilter.addAction(Intent.ACTION_SCREEN_OFF);
intentFilter.addAction(Intent.ACTION_SCREEN_ON);
registerReceiver(mBroadcastReceiver, intentFilter);
Intent notificationIntent = new Intent(this, NotificationService.class);
notificationIntent.setAction(NotificationService.ACTION_SHOW_RECOMMENDATION);
startService(notificationIntent);
}
示例9: updateAvailabilityToast
import android.media.tv.TvInputManager; //导入依赖的package包/类
private void updateAvailabilityToast(StreamInfo info) {
if (info.isVideoAvailable()) {
return;
}
int stringId;
switch (info.getVideoUnavailableReason()) {
case TunableTvView.VIDEO_UNAVAILABLE_REASON_NOT_TUNED:
case TunableTvView.VIDEO_UNAVAILABLE_REASON_NO_RESOURCE:
case TvInputManager.VIDEO_UNAVAILABLE_REASON_TUNING:
case TvInputManager.VIDEO_UNAVAILABLE_REASON_BUFFERING:
case TvInputManager.VIDEO_UNAVAILABLE_REASON_AUDIO_ONLY:
case TvInputManager.VIDEO_UNAVAILABLE_REASON_WEAK_SIGNAL:
return;
case TvInputManager.VIDEO_UNAVAILABLE_REASON_UNKNOWN:
default:
stringId = R.string.msg_channel_unavailable_unknown;
break;
}
Toast.makeText(this, stringId, Toast.LENGTH_SHORT).show();
}
示例10: updateAvailability
import android.media.tv.TvInputManager; //导入依赖的package包/类
/**
* Updates availability. It returns true, if availability is changed.
*/
private void updateAvailability() {
boolean available;
// current playing input cannot be available for PIP.
Channel currentChannel = mChannelTuner.getCurrentChannel();
if (mIsPassthrough) {
if (currentChannel != null && currentChannel.getInputId().equals(mInputId)) {
available = false;
} else {
available = mInputManager.getInputState(mInputId)
== TvInputManager.INPUT_STATE_CONNECTED;
}
} else {
if (currentChannel != null && !currentChannel.isPassthrough()) {
available = false;
} else {
available = mChannelTuner.getBrowsableChannelCount() > 0;
}
}
if (mAvailable != available) {
mAvailable = available;
for (Listener l : mListeners) {
l.onPipInputStateUpdated();
}
}
}
示例11: doTune
import android.media.tv.TvInputManager; //导入依赖的package包/类
private boolean doTune(Uri channelUri) {
if (mSessionState != STATE_IDLE) {
mSession.onError(TvInputManager.RECORDING_ERROR_UNKNOWN);
Log.e(TAG, "Tuning was requested from wrong status.");
return false;
}
mChannel = getChannel(channelUri);
if (mChannel == null) {
mSession.onError(TvInputManager.RECORDING_ERROR_UNKNOWN);
Log.w(TAG, "Failed to start recording. Couldn't find the channel for " + mChannel);
return false;
}
if (!mDvrStorageStatusManager.isStorageSufficient()) {
mSession.onError(TvInputManager.RECORDING_ERROR_INSUFFICIENT_SPACE);
Log.w(TAG, "Tuning failed due to insufficient storage.");
return false;
}
mTunerSource = mSourceManager.createDataSource(mContext, mChannel, this);
if (mTunerSource == null) {
mSession.onError(TvInputManager.RECORDING_ERROR_RESOURCE_BUSY);
Log.w(TAG, "Tuner stream cannot be created due to resource shortage.");
return false;
}
mSessionState = STATE_TUNED;
return true;
}
示例12: stopPlayback
import android.media.tv.TvInputManager; //导入依赖的package包/类
private void stopPlayback() {
mChannelDataManager.removeAllCallbacksAndMessages();
if (mPlayer != null) {
mPlayer.setPlayWhenReady(false);
mPlayer.release();
mPlayer = null;
mPlayerState = ExoPlayer.STATE_IDLE;
mPlaybackParams.setSpeed(1.0f);
mPlayerStarted = false;
mReportedDrawnToSurface = false;
mPreparingStartTimeMs = INVALID_TIME;
mBufferingStartTimeMs = INVALID_TIME;
mReadyStartTimeMs = INVALID_TIME;
mSession.sendUiMessage(TunerSession.MSG_UI_HIDE_AUDIO_UNPLAYABLE);
mSession.notifyTimeShiftStatusChanged(TvInputManager.TIME_SHIFT_STATUS_UNAVAILABLE);
}
}
示例13: updateTunerInputInfo
import android.media.tv.TvInputManager; //导入依赖的package包/类
/**
* Updates tuner input's info.
*
* @param context {@link Context} instance
*/
public static void updateTunerInputInfo(Context context) {
if (BuildCompat.isAtLeastN()) {
if (DEBUG) Log.d(TAG, "updateTunerInputInfo()");
TvInputInfo info = buildTunerInputInfo(context, isBuiltInTuner(context));
if (info != null) {
((TvInputManager) context.getSystemService(Context.TV_INPUT_SERVICE))
.updateTvInputInfo(info);
if (DEBUG) {
Log.d(TAG, "TvInputInfo [" + info.loadLabel(context)
+ "] updated: " + info.toString());
}
} else {
if (DEBUG) {
Log.d(TAG, "Updating tuner input's info failed. Input is not ready yet.");
}
}
}
}
示例14: onTune
import android.media.tv.TvInputManager; //导入依赖的package包/类
@Override
public boolean onTune(Uri channelUri) {
lastTune = new Date();
currentChannelUri = channelUri;
// notifyVideoUnavailable(TvInputManager.VIDEO_UNAVAILABLE_REASON_TUNING);
if(tvInputProvider instanceof SplashScreenable) {
notifyVideoAvailable();
setOverlayViewEnabled(false);
setOverlayViewEnabled(true);
isStillLoading = true;
} else
notifyVideoUnavailable(TvInputManager.VIDEO_UNAVAILABLE_REASON_BUFFERING);
setOverlayViewEnabled(true);
new TuningTask().execute(channelUri, this);
return true;
}
示例15: onTune
import android.media.tv.TvInputManager; //导入依赖的package包/类
@Override
public boolean onTune(Uri channelUri) {
Log.d(TAG, "onTune " + channelUri);
notifyVideoUnavailable(TvInputManager.VIDEO_UNAVAILABLE_REASON_TUNING);
String[] projection = {TvContract.Channels.COLUMN_INTERNAL_PROVIDER_DATA};
try (Cursor cursor = context.getContentResolver().query(
channelUri,
projection,
null, // selection
null, // selectionArgs
null // sortOrder
)) {
if (cursor == null || !cursor.moveToNext()) {
Log.e(TAG, "Channel not found: " + channelUri);
return false;
}
String url = cursor.getString(0);
play(url);
return true;
}
}