Esempio n. 1
0
        //menu
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Resource.Id.novyNakup:
                NakupActivity.startActivity(this);
                return(true);

            case Resource.Id.grafy:
                MainActivity.startActivity(this);
                return(true);

            case Resource.Id.zoznamNakupov:
                NakupListActivity.StartActivity(this);
                return(true);

            case Resource.Id.ucet:
                UcetActivity.startActivity(this);
                return(true);

            case Resource.Id.info:
                InfoActivity.startActivity(this);
                return(true);
            }
            return(base.OnOptionsItemSelected(item));
        }
Esempio n. 2
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            // toto znamená, že som stlačil šípku späť v action bare
            if (item.ItemId == Android.Resource.Id.Home)
            {
                // toto je to isté, akoby som stlačil "späť" na telefóne
                OnBackPressed();
                return(true);
            }
            else
            {
                switch (item.ItemId)
                {
                case Resource.Id.novyNakup:
                    NakupActivity.startActivity(this);
                    return(true);

                case Resource.Id.grafy:
                    MainActivity.startActivity(this);
                    return(true);

                case Resource.Id.zoznamNakupov:
                    NakupListActivity.StartActivity(this);
                    return(true);

                case Resource.Id.info:
                    return(true);
                }
                return(base.OnOptionsItemSelected(item));
            }
        }
Esempio n. 3
0
        protected override void OnCreate(Bundle SavedInstanceState)
        {
            base.OnCreate(SavedInstanceState);
            SetContentView(Resource.Layout.nakup_activity_prehlad_layout);



            txtObchod    = FindViewById <TextView>(Resource.Id.txtObchodPrehlad);
            txtCena      = FindViewById <TextView>(Resource.Id.txtCenaPrehlad);
            txtDatum     = FindViewById <TextView>(Resource.Id.txtDatumPrehlad);
            txtKategoria = FindViewById <TextView>(Resource.Id.txtKatPrehlad);
            btnGrafy     = FindViewById <Button>(Resource.Id.btnGrafy);
            btnNakupList = FindViewById <Button>(Resource.Id.btnNakupList);
            btnNovyNakup = FindViewById <Button>(Resource.Id.btnNovyNakup);


            //nakupPrehladJson = Intent.GetStringExtra("Nakup");
            Nakup nakup = JsonConvert.DeserializeObject <Nakup>(Intent.GetStringExtra("Nakup"));

            txtObchod.Text    = nakup.obchodNakup;
            txtCena.Text      = nakup.vydajNakup.ToString();
            txtKategoria.Text = nakup.kategoria;
            txtDatum.Text     = nakup.den + "." + nakup.mesiac + "." + nakup.rok;



            btnGrafy.Click += delegate
            {
                MainActivity.startActivity(this);
                Finish();
            };

            btnNakupList.Click += delegate
            {
                NakupListActivity.StartActivity(this);
                Finish();
            };

            btnNovyNakup.Click += delegate
            {
                NakupActivity.startActivity(this);
                Finish();
            };
        }
Esempio n. 4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            if (NakupServis.getInstance().emptyNakup())
            {
                NakupActivity.startActivity(this);
                Finish();
            }
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_main);

            nakupList = NakupServis.getInstance().GetNakupList();

            farby = new string[] { "#19152d", "#342a4c", "#424272", "#5c7677", "#7a9968", "#9abc51", "#b4cc49", "#e9ffbf" };

            txtOznam7dni              = FindViewById <TextView>(Resource.Id.txtOznam7dni);
            txtOznam7dni.Visibility   = Android.Views.ViewStates.Gone;
            txtOznamTyzden            = FindViewById <TextView>(Resource.Id.txtOznamTyzden);
            txtOznamTyzden.Visibility = Android.Views.ViewStates.Gone;
            txtOznamMesiac            = FindViewById <TextView>(Resource.Id.txtOznamMesiac);
            txtOznamMesiac.Visibility = Android.Views.ViewStates.Gone;

            LnrLayTyzden    = FindViewById <LinearLayout>(Resource.Id.LnrLayTyzden);
            LnrLayTyzdenKat = FindViewById <LinearLayout>(Resource.Id.LnrLayTyzdenKat);
            LnrLayLast7     = FindViewById <LinearLayout>(Resource.Id.LnrLayLast7);
            LnrLayLast7Kat  = FindViewById <LinearLayout>(Resource.Id.LnrLayLast7kat);
            LnrLayMesiac    = FindViewById <LinearLayout>(Resource.Id.LnrLayMonth);
            LnrLayMesiacKat = FindViewById <LinearLayout>(Resource.Id.LnrLayMonthkat);

            tyzdenList = new List <Entry>();
            List <sumaNakupov> tyzdenSuma = new List <sumaNakupov>();

            tyzdenSuma = SumaTyzden(nakupList);
            for (int i = 0; i < tyzdenSuma.Count; i++)
            {
                var vstup = new Entry(Convert.ToSingle(tyzdenSuma[i].vydajSumaNakup));
                vstup.Label      = tyzdenSuma[i].obchodSumaNakup;
                vstup.ValueLabel = tyzdenSuma[i].vydajSumaNakup.ToString();
                vstup.Color      = SKColor.Parse(farby[i]);
                tyzdenList.Add(vstup);
            }

            tyzdenListKat = new List <Entry>();
            List <sumaNakupov> tyzdenSumaKat = new List <sumaNakupov>();

            tyzdenSumaKat = SumaTyzdenKat(nakupList);
            for (int i = 0; i < tyzdenSumaKat.Count; i++)
            {
                var vstup = new Entry(Convert.ToSingle(tyzdenSumaKat[i].vydajSumaNakup));
                vstup.Label      = tyzdenSumaKat[i].obchodSumaNakup;
                vstup.ValueLabel = tyzdenSumaKat[i].vydajSumaNakup.ToString();
                vstup.Color      = SKColor.Parse(farby[i]);
                tyzdenListKat.Add(vstup);
            }

            mesiacList = new List <Entry>();
            List <sumaNakupov> mesiacSuma = new List <sumaNakupov>();

            mesiacSuma = SumaMesiac(nakupList);
            for (int i = 0; i < mesiacSuma.Count; i++)
            {
                var vstup = new Entry(Convert.ToSingle(mesiacSuma[i].vydajSumaNakup));
                vstup.Label      = mesiacSuma[i].obchodSumaNakup;
                vstup.ValueLabel = mesiacSuma[i].vydajSumaNakup.ToString();
                vstup.Color      = SKColor.Parse(farby[i]);
                mesiacList.Add(vstup);
            }

            mesiacListKat = new List <Entry>();
            List <sumaNakupov> mesiacSumaKat = new List <sumaNakupov>();

            mesiacSumaKat = SumaMesiacKat(nakupList);
            for (int i = 0; i < mesiacSumaKat.Count; i++)
            {
                var vstup = new Entry(Convert.ToSingle(mesiacSumaKat[i].vydajSumaNakup));
                vstup.Label      = mesiacSumaKat[i].obchodSumaNakup;
                vstup.ValueLabel = mesiacSumaKat[i].vydajSumaNakup.ToString();
                vstup.Color      = SKColor.Parse(farby[i]);
                mesiacListKat.Add(vstup);
            }

            tyzdenDatumList = new List <Entry>();
            List <sumaNakupov> tyzdenDatumSuma = new List <sumaNakupov>();

            tyzdenDatumSuma = SumaDatumTyzden(nakupList);
            for (int i = 0; i < tyzdenDatumSuma.Count; i++)
            {
                var vstup = new Entry(Convert.ToSingle(tyzdenDatumSuma[i].vydajSumaNakup));
                vstup.Label      = tyzdenDatumSuma[i].obchodSumaNakup;
                vstup.ValueLabel = tyzdenDatumSuma[i].vydajSumaNakup.ToString();
                vstup.Color      = SKColor.Parse(farby[i]);
                tyzdenDatumList.Add(vstup);
            }

            tyzdenDatumListKat = new List <Entry>();
            List <sumaNakupov> tyzdenDatumSumaKat = new List <sumaNakupov>();

            tyzdenDatumSumaKat = SumaDatumTyzdenKat(nakupList);
            for (int i = 0; i < tyzdenDatumSumaKat.Count; i++)
            {
                var vstup = new Entry(Convert.ToSingle(tyzdenDatumSumaKat[i].vydajSumaNakup));
                vstup.Label      = tyzdenDatumSumaKat[i].obchodSumaNakup;
                vstup.ValueLabel = tyzdenDatumSumaKat[i].vydajSumaNakup.ToString();
                vstup.Color      = SKColor.Parse(farby[i]);
                tyzdenDatumListKat.Add(vstup);
            }

            var chartlast7 = new DonutChart()
            {
                Entries = tyzdenList, LabelTextSize = 30f
            };
            var chartlast7kat = new DonutChart()
            {
                Entries = tyzdenListKat, LabelTextSize = 30f
            };
            var chartWeek = new DonutChart()
            {
                Entries = tyzdenDatumList, LabelTextSize = 30f
            };
            var chartWeekkat = new DonutChart()
            {
                Entries = tyzdenDatumListKat, LabelTextSize = 30f
            };
            var chartMonth = new DonutChart()
            {
                Entries = mesiacList, LabelTextSize = 30f
            };
            var chartMonthkat = new DonutChart()
            {
                Entries = mesiacListKat, LabelTextSize = 30f
            };

            //ošetrenie starých nákupov
            if (tyzdenSuma.Count != 0)
            {
                var chartViewLast7 = FindViewById <ChartView>(Resource.Id.chartViewLast7);
                chartViewLast7.Chart = chartlast7;
                var chartViewLast7kat = FindViewById <ChartView>(Resource.Id.chartViewLast7kat);
                chartViewLast7kat.Chart = chartlast7kat;
            }
            else
            {
                txtOznam7dni.Visibility   = Android.Views.ViewStates.Visible;
                LnrLayLast7.Visibility    = Android.Views.ViewStates.Gone;
                LnrLayLast7Kat.Visibility = Android.Views.ViewStates.Gone;
            }

            if (tyzdenDatumSuma.Count != 0)
            {
                var chartViewWeek = FindViewById <ChartView>(Resource.Id.chartViewWeek);
                chartViewWeek.Chart = chartWeek;
                var chartViewWeekkat = FindViewById <ChartView>(Resource.Id.chartViewWeekkat);
                chartViewWeekkat.Chart = chartWeekkat;
            }
            else
            {
                txtOznamTyzden.Visibility  = Android.Views.ViewStates.Visible;
                LnrLayTyzden.Visibility    = Android.Views.ViewStates.Gone;
                LnrLayTyzdenKat.Visibility = Android.Views.ViewStates.Gone;
            }

            if (mesiacSuma.Count != 0)
            {
                var chartViewMonth = FindViewById <ChartView>(Resource.Id.chartViewMonth);
                chartViewMonth.Chart = chartMonth;
                var chartViewMonthkat = FindViewById <ChartView>(Resource.Id.chartViewMonthkat);
                chartViewMonthkat.Chart = chartMonthkat;
            }
            else
            {
                txtOznamMesiac.Visibility  = Android.Views.ViewStates.Visible;
                LnrLayMesiac.Visibility    = Android.Views.ViewStates.Gone;
                LnrLayMesiacKat.Visibility = Android.Views.ViewStates.Gone;
            }
        }