Example #1
0
        protected override void OnResume()
        {
            base.OnResume();

            adapter = new TaskListAdapter(this);
            taskListView.Adapter = adapter;
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            var sqliteFilename = "TaskDB.db3";
            string libraryPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
            var path = Path.Combine(libraryPath, sqliteFilename);
            var conn = new Connection(path);

            var taskRepository = new TaskRepository(conn, "");
            taskManager = new TaskManager(taskRepository);

            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Main);

            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById<Button> (Resource.Id.addButton);

            button.Click += delegate {
                var todoText = FindViewById<EditText> (Resource.Id.todoItemText);
                taskManager.NewTodoItem.Text = todoText.Text;
                taskManager.AddTodoItem();
                todoText.Text = "";
                StartService(new Intent(CustomActions.TODO_SET_GEOFENCE));

            };

            var taskListView = FindViewById<ListView> (Resource.Id.listTasks);
            var taskListAdapter = new TaskListAdapter (this, taskManager);
            taskListView.Adapter = taskListAdapter;

            //Intent intent = new Intent (this, typeof(GeofencingHelper));
            StartService(new Intent(CustomActions.TODO_START_LOCATION_MONITORING));
        }
Example #3
0
		void Reload() 
		{
            // create our adapter
			taskList = new TaskListAdapter(this, tasks);
			
			//Hook up our adapter to our ListView
			taskListView.Adapter = taskList;
		}
        protected override async void OnResume()
        {
            base.OnResume();
            await this.SetTasks();

            var taskAdapter = new TaskListAdapter(this, tasks); //notify change

            tasksListView.Adapter = taskAdapter;
        }
Example #5
0
        void Reload(List<Task> tasks)
        {
            this.tasks = tasks;
            // create our adapter
            taskList = new TaskListAdapter(this, tasks);

            //Hook up our adapter to our ListView
            taskListView.Adapter = taskList;
        }
Example #6
0
        public void SetupRecyclerView(View view)
        {
            _recyclerView  = view.FindViewById <MvxRecyclerView>(Resource.Id.recyclerView);
            _layoutManager = new LinearLayoutManager(this.Context);
            _recyclerView.SetLayoutManager(_layoutManager);
            var recyclerAdapter = new TaskListAdapter((IMvxAndroidBindingContext)this.BindingContext);

            _recyclerView.Adapter = recyclerAdapter;
        }
Example #7
0
        public void SetupRecyclerView(View view)
        {
            RecyclerView  = view.FindViewById <MvxRecyclerView>(Resource.Id.recycView);
            LayoutManager = new LinearLayoutManager(Context);
            RecyclerView.SetLayoutManager(LayoutManager);

            TaskListAdapter recyclerAdapter = new TaskListAdapter((IMvxAndroidBindingContext)BindingContext);

            RecyclerView.Adapter = recyclerAdapter;
        }
Example #8
0
        protected override void OnResume()
        {
            base.OnResume();

            tasks = TaskManager.GetTasks();

            // create our adapter
            taskList = new TaskListAdapter(this, tasks);

            //Hook up our adapter to our ListView
            taskListView.Adapter = taskList;
        }
		protected override void OnResume ()
		{
			base.OnResume ();

			tasks = vm.GetAll();

			// create our adapter
			adapter = new TaskListAdapter(this, tasks);

			//Hook up our adapter to our ListView
			taskList.Adapter = adapter;
		}
Example #10
0
        protected override void OnResume()
        {
            base.OnResume();

            tasks = TaskManager.GetTasks();

            // create our adapter
            taskList = new TaskListAdapter(this, tasks);

            //Hook up our adapter to our ListView
            taskListView.Adapter = taskList;
        }
Example #11
0
        public override View OnMAMCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View rootView = inflater.Inflate(Resource.Layout.fragment_tasks, container, false);

            // Make a view adapter that will update the list as data updates
            TaskListAdapter adapter     = new TaskListAdapter(Context);
            ListView        displayList = rootView.FindViewById <ListView>(Resource.Id.tasks_nav_list_view);

            displayList.Adapter = adapter;

            // Example of MAM policy - allow printing.
            // Will be automatically blocked by MAM if necessary.
            rootView.FindViewById(Resource.Id.tasks_nav_print_icon).Click += (sender, e) =>
            {
                if (Activity != null)
                {
                    PrintHelper printer = new PrintHelper(Activity);
                    printer.PrintTasks();
                }
                else
                {
                    Toast.MakeText(Activity, Resource.String.err_not_active, ToastLength.Long).Show();
                }
            };

            // Example of MAM policy - allow saving to device.
            // A manual check of the current MAM policy must be performed to determine whether or not saving to the device is allowed.
            // NOTE: If the user's policy asks the app to encrypt files, the output of this process will also be encrypted.
            rootView.FindViewById(Resource.Id.tasks_nav_save_icon).Click += (sender, e) =>
            {
                if (MAMPolicyManager.GetPolicy(Activity).GetIsSaveToLocationAllowed(SaveLocation.Local, AuthManager.User))
                {
                    if (Activity != null && Context != null)
                    {
                        SaveHelper saveHelper = new SaveHelper(Activity, Context, TargetRequestCode);
                        saveHelper.SaveFile();
                    }
                    else
                    {
                        Toast.MakeText(Activity, Resource.String.err_not_active, ToastLength.Long).Show();
                    }
                }
                else
                {
                    Toast.MakeText(Activity, Resource.String.err_not_allowed, ToastLength.Long).Show();
                }
            };

            return(rootView);
        }
Example #12
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var view = base.OnCreateView(inflater, container, savedInstanceState);

            HasOptionsMenu = true;
            _recyclerView  = view.FindViewById <MvxRecyclerView>(Resource.Id.RecyclerView);
            _layoutManager = new GridLayoutManager(this.Context, 2);
            _recyclerView.SetLayoutManager(_layoutManager);
            var recyclerAdapter = new TaskListAdapter((IMvxAndroidBindingContext)this.BindingContext);

            _recyclerView.Adapter = recyclerAdapter;
            var toolbar = view.FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);

            ParentActivity.SetSupportActionBar(toolbar);
            ParentActivity.SupportActionBar.Title = "";
            ViewModel.ShowMenuViewModelCommand.Execute(null);
            return(view);
        }
Example #13
0
        public void ShowTasks(UserTaskListModel list)
        {
            if (list == null)
            {
                return;
            }

            Title = list.Name;

            if (_taskListAdapter != null)
            {
                _taskListAdapter.TaskList = list.UserTasks;
                _taskListAdapter.NotifyDataSetChanged();
            }
            else
            {
                _taskListAdapter = new TaskListAdapter(_taskListView, this, list.UserTasks);
                _taskListView.SetAdapter(_taskListAdapter);
                InitAdapterHandlers();
            }
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            taskManager = new TaskManager ();

            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Main);

            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById<Button> (Resource.Id.addButton);

            button.Click += delegate {
                var todoText = FindViewById<EditText>(Resource.Id.todoItemText);
                taskManager.NewTodoItem.Text = todoText.Text;
                taskManager.AddTodoItem();
            };

            var taskListView = FindViewById<ListView> (Resource.Id.listTasks);
            var taskListAdapter = new TaskListAdapter (this, taskManager.TodoItems);
            taskListView.Adapter = taskListAdapter;
        }
Example #15
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            SetContentView(Resource.Layout.activity_main);

            Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(toolbar);

            //Создаем адаптер для отображения
            var lvTasks = FindViewById <ListView>(Resource.Id.lvTasks);

            tasklist        = new TaskListAdapter(this, UpdateTasks(true));
            lvTasks.Adapter = tasklist;

            //Инициализируем "хранилище"
            Storage.Instance.Init();

            //Вешаем обработчики событий
            FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab);

            fab.Click += FabOnClick;
            FloatingActionButton fabNext = FindViewById <FloatingActionButton>(Resource.Id.fabNextPage);
            FloatingActionButton fabPrev = FindViewById <FloatingActionButton>(Resource.Id.fabPrevPage);

            fabNext.Click     += FabNext_Click;
            fabPrev.Click     += FabPrev_Click;
            fabPrev.Visibility = ViewStates.Invisible; //Скрываем кнопку предидущей страницы, т.к. стартуем на первой странице.

            RadioButton rb = FindViewById <RadioButton>(Resource.Id.rbSortId);

            rb.Click += Rb_Click;
            rb        = FindViewById <RadioButton>(Resource.Id.rbSortUsename);
            rb.Click += Rb_Click;
            rb        = FindViewById <RadioButton>(Resource.Id.rbSortEmail);
            rb.Click += Rb_Click;
            rb        = FindViewById <RadioButton>(Resource.Id.rbSortStatus);
            rb.Click += Rb_Click;

            lvTasks.ItemClick += LvTasks_Click;

            //Инстансим диалоги и задаем действия при скрытии диалогов
            authDialog = new AuthDialog(this);
            authDialog.OnHide(() => { //При скрытии диалога авторизации проверяем была ли она выполнена. И если да, то меняем пункты меню
                if (!string.IsNullOrEmpty(Storage.Instance.GetToken()))
                {
                    mnuAuth.SetVisible(false);
                    mnuLogoff.SetVisible(true);
                }
            });
            taskEditDialog = new TaskEditDialog(this);
            taskEditDialog.OnHide((modified) => { //При скрытии диалога выполняем обновление данных списка задач в случае наличия изменений.
                if (modified)
                {
                    if (taskEditDialog.IsNewItem) //Если создали новую задачу, тогда перезагружаем данные с текущими параметрами сортировки.
                    {
                        tasklist.ListSource = UpdateTasks(false) ?? tasklist.ListSource;
                    }
                    tasklist.NotifyDataSetChanged();
                }
            });
        }
Example #16
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            SetContentView(Resource.Layout.activity_main);

            Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(toolbar);

            //Создаем адаптер для отображения
            var lvTasks = FindViewById <ListView>(Resource.Id.lvTasks);

            tasklist        = new TaskListAdapter(this, UpdateTasks(true));
            lvTasks.Adapter = tasklist;

            // Initialize the "storage"
            Storage.Instance.Init();


            FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab);

            fab.Click += FabOnClick;
            FloatingActionButton fabNext = FindViewById <FloatingActionButton>(Resource.Id.fabNextPage);
            FloatingActionButton fabPrev = FindViewById <FloatingActionButton>(Resource.Id.fabPrevPage);

            fabNext.Click     += FabNext_Click;
            fabPrev.Click     += FabPrev_Click;
            fabPrev.Visibility = ViewStates.Invisible;

            RadioButton rb = FindViewById <RadioButton>(Resource.Id.rbSortId);

            rb.Click += Rb_Click;
            rb        = FindViewById <RadioButton>(Resource.Id.rbSortUsename);
            rb.Click += Rb_Click;
            rb        = FindViewById <RadioButton>(Resource.Id.rbSortEmail);
            rb.Click += Rb_Click;
            rb        = FindViewById <RadioButton>(Resource.Id.rbSortStatus);
            rb.Click += Rb_Click;

            lvTasks.ItemClick += LvTasks_Click;

            // Instance dialogs and set actions when hiding dialogs
            authDialog = new AuthDialog(this);
            authDialog.OnHide(() => { // When hiding the authorization dialog, we check whether it has been completed. And if so, change the menu items
                if (!string.IsNullOrEmpty(Storage.Instance.GetToken()))
                {
                    mnuAuth.SetVisible(false);
                    mnuLogoff.SetVisible(true);
                }
            });
            taskEditDialog = new TaskEditDialog(this);
            taskEditDialog.OnHide((modified) => { // When hiding the dialog, we update the task list data if there are changes.
                if (modified)
                {
                    if (taskEditDialog.IsNewItem) // If we created a new task, then reload the data with the current sorting parameters.
                    {
                        tasklist.ListSource = UpdateTasks(false) ?? tasklist.ListSource;
                    }
                    tasklist.NotifyDataSetChanged();
                }
            });
        }
 private void ListViewPopulatedCompleted(object sender, GetAllTasksCompletedEventArgs getAllTasksCompletedEventArgs)
 {
     tasks = getAllTasksCompletedEventArgs.Result.Where(t => t.CreatorID == AuthenticationService.LoggedUser.ID || t.ResponsibleID == AuthenticationService.LoggedUser.ID).ToArray();
     RunOnUiThread(() => ListAdapter = new TaskListAdapter(this, tasks));
 }