|
|
|
@ -25,15 +25,6 @@ namespace QuickPlay
|
|
|
|
|
appConfig = AppConfiguration.loadConfiguration();
|
|
|
|
|
var playerConfig = await appConfig.GetPlayerConfig();
|
|
|
|
|
currentPlayer = playerConfig.GetPlayer();
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
await currentPlayer.ConnectAsync();
|
|
|
|
|
} catch (CannotConnectException e)
|
|
|
|
|
{
|
|
|
|
|
//TODO: View a toast with details and change some colors?
|
|
|
|
|
var t = Toast.MakeText(this, e.Message + ": " + e.InnerException.Message ?? "", ToastLength.Long);
|
|
|
|
|
t.Show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// UI initialization
|
|
|
|
|
SetContentView(Resource.Layout.activity_main);
|
|
|
|
@ -51,8 +42,7 @@ namespace QuickPlay
|
|
|
|
|
// Since this is rather complicated, it is in a separate method
|
|
|
|
|
InitializeRecyclerView();
|
|
|
|
|
|
|
|
|
|
// FIXME: This should be in OnResume...
|
|
|
|
|
// Refresh player info
|
|
|
|
|
// I don't know why, but this needs to be here in order to show correct colors and player name.
|
|
|
|
|
OnPlayerUpdate();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -135,5 +125,24 @@ namespace QuickPlay
|
|
|
|
|
{
|
|
|
|
|
await currentPlayer.Play(song);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async void OnResume()
|
|
|
|
|
{
|
|
|
|
|
base.OnResume();
|
|
|
|
|
|
|
|
|
|
// Reconnect the player
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
await currentPlayer.ConnectAsync();
|
|
|
|
|
} catch (CannotConnectException e)
|
|
|
|
|
{
|
|
|
|
|
//TODO: View a toast with details and change some colors?
|
|
|
|
|
var t = Toast.MakeText(this, e.Message + ": " + e.InnerException.Message ?? "", ToastLength.Long);
|
|
|
|
|
t.Show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Refresh player info
|
|
|
|
|
OnPlayerUpdate();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|