protected override void OnElementChanged (ElementChangedEventArgs<Button> e) { base.OnElementChanged (e); if (e.OldElement == null) { var checkBoxElement = Element as CheckButton; var control = new Android.Widget.CheckBox (this.Context); control.Checked = checkBoxElement.IsSelected; control.CheckedChange += Control_CheckedChange; control.SetButtonDrawable (Context.GetDrawable (Resource.Drawable.checkbox_button)); this.SetNativeControl (control); } else if (e.NewElement == null) { (Control as Android.Widget.CheckBox).CheckedChange -= Control_CheckedChange; } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { base.OnCreateView(inflater, container, savedInstanceState); View view = this.BindingInflate(Resource.Layout.Configuration, null); var prefs = Application.Context.GetSharedPreferences("Fildo", FileCreationMode.Private); this.cultureInfo = ((MainView)this.Activity).CultureInfo; string cultureForced = prefs.GetString("CultureForced", this.culture); string proxyForced = prefs.GetString("ProxyConf", string.Empty); if (!string.IsNullOrEmpty(((BaseViewModel)((MainView)this.Activity).ViewModel).PlayingArtist)) { ((MainView)this.Activity).FindViewById <Android.Widget.LinearLayout>(Resource.Id.miniPlayer).Visibility = ViewStates.Visible; } if (this.ViewModel != null) { view.FindViewById <Android.Widget.CheckBox>(Resource.Id.checkboxsavealbum).Text = ((BaseViewModel)this.ViewModel).GetString("SaveUnderFolder", this.cultureInfo); view.FindViewById <Android.Widget.CheckBox>(Resource.Id.checkboxexternal).Text = ((BaseViewModel)this.ViewModel).GetString("SaveExternalSD", this.cultureInfo); view.FindViewById <Android.Widget.Button>(Resource.Id.BtnSave).Text = ((BaseViewModel)this.ViewModel).GetString("Save", this.cultureInfo); view.FindViewById <Android.Widget.TextView>(Resource.Id.spinnerCultureText).Text = ((BaseViewModel)this.ViewModel).GetString("SpinnerCultureText", this.cultureInfo); view.FindViewById <Android.Widget.TextView>(Resource.Id.spinnerProxyText).Text = ((BaseViewModel)this.ViewModel).GetString("SpinnerProxyText", this.cultureInfo); } var spinnerCulture = view.FindViewById <MvxSpinner>(Resource.Id.spinnerCulture); spinnerCulture.ItemSelected += this.SpinnerCulture_ItemSelected; this.spinnerProxies = view.FindViewById <MvxSpinner>(Resource.Id.spinnerProxy); this.spinnerProxies.ItemSelected += this.SpinnerProxies_ItemSelected; int cfTemp = ((List <string>)spinnerCulture.ItemsSource).IndexOf(cultureForced); if (cfTemp > -1) { spinnerCulture.SetSelection(cfTemp); } if (!string.IsNullOrEmpty(proxyForced)) { int pxTemp = ((List <string>) this.spinnerProxies.ItemsSource).IndexOf(proxyForced); if (pxTemp > -1) { this.spinnerProxies.SetSelection(pxTemp); } else { this.spinnerProxies.SetSelection(0); } } else { this.spinnerProxies.SetSelection(0); } this.progress = new Bindables.BindableProgress(view.Context, this.ViewModel); var set = this.CreateBindingSet <ConfigurationView, ConfigurationViewModel>(); set.Bind(this.progress).For(p => p.Visible).To(vm => vm.IsBusy); set.Bind(this.progress).For(p => p.NoInternet).To(vm => vm.NoInternet); set.Bind(this).For(p => p.Saved).To(vm => vm.Saved); set.Apply(); this.saveUnderArtistFolder = view.FindViewById <Android.Widget.CheckBox>(Resource.Id.checkboxsavealbum); this.saveUnderExternalSd = view.FindViewById <Android.Widget.CheckBox>(Resource.Id.checkboxexternal); this.saveUnderArtistFolder.Checked = prefs.GetBoolean("SaveUnderArtistFolder", false); this.saveUnderExternalSd.Checked = prefs.GetBoolean("SaveExternalSD", false); GAService.GetGASInstance().Track_App_Page("Configuration"); return(view); }