本文整理匯總了Java中com.google.android.apps.picview.ui.ThumbnailItem類的典型用法代碼示例。如果您正苦於以下問題:Java ThumbnailItem類的具體用法?Java ThumbnailItem怎麽用?Java ThumbnailItem使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ThumbnailItem類屬於com.google.android.apps.picview.ui包,在下文中一共展示了ThumbnailItem類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: MultiColumnImageAdapter
import com.google.android.apps.picview.ui.ThumbnailItem; //導入依賴的package包/類
/**
* Instantiates a new MultiColumnImageAdapter.
*
* @param dataItems
* the list of data items to display
* @param inflater
* the inflater to be used to inflate the thumbnail slots
* @param listener
* a listener that is notified when an album was clicked on
* @param cachedImageFetcher
* used to fetch the thumbnail images
* @param displayMetrics
* used to determine who many thumbnails can be display on a single
* row
*/
public MultiColumnImageAdapter(List<ThumbnailItem<T>> dataItems,
LayoutInflater inflater, ThumbnailClickListener<T> listener,
CachedImageFetcher cachedImageFetcher, DisplayMetrics displayMetrics) {
this.dataItems = dataItems;
this.inflater = inflater;
this.listener = listener;
this.cachedImageFetcher = cachedImageFetcher;
// Determine how many thumbnails can be put onto one row.
float thumbnailWithPx = PicViewConfig.ALBUM_THUMBNAIL_SIZE
* displayMetrics.density;
slotsPerRow = (int) Math
.floor(displayMetrics.widthPixels / thumbnailWithPx);
Log.d(TAG, "Photos per row: " + slotsPerRow);
slotWidth = displayMetrics.widthPixels / slotsPerRow;
}
示例2: wrap
import com.google.android.apps.picview.ui.ThumbnailItem; //導入依賴的package包/類
/**
* Wraps a list of {@link Photo}s into a list of {@link ThumbnailItem}s, so
* they can be displayed in the list.
*/
private static List<ThumbnailItem<Photo>> wrap(List<Photo> photos) {
List<ThumbnailItem<Photo>> result = new ArrayList<ThumbnailItem<Photo>>();
for (Photo photo : photos) {
result.add(new ThumbnailItem<Photo>(photo.getName(), photo
.getThumbnailUrl(), photo));
}
return result;
}
示例3: wrap
import com.google.android.apps.picview.ui.ThumbnailItem; //導入依賴的package包/類
/**
* Wraps a list of {@link Album}s into a list of {@link ThumbnailItem}s, so
* they can be displayed in the list.
*/
private static List<ThumbnailItem<Album>> wrap(List<Album> albums) {
List<ThumbnailItem<Album>> result = new ArrayList<ThumbnailItem<Album>>();
for (Album album : albums) {
result.add(new ThumbnailItem<Album>(album.getName(), album
.getThumbnailUrl(), album));
}
return result;
}
示例4: recycleSlotView
import com.google.android.apps.picview.ui.ThumbnailItem; //導入依賴的package包/類
/**
* Recycles a slot view, if it already exists. This means, changing the title,
* stopping a previous image loading task and instantiating a new image
* loading task.
*
* @param slot
* the slot to recycle
* @param item
* the item that holds the data for the slot
*/
private void recycleSlotView(ThumbnailSlotView slot,
final ThumbnailItem<T> item) {
slot.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
listener.thumbnailClicked(item.getDataObject());
}
});
TextView picTitle = (TextView) slot.findViewById(R.id.picture_title);
picTitle.setText(item.getTitle());
// We need to cancel the UI update of the image loading task for this
// slot, if one is present and instead set the loading icon.
ImageLoadingTask previousLoadingTask = slot.getImageLoadingTask();
if (previousLoadingTask != null) {
previousLoadingTask.setCancelUiUpdate(true);
}
ImageView albumThumbnail = (ImageView) slot
.findViewById(R.id.album_thumbnail);
// The ImageLoadingTask will load the thumbnail asynchronously and set
// the result as soon as the response is in. The image will be set
// immediately, if the result is already in cache.
try {
ImageLoadingTask task = new ImageLoadingTask(albumThumbnail, new URL(
item.getThumbnailUrl()), cachedImageFetcher);
slot.setImageLoadingTask(task);
task.execute();
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
示例5: AlbumsAdapter
import com.google.android.apps.picview.ui.ThumbnailItem; //導入依賴的package包/類
public AlbumsAdapter(List<ThumbnailItem<Album>> dataItems,
LayoutInflater inflater, ThumbnailClickListener<Album> listener,
CachedImageFetcher cachedImageFetcher, DisplayMetrics displayMetrics) {
super(dataItems, inflater, listener, cachedImageFetcher, displayMetrics);
}
示例6: PhotosAdapter
import com.google.android.apps.picview.ui.ThumbnailItem; //導入依賴的package包/類
public PhotosAdapter(List<ThumbnailItem<Photo>> dataItems,
LayoutInflater inflater, ThumbnailClickListener<Photo> listener,
CachedImageFetcher cachedImageFetcher, DisplayMetrics displayMetrics) {
super(dataItems, inflater, listener, cachedImageFetcher, displayMetrics);
}
示例7: getView
import com.google.android.apps.picview.ui.ThumbnailItem; //導入依賴的package包/類
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LinearLayout row = (LinearLayout) convertView;
ThumbnailSlotView[] slotViews = new ThumbnailSlotView[slotsPerRow];
// If we are supposed to recycle the view, clear it first. We are
// caching all the image views anyway.
if (row != null && row.getChildCount() == slotsPerRow) {
// We recycle all of them.
for (int i = 0; i < slotsPerRow; ++i) {
slotViews[i] = (ThumbnailSlotView) row.getChildAt(i);
}
} else {
// Nothing to recycle, so we create a new row.
row = new LinearLayout(inflater.getContext());
row.setBackgroundColor(Color.BLACK);
row.setOrientation(LinearLayout.HORIZONTAL);
row.setGravity(Gravity.CENTER_HORIZONTAL);
row.setPadding(0, 15, 0, 0);
// We need to create new slots.
for (int i = 0; i < slotsPerRow; ++i) {
slotViews[i] = createNewSlotView(parent);
row.addView(slotViews[i]);
}
}
// Add the columns/slots to the row.
for (int i = 0; i < slotsPerRow; ++i) {
int dataIndex = (position * slotsPerRow) + i;
if (dataIndex >= dataItems.size()) {
break;
}
final ThumbnailItem<T> thumbnailData = dataItems.get(dataIndex);
recycleSlotView(slotViews[i], thumbnailData);
}
return row;
}