Loading src/com/android/documentsui/inspector/HeaderView.java +35 −20 Original line number Diff line number Diff line Loading @@ -37,6 +37,8 @@ import com.android.documentsui.inspector.InspectorController.HeaderDisplay; import java.util.function.Consumer; import javax.annotation.Nullable; /** * Organizes and displays the title and thumbnail for a given document */ Loading Loading @@ -77,14 +79,35 @@ public final class HeaderView extends RelativeLayout implements HeaderDisplay { mTitle.setText(displayName); } private void loadHeaderImage(DocumentInfo info) { private void loadHeaderImage(DocumentInfo doc) { if (!doc.isThumbnailSupported()) { showImage(doc, null); } else { Consumer<Bitmap> callback = new Consumer<Bitmap>() { @Override public void accept(Bitmap thumbnail) { showImage(doc, thumbnail); } }; // load the thumbnail async. final ThumbnailLoader task = new ThumbnailLoader(doc.derivedUri, mThumbnail, mImageDimensions, doc.lastModified, callback, false); task.executeOnExecutor(ProviderExecutor.forAuthority(doc.derivedUri.getAuthority()), doc.derivedUri); } } /** * Shows the supplied image, falling back to a mimetype icon if the image is null. */ private void showImage(DocumentInfo info, @Nullable Bitmap thumbnail) { if (thumbnail != null) { mThumbnail.resetPaddingToInitialValues(); mThumbnail.setScaleType(ScaleType.CENTER_CROP); mThumbnail.setImageBitmap(thumbnail); } else { mThumbnail.setPadding(0, 0, 0, mTitle.getHeight()); Drawable mimeIcon = mContext.getContentResolver().getTypeDrawable(info.mimeType); mThumbnail.setScaleType(ScaleType.FIT_CENTER); Loading @@ -92,12 +115,4 @@ public final class HeaderView extends RelativeLayout implements HeaderDisplay { } mThumbnail.animate().alpha(1.0f).start(); } }; // load the thumbnail async. final ThumbnailLoader task = new ThumbnailLoader(info.derivedUri, mThumbnail, mImageDimensions, info.lastModified, callback, false); task.executeOnExecutor(ProviderExecutor.forAuthority(info.derivedUri.getAuthority()), info.derivedUri); } } No newline at end of file tests/common/com/android/documentsui/PagingProvider.java +1 −1 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ public class PagingProvider extends TestRootProvider { String parentDocumentId, String[] projection, Bundle queryArgs) throws FileNotFoundException { // TODO: Content notification. queryArgs = queryArgs != null ? queryArgs : Bundle.EMPTY; MatrixCursor c = createDocCursor(projection); Bundle extras = c.getExtras(); Loading Loading
src/com/android/documentsui/inspector/HeaderView.java +35 −20 Original line number Diff line number Diff line Loading @@ -37,6 +37,8 @@ import com.android.documentsui.inspector.InspectorController.HeaderDisplay; import java.util.function.Consumer; import javax.annotation.Nullable; /** * Organizes and displays the title and thumbnail for a given document */ Loading Loading @@ -77,14 +79,35 @@ public final class HeaderView extends RelativeLayout implements HeaderDisplay { mTitle.setText(displayName); } private void loadHeaderImage(DocumentInfo info) { private void loadHeaderImage(DocumentInfo doc) { if (!doc.isThumbnailSupported()) { showImage(doc, null); } else { Consumer<Bitmap> callback = new Consumer<Bitmap>() { @Override public void accept(Bitmap thumbnail) { showImage(doc, thumbnail); } }; // load the thumbnail async. final ThumbnailLoader task = new ThumbnailLoader(doc.derivedUri, mThumbnail, mImageDimensions, doc.lastModified, callback, false); task.executeOnExecutor(ProviderExecutor.forAuthority(doc.derivedUri.getAuthority()), doc.derivedUri); } } /** * Shows the supplied image, falling back to a mimetype icon if the image is null. */ private void showImage(DocumentInfo info, @Nullable Bitmap thumbnail) { if (thumbnail != null) { mThumbnail.resetPaddingToInitialValues(); mThumbnail.setScaleType(ScaleType.CENTER_CROP); mThumbnail.setImageBitmap(thumbnail); } else { mThumbnail.setPadding(0, 0, 0, mTitle.getHeight()); Drawable mimeIcon = mContext.getContentResolver().getTypeDrawable(info.mimeType); mThumbnail.setScaleType(ScaleType.FIT_CENTER); Loading @@ -92,12 +115,4 @@ public final class HeaderView extends RelativeLayout implements HeaderDisplay { } mThumbnail.animate().alpha(1.0f).start(); } }; // load the thumbnail async. final ThumbnailLoader task = new ThumbnailLoader(info.derivedUri, mThumbnail, mImageDimensions, info.lastModified, callback, false); task.executeOnExecutor(ProviderExecutor.forAuthority(info.derivedUri.getAuthority()), info.derivedUri); } } No newline at end of file
tests/common/com/android/documentsui/PagingProvider.java +1 −1 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ public class PagingProvider extends TestRootProvider { String parentDocumentId, String[] projection, Bundle queryArgs) throws FileNotFoundException { // TODO: Content notification. queryArgs = queryArgs != null ? queryArgs : Bundle.EMPTY; MatrixCursor c = createDocCursor(projection); Bundle extras = c.getExtras(); Loading