protected override void OnCreate(Bundle savedInstanceState) { RequestWindowFeature(WindowFeatures.NoTitle); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.settingsPage); SeekBar sound = FindViewById <SeekBar>(Resource.Id.sound); SeekBar music = FindViewById <SeekBar>(Resource.Id.music); Button reset = FindViewById <Button>(Resource.Id.ResetButton); Button achievements = FindViewById <Button>(Resource.Id.AchievementsButton); Switch note1 = FindViewById <Switch>(Resource.Id.note1); Switch note2 = FindViewById <Switch>(Resource.Id.note2); //object to store local data var localData = Application.Context.GetSharedPreferences("MyContacts", FileCreationMode.Private); var edit = localData.Edit(); //how to pull data sound.Progress = localData.GetInt("sound", 100); music.Progress = localData.GetInt("music", 100); note1.Checked = localData.GetBoolean("notifications", false); note2.Checked = localData.GetBoolean("bubbleNotifications", false); reset.Click += (sender, e) => { UserObject obj = SingleUserObject.getObject(); obj.CompletedBlocks = new int[0]; obj.MoneyEarned = 0; obj.QuestionsAnswered = 0; Android.Widget.Toast.MakeText(this, "data deleted", ToastLength.Short).Show(); }; sound.ProgressChanged += (sender, e) => { //how to save data edit.PutInt("sound", sound.Progress); edit.Commit(); }; music.ProgressChanged += (sender, e) => { edit.PutInt("music", music.Progress); edit.Commit(); }; note1.Click += (sender, e) => { edit.PutBoolean("notifications", note1.Checked); edit.Commit(); }; note2.Click += (sender, e) => { edit.PutBoolean("bubbleNotifications", note2.Checked); edit.Commit(); }; achievements.Click += (sender, e) => { var intent = new Intent(this, typeof(AchievementsPageActivity)); StartActivity(intent); }; }
protected override void OnCreate(Bundle savedInstanceState) { RequestWindowFeature(WindowFeatures.NoTitle); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.QuestionDifficultypage); ImageButton continueButton = FindViewById <ImageButton>(Resource.Id.continueButton); ImageButton EasyButton = FindViewById <ImageButton>(Resource.Id.EasyButton); ImageButton NormalButton = FindViewById <ImageButton>(Resource.Id.EasyButton); ImageButton HardButton = FindViewById <ImageButton>(Resource.Id.EasyButton); ImageButton HardestButton = FindViewById <ImageButton>(Resource.Id.EasyButton); ImageButton BackButton = FindViewById <ImageButton>(Resource.Id.backButton); continueButton.Click += (sender, e) => { var intent = new Intent(this, typeof(QuestionspageActivity)); StartActivity(intent); }; EasyButton.Click += (sender, e) => { UserObject var = SingleUserObject.getObject(); var.Difficulty = "1"; }; NormalButton.Click += (sender, e) => { UserObject var = SingleUserObject.getObject(); var.Difficulty = "2"; }; HardButton.Click += (sender, e) => { UserObject var = SingleUserObject.getObject(); var.Difficulty = "3"; }; HardestButton.Click += (sender, e) => { UserObject var = SingleUserObject.getObject(); var.Difficulty = "4"; }; BackButton.Click += (sender, e) => { Finish(); }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); RequestWindowFeature(WindowFeatures.NoTitle); SetContentView(Resource.Layout.AchievementsPage); TextView lv = FindViewById <TextView>(Resource.Id.level); TextView questions = FindViewById <TextView>(Resource.Id.questionsAnswered); TextView money = FindViewById <TextView>(Resource.Id.moneyRaised); UserObject obj = SingleUserObject.getObject(); questions.Text = Convert.ToString(obj.QuestionsAnswered); money.Text = Convert.ToString(obj.MoneyEarned); lv.Text = Convert.ToString((int)(Math.Sqrt(obj.QuestionsAnswered / 10) + obj.MoneyEarned / 50)); if (lv.Text == "0") { lv.Text = "1"; } }