Ejemplo n.º 1
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var ignored = base.OnCreateView(inflater, container, savedInstanceState);

            View view = inflater.Inflate(Resource.Layout.content_home, null);

            try
            {
                crudSettings = new CrudSettings();
                settings     = Settings.Instance;

                buttonOk        = view.FindViewById <MaterialButton>(Resource.Id.materialButton1);
                buttonOk.Click += HandlerClickButtonOk;

                buttonCancel        = view.FindViewById <MaterialButton>(Resource.Id.materialButton2);
                buttonCancel.Click += HandlerClickButtonCancel;

                return(view);
            }
            catch (System.Exception ex)
            {
                #region Logging
                LogRuntimeAttribute.InLogFiles(typeof(HomeFragment), ex);
                #endregion

                return(view);
            }
        }
Ejemplo n.º 2
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            #region Init View

            var  ignored = base.OnCreateView(inflater, container, savedInstanceState);
            View view    = inflater.Inflate(Resource.Layout.content_settings, null);

            #endregion

            try
            {
                crudSettings = new CrudSettings();
                settings     = Settings.Instance;

                updateServiceIntent = new Intent();
                updateServiceIntent.SetAction(Info.IntentActionUpdateSettings);
                updatePendingIntent = PendingIntent.GetBroadcast(context, 0, updateServiceIntent, 0);

                #region Popup Dialog

                var remoteViews = new RemoteViews(context.PackageName, Resource.Layout.layout_popup);

                var layoutInflater = LayoutInflater.FromContext(context);
                var viewPopup      = layoutInflater.Inflate(remoteViews.LayoutId, null);

                popupDialog = new Dialog(Platform.CurrentActivity);
                popupDialog.SetContentView(viewPopup);
                popupDialog.Window.SetSoftInputMode(SoftInput.AdjustResize);

                var textView = viewPopup.FindViewById <TextView>(Resource.Id.textView1);

                buttonOkPopup        = viewPopup.FindViewById <Button>(Resource.Id.button1);
                buttonOkPopup.Click += ButtonOk_Popup_Click;

                buttonCancelPopup        = viewPopup.FindViewById <Button>(Resource.Id.button2);
                buttonCancelPopup.Click += ButtonCancel_Popup_Click;

                #endregion

                #region Сontrol element

                materialButtonAppInfo = view.FindViewById <MaterialButton>(Resource.Id.materialButton1);

                floatingActionButtonSaveSettings = view.FindViewById <FloatingActionButton>(Resource.Id.floatingActionButton1);
                floatingActionDefaultSettings    = view.FindViewById <FloatingActionButton>(Resource.Id.floatingActionButton2);

                radioGroupMain = view.FindViewById <RadioGroup>(Resource.Id.radioGroup1);

                radioButtonUseRam = view.FindViewById <RadioButton>(Resource.Id.radioButton1);
                radioButtonUseCpu = view.FindViewById <RadioButton>(Resource.Id.radioButton2);

                swithRelativeIsViewRam = view.FindViewById <SwitchCompat>(Resource.Id.switch1);
                swithShowFreeRam       = view.FindViewById <SwitchCompat>(Resource.Id.switch2);
                //swithLogging = view.FindViewById<SwitchCompat>(Resource.Id.switch3);
                //swithCrash = view.FindViewById<SwitchCompat>(Resource.Id.switch4);

                switchCompatUseCpu       = view.FindViewById <SwitchCompat>(Resource.Id.switchCompat1);
                switchAbsoluteIsViewRam  = view.FindViewById <SwitchCompat>(Resource.Id.switchCompat2);
                switchLayoutLotification = view.FindViewById <SwitchCompat>(Resource.Id.switchCompat3);

                sbSizeDigits       = view.FindViewById <AppCompatSeekBar>(Resource.Id.seekBar1);
                sbPositionAbscissa = view.FindViewById <AppCompatSeekBar>(Resource.Id.seekBar3);
                sbPositionOrdinate = view.FindViewById <AppCompatSeekBar>(Resource.Id.seekBar4);
                sbUpdateTimer      = view.FindViewById <AppCompatSeekBar>(Resource.Id.seekBar5);

                spinnerTypefaceDigits  = view.FindViewById <Spinner>(Resource.Id.spinner1);
                spinnerTextColorDigits = view.FindViewById <Spinner>(Resource.Id.spinner3);
                spinnerCanvasColor     = view.FindViewById <Spinner>(Resource.Id.spinner5);
                spinnerCanvasMaterial  = view.FindViewById <Spinner>(Resource.Id.spinner6);

                tvsbSizeDigits             = view.FindViewById <TextView>(Resource.Id.textView2);
                tvsbSwithRelativeIsViewRam = view.FindViewById <TextView>(Resource.Id.textView4);
                tvsbTypefaceDigits         = view.FindViewById <TextView>(Resource.Id.textView5);
                tvsbPositionAbscissa       = view.FindViewById <TextView>(Resource.Id.textView10);
                tvsbPositionOrdinate       = view.FindViewById <TextView>(Resource.Id.textView11);
                tvsbSwithIsShowFreeRam     = view.FindViewById <TextView>(Resource.Id.textView13);
                tvsbUpdateTimer            = view.FindViewById <TextView>(Resource.Id.textView14);
                //tvsbLogging = view.FindViewById<TextView>(Resource.Id.textView15);
                //tvsbCrash = view.FindViewById<TextView>(Resource.Id.textView16);

                tvsbLayoutLotification     = view.FindViewById <AppCompatTextView>(Resource.Id.appCompatTextView3);
                tvsbSwithIsShowFreeCpu     = view.FindViewById <AppCompatTextView>(Resource.Id.appCompatTextView1);
                tvsbSwithAbsoluteIsViewRam = view.FindViewById <AppCompatTextView>(Resource.Id.appCompatTextView2);

                materialButtonAppInfo.Click += MaterialButtonAppInfo_Click;

                floatingActionButtonSaveSettings.Click += ButtonSaveSettings_Click;
                floatingActionDefaultSettings.Click    += ButtonDefaultSettings_Click;

                radioButtonUseRam.Click += RadioButtonUseRam_Click;

                adapter = ArrayAdapter.CreateFromResource(context, Resource.Array.array_typeface_style, Android.Resource.Layout.SimpleSpinnerItem);
                adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);

                adapterColor = ArrayAdapter.CreateFromResource(context, Resource.Array.array_color, Android.Resource.Layout.SimpleSpinnerItem);
                adapterColor.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);

                adapterMaterial = ArrayAdapter.CreateFromResource(context, Resource.Array.array_material, Android.Resource.Layout.SimpleSpinnerItem);
                adapterMaterial.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);

                spinnerTypefaceDigits.Adapter  = adapter;
                spinnerTextColorDigits.Adapter = adapterColor;
                spinnerCanvasColor.Adapter     = adapterColor;
                spinnerCanvasMaterial.Adapter  = adapterMaterial;

                sbSizeDigits.ProgressChanged       += SbSizeDigits_ProgressChanged;
                sbPositionAbscissa.ProgressChanged += SbPositionAbscissa_ProgressChanged;
                sbPositionOrdinate.ProgressChanged += SbPositionOrdinate_ProgressChanged;

                swithRelativeIsViewRam.CheckedChange += SwithRelativeIsViewRam_CheckedChange;
                swithShowFreeRam.CheckedChange       += SwithShowFreeRam_CheckedChange;
                //swithLogging.CheckedChange += SwithLogging_CheckedChange;
                //swithCrash.CheckedChange += SwithCrash_CheckedChange;
                switchCompatUseCpu.CheckedChange       += SwitchCompatUseCpu_CheckedChange;
                switchAbsoluteIsViewRam.CheckedChange  += SwitchAbsoluteIsViewRam_CheckedChange;
                switchLayoutLotification.CheckedChange += SwitchLayoutLotification_CheckedChange;

                spinnerTypefaceDigits.ItemSelected  += SpinnerTypefaceDigits_ItemSelected;
                spinnerCanvasColor.ItemSelected     += SpinnerCanvasColor_ItemSelected;
                spinnerTextColorDigits.ItemSelected += SpinnerTextColorDigits_ItemSelected;
                spinnerCanvasMaterial.ItemSelected  += SpinnerCanvasMaterial_ItemSelected;

                if (settings.ProVersion == false)
                {
                    sbUpdateTimer.ProgressDrawable.SetColorFilter(Color.Olive, PorterDuff.Mode.SrcAtop);
                    sbUpdateTimer.Thumb.SetColorFilter(Color.Olive, PorterDuff.Mode.SrcAtop);

                    radioButtonUseCpu.SetTextColor(Color.Olive);

                    spinnerTypefaceDigits.SetBackgroundColor(Color.Olive);
                    spinnerCanvasColor.SetBackgroundColor(Color.Olive);
                    spinnerTextColorDigits.SetBackgroundColor(Color.Olive);
                    spinnerCanvasMaterial.SetBackgroundColor(Color.Olive);

                    sbUpdateTimer.Touch          += SbUpdateTimer_Touch;
                    radioButtonUseCpu.Touch      += RadioButtonUseCpu_Touch;
                    spinnerTypefaceDigits.Touch  += Spinner_Touch;
                    spinnerCanvasColor.Touch     += Spinner_Touch;
                    spinnerTextColorDigits.Touch += Spinner_Touch;
                    spinnerCanvasMaterial.Touch  += Spinner_Touch;
                }
                else
                {
                    sbUpdateTimer.ProgressChanged       += SbUpdateTimer_ProgressChanged;
                    radioButtonUseCpu.Click             += RadioButtonUseCpu_Click;
                    spinnerTypefaceDigits.ItemSelected  += SpinnerTypefaceDigits_ItemSelected;
                    spinnerCanvasColor.ItemSelected     += SpinnerCanvasColor_ItemSelected;
                    spinnerTextColorDigits.ItemSelected += SpinnerTextColorDigits_ItemSelected;
                    spinnerCanvasMaterial.ItemSelected  += SpinnerCanvasMaterial_ItemSelected;
                }

                UpdateView();

                #endregion

                return(view);
            }
            catch (System.Exception ex)
            {
                #region Logging
                LogRuntimeAttribute.InLogFiles(typeof(SettingsFragment), ex);
                #endregion

                return(view);
            }
            finally { }
        }