Update gradle plugin version
Fix beginBroadcast called while already in a broadcast

for updatePlayerSubscriptionState.

By counting the number of registered callbacks, thus eliminating the need
to call beginBroadcast to get the count.

Also remove the requirement that scrobling turns on second to second
updates, because we already receive (and handle) these events from the
notifications enabled by the listen command.
Fix beginBroadcast called while already in a broadcast

by having the executor run all broadcasts, which ensures sequential
execution.
Update gradle plugin version
Implement grid layout for song list.

Preferred layout is selectable from view menu. Default is list layout.
The view dialog shares functionality with the album view menu, so common
code is moved to the new BaseViewDialog.

There was no server string for song display options, so added the translation
for album display options where the word for album is substituted with the word
for song.

Signed-off-by: Kurt Aaholst <kaaholst@gmail.com>
Do not use AIDL for service calls and asynchronous callbacks

As recommended by <http://developer.android.com/guide/components/bound-services.html>
and <http://developer.android.com/guide/components/aidl.html>

This make the code simpler, and the app faster and less memory consuming,
because we do not need to marshall the objects to and from the service.

Note we still use AIDL for RemoteCallbackList (subscriptions), because of the
generic boundary.
Do not use AIDL for subscriptions

By providing an alternative for RemoteCallbackList
Provide the callback for asynchronous requests as a parameter

Instead of registering and unregistering the callback.

Keep a list of pending requests keyed by the correlation id, and execute
the callback when tre response comes in.
When the callback owner goes away, remove the it's callbacks from the
peding requests. No longer needs to keep track of implicitly obsolete
requests.

This enables the possibility of having different callbacks simultanously
for the same owner (activity), and same data type. E.g. needed to down-
load all songs of an item.

This also enables us to use generic handlers in CliClient and generic
callbacks in the item lists. Only need to override, if special actions
are required.

Signed-off-by: Kurt Aaholst <kaaholst@gmail.com>
Automatic unregistering of service callbacks

so the developer does not have to remember to do it manually.

The service now keeps track of all subscriptions by client and by type.
When a client (normally activity or fragment) unsubscribes, we cancel
all the subscriptions for the client. Unregistering of the individual
callbacks are no longer needed, so they are removed. The callbacks must
still be registered.

This unsubscription is handled in onPause in the base activity which all
Squeezer activities extend. We also provide an empty registerCallback
function, so specialisations only have to implement it, if they have any
subscriptions.
Thread safe callback handling

We use ConcurrentHashMap from the java.util.concurrent package, which
like the java.util.concurrent.atomic classes from the original
implementation does not use locking.

To hold the callbacks in the ServiceCallbackList we also use a
ConCurrentHashMap. This is because there is no ConcurrentList or
ConcurrentSet and Collections.newSetFromMap is not available before
api level 9.

The semantics of the ConcurrentHashMap seems adequate because whether
an activity gets the response/notification, if it comes in  when
resuming/pausing is arbitrary whether or not we use locking. Since
registration and unregistration happens from the same thread, all a
clients callbacks will be safely unregisted when the activity or
fragment is paused.
Implement download of albums,artists,genres,years and musicfolders

To ensure safe download of multiple item we use the download manager,
so this is a gingerbread or better feature.

To ease the implementation of this, the model has been extended with
a new interface, FilterItem, which defines a tag to be passed to the
Squeezebox server. This means the item to download items for can just
be used as a tagged parameter for the songs request.
Since an item can have many songs, this request can take some time
to process, so this logic is moved to the service to avoid problems,
with the activity disapearing. Playlists and musicfolders are special
cases since they use the playlists tracks and musicfolder requests
respectively to get the subitems. Musicfolder are special also, in that
it can contain subfolders, and it is the only list which does not
contain songs.

The name and folder structure of the downloaded songs will match that
of the server. This is accomplished by ordering the server path in the
requests, and removing the configured media folder from the server path.
The mediafolder(s) are ordered when the app starts. If we can't find
the relative server path, we just use the file name from the server
path. All files are placed in Environment.DIRECTORY_MUSIC.

There seems to be a problem downloading files with certain characters in
the path or name ('%' and '?'). To workaround that the files are down-
loaded to a temporary filename, and renamed when the download is
complete. The download id is registered when the download is enqueded
in the download manager, and the filename is looked up when the
download complete event comes. We use a SQLite database to hold the
pending downloads.

Download of genre or musicfolder may result in a substantial number of
downloads. To handle this the user can cancel the downloads by clicking
the download notification.

Download notification clicks and download completed events are handled
by a broadcast receiver which is registered in the manifest.

Since we now have the FilterItem, this is taken advantage of in the
albums and artists requests.

Since the service can now handle load of full lists, this is utilized
in the genre and year spinners.
Upgrade to gradle plugin 0.9

Required by Android Studio 0.5
Authenticated downloads
Fix forget selected player

Defer set active player until all players have been received from the server.

Signed-off-by: Kurt Aaholst <kaaholst@gmail.com>
Implement player dropdown in the actionbar

In the service callback to observers, when the list of players is learned
from the server, and when changes to the player list is notified. A new
handler id registered to receive "client" notifications.

In the now playing fragment (which is present in all activites), when the
player list is notified, set up a dropdown with the known players, and the
active player selected. When a player is selected from the dropdown, call
the service with the selected player.

Remove all updates of the activity title (since it is overridden by the
action bar). The number of items is no longer showed, and for radios and
musicfolders, update the header of the item list, instead of the activity
title.

Signed-off-by: Kurt Aaholst <kaaholst@gmail.com>
Merge branch 'master' into develop

Conflicts:
	Squeezer/build.gradle
	gradle/wrapper/gradle-wrapper.properties
Fix player subscription state not updated

when callback is unregistered
Merge remote-tracking branch 'nik/release-1.0.2' into develop

Conflicts:
	Squeezer/src/main/java/uk/org/ngo/squeezer/HomeActivity.java
	Squeezer/src/main/java/uk/org/ngo/squeezer/service/CliClient.java
	Squeezer/src/main/java/uk/org/ngo/squeezer/service/ConnectionState.java
	Squeezer/src/main/java/uk/org/ngo/squeezer/service/SqueezeService.java
	gradle/wrapper/gradle-wrapper.properties
Remove player dropdown logging
Remove unused menu xml file