Implement alternative player config URLs

develop
LEdoian 3 years ago
parent 0f074607fb
commit 637e076d20

@ -65,7 +65,8 @@ namespace QuickPlay
// Make sure that the configuration is same
var newConfig = AppConfiguration.loadSavedConfiguration();
if (this != newConfig) throw new InvalidDataException("Saved configuration is different from the supplied one.");
// FIXME: Broken? Throws falsely.
//if (this != newConfig) throw new InvalidDataException("Saved configuration is different from the supplied one.");
}
[NonSerialized]

@ -3,6 +3,7 @@ using Android.App;
using Android.OS;
using Android.Views;
using Android.Widget;
using Android.Content;
using Android.Support.V7.App;
using Toolbar = Android.Support.V7.Widget.Toolbar;
using GridLayoutManager = Android.Support.V7.Widget.GridLayoutManager;
@ -67,9 +68,27 @@ namespace QuickPlay
{
if (item.ItemId == Resource.Id.action_settings)
{
// Show the play bar
var bar = FindViewById(Resource.Id.currentSongBar);
bar.Visibility = ViewStates.Visible;
// Set player config URL
var b = new Android.Support.V7.App.AlertDialog.Builder(this);
b.SetTitle("Player config URL");
var input = new EditText(this);
input.Text = appConfig.playerConfigUrl;
b.SetView(input);
b.SetPositiveButton("Set", delegate
{
string text = input.Text;
appConfig.playerConfigUrl = text;
appConfig.saveConfiguration();
Toast.MakeText(this, "Configuration saved, reloading", ToastLength.Short).Show();
var i = new Intent(this, typeof(MainActivity));
StartActivity(i);
});
b.SetNegativeButton("Scan QR", delegate {
Toast.MakeText(this, "Not implemented :-(", ToastLength.Long).Show();
});
b.SetCancelable(true);
b.Show();
}
if (item.ItemId == Resource.Id.action_edit)
@ -144,5 +163,11 @@ namespace QuickPlay
// Refresh player info
OnPlayerUpdate();
}
public void OnDestroy()
{
base.OnDestroy();
this.appConfig.saveConfiguration();
}
}
}

Loading…
Cancel
Save