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
This commit is contained in:
Brion Vibber 2013-07-10 01:07:22 +00:00 committed by SuchABot
parent 1b6d74f7ca
commit 35736733c3

View file

@ -181,7 +181,10 @@ public class MediaDetailPagerFragment extends SherlockFragment implements ViewPa
// On HC/ICS/JB we can leave the download notification up when complete.
// This allows folks to open the file directly in gallery viewer.
req.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
// But for some reason it fails on Honeycomb (Google TV). Sigh.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
req.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
}
}
final DownloadManager manager = (DownloadManager)getActivity().getSystemService(Context.DOWNLOAD_SERVICE);