本文整理匯總了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();
}
示例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();
}
示例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);
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例9: getMainFragmentAdapter
import android.support.v17.leanback.app.BrowseFragment; //導入依賴的package包/類
@Override
public BrowseFragment.MainFragmentAdapter getMainFragmentAdapter() {
return mMainFragmentAdapter;
}