当前位置: 首页>>代码示例>>Java>>正文


Java DetailsFragment类代码示例

本文整理汇总了Java中android.support.v17.leanback.app.DetailsFragment的典型用法代码示例。如果您正苦于以下问题:Java DetailsFragment类的具体用法?Java DetailsFragment怎么用?Java DetailsFragment使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DetailsFragment类属于android.support.v17.leanback.app包,在下文中一共展示了DetailsFragment类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Overlay

import android.support.v17.leanback.app.DetailsFragment; //导入依赖的package包/类
/**
 * Must be created from the Fragment onViewCreated() method
 * @param fragment
 */
public Overlay(Fragment fragment) {

    if (!fragment.isAdded()) {
        throw new IllegalStateException("Overlay must be created once the fragment is added!");
    }

    mContext = fragment.getActivity();
    ViewGroup fragmentView = (ViewGroup)fragment.getView();
    if (fragmentView==null) {
        throw new IllegalStateException("Overlay must be created once the fragment has its view created!");
    }

    int parentViewId = -1;
    if (fragment instanceof BrowseFragment) {
        parentViewId = R.id.browse_frame;
    } else if (fragment instanceof MyVerticalGridFragment) {
        parentViewId = R.id.browse_dummy;
    } else if (fragment instanceof DetailsFragment) {
        parentViewId = R.id.details_fragment_root;
    } else if (fragment instanceof GuidedStepFragment) {
        parentViewId = R.id.guidedstep_background_view_root;
    } else {
        throw new IllegalStateException("Overlay is not compatible with this fragment: "+fragment);
    }

    ViewGroup parentView = (ViewGroup)fragmentView.findViewById(parentViewId);
    if (parentView==null) {
        throw new IllegalStateException("parentView not found! Maybe IDs in the leanback library have been changed?");
    }

    LayoutInflater.from(mContext).inflate(R.layout.leanback_overlay, parentView);
    mOverlayRoot = parentView.findViewById(R.id.overlay_root);
    mScanProgress = new ScannerAndScraperProgress(mContext, mOverlayRoot);
    mClock = new Clock(mContext, mOverlayRoot);
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:40,代码来源:Overlay.java

示例2: onCreate

import android.support.v17.leanback.app.DetailsFragment; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    TvApplication.setCurrentRunningProcess(this, true);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_dvr_details);
    long recordId = getIntent().getLongExtra(RECORDING_ID, -1);
    int detailsViewType = getIntent().getIntExtra(DETAILS_VIEW_TYPE, -1);
    boolean hideViewSchedule = getIntent().getBooleanExtra(HIDE_VIEW_SCHEDULE, false);
    if (recordId != -1 && detailsViewType != -1 && savedInstanceState == null) {
        Bundle args = new Bundle();
        args.putLong(RECORDING_ID, recordId);
        DetailsFragment detailsFragment = null;
        if (detailsViewType == CURRENT_RECORDING_VIEW) {
            detailsFragment = new CurrentRecordingDetailsFragment();
        } else if (detailsViewType == SCHEDULED_RECORDING_VIEW) {
            args.putBoolean(HIDE_VIEW_SCHEDULE, hideViewSchedule);
            detailsFragment = new ScheduledRecordingDetailsFragment();
        } else if (detailsViewType == RECORDED_PROGRAM_VIEW) {
            detailsFragment = new RecordedProgramDetailsFragment();
        } else if (detailsViewType == SERIES_RECORDING_VIEW) {
            detailsFragment = new SeriesRecordingDetailsFragment();
        }
        detailsFragment.setArguments(args);
        getFragmentManager().beginTransaction()
                .replace(R.id.dvr_details_view_frame, detailsFragment).commit();
    }
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:28,代码来源:DvrDetailsActivity.java


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