/// <summary> /// Handle click events on options menu /// </summary> /// <param name="item"></param> /// <returns></returns> public override bool OnOptionsItemSelected(IMenuItem item) { int id = item.ItemId; if (id == Resource.Id.action_Lang) { //Toggle Languages LanguagePrefs prefs = new LanguagePrefs(this); if (prefs.GetLanguageCode() == "el") { prefs.SetLanguageCode("en"); } else { prefs.SetLanguageCode("el"); } langChanged = true; //And recreate the app for changes to take effect this.Recreate(); return(true); } else if (id == Resource.Id.action_Info) { Android.Support.V7.App.AlertDialog info = new Android.Support.V7.App.AlertDialog.Builder(this) .SetTitle(Resource.String.InfoTitle) .SetMessage(Resource.String.InfoMessage).SetPositiveButton(Resource.String.OK, (object o, DialogClickEventArgs args) => { }).Show(); } return(base.OnOptionsItemSelected(item)); }
/// <summary> /// Get the language the user wants /// </summary> /// <param name="c"></param> /// <returns>a string with the language code</returns> public static string GetLanguage(Context c) { LanguagePrefs prefs = new LanguagePrefs(c); return(prefs.GetLanguageCode()); }