Skip to content

Commit 3573673

Browse files
bvibbersuchabot
authored andcommitted
Fix for 'download' on media detail page on Honeycomb
DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED is documented as appearing in 3.0 (api 11) but causes a crash on a GoogleTV 2 (Honeycomb-based) device. Skipping it for Honeycomb as we do for Gingerbread; your media goes into the 'Downloads' directory and can be found there, but there's no notification on completion. GitHub: https://github.com/wikimedia/apps-android-commons/pull/24 Change-Id: I4b5b0c0ffc0d9bfa8d1ff524d531022ba8f3f9f8
1 parent 1b6d74f commit 3573673

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

commons/src/main/java/org/wikimedia/commons/media/MediaDetailPagerFragment.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,10 @@ private void downloadMedia(Media m) {
181181

182182
// On HC/ICS/JB we can leave the download notification up when complete.
183183
// This allows folks to open the file directly in gallery viewer.
184-
req.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
184+
// But for some reason it fails on Honeycomb (Google TV). Sigh.
185+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
186+
req.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
187+
}
185188
}
186189

187190
final DownloadManager manager = (DownloadManager)getActivity().getSystemService(Context.DOWNLOAD_SERVICE);

0 commit comments

Comments
 (0)