本文整理汇总了Java中com.google.samples.apps.iosched.ui.widget.CollectionView.Inventory方法的典型用法代码示例。如果您正苦于以下问题:Java CollectionView.Inventory方法的具体用法?Java CollectionView.Inventory怎么用?Java CollectionView.Inventory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.samples.apps.iosched.ui.widget.CollectionView
的用法示例。
在下文中一共展示了CollectionView.Inventory方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateCollectionView
import com.google.samples.apps.iosched.ui.widget.CollectionView; //导入方法依赖的package包/类
/**
* Updates the CollectionView with the given list of {@code videos}.
*/
private void updateCollectionView(List<VideoLibraryModel.Video> videos) {
LOGD(TAG, "Updating filtered video library collection view.");
CollectionView.Inventory inventory = new CollectionView.Inventory();
int normalColumns = getResources().getInteger(R.integer.video_library_columns);
// Go through all videos and organize them into groups for each topic. We assume they are
// already ordered by topics.
CollectionView.InventoryGroup curGroup = new CollectionView.InventoryGroup(0)
.setDataIndexStart(0)
.setShowHeader(false)
.setDisplayCols(normalColumns);
for (int dataIndex = 0; dataIndex < videos.size(); ++dataIndex) {
curGroup.addItemWithTag(videos.get(dataIndex));
}
if (curGroup.getRowCount() > 0) {
inventory.addGroup(curGroup);
}
mCollectionView.setCollectionAdapter(this);
mCollectionView.updateInventory(inventory);
mEmptyView.setVisibility(videos.isEmpty() ? View.VISIBLE : View.GONE);
}
示例2: getInventory
import com.google.samples.apps.iosched.ui.widget.CollectionView; //导入方法依赖的package包/类
public CollectionView.Inventory getInventory() {
CollectionView.Inventory inventory = new CollectionView.Inventory();
// setup hero hashtag
inventory.addGroup(new CollectionView.InventoryGroup(HERO_GROUP_ID)
.setDisplayCols(1)
.setItemCount(1)
.setShowHeader(false));
// setup other hashtags
inventory.addGroup(new CollectionView.InventoryGroup(HashtagsQuery.TOKEN)
.setDisplayCols(mContext.getResources().getInteger(R.integer.social_grid_columns))
.setItemCount(mCursor.getCount() - 1)
.setDataIndexStart(1)
.setShowHeader(false));
return inventory;
}
示例3: getInventory
import com.google.samples.apps.iosched.ui.widget.CollectionView; //导入方法依赖的package包/类
/**
* Returns a new instance of {@link CollectionView.Inventory}. It always contains a single
* {@link CollectionView.InventoryGroup}.
*
* @return A new instance of {@link CollectionView.Inventory}.
*/
public CollectionView.Inventory getInventory() {
CollectionView.Inventory inventory = new CollectionView.Inventory();
inventory.addGroup(new CollectionView.InventoryGroup(ExploreSessionsQuery.NORMAL_TOKEN)
.setDisplayCols(mDisplayColumns)
.setItemCount(getCursor().getCount())
.setDataIndexStart(0)
.setShowHeader(false));
return inventory;
}
示例4: getInventory
import com.google.samples.apps.iosched.ui.widget.CollectionView; //导入方法依赖的package包/类
public CollectionView.Inventory getInventory() {
CollectionView.Inventory inventory = new CollectionView.Inventory();
inventory.addGroup(new CollectionView.InventoryGroup(PeopleIveMetQuery.TOKEN)
.setDisplayCols(1)
.setItemCount(1)
.setDataIndexStart(0)
.setShowHeader(true)
.setHeaderLabel(mContext.getString(R.string.title_people_ive_met)));
return inventory;
}
示例5: getInventory
import com.google.samples.apps.iosched.ui.widget.CollectionView; //导入方法依赖的package包/类
/**
* Returns a new instance of {@link CollectionView.Inventory}. It always contains only one
* {@link CollectionView.InventoryGroup}.
*
* @return A new instance of {@link CollectionView.Inventory}
*/
public CollectionView.Inventory getInventory() {
CollectionView.Inventory inventory = new CollectionView.Inventory();
inventory.addGroup(new CollectionView.InventoryGroup(ExpertsQuery.TOKEN)
.setDisplayCols(mDisplayCols)
.setItemCount(mCursor.getCount())
.setDataIndexStart(0)
.setShowHeader(mShowHeader)
.setHeaderLabel(getString(R.string.title_experts_directory)));
return inventory;
}
示例6: updateCollectionView
import com.google.samples.apps.iosched.ui.widget.CollectionView; //导入方法依赖的package包/类
private void updateCollectionView() {
if (mCursor == null || mTagMetadata == null) {
LOGD(TAG, "updateCollectionView: not ready yet... " + (mCursor == null ? "no cursor." :
"no tag metadata."));
// not ready!
return;
}
LOGD(TAG, "SessionsFragment updating CollectionView... " + (mSessionDataIsFullReload ?
"(FULL RELOAD)" : "(light refresh)"));
mCursor.moveToPosition(-1);
int itemCount = mCursor.getCount();
mMaxDataIndexAnimated = 0;
CollectionView.Inventory inv;
if (itemCount == 0) {
showEmptyView();
inv = new CollectionView.Inventory();
} else {
hideEmptyView();
inv = prepareInventory();
}
Parcelable state = null;
if (!mSessionDataIsFullReload) {
// it's not a full reload, so we want to keep scroll position, etc
state = mCollectionView.onSaveInstanceState();
}
LOGD(TAG, "Updating CollectionView with inventory, # groups = " + inv.getGroupCount()
+ " total items = " + inv.getTotalItemCount());
mCollectionView.setCollectionAdapter(this);
mCollectionView.updateInventory(inv, mSessionDataIsFullReload);
if (state != null) {
mCollectionView.onRestoreInstanceState(state);
}
mSessionDataIsFullReload = false;
}
示例7: getInventory
import com.google.samples.apps.iosched.ui.widget.CollectionView; //导入方法依赖的package包/类
/**
* Returns a new instance of {@link CollectionView.Inventory}. It always contains only one
* {@link CollectionView.InventoryGroup}.
*
* @return A new instance of {@link CollectionView.Inventory}
*/
public CollectionView.Inventory getInventory() {
CollectionView.Inventory inventory = new CollectionView.Inventory();
inventory.addGroup(new CollectionView.InventoryGroup(PartnersQuery._TOKEN)
.setDisplayCols(mDisplayCols)
.setItemCount(mCursor.getCount())
.setDataIndexStart(0)
.setShowHeader(false)
.setHeaderLabel(getString(R.string.title_experts_directory)));
return inventory;
}
示例8: updateCollectionView
import com.google.samples.apps.iosched.ui.widget.CollectionView; //导入方法依赖的package包/类
private void updateCollectionView() {
LOGD(TAG, "Updating video library collection view.");
CollectionView.InventoryGroup curGroup = null;
CollectionView.Inventory inventory = new CollectionView.Inventory();
mCursor.moveToPosition(-1);
int dataIndex = -1;
int normalColumns = getResources().getInteger(R.integer.video_library_columns);
boolean isEmpty = mCursor.getCount() == 0;
while (mCursor.moveToNext()) {
++dataIndex;
String topic = mCursor.getString(VideosQuery.TOPIC);
boolean isHero = TextUtils.isEmpty(topic);
int year = mCursor.getInt(VideosQuery.YEAR);
String groupName = TextUtils.isEmpty(topic) ?
getString(R.string.google_i_o_year, year) : topic + " (" + year + ")";
if (curGroup == null || !curGroup.getHeaderLabel().equals(groupName)) {
if (curGroup != null) {
inventory.addGroup(curGroup);
}
curGroup = new CollectionView.InventoryGroup(
isHero ? GROUP_ID_HERO : GROUP_ID_NORMAL)
.setDataIndexStart(dataIndex)
.setHeaderLabel(groupName)
.setShowHeader(true)
.setDisplayCols(isHero ? 1 : normalColumns)
.setItemCount(1);
} else {
curGroup.incrementItemCount();
}
}
if (curGroup != null) {
inventory.addGroup(curGroup);
}
mCollectionView.setCollectionAdapter(this);
mCollectionView.updateInventory(inventory);
mEmptyView.setVisibility(isEmpty ? View.VISIBLE : View.GONE);
}
示例9: getInventory
import com.google.samples.apps.iosched.ui.widget.CollectionView; //导入方法依赖的package包/类
public CollectionView.Inventory getInventory() {
CollectionView.Inventory inventory = new CollectionView.Inventory();
CollectionView.InventoryGroup inventoryGroup = null;
int actualGroupId = -1;
int p_gid = 1;
int p_group = 2;
mCursor.moveToFirst();
do {
int groupId = mCursor.getInt( p_gid );
String groupName = mCursor.getString( p_group );
// Create a new InventoryGroup or increase the size of the actual one.
if( actualGroupId != groupId ) {
// Add the previous created InventoryGroup to the Inventory.
// !! We do this at the latest point because the InventoryGroup
// is cloned after it was added to the Inventory otherwise it
// would not register the InventoryGroup size increasment.
if( inventoryGroup != null ) {
inventory.addGroup( inventoryGroup );
}
// Create the new InventoryGroup
inventoryGroup = new CollectionView.InventoryGroup( groupId )
.setDisplayCols( 1 )
.setDataIndexStart( mCursor.getPosition() )
.setShowHeader( true )
.setHeaderLabel( groupName )
.setItemCount( 1 );
actualGroupId = groupId;
} else {
// or increase the size of the existing one
inventoryGroup.incrementItemCount();
}
} while( mCursor.moveToNext() );
// Don't forget to add the last created InventoryGroup
inventory.addGroup( inventoryGroup );
// or use an alternative way
/*
// setup hero hashtag
inventory.addGroup(new CollectionView.InventoryGroup( HERO_GROUP_ID )
.setDisplayCols(1)
.setItemCount(1)
.setHeaderLabel( "Hero View" )
.setShowHeader(true));
// setup other hashtags
inventory.addGroup(new CollectionView.InventoryGroup( 1 )
.setDisplayCols(1)
.setItemCount(mCursor.getCount() - 1)
.setDataIndexStart(1)
.setShowHeader(false));
*/
return inventory;
}