|
|
|
@ -35,16 +35,19 @@ import android.content.Intent;
|
|
|
|
import android.content.IntentFilter;
|
|
|
|
import android.content.IntentFilter;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.speech.RecognizerIntent;
|
|
|
|
import android.speech.RecognizerIntent;
|
|
|
|
|
|
|
|
import android.support.v4.app.Fragment;
|
|
|
|
|
|
|
|
import android.support.v4.app.SupportActivity;
|
|
|
|
|
|
|
|
import android.support.v4.view.Menu;
|
|
|
|
|
|
|
|
import android.support.v4.view.MenuItem;
|
|
|
|
import android.text.TextUtils;
|
|
|
|
import android.text.TextUtils;
|
|
|
|
import android.util.DisplayMetrics;
|
|
|
|
import android.util.DisplayMetrics;
|
|
|
|
import android.util.Log;
|
|
|
|
import android.util.Log;
|
|
|
|
import android.view.KeyEvent;
|
|
|
|
import android.view.KeyEvent;
|
|
|
|
import android.view.LayoutInflater;
|
|
|
|
import android.view.LayoutInflater;
|
|
|
|
import android.view.Menu;
|
|
|
|
import android.view.MenuInflater;
|
|
|
|
import android.view.MenuItem;
|
|
|
|
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.View;
|
|
|
|
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
import android.view.ViewGroup.LayoutParams;
|
|
|
|
import android.view.ViewGroup.LayoutParams;
|
|
|
|
import android.view.Window;
|
|
|
|
|
|
|
|
import android.view.animation.Animation;
|
|
|
|
import android.view.animation.Animation;
|
|
|
|
import android.view.animation.AnimationUtils;
|
|
|
|
import android.view.animation.AnimationUtils;
|
|
|
|
import android.widget.Button;
|
|
|
|
import android.widget.Button;
|
|
|
|
@ -104,7 +107,7 @@ import com.todoroo.astrid.voice.VoiceInputAssistant;
|
|
|
|
* @author timsu
|
|
|
|
* @author timsu
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public final class TaskEditActivity extends Activity {
|
|
|
|
public final class TaskEditActivity extends Fragment {
|
|
|
|
|
|
|
|
|
|
|
|
// --- bundle tokens
|
|
|
|
// --- bundle tokens
|
|
|
|
|
|
|
|
|
|
|
|
@ -135,15 +138,15 @@ public final class TaskEditActivity extends Activity {
|
|
|
|
|
|
|
|
|
|
|
|
// --- menu codes
|
|
|
|
// --- menu codes
|
|
|
|
|
|
|
|
|
|
|
|
private static final int MENU_SAVE_ID = Menu.FIRST;
|
|
|
|
private static final int MENU_SAVE_ID = R.string.TEA_menu_save;
|
|
|
|
private static final int MENU_DISCARD_ID = Menu.FIRST + 1;
|
|
|
|
private static final int MENU_DISCARD_ID = R.string.TEA_menu_discard;
|
|
|
|
private static final int MENU_DELETE_ID = Menu.FIRST + 2;
|
|
|
|
private static final int MENU_DELETE_ID = R.string.TEA_menu_delete;
|
|
|
|
|
|
|
|
|
|
|
|
// --- result codes
|
|
|
|
// --- result codes
|
|
|
|
|
|
|
|
|
|
|
|
public static final int RESULT_CODE_SAVED = RESULT_FIRST_USER;
|
|
|
|
public static final int RESULT_CODE_SAVED = Activity.RESULT_FIRST_USER;
|
|
|
|
public static final int RESULT_CODE_DISCARDED = RESULT_FIRST_USER + 1;
|
|
|
|
public static final int RESULT_CODE_DISCARDED = Activity.RESULT_FIRST_USER + 1;
|
|
|
|
public static final int RESULT_CODE_DELETED = RESULT_FIRST_USER + 2;
|
|
|
|
public static final int RESULT_CODE_DELETED = Activity.RESULT_FIRST_USER + 2;
|
|
|
|
|
|
|
|
|
|
|
|
public static final String TAB_BASIC = "basic"; //$NON-NLS-1$
|
|
|
|
public static final String TAB_BASIC = "basic"; //$NON-NLS-1$
|
|
|
|
|
|
|
|
|
|
|
|
@ -211,24 +214,48 @@ public final class TaskEditActivity extends Activity {
|
|
|
|
|
|
|
|
|
|
|
|
private boolean overrideFinishAnim;
|
|
|
|
private boolean overrideFinishAnim;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// --- fragment handling variables
|
|
|
|
|
|
|
|
OnTaskEditDetailsClickedListener mListener;
|
|
|
|
|
|
|
|
private boolean mDualFragments = false;
|
|
|
|
|
|
|
|
|
|
|
|
/* ======================================================================
|
|
|
|
/* ======================================================================
|
|
|
|
* ======================================================= initialization
|
|
|
|
* ======================================================= initialization
|
|
|
|
* ====================================================================== */
|
|
|
|
* ====================================================================== */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** Container Activity must implement this interface and we ensure
|
|
|
|
|
|
|
|
* that it does during the onAttach() callback
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public interface OnTaskEditDetailsClickedListener {
|
|
|
|
|
|
|
|
public void onTaskEditDetailsClicked(int category, int position);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onAttach(SupportActivity activity) {
|
|
|
|
|
|
|
|
super.onAttach(activity);
|
|
|
|
|
|
|
|
// Check that the container activity has implemented the callback interface
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
mListener = (OnTaskEditDetailsClickedListener) activity;
|
|
|
|
|
|
|
|
} catch (ClassCastException e) {
|
|
|
|
|
|
|
|
throw new ClassCastException(activity.toString()
|
|
|
|
|
|
|
|
+ " must implement OnTaskEditDetailsClickedListener"); //$NON-NLS-1$
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public TaskEditActivity() {
|
|
|
|
public TaskEditActivity() {
|
|
|
|
DependencyInjectionService.getInstance().inject(this);
|
|
|
|
DependencyInjectionService.getInstance().inject(this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
public void onCreate(Bundle savedInstanceState) {
|
|
|
|
ThemeService.applyTheme(this);
|
|
|
|
|
|
|
|
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
|
|
|
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
new StartupService().onStartupApplication(this);
|
|
|
|
// Tell the framework to try to keep this fragment around
|
|
|
|
|
|
|
|
// during a configuration change.
|
|
|
|
|
|
|
|
setRetainInstance(true);
|
|
|
|
|
|
|
|
|
|
|
|
setUpUIComponents();
|
|
|
|
overrideFinishAnim = getActivity().getIntent().getBooleanExtra(OVERRIDE_FINISH_ANIM, true);
|
|
|
|
|
|
|
|
|
|
|
|
overrideFinishAnim = getIntent().getBooleanExtra(OVERRIDE_FINISH_ANIM, true);
|
|
|
|
new StartupService().onStartupApplication(getActivity());
|
|
|
|
|
|
|
|
|
|
|
|
// if we were editing a task already, restore it
|
|
|
|
// if we were editing a task already, restore it
|
|
|
|
if(savedInstanceState != null && savedInstanceState.containsKey(TASK_IN_PROGRESS)) {
|
|
|
|
if(savedInstanceState != null && savedInstanceState.containsKey(TASK_IN_PROGRESS)) {
|
|
|
|
@ -238,81 +265,107 @@ public final class TaskEditActivity extends Activity {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
setResult(RESULT_OK);
|
|
|
|
getActivity().setResult(Activity.RESULT_OK);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* ======================================================================
|
|
|
|
/* ======================================================================
|
|
|
|
* ==================================================== UI initialization
|
|
|
|
* ==================================================== UI initialization
|
|
|
|
* ====================================================================== */
|
|
|
|
* ====================================================================== */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
|
|
|
|
|
|
|
Bundle savedInstanceState) {
|
|
|
|
|
|
|
|
super.onCreateView(inflater, container, savedInstanceState);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
View v = inflater.inflate(R.layout.task_edit_activity_new,
|
|
|
|
|
|
|
|
container, false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return v;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onActivityCreated(Bundle savedInstanceState) {
|
|
|
|
|
|
|
|
super.onActivityCreated(savedInstanceState);
|
|
|
|
|
|
|
|
// We have a menu item to show in action bar.
|
|
|
|
|
|
|
|
setHasOptionsMenu(true);
|
|
|
|
|
|
|
|
getSupportActivity().getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Fragment tasklistFrame = getFragmentManager().findFragmentById(R.id.tasklist_fragment);
|
|
|
|
|
|
|
|
mDualFragments = (tasklistFrame != null) && tasklistFrame.isInLayout();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setUpUIComponents();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// disable keyboard until user requests it
|
|
|
|
|
|
|
|
AndroidUtilities.suppressVirtualKeyboard(title);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** Initialize UI components */
|
|
|
|
/** Initialize UI components */
|
|
|
|
private void setUpUIComponents() {
|
|
|
|
private void setUpUIComponents() {
|
|
|
|
setContentView(R.layout.task_edit_activity_new);
|
|
|
|
scrollView = (ScrollView) getView().findViewById(R.id.edit_scroll);
|
|
|
|
scrollView = (ScrollView) findViewById(R.id.edit_scroll);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LinearLayout basicControls = (LinearLayout) findViewById(R.id.basic_controls);
|
|
|
|
LinearLayout basicControls = (LinearLayout) getView().findViewById(R.id.basic_controls);
|
|
|
|
LinearLayout whenDialogView = (LinearLayout) LayoutInflater.from(this).inflate(R.layout.task_edit_when_controls, null);
|
|
|
|
LinearLayout whenDialogView = (LinearLayout) LayoutInflater.from(getActivity()).inflate(R.layout.task_edit_when_controls, null);
|
|
|
|
LinearLayout whenControls = (LinearLayout) whenDialogView.findViewById(R.id.when_controls);
|
|
|
|
LinearLayout whenControls = (LinearLayout) whenDialogView.findViewById(R.id.when_controls);
|
|
|
|
LinearLayout whenHeader = (LinearLayout) findViewById(R.id.when_header);
|
|
|
|
LinearLayout whenHeader = (LinearLayout) getView().findViewById(R.id.when_header);
|
|
|
|
LinearLayout moreControls = (LinearLayout) findViewById(R.id.more_controls);
|
|
|
|
LinearLayout moreControls = (LinearLayout) getView().findViewById(R.id.more_controls);
|
|
|
|
|
|
|
|
|
|
|
|
constructWhenDialog(whenDialogView);
|
|
|
|
constructWhenDialog(whenDialogView);
|
|
|
|
|
|
|
|
|
|
|
|
HashMap<String, TaskEditControlSet> controlSetMap = new HashMap<String, TaskEditControlSet>();
|
|
|
|
HashMap<String, TaskEditControlSet> controlSetMap = new HashMap<String, TaskEditControlSet>();
|
|
|
|
|
|
|
|
|
|
|
|
// populate control set
|
|
|
|
// populate control set
|
|
|
|
EditTitleControlSet editTitle = new EditTitleControlSet(this, R.layout.control_set_title, Task.TITLE, R.id.title);
|
|
|
|
EditTitleControlSet editTitle = new EditTitleControlSet(getActivity(), R.layout.control_set_title, Task.TITLE, R.id.title);
|
|
|
|
title = (EditText) editTitle.getView().findViewById(R.id.title);
|
|
|
|
title = (EditText) editTitle.getView().findViewById(R.id.title);
|
|
|
|
controls.add(editTitle);
|
|
|
|
controls.add(editTitle);
|
|
|
|
//basicControls.addView(editTitle.getDisplayView());
|
|
|
|
//basicControls.addView(editTitle.getDisplayView());
|
|
|
|
controlSetMap.put(getString(R.string.TEA_control_title), editTitle);
|
|
|
|
controlSetMap.put(getString(R.string.TEA_control_title), editTitle);
|
|
|
|
|
|
|
|
|
|
|
|
TimerActionControlSet timerAction = new TimerActionControlSet(this, editTitle.getView());
|
|
|
|
TimerActionControlSet timerAction = new TimerActionControlSet(getActivity(), editTitle.getView());
|
|
|
|
controls.add(timerAction);
|
|
|
|
controls.add(timerAction);
|
|
|
|
|
|
|
|
|
|
|
|
controls.add(peopleControlSet = new EditPeopleControlSet(TaskEditActivity.this, R.layout.control_set_assigned, R.layout.control_set_assigned_display, R.string.actfm_EPA_assign_label, REQUEST_LOG_IN));
|
|
|
|
controls.add(peopleControlSet = new EditPeopleControlSet(getActivity(), R.layout.control_set_assigned, R.layout.control_set_assigned_display, R.string.actfm_EPA_assign_label, REQUEST_LOG_IN));
|
|
|
|
//basicControls.addView(peopleControlSet.getDisplayView());
|
|
|
|
//basicControls.addView(peopleControlSet.getDisplayView());
|
|
|
|
controlSetMap.put(getString(R.string.TEA_control_who), peopleControlSet);
|
|
|
|
controlSetMap.put(getString(R.string.TEA_control_who), peopleControlSet);
|
|
|
|
|
|
|
|
|
|
|
|
DeadlineControlSet deadlineControl = new DeadlineControlSet(TaskEditActivity.this, R.layout.control_set_deadline, R.layout.control_set_deadline_display, whenHeader, R.id.aux_date, R.id.when_shortcut_container, R.id.when_label, R.id.when_image);
|
|
|
|
DeadlineControlSet deadlineControl = new DeadlineControlSet(getActivity(), R.layout.control_set_deadline, R.layout.control_set_deadline_display, whenHeader, R.id.aux_date, R.id.when_shortcut_container, R.id.when_label, R.id.when_image);
|
|
|
|
controls.add(deadlineControl);
|
|
|
|
controls.add(deadlineControl);
|
|
|
|
whenControls.addView(deadlineControl.getDisplayView());
|
|
|
|
whenControls.addView(deadlineControl.getDisplayView());
|
|
|
|
|
|
|
|
|
|
|
|
RepeatControlSet repeatControls = new RepeatControlSet(TaskEditActivity.this, R.layout.control_set_repeat, R.layout.control_set_repeat_display, R.string.repeat_enabled);
|
|
|
|
RepeatControlSet repeatControls = new RepeatControlSet(getActivity(), R.layout.control_set_repeat, R.layout.control_set_repeat_display, R.string.repeat_enabled);
|
|
|
|
controls.add(repeatControls);
|
|
|
|
controls.add(repeatControls);
|
|
|
|
whenControls.addView(repeatControls.getDisplayView());
|
|
|
|
whenControls.addView(repeatControls.getDisplayView());
|
|
|
|
|
|
|
|
|
|
|
|
GCalControlSet gcalControl = new GCalControlSet(TaskEditActivity.this, R.layout.control_set_gcal, R.layout.control_set_gcal_display, R.string.gcal_TEA_addToCalendar_label);
|
|
|
|
GCalControlSet gcalControl = new GCalControlSet(getActivity(), R.layout.control_set_gcal, R.layout.control_set_gcal_display, R.string.gcal_TEA_addToCalendar_label);
|
|
|
|
controls.add(gcalControl);
|
|
|
|
controls.add(gcalControl);
|
|
|
|
whenControls.addView(gcalControl.getDisplayView());
|
|
|
|
whenControls.addView(gcalControl.getDisplayView());
|
|
|
|
|
|
|
|
|
|
|
|
hideUntilControls = new HideUntilControlSet(TaskEditActivity.this, R.layout.control_set_hide, R.layout.control_set_hide_display, R.string.hide_until_prompt);
|
|
|
|
hideUntilControls = new HideUntilControlSet(getActivity(), R.layout.control_set_hide, R.layout.control_set_hide_display, R.string.hide_until_prompt);
|
|
|
|
controls.add(hideUntilControls);
|
|
|
|
controls.add(hideUntilControls);
|
|
|
|
whenControls.addView(hideUntilControls.getDisplayView());
|
|
|
|
whenControls.addView(hideUntilControls.getDisplayView());
|
|
|
|
|
|
|
|
|
|
|
|
ImportanceControlSet importanceControl = new ImportanceControlSet(TaskEditActivity.this, R.layout.control_set_importance);
|
|
|
|
ImportanceControlSet importanceControl = new ImportanceControlSet(getActivity(), R.layout.control_set_importance);
|
|
|
|
controls.add(importanceControl);
|
|
|
|
controls.add(importanceControl);
|
|
|
|
importanceControl.addListener(editTitle);
|
|
|
|
importanceControl.addListener(editTitle);
|
|
|
|
//moreControls.addView(importanceControl.getDisplayView());
|
|
|
|
//moreControls.addView(importanceControl.getDisplayView());
|
|
|
|
controlSetMap.put(getString(R.string.TEA_control_importance), importanceControl);
|
|
|
|
controlSetMap.put(getString(R.string.TEA_control_importance), importanceControl);
|
|
|
|
|
|
|
|
|
|
|
|
TagsControlSet tagsControl = new TagsControlSet(TaskEditActivity.this, R.layout.control_set_tags, R.layout.control_set_tags_display, R.string.TEA_tags_label);
|
|
|
|
TagsControlSet tagsControl = new TagsControlSet(getActivity(), R.layout.control_set_tags, R.layout.control_set_tags_display, R.string.TEA_tags_label);
|
|
|
|
controls.add(tagsControl);
|
|
|
|
controls.add(tagsControl);
|
|
|
|
//moreControls.addView(tagsControl.getDisplayView());
|
|
|
|
//moreControls.addView(tagsControl.getDisplayView());
|
|
|
|
controlSetMap.put(getString(R.string.TEA_control_lists), tagsControl);
|
|
|
|
controlSetMap.put(getString(R.string.TEA_control_lists), tagsControl);
|
|
|
|
|
|
|
|
|
|
|
|
notesControlSet = new EditNotesControlSet(TaskEditActivity.this, R.layout.control_set_notes, R.layout.control_set_notes_display);
|
|
|
|
notesControlSet = new EditNotesControlSet(getActivity(), R.layout.control_set_notes, R.layout.control_set_notes_display);
|
|
|
|
notesEditText = (EditText) notesControlSet.getView().findViewById(R.id.notes);
|
|
|
|
notesEditText = (EditText) notesControlSet.getView().findViewById(R.id.notes);
|
|
|
|
controls.add(notesControlSet);
|
|
|
|
controls.add(notesControlSet);
|
|
|
|
//moreControls.addView(notesControlSet.getDisplayView());
|
|
|
|
//moreControls.addView(notesControlSet.getDisplayView());
|
|
|
|
controlSetMap.put(getString(R.string.TEA_control_notes), notesControlSet);
|
|
|
|
controlSetMap.put(getString(R.string.TEA_control_notes), notesControlSet);
|
|
|
|
|
|
|
|
|
|
|
|
ReminderControlSet reminderControl = new ReminderControlSet(TaskEditActivity.this, R.layout.control_set_reminders, R.layout.control_set_reminders_display);
|
|
|
|
ReminderControlSet reminderControl = new ReminderControlSet(getActivity(), R.layout.control_set_reminders, R.layout.control_set_reminders_display);
|
|
|
|
controls.add(reminderControl);
|
|
|
|
controls.add(reminderControl);
|
|
|
|
//moreControls.addView(reminderControl.getDisplayView());
|
|
|
|
//moreControls.addView(reminderControl.getDisplayView());
|
|
|
|
controlSetMap.put(getString(R.string.TEA_control_reminders), reminderControl);
|
|
|
|
controlSetMap.put(getString(R.string.TEA_control_reminders), reminderControl);
|
|
|
|
|
|
|
|
|
|
|
|
TimerControlSet timerControl = new TimerControlSet(TaskEditActivity.this, R.layout.control_set_timers, R.layout.control_set_timers_extras_display, R.string.TEA_timer_controls);
|
|
|
|
TimerControlSet timerControl = new TimerControlSet(getActivity(), R.layout.control_set_timers, R.layout.control_set_timers_extras_display, R.string.TEA_timer_controls);
|
|
|
|
timerAction.setListener(timerControl);
|
|
|
|
timerAction.setListener(timerControl);
|
|
|
|
controls.add(timerControl);
|
|
|
|
controls.add(timerControl);
|
|
|
|
//moreControls.addView(timerControl.getDisplayView());
|
|
|
|
//moreControls.addView(timerControl.getDisplayView());
|
|
|
|
@ -322,7 +375,7 @@ public final class TaskEditActivity extends Activity {
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
if(ProducteevUtilities.INSTANCE.isLoggedIn()) {
|
|
|
|
if(ProducteevUtilities.INSTANCE.isLoggedIn()) {
|
|
|
|
ProducteevControlSet producteevControl = new ProducteevControlSet(TaskEditActivity.this, R.layout.control_set_producteev, R.layout.control_set_producteev_display, R.string.producteev_TEA_control_set_display);
|
|
|
|
ProducteevControlSet producteevControl = new ProducteevControlSet(getActivity(), R.layout.control_set_producteev, R.layout.control_set_producteev_display, R.string.producteev_TEA_control_set_display);
|
|
|
|
controls.add(producteevControl);
|
|
|
|
controls.add(producteevControl);
|
|
|
|
basicControls.addView(producteevControl.getDisplayView());
|
|
|
|
basicControls.addView(producteevControl.getDisplayView());
|
|
|
|
notesEditText.setHint(R.string.producteev_TEA_notes);
|
|
|
|
notesEditText.setHint(R.string.producteev_TEA_notes);
|
|
|
|
@ -334,7 +387,7 @@ public final class TaskEditActivity extends Activity {
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
if(OpencrxCoreUtils.INSTANCE.isLoggedIn()) {
|
|
|
|
if(OpencrxCoreUtils.INSTANCE.isLoggedIn()) {
|
|
|
|
OpencrxControlSet ocrxControl = new OpencrxControlSet(TaskEditActivity.this, R.layout.control_set_opencrx, R.layout.control_set_opencrx_display, R.string.opencrx_TEA_opencrx_title);
|
|
|
|
OpencrxControlSet ocrxControl = new OpencrxControlSet(getActivity(), R.layout.control_set_opencrx, R.layout.control_set_opencrx_display, R.string.opencrx_TEA_opencrx_title);
|
|
|
|
controls.add(ocrxControl);
|
|
|
|
controls.add(ocrxControl);
|
|
|
|
basicControls.addView(ocrxControl.getDisplayView());
|
|
|
|
basicControls.addView(ocrxControl.getDisplayView());
|
|
|
|
notesEditText.setHint(R.string.opencrx_TEA_notes);
|
|
|
|
notesEditText.setHint(R.string.opencrx_TEA_notes);
|
|
|
|
@ -344,7 +397,6 @@ public final class TaskEditActivity extends Activity {
|
|
|
|
Log.e("astrid-error", "loading-control-set", e); //$NON-NLS-1$ //$NON-NLS-2$
|
|
|
|
Log.e("astrid-error", "loading-control-set", e); //$NON-NLS-1$ //$NON-NLS-2$
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String[] itemOrder;
|
|
|
|
String[] itemOrder;
|
|
|
|
String orderPreference = Preferences.getStringValue(BeastModePreferenceActivity.BEAST_MODE_ORDER_PREF);
|
|
|
|
String orderPreference = Preferences.getStringValue(BeastModePreferenceActivity.BEAST_MODE_ORDER_PREF);
|
|
|
|
if (orderPreference != null)
|
|
|
|
if (orderPreference != null)
|
|
|
|
@ -353,7 +405,7 @@ public final class TaskEditActivity extends Activity {
|
|
|
|
itemOrder = getResources().getStringArray(R.array.TEA_control_sets);
|
|
|
|
itemOrder = getResources().getStringArray(R.array.TEA_control_sets);
|
|
|
|
String moreSectionTrigger = getString(R.string.TEA_control_more_section);
|
|
|
|
String moreSectionTrigger = getString(R.string.TEA_control_more_section);
|
|
|
|
String whenViewDescriptor = getString(R.string.TEA_control_when);
|
|
|
|
String whenViewDescriptor = getString(R.string.TEA_control_when);
|
|
|
|
View whenView = findViewById(R.id.when_container);
|
|
|
|
View whenView = getView().findViewById(R.id.when_container);
|
|
|
|
String shareViewDescriptor = getString(R.string.TEA_control_share);
|
|
|
|
String shareViewDescriptor = getString(R.string.TEA_control_share);
|
|
|
|
LinearLayout section = basicControls;
|
|
|
|
LinearLayout section = basicControls;
|
|
|
|
for (int i = 0; i < itemOrder.length; i++) {
|
|
|
|
for (int i = 0; i < itemOrder.length; i++) {
|
|
|
|
@ -373,7 +425,7 @@ public final class TaskEditActivity extends Activity {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (moreControls.getChildCount() == 0)
|
|
|
|
if (moreControls.getChildCount() == 0)
|
|
|
|
findViewById(R.id.more_header).setVisibility(View.GONE);
|
|
|
|
getView().findViewById(R.id.more_header).setVisibility(View.GONE);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -401,14 +453,14 @@ public final class TaskEditActivity extends Activity {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
final View.OnClickListener mExpandMoreListener = new View.OnClickListener() {
|
|
|
|
final View.OnClickListener mExpandMoreListener = new View.OnClickListener() {
|
|
|
|
final Animation fadeIn = AnimationUtils.loadAnimation(TaskEditActivity.this, android.R.anim.fade_in);
|
|
|
|
final Animation fadeIn = AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in);
|
|
|
|
final Animation fadeOut = AnimationUtils.loadAnimation(TaskEditActivity.this, android.R.anim.fade_out);
|
|
|
|
final Animation fadeOut = AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out);
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
|
|
|
public void onClick(View v) {
|
|
|
|
fadeIn.setDuration(300);
|
|
|
|
fadeIn.setDuration(300);
|
|
|
|
fadeOut.setDuration(300);
|
|
|
|
fadeOut.setDuration(300);
|
|
|
|
View moreView = findViewById(R.id.more_controls);
|
|
|
|
View moreView = getView().findViewById(R.id.more_controls);
|
|
|
|
View moreHeader = findViewById(R.id.more_header);
|
|
|
|
View moreHeader = getView().findViewById(R.id.more_header);
|
|
|
|
if (moreView.getVisibility() == View.GONE) {
|
|
|
|
if (moreView.getVisibility() == View.GONE) {
|
|
|
|
moreView.setVisibility(View.VISIBLE);
|
|
|
|
moreView.setVisibility(View.VISIBLE);
|
|
|
|
moreView.startAnimation(fadeIn);
|
|
|
|
moreView.startAnimation(fadeIn);
|
|
|
|
@ -420,12 +472,12 @@ public final class TaskEditActivity extends Activity {
|
|
|
|
|
|
|
|
|
|
|
|
// set up save, cancel, and delete buttons
|
|
|
|
// set up save, cancel, and delete buttons
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
Button saveButtonGeneral = (Button) findViewById(R.id.save);
|
|
|
|
Button saveButtonGeneral = (Button) getView().findViewById(R.id.save);
|
|
|
|
saveButtonGeneral.setOnClickListener(mSaveListener);
|
|
|
|
saveButtonGeneral.setOnClickListener(mSaveListener);
|
|
|
|
|
|
|
|
|
|
|
|
Button saveButton2 = (Button) findViewById(R.id.save2);
|
|
|
|
Button saveButton2 = (Button) getView().findViewById(R.id.save2);
|
|
|
|
Button saveButton3 = (Button) findViewById(R.id.save3);
|
|
|
|
Button saveButton3 = (Button) getView().findViewById(R.id.save3);
|
|
|
|
Button saveButton4 = (Button) findViewById(R.id.save4);
|
|
|
|
Button saveButton4 = (Button) getView().findViewById(R.id.save4);
|
|
|
|
if (saveButton2 != null) {
|
|
|
|
if (saveButton2 != null) {
|
|
|
|
saveButton2.setOnClickListener(mSaveListener);
|
|
|
|
saveButton2.setOnClickListener(mSaveListener);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -437,12 +489,12 @@ public final class TaskEditActivity extends Activity {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Button discardButtonGeneral = (Button) findViewById(R.id.discard);
|
|
|
|
Button discardButtonGeneral = (Button) getView().findViewById(R.id.discard);
|
|
|
|
discardButtonGeneral.setOnClickListener(mDiscardListener);
|
|
|
|
discardButtonGeneral.setOnClickListener(mDiscardListener);
|
|
|
|
|
|
|
|
|
|
|
|
Button discardButton2 = (Button) findViewById(R.id.discard2);
|
|
|
|
Button discardButton2 = (Button) getView().findViewById(R.id.discard2);
|
|
|
|
Button discardButton3 = (Button) findViewById(R.id.discard3);
|
|
|
|
Button discardButton3 = (Button) getView().findViewById(R.id.discard3);
|
|
|
|
Button discardButton4 = (Button) findViewById(R.id.discard4);
|
|
|
|
Button discardButton4 = (Button) getView().findViewById(R.id.discard4);
|
|
|
|
if (discardButton2 != null) {
|
|
|
|
if (discardButton2 != null) {
|
|
|
|
discardButton2.setOnClickListener(mDiscardListener);
|
|
|
|
discardButton2.setOnClickListener(mDiscardListener);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -453,14 +505,14 @@ public final class TaskEditActivity extends Activity {
|
|
|
|
discardButton4.setOnClickListener(mDiscardListener);
|
|
|
|
discardButton4.setOnClickListener(mDiscardListener);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
findViewById(R.id.when_header).setOnClickListener(mExpandWhenListener);
|
|
|
|
getView().findViewById(R.id.when_header).setOnClickListener(mExpandWhenListener);
|
|
|
|
|
|
|
|
|
|
|
|
findViewById(R.id.more_header).setOnClickListener(mExpandMoreListener);
|
|
|
|
getView().findViewById(R.id.more_header).setOnClickListener(mExpandMoreListener);
|
|
|
|
|
|
|
|
|
|
|
|
findViewById(R.id.activity).setOnClickListener(new View.OnClickListener() {
|
|
|
|
getView().findViewById(R.id.activity).setOnClickListener(new View.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
|
|
|
public void onClick(View v) {
|
|
|
|
Intent launchIntent = new Intent(TaskEditActivity.this, EditNoteActivity.class);
|
|
|
|
Intent launchIntent = new Intent(getActivity(), EditNoteActivity.class);
|
|
|
|
launchIntent.putExtra(EditNoteActivity.EXTRA_TASK_ID, model.getId());
|
|
|
|
launchIntent.putExtra(EditNoteActivity.EXTRA_TASK_ID, model.getId());
|
|
|
|
startActivity(launchIntent);
|
|
|
|
startActivity(launchIntent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -473,10 +525,10 @@ public final class TaskEditActivity extends Activity {
|
|
|
|
private void constructWhenDialog(View whenDialogView) {
|
|
|
|
private void constructWhenDialog(View whenDialogView) {
|
|
|
|
int theme = ThemeService.getTheme();
|
|
|
|
int theme = ThemeService.getTheme();
|
|
|
|
if (theme == R.style.Theme || theme == R.style.Theme_Transparent) {
|
|
|
|
if (theme == R.style.Theme || theme == R.style.Theme_Transparent) {
|
|
|
|
whenDialog = new Dialog(this, R.style.Theme_TEA_Dialog);//R.style.Theme_WhenDialog
|
|
|
|
whenDialog = new Dialog(getActivity(), R.style.Theme_TEA_Dialog);//R.style.Theme_WhenDialog
|
|
|
|
//whenDialogView.setBackgroundColor(getResources().getColor(android.R.color.black));
|
|
|
|
//whenDialogView.setBackgroundColor(getResources().getColor(android.R.color.black));
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
whenDialog = new Dialog(this, R.style.Theme_TEA_Dialog); //R.style.Theme_White_WhenDialog
|
|
|
|
whenDialog = new Dialog(getActivity(), R.style.Theme_TEA_Dialog); //R.style.Theme_White_WhenDialog
|
|
|
|
//whenDialogView.setBackgroundColor(getResources().getColor(android.R.color.white));
|
|
|
|
//whenDialogView.setBackgroundColor(getResources().getColor(android.R.color.white));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -484,12 +536,12 @@ public final class TaskEditActivity extends Activity {
|
|
|
|
dismissDialogButton.setOnClickListener(new View.OnClickListener() {
|
|
|
|
dismissDialogButton.setOnClickListener(new View.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
|
|
|
public void onClick(View v) {
|
|
|
|
DialogUtilities.dismissDialog(TaskEditActivity.this, whenDialog);
|
|
|
|
DialogUtilities.dismissDialog(getActivity(), whenDialog);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
DisplayMetrics metrics = new DisplayMetrics();
|
|
|
|
DisplayMetrics metrics = new DisplayMetrics();
|
|
|
|
this.getWindowManager().getDefaultDisplay().getMetrics(metrics);
|
|
|
|
getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics);
|
|
|
|
whenDialog.setTitle(R.string.TEA_when_dialog_title);
|
|
|
|
whenDialog.setTitle(R.string.TEA_when_dialog_title);
|
|
|
|
whenDialog.addContentView(whenDialogView, new LayoutParams(metrics.widthPixels - (int)(30 * metrics.density), LayoutParams.WRAP_CONTENT));
|
|
|
|
whenDialog.addContentView(whenDialogView, new LayoutParams(metrics.widthPixels - (int)(30 * metrics.density), LayoutParams.WRAP_CONTENT));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -508,7 +560,7 @@ public final class TaskEditActivity extends Activity {
|
|
|
|
voiceAddNoteButton = (ImageButton) notesControlSet.getView().findViewById(R.id.voiceAddNoteButton);
|
|
|
|
voiceAddNoteButton = (ImageButton) notesControlSet.getView().findViewById(R.id.voiceAddNoteButton);
|
|
|
|
voiceAddNoteButton.setVisibility(View.VISIBLE);
|
|
|
|
voiceAddNoteButton.setVisibility(View.VISIBLE);
|
|
|
|
int prompt = R.string.voice_edit_note_prompt;
|
|
|
|
int prompt = R.string.voice_edit_note_prompt;
|
|
|
|
voiceNoteAssistant = new VoiceInputAssistant(TaskEditActivity.this, voiceAddNoteButton,
|
|
|
|
voiceNoteAssistant = new VoiceInputAssistant(getActivity(), voiceAddNoteButton,
|
|
|
|
notesEditText, REQUEST_VOICE_RECOG);
|
|
|
|
notesEditText, REQUEST_VOICE_RECOG);
|
|
|
|
voiceNoteAssistant.setAppend(true);
|
|
|
|
voiceNoteAssistant.setAppend(true);
|
|
|
|
voiceNoteAssistant.setLanguageModel(RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
|
|
|
|
voiceNoteAssistant.setLanguageModel(RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
|
|
|
|
@ -546,7 +598,7 @@ public final class TaskEditActivity extends Activity {
|
|
|
|
public void run() {
|
|
|
|
public void run() {
|
|
|
|
AndroidUtilities.sleepDeep(500L);
|
|
|
|
AndroidUtilities.sleepDeep(500L);
|
|
|
|
|
|
|
|
|
|
|
|
runOnUiThread(new Runnable() {
|
|
|
|
getActivity().runOnUiThread(new Runnable() {
|
|
|
|
public void run() {
|
|
|
|
public void run() {
|
|
|
|
onUiThread();
|
|
|
|
onUiThread();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -607,13 +659,13 @@ public final class TaskEditActivity extends Activity {
|
|
|
|
if(model == null) {
|
|
|
|
if(model == null) {
|
|
|
|
exceptionService.reportError("task-edit-no-task",
|
|
|
|
exceptionService.reportError("task-edit-no-task",
|
|
|
|
new NullPointerException("model"));
|
|
|
|
new NullPointerException("model"));
|
|
|
|
finish();
|
|
|
|
getActivity().finish();
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!isNewTask) {
|
|
|
|
if (!isNewTask) {
|
|
|
|
if (actFmPreferenceService.isLoggedIn()) {
|
|
|
|
if (actFmPreferenceService.isLoggedIn()) {
|
|
|
|
findViewById(R.id.activityContainer).setVisibility(View.VISIBLE);
|
|
|
|
getView().findViewById(R.id.activityContainer).setVisibility(View.VISIBLE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -622,10 +674,10 @@ public final class TaskEditActivity extends Activity {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** Populate UI component values from the model */
|
|
|
|
/** Populate UI component values from the model */
|
|
|
|
private void populateFields() {
|
|
|
|
public void populateFields(Intent intent) {
|
|
|
|
loadItem(getIntent());
|
|
|
|
loadItem(intent);
|
|
|
|
|
|
|
|
|
|
|
|
TextView titleText = (TextView) findViewById(R.id.taskLabel);
|
|
|
|
TextView titleText = (TextView) getView().findViewById(R.id.taskLabel);
|
|
|
|
if(isNewTask)
|
|
|
|
if(isNewTask)
|
|
|
|
titleText.setText(R.string.TEA_view_titleNew);
|
|
|
|
titleText.setText(R.string.TEA_view_titleNew);
|
|
|
|
else
|
|
|
|
else
|
|
|
|
@ -637,6 +689,11 @@ public final class TaskEditActivity extends Activity {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** Populate UI component values from the model */
|
|
|
|
|
|
|
|
private void populateFields() {
|
|
|
|
|
|
|
|
populateFields(getActivity().getIntent());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** Save task model from values in UI components */
|
|
|
|
/** Save task model from values in UI components */
|
|
|
|
private void save(boolean onPause) {
|
|
|
|
private void save(boolean onPause) {
|
|
|
|
if(title.getText().length() > 0)
|
|
|
|
if(title.getText().length() > 0)
|
|
|
|
@ -662,22 +719,21 @@ public final class TaskEditActivity extends Activity {
|
|
|
|
|
|
|
|
|
|
|
|
if (!onPause) { // Saving during on pause could cause a double finish
|
|
|
|
if (!onPause) { // Saving during on pause could cause a double finish
|
|
|
|
shouldSaveState = false;
|
|
|
|
shouldSaveState = false;
|
|
|
|
finish();
|
|
|
|
getActivity().finish();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
|
|
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
|
|
|
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
|
|
|
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
|
|
|
save(false);
|
|
|
|
save(false);
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return super.onKeyDown(keyCode, event);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void finish() {
|
|
|
|
public void onDetach() {
|
|
|
|
super.finish();
|
|
|
|
super.onDetach();
|
|
|
|
|
|
|
|
|
|
|
|
// abandon editing and delete the newly created task if
|
|
|
|
// abandon editing and delete the newly created task if
|
|
|
|
// no title was entered
|
|
|
|
// no title was entered
|
|
|
|
@ -710,13 +766,13 @@ public final class TaskEditActivity extends Activity {
|
|
|
|
RemoteViews view = extras.getParcelable(AstridApiConstants.EXTRAS_RESPONSE);
|
|
|
|
RemoteViews view = extras.getParcelable(AstridApiConstants.EXTRAS_RESPONSE);
|
|
|
|
|
|
|
|
|
|
|
|
// add a separator
|
|
|
|
// add a separator
|
|
|
|
View separator = new View(TaskEditActivity.this);
|
|
|
|
View separator = new View(getActivity());
|
|
|
|
separator.setPadding(5, 5, 5, 5);
|
|
|
|
separator.setPadding(5, 5, 5, 5);
|
|
|
|
separator.setBackgroundResource(android.R.drawable.divider_horizontal_dark);
|
|
|
|
separator.setBackgroundResource(android.R.drawable.divider_horizontal_dark);
|
|
|
|
|
|
|
|
|
|
|
|
LinearLayout dest = (LinearLayout)findViewById(R.id.addons_more);
|
|
|
|
LinearLayout dest = (LinearLayout)getView().findViewById(R.id.addons_more);
|
|
|
|
dest.addView(separator);
|
|
|
|
dest.addView(separator);
|
|
|
|
view.apply(TaskEditActivity.this, dest);
|
|
|
|
view.apply(getActivity(), dest);
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
exceptionService.reportError("receive-detail-" + //$NON-NLS-1$
|
|
|
|
exceptionService.reportError("receive-detail-" + //$NON-NLS-1$
|
|
|
|
@ -747,7 +803,7 @@ public final class TaskEditActivity extends Activity {
|
|
|
|
if (due != 0) {
|
|
|
|
if (due != 0) {
|
|
|
|
stringResource = R.string.TEA_onTaskSave_due;
|
|
|
|
stringResource = R.string.TEA_onTaskSave_due;
|
|
|
|
CharSequence formattedDate =
|
|
|
|
CharSequence formattedDate =
|
|
|
|
DateUtilities.getRelativeDay(this, due);
|
|
|
|
DateUtilities.getRelativeDay(getActivity(), due);
|
|
|
|
toastMessage = getString(stringResource, formattedDate);
|
|
|
|
toastMessage = getString(stringResource, formattedDate);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
toastMessage = getString(R.string.TEA_onTaskSave_notDue);
|
|
|
|
toastMessage = getString(R.string.TEA_onTaskSave_notDue);
|
|
|
|
@ -766,20 +822,20 @@ public final class TaskEditActivity extends Activity {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
showCancelToast();
|
|
|
|
showCancelToast();
|
|
|
|
setResult(RESULT_CANCELED);
|
|
|
|
getActivity().setResult(Activity.RESULT_CANCELED);
|
|
|
|
finish();
|
|
|
|
getActivity().finish();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Show toast for task edit canceling
|
|
|
|
* Show toast for task edit canceling
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private void showCancelToast() {
|
|
|
|
private void showCancelToast() {
|
|
|
|
Toast.makeText(this, R.string.TEA_onTaskCancel,
|
|
|
|
Toast.makeText(getActivity(), R.string.TEA_onTaskCancel,
|
|
|
|
Toast.LENGTH_SHORT).show();
|
|
|
|
Toast.LENGTH_SHORT).show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected void deleteButtonClick() {
|
|
|
|
protected void deleteButtonClick() {
|
|
|
|
new AlertDialog.Builder(this)
|
|
|
|
new AlertDialog.Builder(getActivity())
|
|
|
|
.setTitle(R.string.DLG_confirm_title)
|
|
|
|
.setTitle(R.string.DLG_confirm_title)
|
|
|
|
.setMessage(R.string.DLG_delete_this_task_question)
|
|
|
|
.setMessage(R.string.DLG_delete_this_task_question)
|
|
|
|
.setIcon(android.R.drawable.ic_dialog_alert)
|
|
|
|
.setIcon(android.R.drawable.ic_dialog_alert)
|
|
|
|
@ -789,8 +845,8 @@ public final class TaskEditActivity extends Activity {
|
|
|
|
taskService.delete(model);
|
|
|
|
taskService.delete(model);
|
|
|
|
shouldSaveState = false;
|
|
|
|
shouldSaveState = false;
|
|
|
|
showDeleteToast();
|
|
|
|
showDeleteToast();
|
|
|
|
setResult(RESULT_CANCELED);
|
|
|
|
getActivity().setResult(Activity.RESULT_CANCELED);
|
|
|
|
finish();
|
|
|
|
getActivity().finish();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.setNegativeButton(android.R.string.cancel, null)
|
|
|
|
.setNegativeButton(android.R.string.cancel, null)
|
|
|
|
@ -801,12 +857,12 @@ public final class TaskEditActivity extends Activity {
|
|
|
|
* Show toast for task edit deleting
|
|
|
|
* Show toast for task edit deleting
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private void showDeleteToast() {
|
|
|
|
private void showDeleteToast() {
|
|
|
|
Toast.makeText(this, R.string.TEA_onTaskDelete,
|
|
|
|
Toast.makeText(getActivity(), R.string.TEA_onTaskDelete,
|
|
|
|
Toast.LENGTH_SHORT).show();
|
|
|
|
Toast.LENGTH_SHORT).show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean onMenuItemSelected(int featureId, MenuItem item) {
|
|
|
|
public boolean onOptionsItemSelected(MenuItem item) {
|
|
|
|
switch(item.getItemId()) {
|
|
|
|
switch(item.getItemId()) {
|
|
|
|
case MENU_SAVE_ID:
|
|
|
|
case MENU_SAVE_ID:
|
|
|
|
saveButtonClick();
|
|
|
|
saveButtonClick();
|
|
|
|
@ -819,12 +875,12 @@ public final class TaskEditActivity extends Activity {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return super.onMenuItemSelected(featureId, item);
|
|
|
|
return super.onOptionsItemSelected(item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean onCreateOptionsMenu(Menu menu) {
|
|
|
|
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
|
|
|
super.onCreateOptionsMenu(menu);
|
|
|
|
super.onCreateOptionsMenu(menu, inflater);
|
|
|
|
MenuItem item;
|
|
|
|
MenuItem item;
|
|
|
|
|
|
|
|
|
|
|
|
item = menu.add(Menu.NONE, MENU_SAVE_ID, 0, R.string.TEA_menu_save);
|
|
|
|
item = menu.add(Menu.NONE, MENU_SAVE_ID, 0, R.string.TEA_menu_save);
|
|
|
|
@ -835,32 +891,30 @@ public final class TaskEditActivity extends Activity {
|
|
|
|
|
|
|
|
|
|
|
|
item = menu.add(Menu.NONE, MENU_DELETE_ID, 0, R.string.TEA_menu_delete);
|
|
|
|
item = menu.add(Menu.NONE, MENU_DELETE_ID, 0, R.string.TEA_menu_delete);
|
|
|
|
item.setIcon(android.R.drawable.ic_menu_delete);
|
|
|
|
item.setIcon(android.R.drawable.ic_menu_delete);
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected void onPause() {
|
|
|
|
public void onPause() {
|
|
|
|
super.onPause();
|
|
|
|
super.onPause();
|
|
|
|
StatisticsService.sessionPause();
|
|
|
|
StatisticsService.sessionPause();
|
|
|
|
unregisterReceiver(controlReceiver);
|
|
|
|
getActivity().unregisterReceiver(controlReceiver);
|
|
|
|
|
|
|
|
|
|
|
|
if(shouldSaveState)
|
|
|
|
if(shouldSaveState)
|
|
|
|
save(true);
|
|
|
|
save(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected void onResume() {
|
|
|
|
public void onResume() {
|
|
|
|
super.onResume();
|
|
|
|
super.onResume();
|
|
|
|
StatisticsService.sessionStart(this);
|
|
|
|
StatisticsService.sessionStart(getActivity());
|
|
|
|
registerReceiver(controlReceiver,
|
|
|
|
getActivity().registerReceiver(controlReceiver,
|
|
|
|
new IntentFilter(AstridApiConstants.BROADCAST_SEND_EDIT_CONTROLS));
|
|
|
|
new IntentFilter(AstridApiConstants.BROADCAST_SEND_EDIT_CONTROLS));
|
|
|
|
populateFields();
|
|
|
|
populateFields();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
|
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
|
|
if(requestCode == REQUEST_VOICE_RECOG && resultCode == RESULT_OK) {
|
|
|
|
if(requestCode == REQUEST_VOICE_RECOG && resultCode == Activity.RESULT_OK) {
|
|
|
|
// handle the result of voice recognition, put it into the appropiate textfield
|
|
|
|
// handle the result of voice recognition, put it into the appropiate textfield
|
|
|
|
voiceNoteAssistant.handleActivityResult(requestCode, resultCode, data);
|
|
|
|
voiceNoteAssistant.handleActivityResult(requestCode, resultCode, data);
|
|
|
|
|
|
|
|
|
|
|
|
@ -876,7 +930,7 @@ public final class TaskEditActivity extends Activity {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected void onSaveInstanceState(Bundle outState) {
|
|
|
|
public void onSaveInstanceState(Bundle outState) {
|
|
|
|
super.onSaveInstanceState(outState);
|
|
|
|
super.onSaveInstanceState(outState);
|
|
|
|
|
|
|
|
|
|
|
|
// stick our task into the outState
|
|
|
|
// stick our task into the outState
|
|
|
|
@ -884,19 +938,14 @@ public final class TaskEditActivity extends Activity {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected void onRestoreInstanceState(Bundle inState) {
|
|
|
|
public void onStart() {
|
|
|
|
super.onRestoreInstanceState(inState);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
protected void onStart() {
|
|
|
|
|
|
|
|
super.onStart();
|
|
|
|
super.onStart();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected void onStop() {
|
|
|
|
public void onStop() {
|
|
|
|
super.onStop();
|
|
|
|
super.onStop();
|
|
|
|
StatisticsService.sessionStop(this);
|
|
|
|
StatisticsService.sessionStop(getActivity());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* ======================================================================
|
|
|
|
/* ======================================================================
|
|
|
|
|