Пример #1
0
        public void OnClick(View v)
        {
            if (Convert.ToUInt32(v.Tag.ToString()) == 3)
            {
                datePickerListener = new DatePickerDialog(this, Android.Resource.Style.ThemeHoloLightDialogMinWidth);
                datePickerListener.SetOnDateSetListener(this);
                datePickerListener.Show();
            }
            if (Convert.ToUInt32(v.Tag.ToString()) == 1)
            {
                string tname, tdesc, tdue;
                tname = taskName.Text;
                tdesc = taskDesc.Text;
                tdue  = taskDue.Text;

                if (tname.Trim().Length == 0 || tdesc.Trim().Length == 0 || tdue.Trim().Length == 0)
                {
                    string umsg = "Enter all task data..";
                    Toast  t    = Toast.MakeText(v.Context, umsg, ToastLength.Long);
                    t.Show();
                }
                else
                {
                    UserTask task = new UserTask();
                    task.TaskName = tname;
                    task.TaskDesc = tdesc;
                    task.TaskDue  = tdue;
                    userTasks.Add(task);
                    string umsg = "Task added..";
                    Toast  t    = Toast.MakeText(v.Context, umsg, ToastLength.Long);
                    t.Show();
                    taskName.Text = "";
                    taskDesc.Text = "";
                    taskDue.Text  = "";
                }
            }
            if (Convert.ToUInt32(v.Tag.ToString()) == 2)
            {
                var mainActivity = new Intent(this, typeof(MainActivity));
                if (userTasks.Count > 0)
                {
                    mainActivity.PutExtra("userTasks", JsonConvert.SerializeObject(userTasks));
                    StartActivity(mainActivity);
                }
                else
                {
                    Toast t = Toast.MakeText(v.Context, "Please add tasks", ToastLength.Long);
                    t.Show();
                }
            }
        }
Пример #2
0
 private void Calendartxt_Click(object sender, EventArgs e)
 {
     picker.Show();
     picker.SetOnDateSetListener(this);
 }
Пример #3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            FrameLayout frame        = FindViewById <FrameLayout>(Resource.Id.Common_FrameLayout);
            View        calendarPage = LayoutInflater.Inflate(Resource.Layout.GoalCreationPage, null);

            frame.AddView(calendarPage.FindViewById <LinearLayout>(Resource.Id.GoalCreation_Layout));

            LinearLayout navLayout = FindViewById <LinearLayout>(Resource.Id.Common_NavLayout);

            navLayout.Visibility = ViewStates.Gone;

            taskNameField        = FindViewById <EditText>(Resource.Id.GoalCreation_TaskNameField);
            taskDescriptionField = FindViewById <EditText>(Resource.Id.GoalCreation_DescriptionField);
            pointsSlider         = FindViewById <SeekBar>(Resource.Id.GoalCreation_PointsSlider);
            pointsLabel          = FindViewById <TextView>(Resource.Id.GoalCreation_PointsTextView);
            typeSwitch           = FindViewById <Switch>(Resource.Id.GoalCreation_GoalSwitch);
            frequencyLayout      = FindViewById <LinearLayout>(Resource.Id.GoalCreation_FrequencyLayout);
            frequencyButton      = FindViewById <Button>(Resource.Id.GoalCreation_FrequencyButton);
            timePickButton       = FindViewById <Button>(Resource.Id.GoalCreation_TimePickButton);
            datePickButton       = FindViewById <Button>(Resource.Id.GoalCreation_DatePickButton);

            Button cancelButton = FindViewById <Button>(Resource.Id.GoalCreation_CancelButton);
            Button saveButton   = FindViewById <Button>(Resource.Id.GoalCreation_SaveButton);

            cancelButton.Click += Cancel_Click;
            saveButton.Click   += Save_Click;

            frequencyButton.Click += delegate {
                PopupMenu menu = new PopupMenu(this, frequencyButton);
                menu.MenuInflater.Inflate(Resource.Menu.frequency_menu, menu.Menu);

                menu.MenuItemClick += (s, arg) => { frequencyButton.Text = arg.Item.TitleFormatted.ToString(); };

                menu.Show();
            };
            datePickButton.Click += delegate {
                DatePickerDialog datePickDialog = new DatePickerDialog(this);
                datePickDialog.SetOnDateSetListener(this);
                datePickDialog.Show();
            };
            timePickButton.Click += delegate {
                TimePickerDialog timePickDialog = new TimePickerDialog(this, this, DateTime.Now.Hour, DateTime.Now.Minute, false);
                timePickDialog.Show();
            };

            typeSwitch.CheckedChange += delegate(object sender, CompoundButton.CheckedChangeEventArgs e) {
                if (e.IsChecked)
                {
                    frequencyLayout.Visibility = ViewStates.Visible;
                }
                else
                {
                    frequencyLayout.Visibility = ViewStates.Invisible;
                }
            };

            pointsSlider.SetOnSeekBarChangeListener(this);
            pointsSlider.Max = 19;
            pointsLabel.Text = (pointsSlider.Progress + 1).ToString();
        }
Пример #4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.detail_layout);

            _startDatePickerDialog = new DatePickerDialog(this);
            _startDatePickerDialog.DatePicker.Tag = StartDatePicker;
            _startDatePickerDialog.SetOnDateSetListener(this);

            _endDatePickerDialog = new DatePickerDialog(this);
            _endDatePickerDialog.DatePicker.Tag = EndDatePicker;
            _endDatePickerDialog.SetOnDateSetListener(this);

            _startVac       = FindViewById <TextView>(Resource.Id.dayStart);
            _startDateMonth = FindViewById <TextView>(Resource.Id.monthStart);
            _startDateYear  = FindViewById <TextView>(Resource.Id.yearStart);

            _endVac       = FindViewById <TextView>(Resource.Id.dayEnd);
            _endDateMonth = FindViewById <TextView>(Resource.Id.monthEnd);
            _endDateYear  = FindViewById <TextView>(Resource.Id.yearEnd);

            _saveButton = FindViewById <Button>(Resource.Id.saveButton);

            _recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerViewDetail);
            _adapter      = new RadioButtonAdapter(_recyclerView);
            _recyclerView.SetAdapter(_adapter);

            _linearLayoutManager = new LinearLayoutManager(this, LinearLayoutManager.Horizontal, false);
            _recyclerView.SetLayoutManager(_linearLayoutManager);
            _recyclerView.StopNestedScroll();

            _viewPager = FindViewById <ViewPager>(Resource.Id.viewPager);
            DetailFragmentStatePagerAdapter detailFragmentPagerAdapter = new DetailFragmentStatePagerAdapter(SupportFragmentManager);

            detailFragmentPagerAdapter.AddFragmentView((arg1, arg2, arg3) =>
            {
                return(SetViewPagerFragment(arg1, arg2, "Regular", Resource.Drawable.Icon_Request_Green));
            });
            detailFragmentPagerAdapter.AddFragmentView((arg1, arg2, arg3) =>
            {
                return(SetViewPagerFragment(arg1, arg2, "Sick", Resource.Drawable.Icon_Request_Plum));
            });
            detailFragmentPagerAdapter.AddFragmentView((arg1, arg2, arg3) =>
            {
                return(SetViewPagerFragment(arg1, arg2, "Exceptional", Resource.Drawable.Icon_Request_Gray));
            });
            detailFragmentPagerAdapter.AddFragmentView((arg1, arg2, arg3) =>
            {
                return(SetViewPagerFragment(arg1, arg2, "LeaveWithoutPay", Resource.Drawable.Icon_Request_Dark));
            });
            detailFragmentPagerAdapter.AddFragmentView((arg1, arg2, arg3) =>
            {
                return(SetViewPagerFragment(arg1, arg2, "OverTime", Resource.Drawable.Icon_Request_Blue));
            });

            _viewPager.Adapter = detailFragmentPagerAdapter;

            var dots = FindViewById <TabLayout>(Resource.Id.dot);

            dots.SetupWithViewPager(_viewPager, true);

            var startDateEditText = FindViewById <RelativeLayout>(Resource.Id.relative1);

            startDateEditText.Click += (s, e) =>
            {
                _startDatePickerDialog.UpdateDate(StartDatePickerTime.Year, StartDatePickerTime.Month - 1, StartDatePickerTime.Day);
                _startDatePickerDialog.Show();
            };

            var endDateEditText = FindViewById <RelativeLayout>(Resource.Id.relative2);

            endDateEditText.Click += (s, e) =>
            {
                _endDatePickerDialog.UpdateDate(EndDatePickerTime.Year, EndDatePickerTime.Month - 1, EndDatePickerTime.Day);
                _endDatePickerDialog.Show();
            };
        }
Пример #5
0
 private void Datefield_Click(object sender, EventArgs e)
 {
     picker.Show();
     picker.SetOnDateSetListener(this);
 }