예제 #1
0
        private void Adapter_ItemClick(object sender, int position)
        {
            TaskType chosenType   = adapter.Data[position];
            Type     activityType = AndroidUtils.GetTaskCreationActivityType(chosenType.IdName);

            Intent myIntent = new Intent(this, activityType);

            myIntent.PutExtra("JSON", JsonConvert.SerializeObject(chosenType));
            myIntent.PutExtra("PARENT", Intent.GetStringExtra("PARENT")); // null if not a child task
            StartActivityForResult(myIntent, 200);
        }
        private void Adapter_EditItemClick(object sender, int position)
        {
            LearningTask thisTask = adapter.data[position - 1];

            if (thisTask?.TaskType == null)
            {
                return;
            }

            Type   activityType = AndroidUtils.GetTaskCreationActivityType(thisTask.TaskType.IdName);
            Intent intent       = new Intent(this, activityType);
            string json         = JsonConvert.SerializeObject(thisTask);

            intent.PutExtra("EDIT", json);
            intent.PutExtra("PARENT", JsonConvert.SerializeObject(parentTask));

            StartActivityForResult(intent, EditTaskIntent);
        }
예제 #3
0
        private void Adapter_EditItemClick(object sender, int position)
        {
            LearningTask thisTask = adapter.Data[position - 1];

            if (thisTask?.TaskType == null)
            {
                return;
            }

            Type   activityType = AndroidUtils.GetTaskCreationActivityType(thisTask.TaskType.IdName);
            Intent intent       = new Intent(this, activityType);
            string json         = JsonConvert.SerializeObject(thisTask);

            intent.PutExtra("EDIT", json);

            List <LearningTask> tasksToPass = new List <LearningTask>(adapter.Data);

            tasksToPass.RemoveAt(position - 1);
            intent.PutExtra("CURRENT_TASKS", JsonConvert.SerializeObject(tasksToPass));

            StartActivityForResult(intent, EditTaskIntent);
        }