當前位置: 首頁>>代碼示例>>Java>>正文


Java BrowseFragment類代碼示例

本文整理匯總了Java中android.support.v17.leanback.app.BrowseFragment的典型用法代碼示例。如果您正苦於以下問題:Java BrowseFragment類的具體用法?Java BrowseFragment怎麽用?Java BrowseFragment使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


BrowseFragment類屬於android.support.v17.leanback.app包,在下文中一共展示了BrowseFragment類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCreate

import android.support.v17.leanback.app.BrowseFragment; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_manageaccounts);

    mLibrary = Library.getInstance();
    mLibrary.registerListener(this);
    mFitnessLibrary = FitnessLibrary.getInstance();
    mFitnessLibrary.registerListener(this);

    mFragmentManager = getFragmentManager();
    mBrowseFragment = (BrowseFragment) mFragmentManager.findFragmentById(R.id.id_Fragment_ManageAccountActivity);

    mBrowseFragment.setHeadersState(BrowseFragment.HEADERS_ENABLED);
    mBrowseFragment.setBadgeDrawable(getDrawable(R.drawable.browse_logo));
    mBrowseFragment.setOnItemViewClickedListener(this);

    BackgroundManager backgroundManager = BackgroundManager.getInstance(this);
    backgroundManager.attach(this.getWindow());
    backgroundManager.setDrawable(getResources().getDrawable(R.drawable.background, null));

    mArrayObjectAdapter = new ArrayObjectAdapter(new ListRowPresenter());
    mBrowseFragment.setAdapter(mArrayObjectAdapter);

    updateUI();
}
 
開發者ID:mklschreiber,項目名稱:Crowdi,代碼行數:27,代碼來源:ManageAccountsActivity.java

示例2: onCreate

import android.support.v17.leanback.app.BrowseFragment; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    mContext = this;
    mBrowseFragment = (BrowseFragment) getFragmentManager().findFragmentById(R.id.browse_fragment);
    mBrowseFragment.setHeadersState(BrowseFragment.HEADERS_DISABLED);

    getLoaderManager().initLoader(ITEM_LOADER_ID, null, new MainFragmentLoaderCallbacks());

    mBrowseFragment.setTitle(getString(R.string.app_name));
    prepareBackgroundManager();
}
 
開發者ID:TAnsz,項目名稱:MyTvLauncher,代碼行數:14,代碼來源:MainActivity.java

示例3: Overlay

import android.support.v17.leanback.app.BrowseFragment; //導入依賴的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

示例4: onCreate

import android.support.v17.leanback.app.BrowseFragment; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mContext = this;
    mBrowseFragment = (BrowseFragment) getFragmentManager().findFragmentById(R.id.browse_fragment);

    mBrowseFragment.setHeadersState(BrowseFragment.HEADERS_DISABLED);
    mBrowseFragment.setTitle(getString(R.string.app_name));

    prepareBackgroundManager();
    buildRowsAdapter();
}
 
開發者ID:JackyAndroid,項目名稱:AndroidTVLauncher,代碼行數:15,代碼來源:MainActivity.java

示例5: onCreate

import android.support.v17.leanback.app.BrowseFragment; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (mMediaLibrary.getMediaItems().isEmpty()) {
        if (mSettings.getBoolean(PreferencesActivity.AUTO_RESCAN, true))
            mMediaLibrary.scanMediaItems(false);
        else
            mMediaLibrary.loadMedaItems();
    }

    if (!VLCInstance.testCompatibleCPU(this)) {
        finish();
        return;
    }

    mContext = this;
    setContentView(R.layout.tv_main_fragment);

    mDefaultBackground = getResources().getDrawable(R.drawable.background);
    final FragmentManager fragmentManager = getFragmentManager();
    mBrowseFragment = (BrowseFragment) fragmentManager.findFragmentById(
            R.id.browse_fragment);
    mProgressBar = (ProgressBar) findViewById(R.id.tv_main_progress);

    // Set display parameters for the BrowseFragment
    mBrowseFragment.setHeadersState(BrowseFragment.HEADERS_ENABLED);
    mBrowseFragment.setTitle(getString(R.string.app_name));
    mBrowseFragment.setBadgeDrawable(getResources().getDrawable(R.drawable.icon));

    // add a listener for selected items
    mBrowseFragment.setOnItemViewClickedListener(this);
    mBrowseFragment.setOnItemViewSelectedListener(this);

    if (!Build.MANUFACTURER.equalsIgnoreCase("amazon")) { //Hide search for Amazon Fire TVs
        mBrowseFragment.setOnSearchClickedListener(this);
        // set search icon color
        mBrowseFragment.setSearchAffordanceColor(getResources().getColor(R.color.orange500));
    }
    mRootContainer = mBrowseFragment.getView();
}
 
開發者ID:hanhailong,項目名稱:VCL-Android,代碼行數:41,代碼來源:MainTvActivity.java

示例6: onCreate

import android.support.v17.leanback.app.BrowseFragment; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mMediaLibrary.loadMediaItems(false);

    if (!VLCInstance.testCompatibleCPU(this)) {
        finish();
        return;
    }

    mContext = this;
    setContentView(R.layout.tv_main_fragment);

    mDefaultBackground = getResources().getDrawable(R.drawable.background);
    final FragmentManager fragmentManager = getFragmentManager();
    mBrowseFragment = (BrowseFragment) fragmentManager.findFragmentById(
            R.id.browse_fragment);
    mProgressBar = (ProgressBar) findViewById(R.id.tv_main_progress);

    // Set display parameters for the BrowseFragment
    mBrowseFragment.setHeadersState(BrowseFragment.HEADERS_ENABLED);
    mBrowseFragment.setTitle(getString(R.string.app_name));
    mBrowseFragment.setBadgeDrawable(getResources().getDrawable(R.drawable.icon));

    // add a listener for selected items
    mBrowseFragment.setOnItemViewClickedListener(this);
    mBrowseFragment.setOnItemViewSelectedListener(this);

    if (!Build.MANUFACTURER.equalsIgnoreCase("amazon")) { //Hide search for Amazon Fire TVs
        mBrowseFragment.setOnSearchClickedListener(this);
        // set search icon color
        mBrowseFragment.setSearchAffordanceColor(getResources().getColor(R.color.orange500));
    }
    mRootContainer = mBrowseFragment.getView();
}
 
開發者ID:xuie0000,項目名稱:vlc-android,代碼行數:36,代碼來源:MainTvActivity.java

示例7: onCreate

import android.support.v17.leanback.app.BrowseFragment; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_tvmain);

    mFragmentManager = getFragmentManager();
    mBrowseFragment = (BrowseFragment) mFragmentManager.findFragmentById(R.id.id_frag_TVMainActivity);

    mBrowseFragment.setHeadersState(BrowseFragment.HEADERS_ENABLED);
    mBrowseFragment.setBadgeDrawable(getDrawable(R.drawable.browse_logo));
    mBrowseFragment.setOnItemViewClickedListener(this);

    BackgroundManager backgroundManager = BackgroundManager.getInstance(this);
    backgroundManager.attach(this.getWindow());
    backgroundManager.setDrawable(getResources().getDrawable(R.drawable.background, null));

    mArrayObjectAdapter = new ArrayObjectAdapter(new ListRowPresenter());
    mBrowseFragment.setAdapter(mArrayObjectAdapter);

    mLibrary = Library.getInstance();
    mLibrary.init(this);

    mFitnessLibrary = FitnessLibrary.getInstance();
    mFitnessLibrary.init(this);

    updateUI();
}
 
開發者ID:mklschreiber,項目名稱:Crowdi,代碼行數:28,代碼來源:MainActivity.java

示例8: setupUIElements

import android.support.v17.leanback.app.BrowseFragment; //導入依賴的package包/類
/**
 * We want to setup the default aspects of this browser fragment
 */
private void setupUIElements() {
    setTitle(getString(R.string.app_name));
    setHeadersState(BrowseFragment.HEADERS_ENABLED);
    setHeadersTransitionOnBackEnabled(true);
    setBadgeDrawable(getResources().getDrawable(R.drawable.ic_launcher));
    setBrandColor(getResources().getColor(R.color.drawer_color));
    setSearchAffordanceColor(getResources().getColor(R.color.search_color));

    setAdapter(getBrowseAdapter());

    setDefaultBackground(getResources().getDrawable(R.drawable.hd_default_background));
    clearBackground();
}
 
開發者ID:wildsmith,項目名稱:TickTank_old,代碼行數:17,代碼來源:TickTankMenuFragment.java

示例9: getMainFragmentAdapter

import android.support.v17.leanback.app.BrowseFragment; //導入依賴的package包/類
@Override
public BrowseFragment.MainFragmentAdapter getMainFragmentAdapter() {
    return mMainFragmentAdapter;
}
 
開發者ID:googlesamples,項目名稱:leanback-showcase,代碼行數:5,代碼來源:GridFragment.java


注:本文中的android.support.v17.leanback.app.BrowseFragment類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。