• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Utils类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.android.libraries.cast.companionlibrary.utils.Utils的典型用法代码示例。如果您正苦于以下问题:Java Utils类的具体用法?Java Utils怎么用?Java Utils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Utils类属于com.google.android.libraries.cast.companionlibrary.utils包,在下文中一共展示了Utils类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: updateMetadata

import com.google.android.libraries.cast.companionlibrary.utils.Utils; //导入依赖的package包/类
private void updateMetadata() {
    Uri imageUrl = null;
    if (mSelectedMedia == null) {
        if (mMediaAuthService != null) {
            /* <--archos changes> */
            imageUrl = Utils.getImageUri(ArchosVideoCastManager.getInstance().getMediaInfo(), 1);
            /* <!--archos changes> */
        }
    } else {
        imageUrl = Utils.getImageUri(mSelectedMedia, 1);
    }
    showImage(imageUrl);
    if (mSelectedMedia == null) {
        return;
    }
    MediaMetadata mm = mSelectedMedia.getMetadata();
    mCastController.setTitle(mm.getString(MediaMetadata.KEY_TITLE) != null
            ? mm.getString(MediaMetadata.KEY_TITLE) : "");
    boolean isLive = mSelectedMedia.getStreamType() == MediaInfo.STREAM_TYPE_LIVE;
    mCastController.adjustControllersForLiveStream(isLive);
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:22,代码来源:VideoCastControllerFragment.java


示例2: onConfigurationChanged

import com.google.android.libraries.cast.companionlibrary.utils.Utils; //导入依赖的package包/类
@Override
public void onConfigurationChanged() {
    updateOverallState();
    if (mSelectedMedia == null) {
        if (mMediaAuthService != null) {
            /* <--archos changes> */
            showImage(Utils.getImageUri(ArchosVideoCastManager.getInstance().getMediaInfo(), 1));
            /* <!--archos changes> */
        }
    } else {
        updateMetadata();
        updatePlayerStatus();
        mCastController.updateControllersStatus(mCastManager.isConnected());

    }
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:17,代码来源:VideoCastControllerFragment.java


示例3: updateMiniController

import com.google.android.libraries.cast.companionlibrary.utils.Utils; //导入依赖的package包/类
/**
 * Updates the information and state of a MiniController.
 *
 * @throws TransientNetworkDisconnectionException
 * @throws NoConnectionException
 */
private void updateMiniController(IMiniController controller)
        throws TransientNetworkDisconnectionException, NoConnectionException {
    checkConnectivity();
    checkRemoteMediaPlayerAvailable();
    if (mRemoteMediaPlayer.getStreamDuration() > 0 || isRemoteStreamLive()) {
        MediaInfo mediaInfo = getRemoteMediaInformation();
        MediaMetadata mm = mediaInfo.getMetadata();
        controller.setStreamType(mediaInfo.getStreamType());
        controller.setPlaybackStatus(mState, mIdleReason);
        controller.setSubtitle(mContext.getResources().getString(R.string.ccl_casting_to_device,
                mDeviceName));
        controller.setTitle(mm.getString(MediaMetadata.KEY_TITLE));
        controller.setIcon(Utils.getImageUri(mediaInfo, 0));
    }
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:22,代码来源:VideoCastManager.java


示例4: updateMetadata

import com.google.android.libraries.cast.companionlibrary.utils.Utils; //导入依赖的package包/类
private void updateMetadata() {
    Uri imageUrl = null;
    if (mSelectedMedia == null) {
        if (mMediaAuthService != null) {
            imageUrl = Utils.getImageUri(mMediaAuthService.getMediaInfo(), 1);
        }
    } else {
        imageUrl = Utils.getImageUri(mSelectedMedia, 1);
    }
    showImage(imageUrl);
    if (mSelectedMedia == null) {
        return;
    }
    MediaMetadata mm = mSelectedMedia.getMetadata();
    mCastController.setTitle(mm.getString(MediaMetadata.KEY_TITLE) != null
            ? mm.getString(MediaMetadata.KEY_TITLE) : "");
    boolean isLive = mSelectedMedia.getStreamType() == MediaInfo.STREAM_TYPE_LIVE;
    mCastController.adjustControllersForLiveStream(isLive);
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:20,代码来源:VideoCastControllerFragment.java


示例5: onCreate

import com.google.android.libraries.cast.companionlibrary.utils.Utils; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    VideoCastManager castManager = VideoCastManager.getInstance();
    if (!castManager.isFeatureEnabled(CastConfiguration.FEATURE_CAPTIONS_PREFERENCE)) {
        LOGE(TAG, "Did you forget to enable FEATURE_CAPTIONS_PREFERENCE when you initialized"
                + " the VideoCastManage?");
        finish();
        return;
    }
    if (Utils.IS_KITKAT_OR_ABOVE) {
        startActivity(new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS));
        finish();
        return;
    }
    addPreferencesFromResource(R.xml.caption_preference);
    castManager.getTracksPreferenceManager().setUpPreferences(getPreferenceScreen());
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:20,代码来源:CaptionsPreferenceActivity.java


示例6: newInstance

import com.google.android.libraries.cast.companionlibrary.utils.Utils; //导入依赖的package包/类
public static ArchosTracksChooserDialog newInstance(MediaInfo mediaInfo) {
    ArchosTracksChooserDialog fragment = new ArchosTracksChooserDialog();
    Bundle bundle = new Bundle();
    bundle.putBundle(VideoCastManager.EXTRA_MEDIA, Utils.mediaInfoToBundle(mediaInfo));
    fragment.setArguments(bundle);
    return fragment;
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:8,代码来源:ArchosTracksChooserDialog.java


示例7: onCreate

import com.google.android.libraries.cast.companionlibrary.utils.Utils; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setRetainInstance(true);
    Bundle mediaWrapper = getArguments().getBundle(VideoCastManager.EXTRA_MEDIA);
    mMediaInfo = Utils.bundleToMediaInfo(mediaWrapper);
    mCastManager = VideoCastManager.getInstance();
    mArchosCastManager = ArchosVideoCastManager.getInstance();
    mActiveTracks = mArchosCastManager.getSelectedTracks();
    List<MediaTrack> allTracks = mMediaInfo.getMediaTracks();
    if (allTracks == null || allTracks.isEmpty()) {
        Utils.showToast(getActivity(), R.string.ccl_caption_no_tracks_available);
        dismiss();
    }
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:16,代码来源:ArchosTracksChooserDialog.java


示例8: setUpcomingItem

import com.google.android.libraries.cast.companionlibrary.utils.Utils; //导入依赖的package包/类
@Override
public void setUpcomingItem(MediaQueueItem item) {
    mUpcomingItem = item;
    if (item != null) {
        MediaInfo mediaInfo = item.getMedia();
        if (mediaInfo != null) {
            MediaMetadata metadata = mediaInfo.getMetadata();
            setUpcomingTitle(metadata.getString(MediaMetadata.KEY_TITLE));
            setUpcomingIcon(Utils.getImageUri(mediaInfo, 0));
        }
    } else {
        setUpcomingTitle("");
        setUpcomingIcon((Uri) null);
    }
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:16,代码来源:ArchosMiniPlayer.java


示例9: updateSeekbar

import com.google.android.libraries.cast.companionlibrary.utils.Utils; //导入依赖的package包/类
public void updateSeekbar(int position, int duration) {
    if(mIsSeeking)
        return;
    mSeekbar.setProgress(position);
    mSeekbar.setMax(duration);
    mStart.setText(Utils.formatMillis(position));
    mEnd.setText(Utils.formatMillis(duration));
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:9,代码来源:ArchosMiniPlayer.java


示例10: updateSeekbar

import com.google.android.libraries.cast.companionlibrary.utils.Utils; //导入依赖的package包/类
@Override
public void updateSeekbar(int position, int duration) {
    mSeekbar.setProgress(position);
    mSeekbar.setMax(duration);
    mStart.setText(Utils.formatMillis(position));
    mEnd.setText(Utils.formatMillis(duration));
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:8,代码来源:CastPlayerActivity.java


示例11: onFailed

import com.google.android.libraries.cast.companionlibrary.utils.Utils; //导入依赖的package包/类
@Override
public void onFailed(int resourceId, int statusCode) {
    LOGD(TAG, "onFailed(): " + getString(resourceId) + ", status code: " + statusCode);
    if (statusCode == RemoteMediaPlayer.STATUS_FAILED
            || statusCode == RemoteMediaPlayer.STATUS_TIMED_OUT) {
        Utils.showToast(getActivity(), resourceId);
        /* <--archos changes> */
        /* <!--archos changes> */
    }
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:11,代码来源:VideoCastControllerFragment.java


示例12: updateClosedCaptionState

import com.google.android.libraries.cast.companionlibrary.utils.Utils; //导入依赖的package包/类
private void updateClosedCaptionState() {
    int state = VideoCastController.CC_HIDDEN;
    if (mCastManager.isFeatureEnabled(CastConfiguration.FEATURE_CAPTIONS_PREFERENCE)
            && mSelectedMedia != null
            /*<archos changes> && mCastManager.getTracksPreferenceManager().isCaptionEnabled()<!archos changes>*/) {
        List<MediaTrack> tracks = mSelectedMedia.getMediaTracks();
        state = Utils.hasAudioOrTextTrack(tracks) ? VideoCastController.CC_ENABLED
                : VideoCastController.CC_DISABLED;
    }
    mCastController.setClosedCaptionState(state);
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:12,代码来源:VideoCastControllerFragment.java


示例13: showImage

import com.google.android.libraries.cast.companionlibrary.utils.Utils; //导入依赖的package包/类
private void showImage(final Uri uri) {

        if (uri == null) {
            mCastController.setImage(BitmapFactory.decodeResource(getActivity().getResources(),
                    R.drawable.album_art_placeholder_large));
            return;
        }
        if (mUrlAndBitmap != null && mUrlAndBitmap.isMatch(uri)) {
            // we can reuse mBitmap
            mCastController.setImage(mUrlAndBitmap.mBitmap);
            return;
        }
        mUrlAndBitmap = null;
        if (mImageAsyncTask != null) {
            mImageAsyncTask.cancel(true);
        }
        Point screenSize = Utils.getDisplaySize(getActivity());
        mImageAsyncTask = new FetchBitmapTask(screenSize.x, screenSize.y, false) {
            @Override
            protected void onPostExecute(Bitmap bitmap) {
                if (bitmap != null) {
                    mUrlAndBitmap = new UrlAndBitmap();
                    mUrlAndBitmap.mBitmap = bitmap;
                    mUrlAndBitmap.mUrl = uri;
                    if (!isCancelled()) {
                        mCastController.setImage(bitmap);
                    }
                }
                if (this == mImageAsyncTask) {
                    mImageAsyncTask = null;
                }
            }
        };
        mImageAsyncTask.execute(uri);
    }
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:36,代码来源:VideoCastControllerFragment.java


示例14: onTargetActivityInvoked

import com.google.android.libraries.cast.companionlibrary.utils.Utils; //导入依赖的package包/类
@Override
public void onTargetActivityInvoked(Context context) throws
        TransientNetworkDisconnectionException, NoConnectionException {
    Intent intent = new Intent(context, mTargetActivity);
    intent.putExtra(EXTRA_MEDIA, Utils.mediaInfoToBundle(getRemoteMediaInformation()));
    context.startActivity(intent);
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:8,代码来源:VideoCastManager.java


示例15: getCastControllerPendingIntent

import com.google.android.libraries.cast.companionlibrary.utils.Utils; //导入依赖的package包/类
private PendingIntent getCastControllerPendingIntent() {
    try {
        Bundle mediaWrapper = Utils.mediaInfoToBundle(getRemoteMediaInformation());
        Intent contentIntent = new Intent(mContext, mTargetActivity);
        contentIntent.putExtra(VideoCastManager.EXTRA_MEDIA, mediaWrapper);
        return PendingIntent
                .getActivity(mContext, 0, contentIntent, PendingIntent.FLAG_UPDATE_CURRENT);
    } catch (TransientNetworkDisconnectionException | NoConnectionException e) {
        LOGE(TAG,
                "getCastControllerPendingIntent(): Failed to get the remote media information");
    }
    return null;
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:14,代码来源:VideoCastManager.java


示例16: registerCaptionListener

import com.google.android.libraries.cast.companionlibrary.utils.Utils; //导入依赖的package包/类
@SuppressLint("NewApi")
private void registerCaptionListener(final Context context) {
    if (Utils.IS_KITKAT_OR_ABOVE) {
        CaptioningManager captioningManager =
                (CaptioningManager) context.getSystemService(Context.CAPTIONING_SERVICE);
        captioningManager.addCaptioningChangeListener(
                new CaptioningManager.CaptioningChangeListener() {
                    @Override
                    public void onEnabledChanged(boolean enabled) {
                        onTextTrackEnabledChanged(enabled);
                    }

                    @Override
                    public void onUserStyleChanged(
                            @NonNull CaptioningManager.CaptionStyle userStyle) {
                        onTextTrackStyleChanged(mTrackManager.getTextTrackStyle());
                    }

                    @Override
                    public void onFontScaleChanged(float fontScale) {
                        onTextTrackStyleChanged(mTrackManager.getTextTrackStyle());
                    }

                    @Override
                    public void onLocaleChanged(Locale locale) {
                        onTextTrackLocaleChanged(locale);
                    }
                }
        );
    }
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:32,代码来源:VideoCastManager.java


示例17: onMediaLoadResult

import com.google.android.libraries.cast.companionlibrary.utils.Utils; //导入依赖的package包/类
@Override
public void onMediaLoadResult(int statusCode) {
    if (CastStatusCodes.SUCCESS != statusCode) {
        LOGD(TAG, "onMediaLoadResult(): Failed to load media with status code: "
                + statusCode);
        Utils.showToast(getActivity(), R.string.ccl_failed_to_load_media);
        mCastController.closeActivity();
    }
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:10,代码来源:VideoCastControllerFragment.java


示例18: onFailed

import com.google.android.libraries.cast.companionlibrary.utils.Utils; //导入依赖的package包/类
@Override
public void onFailed(int resourceId, int statusCode) {
    LOGD(TAG, "onFailed(): " + getString(resourceId) + ", status code: " + statusCode);
    if (statusCode == RemoteMediaPlayer.STATUS_FAILED
            || statusCode == RemoteMediaPlayer.STATUS_TIMED_OUT) {
        Utils.showToast(getActivity(), resourceId);
        mCastController.closeActivity();
    }
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:10,代码来源:VideoCastControllerFragment.java


示例19: updateClosedCaptionState

import com.google.android.libraries.cast.companionlibrary.utils.Utils; //导入依赖的package包/类
private void updateClosedCaptionState() {
    int state = VideoCastController.CC_HIDDEN;
    if (mCastManager.isFeatureEnabled(CastConfiguration.FEATURE_CAPTIONS_PREFERENCE)
            && mSelectedMedia != null
            && mCastManager.getTracksPreferenceManager().isCaptionEnabled()) {
        List<MediaTrack> tracks = mSelectedMedia.getMediaTracks();
        state = Utils.hasAudioOrTextTrack(tracks) ? VideoCastController.CC_ENABLED
                : VideoCastController.CC_DISABLED;
    }
    mCastController.setClosedCaptionState(state);
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:12,代码来源:VideoCastControllerFragment.java


示例20: showImage

import com.google.android.libraries.cast.companionlibrary.utils.Utils; //导入依赖的package包/类
private void showImage(final Uri uri) {
    if (uri == null) {
        mCastController.setImage(BitmapFactory.decodeResource(getActivity().getResources(),
                R.drawable.album_art_placeholder_large));
        return;
    }
    if (mUrlAndBitmap != null && mUrlAndBitmap.isMatch(uri)) {
        // we can reuse mBitmap
        mCastController.setImage(mUrlAndBitmap.mBitmap);
        return;
    }
    mUrlAndBitmap = null;
    if (mImageAsyncTask != null) {
        mImageAsyncTask.cancel(true);
    }
    Point screenSize = Utils.getDisplaySize(getActivity());
    mImageAsyncTask = new FetchBitmapTask(screenSize.x, screenSize.y, false) {
        @Override
        protected void onPostExecute(Bitmap bitmap) {
            if (bitmap != null) {
                mUrlAndBitmap = new UrlAndBitmap();
                mUrlAndBitmap.mBitmap = bitmap;
                mUrlAndBitmap.mUrl = uri;
                if (!isCancelled()) {
                    mCastController.setImage(bitmap);
                }
            }
            if (this == mImageAsyncTask) {
                mImageAsyncTask = null;
            }
        }
    };
    mImageAsyncTask.execute(uri);
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:35,代码来源:VideoCastControllerFragment.java



注:本文中的com.google.android.libraries.cast.companionlibrary.utils.Utils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MorphApi类代码示例发布时间:2022-05-23
下一篇:
Java Parser类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap