Add downloaded files to the media library.

Since we can't download the file directly to it's final destination, we can't
have the download manager requisting the file scanned by the media server.
Instead we do it in broadcast receiver which listens for completed downloads.
As it is not allowed to bind to a service from a broadcast receiver, we can't
call MediaScannerConnection.scanFile, because it internally binds to the
media service.
So we use the ACTION_MEDIA_SCANNER_SCAN_FILE intent action to have the file
scanned.

This fixes a comment on issue #55.

Signed-off-by: Kurt Aaholst <kaaholst@gmail.com>
Merge remote-tracking branch 'nik/develop' into develop
Add downloaded files to the media library.

Since we can't download the file directly to it's final destination, we
can't have the download manager request that the file be scanned by the
media server.

Instead we do it in broadcast receiver which listens for completed
downloads.

As it is not allowed to bind to a service from a broadcast receiver,
we can't call MediaScannerConnection.scanFile, because it internally
binds to the media service.

So we use the ACTION_MEDIA_SCANNER_SCAN_FILE intent action to have the
file scanned.

This fixes a comment on issue #55.
Use an explicit version of Gradle to ensure reproducibility.
Prepare the release for 1.1.0-beta-5.
Fix an NPE in updatePlayerDropDown().

Require that the "players" parameter be non-null. In the one case
where null was passed use Collections.<Player>emptyList() instead.
Add a feature graphic, which is now a requirement for Google Play.
WIP: Fix NPEs involving the bound service.

- Mark BaseActivity::getService() as potentially returning null.
WIP: Rename "service" to "mService".
Avoid NPEs when registering callbacks.

- Pass the connection to the bound service as a parameter to
  BaseActivity::onServiceConnected().

- Pass this connection as a parameter to BaseActivity::registerCallback()
  via BaseActivity::maybeRegisterCallbacks().

- Update subclasses to use this connection instead of calling getService().
Fix the REORDER_TO_FRONT 4.4.2 problem

The problem and workaround is described in:
https://code.google.com/p/android/issues/detail?id=63570

The suggested workaround requires the REORDER_TASKS permission, so this
also included.

Signed-off-by: Kurt Aaholst <kaaholst@gmail.com>
Fix NPEs with the service connection in *ListActivity::orderPage().

- Add a stack of pages to order in ItemListActivity.

- Check for the service connection in ItemListActivity::maybeOrderPage().
  If the service is not connected then add the requested page to the
  to-be-ordered a stack.

- Add an implementation of ItemListActivity::onServiceConnected(). When
  the service connection is complete order any pages stored on the stack
  by maybeOrderPage().

- This allows *ListActivity::orderPage() to only be called when the
  service connection is known to be non-null. Add the service connection
  as a parameter, and amend all the subclasses that implement this to
  use it.
Ensure that activity options menu items reflect the bound service state.

- Call supportInvalidateOptionsMenu() when the service binding completes.

- Implement onPrepareOptionsMenu() in derived classes to
  set the enabled state of menu items that require a service connection
  based on the service connection state.
Start handling a nullable service binding in NowPlayingFragment.

- Mark mService as @Nullable.

- Pass the bound service as a parameter to onServiceConnected().

- Pass the bound service as a parameter to maybeRegisterCallbacks().

- Use onPrepareOptionsMenu() to set the state of options menu items.
  Call getActivity().supportInvalidateOptionsMenu()
Verify that the return from getService() is not null.
Propogate the return value from changeVolumeBy().

This returns false if the service is is not bound.
Handle service NPEs in RandomPlayActivity.

Delay setting the list of menu items until the service has been connected,
and pass the connection to the service to the item click listener.
Merge branch 'release-1.1.0' of https://github.com/nikclayton/android-squeezer into release-1.1.0

# By Nik Clayton (3) and Kurt Aaholst (1)
# Via Nik Clayton (2) and Kurt Aaholst (1)
* 'release-1.1.0' of https://github.com/nikclayton/android-squeezer:
  Fix an NPE in updatePlayerDropDown().
  Prepare the release for 1.1.0-beta-5.
  Use an explicit version of Gradle to ensure reproducibility.
  Add downloaded files to the media library.
Merge branch 'service-npe' into release-1.1.0

* service-npe:
  Handle service NPEs in RandomPlayActivity.
  Propogate the return value from changeVolumeBy().
  Verify that the return from getService() is not null.
  Start handling a nullable service binding in NowPlayingFragment.
  Ensure that activity options menu items reflect the bound service state.
  Fix NPEs with the service connection in *ListActivity::orderPage().
  Avoid NPEs when registering callbacks.
  WIP: Rename "service" to "mService".
  WIP: Fix NPEs involving the bound service.
Merge branch 'kaaholst-reorder_task_fix' into release-1.1.0

* kaaholst-reorder_task_fix:
  Fix the REORDER_TO_FRONT 4.4.2 problem