Ejemplo n.º 1
0
        private void editDate(DateTimeOffset currentDate)
        {
            if (editDialog == null)
            {
                var datePickerDialog = new DatePickerDialog(this, Resource.Style.WheelDialogStyle, new DatePickerListener(currentDate, activeEditionChangedSubject.OnNext),
                                                            currentDate.Year, currentDate.Month - 1, currentDate.Day);

                void updateDateBounds()
                {
                    datePickerDialog.DatePicker.MinDate = minDateTime.ToUnixTimeMilliseconds();
                    datePickerDialog.DatePicker.MaxDate = maxDateTime.ToUnixTimeMilliseconds();
                }

                updateDateBounds();

                void resetAction()
                {
                    updateDateBounds();
                    datePickerDialog.UpdateDate(currentDate.Year, currentDate.Month - 1, currentDate.Day);
                }

                editDialog = datePickerDialog;
                editDialog.DismissEvent += (_, __) => onCurrentEditDialogDismiss(resetAction);
                editDialog.Show();
            }
        }
Ejemplo n.º 2
0
        private void editDate(DateTimeOffset currentDate)
        {
            if (editDialog == null)
            {
                var datePickerDialog = new DatePickerDialog(this, Resource.Style.WheelDialogStyle, new DatePickerListener(currentDate, activeEditionChangedSubject.OnNext),
                                                            currentDate.Year, currentDate.Month - 1, currentDate.Day);

                // FirstDayOfWeek days start with sunday at 1 and finish with saturday at 7
                var normalizedBeginningOfWeek = (int)ViewModel.BeginningOfWeek + 1;
                datePickerDialog.DatePicker.FirstDayOfWeek = normalizedBeginningOfWeek;

                void updateDateBounds()
                {
                    datePickerDialog.DatePicker.MinDate = minDateTime.ToUnixTimeMilliseconds();
                    datePickerDialog.DatePicker.MaxDate = maxDateTime.ToUnixTimeMilliseconds();
                }

                updateDateBounds();

                void resetAction()
                {
                    updateDateBounds();
                    datePickerDialog.UpdateDate(currentDate.Year, currentDate.Month - 1, currentDate.Day);
                }

                editDialog = datePickerDialog;
                editDialog.DismissEvent += (_, __) => onCurrentEditDialogDismiss(resetAction);
                editDialog.Show();
            }
        }
Ejemplo n.º 3
0
        private void M_edittextCalendar_Click(object sender, EventArgs e)
        {
            try
            {
                m_edittextCalendar.Enabled = false;

                MobileCenter_Helper.TrackEvent(new FileAccessManager(), GetType().Name, "M_edittextCalendar_Click");

                DateTime maxDate          = DateTime.Now.Date.AddDays(Settings.NbSelectableDaysAfterToday);
                DateTime minDate          = DateTime.Now.Date.AddDays(Settings.NbSelectableDaysBeforeToday);
                DateTime firstJanuary1970 = new DateTime(1970, 1, 1, 0, 0, 0);

                //Prompt a calendar
                DatePickerDialog datePicker = new DatePickerDialog(this, Resource.Style.DatePicker_Red_dayMode, OnDateSetDateBegin, DateTime.Now.Year, DateTime.Now.Month - 1, DateTime.Now.Day);
                datePicker.UpdateDate(DateTime.Now);
                datePicker.DatePicker.MaxDate = (long)maxDate.Subtract(firstJanuary1970).TotalMilliseconds;
                datePicker.DatePicker.MinDate = (long)minDate.Subtract(firstJanuary1970).TotalMilliseconds;
                datePicker.DismissEvent      += (senser, eventArgs) => { m_edittextCalendar.Enabled = true; };
                datePicker.Show();
            }
            catch (Exception ex)
            {
                MobileCenter_Helper.ReportError(new FileAccessManager(), ex, GetType().Name, MethodBase.GetCurrentMethod().Name);
            }
        }
Ejemplo n.º 4
0
        public void Init()
        {
            mDatePickerDialog = new DatePickerDialog(this, this, ViewModel.EndBookingDateTime.Year, ViewModel.EndBookingDateTime.Month - 1, ViewModel.EndBookingDateTime.Day);
            mTimePickerDialog = new TimePickerDialog(this, this, ViewModel.EndBookingDateTime.Hour, ViewModel.EndBookingDateTime.Minute, true);
            etDate            = FindViewById <TextView>(Resource.Id.etDate);
            etHour            = FindViewById <TextView>(Resource.Id.etHour);
            mSeekBar          = FindViewById <SeekBar>(Resource.Id.seekBar1);
            mSeekBar.Touch   += (sender, args) =>
            {
                if (args.Event.Action == MotionEventActions.Up)
                {
                    if (mSeekBar.Progress != mCurrentProgress)
                    {
                        mCurrentProgress = mSeekBar.Progress;
                        ViewModel.HandleValueChanged();
                        args.Handled = true;
                        return;
                    }
                }

                args.Handled = false;
            };
            mCurrentProgress = 0;
            etDate.Click    += (sender, args) =>
            {
                mDatePickerDialog.UpdateDate(ViewModel.EndBookingDateTime.Year, ViewModel.EndBookingDateTime.Month - 1, ViewModel.EndBookingDateTime.Day);
                mDatePickerDialog.Show();
            };
            etHour.Click += (sender, args) =>
            {
                mTimePickerDialog.UpdateTime(ViewModel.EndBookingDateTime.Hour, ViewModel.EndBookingDateTime.Minute);
                mTimePickerDialog.Show();
            };

            locationManager = (LocationManager)GetSystemService(LocationService);
            bool GPSEnable = DetectLocationService();

            var _isGooglePlayServicesInstalled = IsGooglePlayServicesInstalled();

            if (_isGooglePlayServicesInstalled)
            {
                // pass in the Context, ConnectionListener and ConnectionFailedListener
                apiClient = new GoogleApiClientBuilder(this, this, this)
                            .AddApi(LocationServices.API).Build();

                // generate a location request that we will pass into a call for location updates
                locRequest = new LocationRequest();
            }
            else
            {
                Log.Error("OnCreate", "Google Play Services is not installed");
                Toast.MakeText(this, ViewModel.SharedTextSource.GetText("GGPlayNotInstalledText"), ToastLength.Long).Show();
            }
        }
Ejemplo n.º 5
0
        public void Init()
        {
            mDatePickerDialog  = new DatePickerDialog(this, this, ViewModel.EndBookingDateTime.Year, ViewModel.EndBookingDateTime.Month - 1, ViewModel.EndBookingDateTime.Day);
            mTimePickerDialog  = new TimePickerDialog(this, this, ViewModel.EndBookingDateTime.Hour, ViewModel.EndBookingDateTime.Minute, true);
            etStartDate        = FindViewById <TextRegular>(Resource.Id.etStartDate);
            etStartHour        = FindViewById <TextRegular>(Resource.Id.etStartHour);
            etStartDate.Click += (sender, args) =>
            {
                IsStartClick = true;
                mDatePickerDialog.UpdateDate(ViewModel.StartBookingDateTime.Year, ViewModel.StartBookingDateTime.Month - 1, ViewModel.StartBookingDateTime.Day);
                mDatePickerDialog.Show();
            };
            etStartHour.Click += (sender, args) =>
            {
                IsStartClick = true;
                mTimePickerDialog.UpdateTime(ViewModel.StartBookingDateTime.Hour, ViewModel.StartBookingDateTime.Minute);
                mTimePickerDialog.Show();
            };

            locationManager = (LocationManager)GetSystemService(LocationService);
            bool GPSEnable = DetectLocationService();

            var _isGooglePlayServicesInstalled = IsGooglePlayServicesInstalled();

            if (_isGooglePlayServicesInstalled)
            {
                // pass in the Context, ConnectionListener and ConnectionFailedListener
                apiClient = new GoogleApiClientBuilder(this, this, this)
                            .AddApi(LocationServices.API).Build();

                // generate a location request that we will pass into a call for location updates
                locRequest = new LocationRequest();
            }
            else
            {
                Log.Error("OnCreate", "Google Play Services is not installed");
                Toast.MakeText(this, ViewModel.SharedTextSource.GetText("GGPlayNotInstalledText"), ToastLength.Long).Show();
            }
        }
Ejemplo n.º 6
0
 partial void OnDateChangedPartialNative(DateTimeOffset oldDate, DateTimeOffset newDate)
 {
     _dialog?.UpdateDate(newDate.Date);
 }
Ejemplo n.º 7
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);

            SetContentView(Resource.Layout.activity_main);

            CurrentUserUid         = Intent.GetStringExtra("CurrentUserUid");
            CurrentUserDisplayName = Intent.GetStringExtra("CurrentUserDisplayName");
            //CurrentUserEmail = Intent.GetStringExtra("CurrentUserEmail");
            CurrentUserPhoto = Intent.GetStringExtra("CurrentUserPhoto");
            // var ButtonClickStatus = Intent.GetStringExtra("ButtonClickStatus");



            database     = AppDataHelper.GetDatabase();
            firebaseAuth = AppDataHelper.GetFirebaseAuth();
            this.Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds);
            this.Window.ClearFlags(WindowManagerFlags.TranslucentStatus);
            this.Window.SetStatusBarColor(Color.ParseColor("#204060"));

            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);
            toolbar.SetNavigationOnClickListener(this);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetDisplayShowTitleEnabled(true);
            // SupportActionBar.SetHomeButtonEnabled(true);
            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.baseline_notes_24);
            nodataicon         = FindViewById <ImageView>(Resource.Id.nodataicon);
            homeText           = FindViewById <TextView>(Resource.Id.homeText);
            statsText          = FindViewById <TextView>(Resource.Id.statsText);
            calendarpickericon = FindViewById <ImageView>(Resource.Id.calendarpickericon);
            calendarpickericon.SetColorFilter(Color.ParseColor("#04040C"));
            drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            drawerLayout.AddDrawerListener(this);
            navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);
            navigationView.SetNavigationItemSelectedListener(this);

            View headerView = navigationView.GetHeaderView(0);

            navheader_username      = headerView.FindViewById <TextView>(Resource.Id.navheader_username);
            navheader_username.Text = CurrentUserDisplayName;
            ProfilePic     = headerView.FindViewById <ImageView>(Resource.Id.ProfilePic);
            versionno      = FindViewById <TextView>(Resource.Id.versionno);
            versionno.Text = "v " + Application.Context.ApplicationContext.PackageManager.GetPackageInfo(Application.Context.ApplicationContext.PackageName, 0).VersionName;

            //Android.Net.Uri myUri = Android.Net.Uri.Parse(CurrentUserPhoto);
            //if (CrossConnectivity.Current.IsConnected)
            //{
            //    var imageBitmap = GetImageBitmapFromUrl(CurrentUserPhoto);
            //    ProfilePic.SetImageBitmap(imageBitmap);
            //}
            Picasso.Get().Load(CurrentUserPhoto).Placeholder(Resource.Drawable.icon).Into(ProfilePic);
            // ProfilePic.SetImageURI(myUri);
            //ProfilePic.SetImageURI(CurrentUserPhoto);
            recyclerView     = FindViewById <RecyclerView>(Resource.Id.recyclerView);
            nestedscroolview = FindViewById <NestedScrollView>(Resource.Id.nestedscroolview);
            MarginItemDecoration_Hor marginItemDecoration_Hor = new MarginItemDecoration_Hor(15, true, true);

            recyclerView.AddItemDecoration(marginItemDecoration_Hor);
            prefs = PreferenceManager.GetDefaultSharedPreferences(this);
            AppDataHelper.editor = prefs.Edit();

            var mString = prefs.GetString("CurrencySymbolSelected", "");

            if (mString == "")
            {
                AppDataHelper.editor.PutString("CurrencySymbolSelected", GetString(Resource.String.Rs));
                AppDataHelper.editor.PutString("CurrencyTextSelected", GetString(Resource.String.RsCurrency));
                AppDataHelper.editor.Apply();
            }

            var mStringOrderBySelected = prefs.GetString("OrderBySelected", "");

            if (mStringOrderBySelected == "")
            {
                AppDataHelper.editor.PutString("OrderBySelected", "DateDay");
                AppDataHelper.editor.Apply();
            }
            //else
            //{

            //}
            totalexpenseVALUE      = FindViewById <TextView>(Resource.Id.totalexpenseVALUE);
            totalexpenseVALUE.Text = prefs.GetString("CurrencySymbolSelected", "") + "0";

            Datetxt       = FindViewById <TextView>(Resource.Id.Datetxt);
            Datetxt.Text  = DateTime.Now.DayOfWeek + ", " + DateTime.Today.Day + " " + DateTime.Now.ToString("MMMM", CultureInfo.InvariantCulture) + " " + DateTime.Today.Year;
            YearSelected  = DateTime.Today.Year.ToString();
            MonthSelected = DateTime.Now.ToString("MMMM", CultureInfo.InvariantCulture);

            homeText.SetCompoundDrawablesWithIntrinsicBounds(null, GetDrawable(Resource.Drawable.baseline_home_24), null, null);
            statsText.SetCompoundDrawablesWithIntrinsicBounds(null, GetDrawable(Resource.Drawable.outline_insert_chart_24), null, null);

            homeText.Click  += HomeText_Click;
            statsText.Click += StatsText_Click;
            fab              = FindViewById <FloatingActionButton>(Resource.Id.fab);
            fab.Click       += Fab_Click;
            if (VersionTracking.IsFirstLaunchEver)
            {
                currencyModal_Fragment = new CurrencyModal_Fragment();
                var trans = SupportFragmentManager.BeginTransaction();
                currencyModal_Fragment.Show(trans, "Currency");
            }


            calendarpickericon.Click += Calendartxt_Click;
            TotalExpenseValue         = new List <string>();
            parentObjects             = new List <IParentObject>();
            SetupVerticalRecyclerView();
            DisplayAndBindMonthRecyclerView();

            int day   = DateTime.Now.Day;
            int month = DateTime.Now.Month - 1;
            int year  = DateTime.Now.Year;

            picker = new DatePickerDialog(this);
            picker.UpdateDate(year, month, day);

            bottomAppBar = FindViewById <BottomAppBar>(Resource.Id.bar);

            childListsearch = new List <ExpenseItemChild>();
            //FetchAndListenExpensesTable();
            recyclerView.SetOnClickListener(this);
        }
        private void OnDateChanged(DependencyObject sender, DependencyProperty dp)
        {
            var date = Date.Date;

            _dialog?.UpdateDate(date);
        }
Ejemplo n.º 9
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();
            };
        }
Ejemplo n.º 10
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View view = inflater.Inflate(Resource.Layout.Add_Edit_Expense, container, false);

            headertext        = view.FindViewById <TextView>(Resource.Id.headertext);
            desciptiontext    = view.FindViewById <TextInputLayout>(Resource.Id.desciptiontext);
            amounttext        = view.FindViewById <TextInputLayout>(Resource.Id.amounttext);
            datefield         = view.FindViewById <EditText>(Resource.Id.datefield);
            itemspinner       = view.FindViewById <MaterialSpinner>(Resource.Id.itemspinner);
            saveexpensebutton = view.FindViewById <Button>(Resource.Id.saveexpensebutton);
            closebutton       = view.FindViewById <ImageView>(Resource.Id.closebutton);
            closebutton.SetColorFilter(Color.ParseColor("#04040C"));
            closebutton.Click += Closebutton_Click;
            ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(Activity);

            amounttext.Hint = "Amount" + "(" + prefs.GetString("CurrencySymbolSelected", "") + ")";
            database        = AppDataHelper.GetDatabase();
            FragTagName     = Tag;
            FetchExpenseItemsTable();
            if (FragTagName == "Add Expense")
            {
                headertext.Text = FragTagName;
                int day   = DateTime.Now.Day;
                int month = DateTime.Now.Month - 1;
                int year  = DateTime.Now.Year;

                picker = new DatePickerDialog(Activity);
                picker.UpdateDate(year, month, day);
                CurrentUserUid = Arguments.GetString("CurrentUserUid");
            }
            else
            {
                headertext.Text        = FragTagName;
                expenseID              = Arguments.GetString("expenseID");
                ExpenseItemDescription = Arguments.GetString("ExpenseItemDescription");
                ExpenseItemDate        = Arguments.GetString("ExpenseItemDate");
                ExpenseItemAmount      = Arguments.GetString("ExpenseItemAmount");
                ExpenseItemName        = Arguments.GetString("ExpenseItemName");

                desciptiontext.EditText.Text = ExpenseItemDescription;
                amounttext.EditText.Text     = ExpenseItemAmount;
                datefield.Text = ExpenseItemDate;

                string[] val = ExpenseItemDate.Split(',');

                int day   = Convert.ToInt32(val[0].Trim());
                int month = Array.IndexOf(MONTHS, val[1].Trim());
                int year  = Convert.ToInt32(val[2].Trim());
                picker = new DatePickerDialog(Activity);
                picker.UpdateDate(year, month, day);

                MonthSelected = val[1].Trim();
                YearSelected  = val[2].Trim();
                DaySelected   = val[0].Trim();
            }



            datefield.Click         += Datefield_Click;
            saveexpensebutton.Click += Saveexpensebutton_Click;

            return(view);
        }