Methods Summary |
---|
protected com.android.ex.photo.fragments.PhotoViewFragment | createPhotoViewFragment(android.content.Intent intent, int position, boolean onlyShowSpinner)
return PhotoViewFragment.newInstance(intent, position, onlyShowSpinner);
|
public java.lang.String | getContentType(android.database.Cursor cursor)
return getString(cursor, PhotoViewColumns.CONTENT_TYPE);
|
public android.support.v4.app.Fragment | getItem(android.content.Context context, android.database.Cursor cursor, int position)
final String photoUri = getPhotoUri(cursor);
final String thumbnailUri = getThumbnailUri(cursor);
boolean loading = shouldShowLoadingIndicator(cursor);
boolean onlyShowSpinner = false;
if(photoUri == null && loading) {
onlyShowSpinner = true;
}
// create new PhotoViewFragment
final PhotoViewIntentBuilder builder =
Intents.newPhotoViewFragmentIntentBuilder(mContext, getPhotoViewFragmentClass());
builder
.setResolvedPhotoUri(photoUri)
.setThumbnailUri(thumbnailUri)
.setDisplayThumbsFullScreen(mDisplayThumbsFullScreen)
.setMaxInitialScale(mMaxScale);
return createPhotoViewFragment(builder.build(), position, onlyShowSpinner);
|
public java.lang.String | getPhotoUri(android.database.Cursor cursor)
return getString(cursor, PhotoViewColumns.CONTENT_URI);
|
protected java.lang.Class | getPhotoViewFragmentClass()
return PhotoViewFragment.class;
|
private java.lang.String | getString(android.database.Cursor cursor, java.lang.String column)
if (mColumnIndices.containsKey(column)) {
return cursor.getString(mColumnIndices.get(column));
} else {
return null;
}
|
public java.lang.String | getThumbnailUri(android.database.Cursor cursor)
return getString(cursor, PhotoViewColumns.THUMBNAIL_URI);
|
public boolean | shouldShowLoadingIndicator(android.database.Cursor cursor)
String value = getString(cursor, PhotoViewColumns.LOADING_INDICATOR);
if (value == null) {
return false;
} else {
return Boolean.valueOf(value);
}
|
public android.database.Cursor | swapCursor(android.database.Cursor newCursor)
mColumnIndices.clear();
if (newCursor != null) {
for(String column : PhotoQuery.PROJECTION) {
mColumnIndices.put(column, newCursor.getColumnIndexOrThrow(column));
}
for(String column : PhotoQuery.OPTIONAL_COLUMNS) {
int index = newCursor.getColumnIndex(column);
if (index != -1) {
mColumnIndices.put(column, index);
}
}
}
return super.swapCursor(newCursor);
|