|
|
@ -122,8 +122,8 @@ import com.todoroo.astrid.welcome.tutorial.WelcomeWalkthrough;
|
|
|
|
import com.todoroo.astrid.widget.TasksWidget;
|
|
|
|
import com.todoroo.astrid.widget.TasksWidget;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Primary activity for the Bente application. Shows a list of upcoming
|
|
|
|
* Primary activity for the Bente application. Shows a list of upcoming tasks
|
|
|
|
* tasks and a user's coaches.
|
|
|
|
* and a user's coaches.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @author Tim Su <tim@todoroo.com>
|
|
|
|
* @author Tim Su <tim@todoroo.com>
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -171,26 +171,33 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
|
|
|
|
|
|
|
|
// --- instance variables
|
|
|
|
// --- instance variables
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired ExceptionService exceptionService;
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
ExceptionService exceptionService;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired protected TaskService taskService;
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
protected TaskService taskService;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired MetadataService metadataService;
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
MetadataService metadataService;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired Database database;
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
Database database;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired AddOnService addOnService;
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
AddOnService addOnService;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired UpgradeService upgradeService;
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
UpgradeService upgradeService;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired protected SyncV2Service syncService;
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
protected SyncV2Service syncService;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired TagDataService tagDataService;
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
TagDataService tagDataService;
|
|
|
|
|
|
|
|
|
|
|
|
private final TaskContextActionExposer[] contextItemExposers = new TaskContextActionExposer[] {
|
|
|
|
private final TaskContextActionExposer[] contextItemExposers = new TaskContextActionExposer[] {
|
|
|
|
new ReminderDebugContextActions.MakeNotification(),
|
|
|
|
new ReminderDebugContextActions.MakeNotification(),
|
|
|
|
new ReminderDebugContextActions.WhenReminder(),
|
|
|
|
new ReminderDebugContextActions.WhenReminder(), };
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected TaskAdapter taskAdapter = null;
|
|
|
|
protected TaskAdapter taskAdapter = null;
|
|
|
|
protected DetailReceiver detailReceiver = new DetailReceiver();
|
|
|
|
protected DetailReceiver detailReceiver = new DetailReceiver();
|
|
|
@ -218,16 +225,19 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
OnTaskListItemClickedListener mListener;
|
|
|
|
OnTaskListItemClickedListener mListener;
|
|
|
|
private boolean mDualFragments = false;
|
|
|
|
private boolean mDualFragments = false;
|
|
|
|
|
|
|
|
|
|
|
|
/* ======================================================================
|
|
|
|
/*
|
|
|
|
|
|
|
|
* ======================================================================
|
|
|
|
* ======================================================= initialization
|
|
|
|
* ======================================================= initialization
|
|
|
|
* ====================================================================== */
|
|
|
|
* ======================================================================
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
static {
|
|
|
|
static {
|
|
|
|
AstridDependencyInjector.initialize();
|
|
|
|
AstridDependencyInjector.initialize();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** Container Activity must implement this interface and we ensure
|
|
|
|
/**
|
|
|
|
* that it does during the onAttach() callback
|
|
|
|
* Container Activity must implement this interface and we ensure that it
|
|
|
|
|
|
|
|
* does during the onAttach() callback
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public interface OnTaskListItemClickedListener {
|
|
|
|
public interface OnTaskListItemClickedListener {
|
|
|
|
public void onTaskListItemClicked(long taskId);
|
|
|
|
public void onTaskListItemClicked(long taskId);
|
|
|
@ -236,7 +246,8 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onAttach(SupportActivity activity) {
|
|
|
|
public void onAttach(SupportActivity activity) {
|
|
|
|
super.onAttach(activity);
|
|
|
|
super.onAttach(activity);
|
|
|
|
// Check that the container activity has implemented the callback interface
|
|
|
|
// Check that the container activity has implemented the callback
|
|
|
|
|
|
|
|
// interface
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
mListener = (OnTaskListItemClickedListener) activity;
|
|
|
|
mListener = (OnTaskListItemClickedListener) activity;
|
|
|
|
} catch (ClassCastException e) {
|
|
|
|
} catch (ClassCastException e) {
|
|
|
@ -252,9 +263,11 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
protected View getListBody(ViewGroup root) {
|
|
|
|
protected View getListBody(ViewGroup root) {
|
|
|
|
if (AndroidUtilities.getSdkVersion() > 3)
|
|
|
|
if (AndroidUtilities.getSdkVersion() > 3)
|
|
|
|
return getActivity().getLayoutInflater().inflate(R.layout.task_list_body_standard, root, false);
|
|
|
|
return getActivity().getLayoutInflater().inflate(
|
|
|
|
|
|
|
|
R.layout.task_list_body_standard, root, false);
|
|
|
|
else
|
|
|
|
else
|
|
|
|
return getActivity().getLayoutInflater().inflate(R.layout.task_list_body_api3, root, false);
|
|
|
|
return getActivity().getLayoutInflater().inflate(
|
|
|
|
|
|
|
|
R.layout.task_list_body_api3, root, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** Called when loading up the activity */
|
|
|
|
/** Called when loading up the activity */
|
|
|
@ -275,9 +288,12 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
database.openForWriting();
|
|
|
|
database.openForWriting();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/* (non-Javadoc)
|
|
|
|
* (non-Javadoc)
|
|
|
|
* @see android.support.v4.app.Fragment#onCreateView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle)
|
|
|
|
*
|
|
|
|
|
|
|
|
* @see
|
|
|
|
|
|
|
|
* android.support.v4.app.Fragment#onCreateView(android.view.LayoutInflater,
|
|
|
|
|
|
|
|
* android.view.ViewGroup, android.os.Bundle)
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
|
|
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
|
|
@ -298,8 +314,10 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
setUpUiComponents();
|
|
|
|
setUpUiComponents();
|
|
|
|
onNewIntent(getActivity().getIntent());
|
|
|
|
onNewIntent(getActivity().getIntent());
|
|
|
|
|
|
|
|
|
|
|
|
Fragment filterlistFrame = getFragmentManager().findFragmentByTag(FilterListActivity.TAG_FILTERLIST_FRAGMENT);
|
|
|
|
Fragment filterlistFrame = getFragmentManager().findFragmentByTag(
|
|
|
|
mDualFragments = (filterlistFrame != null) && filterlistFrame.isInLayout();
|
|
|
|
FilterListActivity.TAG_FILTERLIST_FRAGMENT);
|
|
|
|
|
|
|
|
mDualFragments = (filterlistFrame != null)
|
|
|
|
|
|
|
|
&& filterlistFrame.isInLayout();
|
|
|
|
|
|
|
|
|
|
|
|
if (mDualFragments) {
|
|
|
|
if (mDualFragments) {
|
|
|
|
// In dual-pane mode, the list view highlights the selected item.
|
|
|
|
// In dual-pane mode, the list view highlights the selected item.
|
|
|
@ -308,10 +326,12 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (Preferences.getInt(AstridPreferences.P_UPGRADE_FROM, -1) > -1)
|
|
|
|
if (Preferences.getInt(AstridPreferences.P_UPGRADE_FROM, -1) > -1)
|
|
|
|
upgradeService.showChangeLog(getActivity(), Preferences.getInt(AstridPreferences.P_UPGRADE_FROM, -1));
|
|
|
|
upgradeService.showChangeLog(getActivity(),
|
|
|
|
|
|
|
|
Preferences.getInt(AstridPreferences.P_UPGRADE_FROM, -1));
|
|
|
|
|
|
|
|
|
|
|
|
if (getActivity().getIntent().hasExtra(TOKEN_SOURCE)) {
|
|
|
|
if (getActivity().getIntent().hasExtra(TOKEN_SOURCE)) {
|
|
|
|
switch(getActivity().getIntent().getIntExtra(TOKEN_SOURCE, Constants.SOURCE_DEFAULT)) {
|
|
|
|
switch (getActivity().getIntent().getIntExtra(TOKEN_SOURCE,
|
|
|
|
|
|
|
|
Constants.SOURCE_DEFAULT)) {
|
|
|
|
case Constants.SOURCE_NOTIFICATION:
|
|
|
|
case Constants.SOURCE_NOTIFICATION:
|
|
|
|
StatisticsService.reportEvent(StatisticsConstants.LAUNCH_FROM_NOTIFICATION);
|
|
|
|
StatisticsService.reportEvent(StatisticsConstants.LAUNCH_FROM_NOTIFICATION);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -347,8 +367,10 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
String intentAction = intent.getAction();
|
|
|
|
String intentAction = intent.getAction();
|
|
|
|
if (Intent.ACTION_SEARCH.equals(intentAction)) {
|
|
|
|
if (Intent.ACTION_SEARCH.equals(intentAction)) {
|
|
|
|
String query = intent.getStringExtra(SearchManager.QUERY).trim();
|
|
|
|
String query = intent.getStringExtra(SearchManager.QUERY).trim();
|
|
|
|
Filter searchFilter = new Filter(null, getString(R.string.FLA_search_filter, query),
|
|
|
|
Filter searchFilter = new Filter(null, getString(
|
|
|
|
new QueryTemplate().where(Functions.upper(Task.TITLE).like("%" + //$NON-NLS-1$
|
|
|
|
R.string.FLA_search_filter, query),
|
|
|
|
|
|
|
|
new QueryTemplate().where(Functions.upper(Task.TITLE).like(
|
|
|
|
|
|
|
|
"%" + //$NON-NLS-1$
|
|
|
|
query.toUpperCase() + "%")), //$NON-NLS-1$
|
|
|
|
query.toUpperCase() + "%")), //$NON-NLS-1$
|
|
|
|
null);
|
|
|
|
null);
|
|
|
|
intent = new Intent(getActivity(), TaskListWrapperActivity.class);
|
|
|
|
intent = new Intent(getActivity(), TaskListWrapperActivity.class);
|
|
|
@ -356,7 +378,8 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
startActivity(intent);
|
|
|
|
startActivity(intent);
|
|
|
|
getActivity().finish();
|
|
|
|
getActivity().finish();
|
|
|
|
if (overrideFinishAnim) {
|
|
|
|
if (overrideFinishAnim) {
|
|
|
|
AndroidUtilities.callOverridePendingTransition(getActivity(), R.anim.slide_right_in, R.anim.slide_right_out);
|
|
|
|
AndroidUtilities.callOverridePendingTransition(getActivity(),
|
|
|
|
|
|
|
|
R.anim.slide_right_in, R.anim.slide_right_out);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
} else if (extras != null && extras.containsKey(TOKEN_FILTER)) {
|
|
|
|
} else if (extras != null && extras.containsKey(TOKEN_FILTER)) {
|
|
|
@ -396,7 +419,8 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
MenuItem item;
|
|
|
|
MenuItem item;
|
|
|
|
|
|
|
|
|
|
|
|
if (!(this instanceof DraggableTaskListActivity)) {
|
|
|
|
if (!(this instanceof DraggableTaskListActivity)) {
|
|
|
|
item = menu.add(Menu.NONE, MENU_SORT_ID, Menu.NONE, R.string.TLA_menu_sort);
|
|
|
|
item = menu.add(Menu.NONE, MENU_SORT_ID, Menu.NONE,
|
|
|
|
|
|
|
|
R.string.TLA_menu_sort);
|
|
|
|
item.setIcon(android.R.drawable.ic_menu_sort_by_size);
|
|
|
|
item.setIcon(android.R.drawable.ic_menu_sort_by_size);
|
|
|
|
if (((AstridWrapperActivity) getActivity()).isMultipleFragments())
|
|
|
|
if (((AstridWrapperActivity) getActivity()).isMultipleFragments())
|
|
|
|
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
|
|
|
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
|
|
@ -419,10 +443,12 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
item.setIcon(android.R.drawable.ic_menu_preferences);
|
|
|
|
item.setIcon(android.R.drawable.ic_menu_preferences);
|
|
|
|
|
|
|
|
|
|
|
|
// ask about plug-ins
|
|
|
|
// ask about plug-ins
|
|
|
|
Intent queryIntent = new Intent(AstridApiConstants.ACTION_TASK_LIST_MENU);
|
|
|
|
Intent queryIntent = new Intent(
|
|
|
|
|
|
|
|
AstridApiConstants.ACTION_TASK_LIST_MENU);
|
|
|
|
|
|
|
|
|
|
|
|
PackageManager pm = getActivity().getPackageManager();
|
|
|
|
PackageManager pm = getActivity().getPackageManager();
|
|
|
|
List<ResolveInfo> resolveInfoList = pm.queryIntentActivities(queryIntent, 0);
|
|
|
|
List<ResolveInfo> resolveInfoList = pm.queryIntentActivities(
|
|
|
|
|
|
|
|
queryIntent, 0);
|
|
|
|
int length = resolveInfoList.size();
|
|
|
|
int length = resolveInfoList.size();
|
|
|
|
for (int i = 0; i < length; i++) {
|
|
|
|
for (int i = 0; i < length; i++) {
|
|
|
|
ResolveInfo resolveInfo = resolveInfoList.get(i);
|
|
|
|
ResolveInfo resolveInfo = resolveInfoList.get(i);
|
|
|
@ -449,7 +475,8 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
View selected = getListView().getSelectedView();
|
|
|
|
View selected = getListView().getSelectedView();
|
|
|
|
|
|
|
|
|
|
|
|
// hot-key to set task priority - 1-4 or ALT + Q-R
|
|
|
|
// hot-key to set task priority - 1-4 or ALT + Q-R
|
|
|
|
if(!filterOn && event.getUnicodeChar() >= '1' && event.getUnicodeChar() <= '4' && selected != null) {
|
|
|
|
if (!filterOn && event.getUnicodeChar() >= '1'
|
|
|
|
|
|
|
|
&& event.getUnicodeChar() <= '4' && selected != null) {
|
|
|
|
int importance = event.getNumber() - '1';
|
|
|
|
int importance = event.getNumber() - '1';
|
|
|
|
Task task = ((ViewHolder) selected.getTag()).task;
|
|
|
|
Task task = ((ViewHolder) selected.getTag()).task;
|
|
|
|
task.setValue(Task.IMPORTANCE, importance);
|
|
|
|
task.setValue(Task.IMPORTANCE, importance);
|
|
|
@ -459,10 +486,12 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
// filter
|
|
|
|
// filter
|
|
|
|
else if (!filterOn && event.getUnicodeChar() != 0) {
|
|
|
|
else if (!filterOn && event.getUnicodeChar() != 0) {
|
|
|
|
getListView().setTextFilterEnabled(true);
|
|
|
|
getListView().setTextFilterEnabled(true);
|
|
|
|
getListView().setFilterText(Character.toString((char)event.getUnicodeChar()));
|
|
|
|
getListView().setFilterText(
|
|
|
|
|
|
|
|
Character.toString((char) event.getUnicodeChar()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// turn off filter if nothing is selected
|
|
|
|
// turn off filter if nothing is selected
|
|
|
|
else if(filterOn && TextUtils.isEmpty(getListView().getTextFilter())) {
|
|
|
|
else if (filterOn
|
|
|
|
|
|
|
|
&& TextUtils.isEmpty(getListView().getTextFilter())) {
|
|
|
|
getListView().setTextFilterEnabled(false);
|
|
|
|
getListView().setTextFilterEnabled(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -477,8 +506,10 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
* When user presses enter, quick-add the task
|
|
|
|
* When user presses enter, quick-add the task
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean onEditorAction(TextView view, int actionId, KeyEvent event) {
|
|
|
|
public boolean onEditorAction(TextView view, int actionId,
|
|
|
|
if(actionId == EditorInfo.IME_NULL && !TextUtils.isEmpty(quickAddBox.getText().toString().trim())) {
|
|
|
|
KeyEvent event) {
|
|
|
|
|
|
|
|
if (actionId == EditorInfo.IME_NULL
|
|
|
|
|
|
|
|
&& !TextUtils.isEmpty(quickAddBox.getText().toString().trim())) {
|
|
|
|
quickAddTask(quickAddBox.getText().toString(), true);
|
|
|
|
quickAddTask(quickAddBox.getText().toString(), true);
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -486,8 +517,8 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
quickAddButton = ((ImageButton) getView().findViewById(
|
|
|
|
quickAddButton = ((ImageButton)getView().findViewById(R.id.quickAddButton));
|
|
|
|
R.id.quickAddButton));
|
|
|
|
|
|
|
|
|
|
|
|
// set listener for quick add button
|
|
|
|
// set listener for quick add button
|
|
|
|
quickAddButton.setOnClickListener(new OnClickListener() {
|
|
|
|
quickAddButton.setOnClickListener(new OnClickListener() {
|
|
|
@ -500,18 +531,21 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// prepare and set listener for voice add button
|
|
|
|
// prepare and set listener for voice add button
|
|
|
|
voiceAddButton = (ImageButton) getView().findViewById(R.id.voiceAddButton);
|
|
|
|
voiceAddButton = (ImageButton) getView().findViewById(
|
|
|
|
|
|
|
|
R.id.voiceAddButton);
|
|
|
|
int prompt = R.string.voice_edit_title_prompt;
|
|
|
|
int prompt = R.string.voice_edit_title_prompt;
|
|
|
|
if (Preferences.getBoolean(R.string.p_voiceInputCreatesTask, false))
|
|
|
|
if (Preferences.getBoolean(R.string.p_voiceInputCreatesTask, false))
|
|
|
|
prompt = R.string.voice_create_prompt;
|
|
|
|
prompt = R.string.voice_create_prompt;
|
|
|
|
voiceInputAssistant = new VoiceInputAssistant(getActivity(),voiceAddButton,quickAddBox);
|
|
|
|
voiceInputAssistant = new VoiceInputAssistant(getActivity(),
|
|
|
|
|
|
|
|
voiceAddButton, quickAddBox);
|
|
|
|
voiceInputAssistant.configureMicrophoneButton(prompt);
|
|
|
|
voiceInputAssistant.configureMicrophoneButton(prompt);
|
|
|
|
|
|
|
|
|
|
|
|
// set listener for extended addbutton
|
|
|
|
// set listener for extended addbutton
|
|
|
|
quickAddButton.setOnLongClickListener(new OnLongClickListener() {
|
|
|
|
quickAddButton.setOnLongClickListener(new OnLongClickListener() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean onLongClick(View v) {
|
|
|
|
public boolean onLongClick(View v) {
|
|
|
|
Task task = quickAddTask(quickAddBox.getText().toString(), false);
|
|
|
|
Task task = quickAddTask(quickAddBox.getText().toString(),
|
|
|
|
|
|
|
|
false);
|
|
|
|
if (task == null)
|
|
|
|
if (task == null)
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
|
@ -528,10 +562,10 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// gestures / animation
|
|
|
|
// gestures / animation
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
GestureService.registerGestureDetector(getActivity(), R.id.gestures, R.raw.gestures, this);
|
|
|
|
GestureService.registerGestureDetector(getActivity(),
|
|
|
|
|
|
|
|
R.id.gestures, R.raw.gestures, this);
|
|
|
|
} catch (VerifyError e) {
|
|
|
|
} catch (VerifyError e) {
|
|
|
|
// failed check, no gestures :P
|
|
|
|
// failed check, no gestures :P
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -542,13 +576,16 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
|
|
|
|
|
|
|
|
// dithering
|
|
|
|
// dithering
|
|
|
|
getActivity().getWindow().setFormat(PixelFormat.RGBA_8888);
|
|
|
|
getActivity().getWindow().setFormat(PixelFormat.RGBA_8888);
|
|
|
|
getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_DITHER);
|
|
|
|
getActivity().getWindow().addFlags(
|
|
|
|
|
|
|
|
WindowManager.LayoutParams.FLAG_DITHER);
|
|
|
|
|
|
|
|
|
|
|
|
syncResultCallback = new ProgressBarSyncResultCallback(getActivity(),
|
|
|
|
syncResultCallback = new ProgressBarSyncResultCallback(getActivity(),
|
|
|
|
R.id.progressBar, new Runnable() {
|
|
|
|
R.id.progressBar, new Runnable() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
public void run() {
|
|
|
|
ContextManager.getContext().sendBroadcast(new Intent(AstridApiConstants.BROADCAST_EVENT_REFRESH));
|
|
|
|
ContextManager.getContext().sendBroadcast(
|
|
|
|
|
|
|
|
new Intent(
|
|
|
|
|
|
|
|
AstridApiConstants.BROADCAST_EVENT_REFRESH));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -562,7 +599,8 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void transitionForTaskEdit() {
|
|
|
|
public void transitionForTaskEdit() {
|
|
|
|
AndroidUtilities.callOverridePendingTransition(getActivity(), R.anim.slide_left_in, R.anim.slide_left_out);
|
|
|
|
AndroidUtilities.callOverridePendingTransition(getActivity(),
|
|
|
|
|
|
|
|
R.anim.slide_left_in, R.anim.slide_left_out);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void setUpBackgroundJobs() {
|
|
|
|
private void setUpBackgroundJobs() {
|
|
|
@ -588,9 +626,11 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
}, BACKGROUND_REFRESH_INTERVAL, BACKGROUND_REFRESH_INTERVAL);
|
|
|
|
}, BACKGROUND_REFRESH_INTERVAL, BACKGROUND_REFRESH_INTERVAL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* ======================================================================
|
|
|
|
/*
|
|
|
|
|
|
|
|
* ======================================================================
|
|
|
|
* ============================================================ lifecycle
|
|
|
|
* ============================================================ lifecycle
|
|
|
|
* ====================================================================== */
|
|
|
|
* ======================================================================
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onStart() {
|
|
|
|
public void onStart() {
|
|
|
@ -608,9 +648,9 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
super.onResume();
|
|
|
|
super.onResume();
|
|
|
|
|
|
|
|
|
|
|
|
StatisticsService.sessionStart(getActivity());
|
|
|
|
StatisticsService.sessionStart(getActivity());
|
|
|
|
if (addOnService.hasPowerPack() &&
|
|
|
|
if (addOnService.hasPowerPack()
|
|
|
|
Preferences.getBoolean(R.string.p_voiceInputEnabled, true) &&
|
|
|
|
&& Preferences.getBoolean(R.string.p_voiceInputEnabled, true)
|
|
|
|
voiceInputAssistant.isVoiceInputAvailable()) {
|
|
|
|
&& voiceInputAssistant.isVoiceInputAvailable()) {
|
|
|
|
voiceAddButton.setVisibility(View.VISIBLE);
|
|
|
|
voiceAddButton.setVisibility(View.VISIBLE);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
voiceAddButton.setVisibility(View.GONE);
|
|
|
|
voiceAddButton.setVisibility(View.GONE);
|
|
|
@ -624,26 +664,34 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
new IntentFilter(AstridApiConstants.BROADCAST_SEND_ACTIONS));
|
|
|
|
new IntentFilter(AstridApiConstants.BROADCAST_SEND_ACTIONS));
|
|
|
|
getActivity().registerReceiver(refreshReceiver,
|
|
|
|
getActivity().registerReceiver(refreshReceiver,
|
|
|
|
new IntentFilter(AstridApiConstants.BROADCAST_EVENT_REFRESH));
|
|
|
|
new IntentFilter(AstridApiConstants.BROADCAST_EVENT_REFRESH));
|
|
|
|
getActivity().registerReceiver(syncActionReceiver,
|
|
|
|
getActivity().registerReceiver(
|
|
|
|
|
|
|
|
syncActionReceiver,
|
|
|
|
new IntentFilter(AstridApiConstants.BROADCAST_SEND_SYNC_ACTIONS));
|
|
|
|
new IntentFilter(AstridApiConstants.BROADCAST_SEND_SYNC_ACTIONS));
|
|
|
|
setUpBackgroundJobs();
|
|
|
|
setUpBackgroundJobs();
|
|
|
|
|
|
|
|
|
|
|
|
if (!Preferences.getBoolean(WelcomeWalkthrough.KEY_SHOWED_WELCOME_LOGIN, false)) {
|
|
|
|
if (!Preferences.getBoolean(
|
|
|
|
Preferences.setBoolean(WelcomeWalkthrough.KEY_SHOWED_WELCOME_LOGIN, true);
|
|
|
|
WelcomeWalkthrough.KEY_SHOWED_WELCOME_LOGIN, false)) {
|
|
|
|
Intent showWelcomeLogin = new Intent(getActivity(), WelcomeWalkthrough.class);
|
|
|
|
Preferences.setBoolean(WelcomeWalkthrough.KEY_SHOWED_WELCOME_LOGIN,
|
|
|
|
|
|
|
|
true);
|
|
|
|
|
|
|
|
Intent showWelcomeLogin = new Intent(getActivity(),
|
|
|
|
|
|
|
|
WelcomeWalkthrough.class);
|
|
|
|
showWelcomeLogin.putExtra(ActFmLoginActivity.SHOW_TOAST, false);
|
|
|
|
showWelcomeLogin.putExtra(ActFmLoginActivity.SHOW_TOAST, false);
|
|
|
|
startActivity(showWelcomeLogin);
|
|
|
|
startActivity(showWelcomeLogin);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!Preferences.getBoolean(R.string.p_showed_add_task_help, false)) {
|
|
|
|
if (!Preferences.getBoolean(R.string.p_showed_add_task_help, false)) {
|
|
|
|
HelpInfoPopover.showPopover(getActivity(), quickAddBox, R.string.help_popover_add_task, null);
|
|
|
|
HelpInfoPopover.showPopover(getActivity(), quickAddBox,
|
|
|
|
|
|
|
|
R.string.help_popover_add_task, null);
|
|
|
|
Preferences.setBoolean(R.string.p_showed_add_task_help, true);
|
|
|
|
Preferences.setBoolean(R.string.p_showed_add_task_help, true);
|
|
|
|
} else if (!Preferences.getBoolean(R.string.p_showed_tap_task_help, false)) {
|
|
|
|
} else if (!Preferences.getBoolean(R.string.p_showed_tap_task_help,
|
|
|
|
|
|
|
|
false)) {
|
|
|
|
showTaskEditHelpPopover();
|
|
|
|
showTaskEditHelpPopover();
|
|
|
|
} else if (Preferences.isSet(getString(R.string.p_showed_lists_help)) &&
|
|
|
|
} else if (Preferences.isSet(getString(R.string.p_showed_lists_help))
|
|
|
|
!Preferences.getBoolean(R.string.p_showed_lists_help, false)) {
|
|
|
|
&& !Preferences.getBoolean(R.string.p_showed_lists_help, false)) {
|
|
|
|
//HelpInfoPopover.showPopover(getActivity(), getView().findViewById(R.id.back), R.string.help_popover_lists, null);
|
|
|
|
// HelpInfoPopover.showPopover(getActivity(),
|
|
|
|
|
|
|
|
// getView().findViewById(R.id.back), R.string.help_popover_lists,
|
|
|
|
|
|
|
|
// null);
|
|
|
|
Preferences.setBoolean(R.string.p_showed_lists_help, true);
|
|
|
|
Preferences.setBoolean(R.string.p_showed_lists_help, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -673,7 +721,8 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
protected class RefreshReceiver extends BroadcastReceiver {
|
|
|
|
protected class RefreshReceiver extends BroadcastReceiver {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onReceive(Context context, Intent intent) {
|
|
|
|
public void onReceive(Context context, Intent intent) {
|
|
|
|
if(intent == null || !AstridApiConstants.BROADCAST_EVENT_REFRESH.equals(intent.getAction()))
|
|
|
|
if (intent == null
|
|
|
|
|
|
|
|
|| !AstridApiConstants.BROADCAST_EVENT_REFRESH.equals(intent.getAction()))
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
getActivity().runOnUiThread(new Runnable() {
|
|
|
|
getActivity().runOnUiThread(new Runnable() {
|
|
|
@ -685,7 +734,6 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Called by the RefreshReceiver when the task list receives a refresh
|
|
|
|
* Called by the RefreshReceiver when the task list receives a refresh
|
|
|
|
* broadcast. Subclasses should override this.
|
|
|
|
* broadcast. Subclasses should override this.
|
|
|
@ -704,7 +752,8 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
protected class SyncActionReceiver extends BroadcastReceiver {
|
|
|
|
protected class SyncActionReceiver extends BroadcastReceiver {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onReceive(Context context, Intent intent) {
|
|
|
|
public void onReceive(Context context, Intent intent) {
|
|
|
|
if(intent == null || !AstridApiConstants.BROADCAST_SEND_SYNC_ACTIONS.equals(intent.getAction()))
|
|
|
|
if (intent == null
|
|
|
|
|
|
|
|
|| !AstridApiConstants.BROADCAST_SEND_SYNC_ACTIONS.equals(intent.getAction()))
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
@ -713,7 +762,8 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
syncActions.add(syncAction);
|
|
|
|
syncActions.add(syncAction);
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
exceptionService.reportError("receive-sync-action-" + //$NON-NLS-1$
|
|
|
|
exceptionService.reportError("receive-sync-action-" + //$NON-NLS-1$
|
|
|
|
intent.getStringExtra(AstridApiConstants.EXTRAS_ADDON), e);
|
|
|
|
intent.getStringExtra(AstridApiConstants.EXTRAS_ADDON),
|
|
|
|
|
|
|
|
e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -734,17 +784,20 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
|
|
|
|
|
|
|
|
if (AstridApiConstants.BROADCAST_SEND_DECORATIONS.equals(intent.getAction())) {
|
|
|
|
if (AstridApiConstants.BROADCAST_SEND_DECORATIONS.equals(intent.getAction())) {
|
|
|
|
TaskDecoration deco = extras.getParcelable(AstridApiConstants.EXTRAS_RESPONSE);
|
|
|
|
TaskDecoration deco = extras.getParcelable(AstridApiConstants.EXTRAS_RESPONSE);
|
|
|
|
taskAdapter.decorationManager.addNew(taskId, addOn, deco, null);
|
|
|
|
taskAdapter.decorationManager.addNew(taskId, addOn, deco,
|
|
|
|
|
|
|
|
null);
|
|
|
|
} else if (AstridApiConstants.BROADCAST_SEND_DETAILS.equals(intent.getAction())) {
|
|
|
|
} else if (AstridApiConstants.BROADCAST_SEND_DETAILS.equals(intent.getAction())) {
|
|
|
|
String detail = extras.getString(AstridApiConstants.EXTRAS_RESPONSE);
|
|
|
|
String detail = extras.getString(AstridApiConstants.EXTRAS_RESPONSE);
|
|
|
|
taskAdapter.addDetails(taskId, detail);
|
|
|
|
taskAdapter.addDetails(taskId, detail);
|
|
|
|
} else if (AstridApiConstants.BROADCAST_SEND_ACTIONS.equals(intent.getAction())) {
|
|
|
|
} else if (AstridApiConstants.BROADCAST_SEND_ACTIONS.equals(intent.getAction())) {
|
|
|
|
TaskAction action = extras.getParcelable(AstridApiConstants.EXTRAS_RESPONSE);
|
|
|
|
TaskAction action = extras.getParcelable(AstridApiConstants.EXTRAS_RESPONSE);
|
|
|
|
taskAdapter.taskActionManager.addNew(taskId, addOn, action, null);
|
|
|
|
taskAdapter.taskActionManager.addNew(taskId, addOn, action,
|
|
|
|
|
|
|
|
null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
exceptionService.reportError("receive-detail-" + //$NON-NLS-1$
|
|
|
|
exceptionService.reportError("receive-detail-" + //$NON-NLS-1$
|
|
|
|
intent.getStringExtra(AstridApiConstants.EXTRAS_ADDON), e);
|
|
|
|
intent.getStringExtra(AstridApiConstants.EXTRAS_ADDON),
|
|
|
|
|
|
|
|
e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -761,35 +814,44 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
|
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
|
|
// handle the result of voice recognition, put it into the textfield
|
|
|
|
// handle the result of voice recognition, put it into the textfield
|
|
|
|
if (voiceInputAssistant.handleActivityResult(requestCode, resultCode, data)) {
|
|
|
|
if (voiceInputAssistant.handleActivityResult(requestCode, resultCode,
|
|
|
|
// if user wants, create the task directly (with defaultvalues) after saying it
|
|
|
|
data)) {
|
|
|
|
|
|
|
|
// if user wants, create the task directly (with defaultvalues)
|
|
|
|
|
|
|
|
// after saying it
|
|
|
|
Flags.set(Flags.TLA_RESUMED_FROM_VOICE_ADD);
|
|
|
|
Flags.set(Flags.TLA_RESUMED_FROM_VOICE_ADD);
|
|
|
|
if (Preferences.getBoolean(R.string.p_voiceInputCreatesTask, false))
|
|
|
|
if (Preferences.getBoolean(R.string.p_voiceInputCreatesTask, false))
|
|
|
|
quickAddTask(quickAddBox.getText().toString(), true);
|
|
|
|
quickAddTask(quickAddBox.getText().toString(), true);
|
|
|
|
super.onActivityResult(requestCode, resultCode, data);
|
|
|
|
super.onActivityResult(requestCode, resultCode, data);
|
|
|
|
|
|
|
|
|
|
|
|
// the rest of onActivityResult is totally unrelated to voicerecognition, so bail out
|
|
|
|
// the rest of onActivityResult is totally unrelated to
|
|
|
|
|
|
|
|
// voicerecognition, so bail out
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(requestCode == ACTIVITY_SETTINGS && resultCode == EditPreferences.RESULT_CODE_THEME_CHANGED) {
|
|
|
|
if (requestCode == ACTIVITY_SETTINGS
|
|
|
|
|
|
|
|
&& resultCode == EditPreferences.RESULT_CODE_THEME_CHANGED) {
|
|
|
|
getActivity().finish();
|
|
|
|
getActivity().finish();
|
|
|
|
if (overrideFinishAnim) {
|
|
|
|
if (overrideFinishAnim) {
|
|
|
|
AndroidUtilities.callOverridePendingTransition(getActivity(), R.anim.slide_right_in, R.anim.slide_right_out);
|
|
|
|
AndroidUtilities.callOverridePendingTransition(getActivity(),
|
|
|
|
|
|
|
|
R.anim.slide_right_in, R.anim.slide_right_out);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
getActivity().startActivity(getActivity().getIntent());
|
|
|
|
getActivity().startActivity(getActivity().getIntent());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
super.onActivityResult(requestCode, resultCode, data);
|
|
|
|
super.onActivityResult(requestCode, resultCode, data);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!Preferences.getBoolean(R.string.p_showed_add_task_help, false)) {
|
|
|
|
if (!Preferences.getBoolean(R.string.p_showed_add_task_help, false)) {
|
|
|
|
HelpInfoPopover.showPopover(getActivity(), quickAddBox, R.string.help_popover_add_task, null);
|
|
|
|
HelpInfoPopover.showPopover(getActivity(), quickAddBox,
|
|
|
|
|
|
|
|
R.string.help_popover_add_task, null);
|
|
|
|
Preferences.setBoolean(R.string.p_showed_add_task_help, true);
|
|
|
|
Preferences.setBoolean(R.string.p_showed_add_task_help, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (resultCode != Activity.RESULT_CANCELED) {
|
|
|
|
if (resultCode != Activity.RESULT_CANCELED) {
|
|
|
|
if (data != null && data.hasExtra(TaskEditActivity.TOKEN_TASK_WAS_ASSIGNED) && data.getBooleanExtra(TaskEditActivity.TOKEN_TASK_WAS_ASSIGNED, false) && !isFilter) {
|
|
|
|
if (data != null
|
|
|
|
|
|
|
|
&& data.hasExtra(TaskEditActivity.TOKEN_TASK_WAS_ASSIGNED)
|
|
|
|
|
|
|
|
&& data.getBooleanExtra(
|
|
|
|
|
|
|
|
TaskEditActivity.TOKEN_TASK_WAS_ASSIGNED, false)
|
|
|
|
|
|
|
|
&& !isFilter) {
|
|
|
|
String assignedTo = data.getStringExtra(TaskEditActivity.TOKEN_ASSIGNED_TO);
|
|
|
|
String assignedTo = data.getStringExtra(TaskEditActivity.TOKEN_ASSIGNED_TO);
|
|
|
|
switchToAssignedFilter(assignedTo);
|
|
|
|
switchToAssignedFilter(assignedTo);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -806,7 +868,8 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
Filter assignedFilter = CustomFilterExposer.getAssignedByMeFilter(getResources());
|
|
|
|
Filter assignedFilter = CustomFilterExposer.getAssignedByMeFilter(getResources());
|
|
|
|
|
|
|
|
|
|
|
|
Intent intent = new Intent(getActivity(), TaskListWrapperActivity.class);
|
|
|
|
Intent intent = new Intent(getActivity(),
|
|
|
|
|
|
|
|
TaskListWrapperActivity.class);
|
|
|
|
intent.putExtra(TaskListActivity.TOKEN_FILTER, assignedFilter);
|
|
|
|
intent.putExtra(TaskListActivity.TOKEN_FILTER, assignedFilter);
|
|
|
|
intent.putExtra(TaskListActivity.TOKEN_OVERRIDE_ANIM, true);
|
|
|
|
intent.putExtra(TaskListActivity.TOKEN_OVERRIDE_ANIM, true);
|
|
|
|
startActivityForResult(intent, 0);
|
|
|
|
startActivityForResult(intent, 0);
|
|
|
@ -814,19 +877,20 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
DialogUtilities.okCancelCustomDialog(getActivity(),
|
|
|
|
DialogUtilities.okCancelCustomDialog(getActivity(),
|
|
|
|
getString(R.string.actfm_view_task_title), getString(R.string.actfm_view_task_text, assignedEmail),
|
|
|
|
getString(R.string.actfm_view_task_title),
|
|
|
|
R.string.actfm_view_task_ok, R.string.actfm_view_task_cancel, 0,
|
|
|
|
getString(R.string.actfm_view_task_text, assignedEmail),
|
|
|
|
okListener, null);
|
|
|
|
R.string.actfm_view_task_ok, R.string.actfm_view_task_cancel,
|
|
|
|
|
|
|
|
0, okListener, null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount,
|
|
|
|
public void onScroll(AbsListView view, int firstVisibleItem,
|
|
|
|
int totalItemCount) {
|
|
|
|
int visibleItemCount, int totalItemCount) {
|
|
|
|
// do nothing
|
|
|
|
// do nothing
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Detect when user is flinging the task, disable task adapter loading
|
|
|
|
* Detect when user is flinging the task, disable task adapter loading when
|
|
|
|
* when this occurs to save resources and time.
|
|
|
|
* this occurs to save resources and time.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void onScrollStateChanged(AbsListView view, int scrollState) {
|
|
|
|
public void onScrollStateChanged(AbsListView view, int scrollState) {
|
|
|
|
switch (scrollState) {
|
|
|
|
switch (scrollState) {
|
|
|
@ -846,12 +910,15 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* ======================================================================
|
|
|
|
/*
|
|
|
|
|
|
|
|
* ======================================================================
|
|
|
|
* =================================================== managing list view
|
|
|
|
* =================================================== managing list view
|
|
|
|
* ====================================================================== */
|
|
|
|
* ======================================================================
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Load or re-load action items and update views
|
|
|
|
* Load or re-load action items and update views
|
|
|
|
|
|
|
|
*
|
|
|
|
* @param requery
|
|
|
|
* @param requery
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void loadTaskListContent(boolean requery) {
|
|
|
|
public void loadTaskListContent(boolean requery) {
|
|
|
@ -870,26 +937,30 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
getActivity().startManagingCursor(taskCursor);
|
|
|
|
getActivity().startManagingCursor(taskCursor);
|
|
|
|
|
|
|
|
|
|
|
|
if(oldListItemSelected != ListView.INVALID_POSITION &&
|
|
|
|
if (oldListItemSelected != ListView.INVALID_POSITION
|
|
|
|
oldListItemSelected < taskCursor.getCount())
|
|
|
|
&& oldListItemSelected < taskCursor.getCount())
|
|
|
|
getListView().setSelection(oldListItemSelected);
|
|
|
|
getListView().setSelection(oldListItemSelected);
|
|
|
|
|
|
|
|
|
|
|
|
// also load sync actions
|
|
|
|
// also load sync actions
|
|
|
|
syncActions.clear();
|
|
|
|
syncActions.clear();
|
|
|
|
Intent broadcastIntent = new Intent(AstridApiConstants.BROADCAST_REQUEST_SYNC_ACTIONS);
|
|
|
|
Intent broadcastIntent = new Intent(
|
|
|
|
getActivity().sendOrderedBroadcast(broadcastIntent, AstridApiConstants.PERMISSION_READ);
|
|
|
|
AstridApiConstants.BROADCAST_REQUEST_SYNC_ACTIONS);
|
|
|
|
|
|
|
|
getActivity().sendOrderedBroadcast(broadcastIntent,
|
|
|
|
|
|
|
|
AstridApiConstants.PERMISSION_READ);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Fill in the Task List with current items
|
|
|
|
* Fill in the Task List with current items
|
|
|
|
* @param withCustomId force task with given custom id to be part of list
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param withCustomId
|
|
|
|
|
|
|
|
* force task with given custom id to be part of list
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
protected void setUpTaskList() {
|
|
|
|
protected void setUpTaskList() {
|
|
|
|
if (filter == null)
|
|
|
|
if (filter == null)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
sqlQueryTemplate.set(SortHelper.adjustQueryForFlagsAndSort(filter.sqlQuery,
|
|
|
|
sqlQueryTemplate.set(SortHelper.adjustQueryForFlagsAndSort(
|
|
|
|
sortFlags, sortSort));
|
|
|
|
filter.sqlQuery, sortFlags, sortSort));
|
|
|
|
|
|
|
|
|
|
|
|
// perform query
|
|
|
|
// perform query
|
|
|
|
TodorooCursor<Task> currentCursor = taskService.fetchFiltered(
|
|
|
|
TodorooCursor<Task> currentCursor = taskService.fetchFiltered(
|
|
|
@ -898,7 +969,8 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
|
|
|
|
|
|
|
|
// set up list adapters
|
|
|
|
// set up list adapters
|
|
|
|
taskAdapter = new TaskAdapter(this, R.layout.task_adapter_row,
|
|
|
|
taskAdapter = new TaskAdapter(this, R.layout.task_adapter_row,
|
|
|
|
currentCursor, sqlQueryTemplate, false, new OnCompletedTaskListener() {
|
|
|
|
currentCursor, sqlQueryTemplate, false,
|
|
|
|
|
|
|
|
new OnCompletedTaskListener() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onCompletedTask(Task item, boolean newState) {
|
|
|
|
public void onCompletedTask(Task item, boolean newState) {
|
|
|
|
if (newState == true)
|
|
|
|
if (newState == true)
|
|
|
@ -913,8 +985,9 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Select a custom task id in the list. If it doesn't exist, create
|
|
|
|
* Select a custom task id in the list. If it doesn't exist, create a new
|
|
|
|
* a new custom filter
|
|
|
|
* custom filter
|
|
|
|
|
|
|
|
*
|
|
|
|
* @param withCustomId
|
|
|
|
* @param withCustomId
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@SuppressWarnings("nls")
|
|
|
|
@SuppressWarnings("nls")
|
|
|
@ -932,12 +1005,14 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
|
|
|
|
|
|
|
|
// create a custom cursor
|
|
|
|
// create a custom cursor
|
|
|
|
if (!sqlQueryTemplate.get().contains("WHERE"))
|
|
|
|
if (!sqlQueryTemplate.get().contains("WHERE"))
|
|
|
|
sqlQueryTemplate.set(sqlQueryTemplate.get() + " WHERE " + TaskCriteria.byId(withCustomId));
|
|
|
|
sqlQueryTemplate.set(sqlQueryTemplate.get() + " WHERE "
|
|
|
|
|
|
|
|
+ TaskCriteria.byId(withCustomId));
|
|
|
|
else
|
|
|
|
else
|
|
|
|
sqlQueryTemplate.set(sqlQueryTemplate.get().replace("WHERE ", "WHERE " +
|
|
|
|
sqlQueryTemplate.set(sqlQueryTemplate.get().replace("WHERE ",
|
|
|
|
TaskCriteria.byId(withCustomId) + " OR "));
|
|
|
|
"WHERE " + TaskCriteria.byId(withCustomId) + " OR "));
|
|
|
|
|
|
|
|
|
|
|
|
currentCursor = taskService.fetchFiltered(sqlQueryTemplate.get(), null, TaskAdapter.PROPERTIES);
|
|
|
|
currentCursor = taskService.fetchFiltered(sqlQueryTemplate.get(), null,
|
|
|
|
|
|
|
|
TaskAdapter.PROPERTIES);
|
|
|
|
getListView().setFilterText("");
|
|
|
|
getListView().setFilterText("");
|
|
|
|
getActivity().startManagingCursor(currentCursor);
|
|
|
|
getActivity().startManagingCursor(currentCursor);
|
|
|
|
|
|
|
|
|
|
|
@ -961,25 +1036,35 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
private void showTaskEditHelpPopover() {
|
|
|
|
private void showTaskEditHelpPopover() {
|
|
|
|
if (!Preferences.getBoolean(R.string.p_showed_tap_task_help, false)) {
|
|
|
|
if (!Preferences.getBoolean(R.string.p_showed_tap_task_help, false)) {
|
|
|
|
Preferences.setBoolean(R.string.p_showed_tap_task_help, true);
|
|
|
|
Preferences.setBoolean(R.string.p_showed_tap_task_help, true);
|
|
|
|
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
|
|
|
|
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(
|
|
|
|
|
|
|
|
Context.INPUT_METHOD_SERVICE);
|
|
|
|
imm.hideSoftInputFromWindow(quickAddBox.getWindowToken(), 0);
|
|
|
|
imm.hideSoftInputFromWindow(quickAddBox.getWindowToken(), 0);
|
|
|
|
getListView().postDelayed(new Runnable() {
|
|
|
|
getListView().postDelayed(new Runnable() {
|
|
|
|
public void run() {
|
|
|
|
public void run() {
|
|
|
|
if (taskAdapter.getCount() > 0) {
|
|
|
|
if (taskAdapter.getCount() > 0) {
|
|
|
|
final View view = getListView().getChildAt(getListView().getChildCount() - 1);
|
|
|
|
final View view = getListView().getChildAt(
|
|
|
|
|
|
|
|
getListView().getChildCount() - 1);
|
|
|
|
if (view != null) {
|
|
|
|
if (view != null) {
|
|
|
|
OnDismissListener onDismiss = new OnDismissListener() {
|
|
|
|
OnDismissListener onDismiss = new OnDismissListener() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onDismiss() {
|
|
|
|
public void onDismiss() {
|
|
|
|
if (!Preferences.isSet(getString(R.string.p_showed_lists_help))) {
|
|
|
|
if (!Preferences.isSet(getString(R.string.p_showed_lists_help))) {
|
|
|
|
Preferences.setBoolean(R.string.p_showed_lists_help, false);
|
|
|
|
Preferences.setBoolean(
|
|
|
|
} else if (!Preferences.getBoolean(R.string.p_showed_lists_help, false)) {
|
|
|
|
R.string.p_showed_lists_help,
|
|
|
|
Preferences.setBoolean(R.string.p_showed_lists_help, true);
|
|
|
|
false);
|
|
|
|
//HelpInfoPopover.showPopover(getActivity(), getView().findViewById(R.id.back), R.string.help_popover_lists, null);
|
|
|
|
} else if (!Preferences.getBoolean(
|
|
|
|
|
|
|
|
R.string.p_showed_lists_help, false)) {
|
|
|
|
|
|
|
|
Preferences.setBoolean(
|
|
|
|
|
|
|
|
R.string.p_showed_lists_help,
|
|
|
|
|
|
|
|
true);
|
|
|
|
|
|
|
|
// HelpInfoPopover.showPopover(getActivity(),
|
|
|
|
|
|
|
|
// getView().findViewById(R.id.back),
|
|
|
|
|
|
|
|
// R.string.help_popover_lists, null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
HelpInfoPopover.showPopover(getActivity(), view, R.string.help_popover_tap_task, onDismiss);
|
|
|
|
HelpInfoPopover.showPopover(getActivity(), view,
|
|
|
|
|
|
|
|
R.string.help_popover_tap_task, onDismiss);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -988,13 +1073,17 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* ======================================================================
|
|
|
|
/*
|
|
|
|
|
|
|
|
* ======================================================================
|
|
|
|
* ============================================================== actions
|
|
|
|
* ============================================================== actions
|
|
|
|
* ====================================================================== */
|
|
|
|
* ======================================================================
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* A task was completed from the task adapter
|
|
|
|
* A task was completed from the task adapter
|
|
|
|
* @param item task that was completed
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param item
|
|
|
|
|
|
|
|
* task that was completed
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
protected void onTaskCompleted(Task item) {
|
|
|
|
protected void onTaskCompleted(Task item) {
|
|
|
|
if (isFilter)
|
|
|
|
if (isFilter)
|
|
|
@ -1005,6 +1094,7 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Quick-add a new task
|
|
|
|
* Quick-add a new task
|
|
|
|
|
|
|
|
*
|
|
|
|
* @param title
|
|
|
|
* @param title
|
|
|
|
* @return
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -1013,18 +1103,21 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
if (title != null)
|
|
|
|
if (title != null)
|
|
|
|
title = title.trim();
|
|
|
|
title = title.trim();
|
|
|
|
Task task = createWithValues(filter.valuesForNewTasks,
|
|
|
|
Task task = createWithValues(filter.valuesForNewTasks, title,
|
|
|
|
title, taskService, metadataService);
|
|
|
|
taskService, metadataService);
|
|
|
|
|
|
|
|
|
|
|
|
boolean gcalCreateEventEnabled = Preferences.getStringValue(R.string.gcal_p_default) != null &&
|
|
|
|
boolean gcalCreateEventEnabled = Preferences.getStringValue(R.string.gcal_p_default) != null
|
|
|
|
!Preferences.getStringValue(R.string.gcal_p_default).equals("-1");
|
|
|
|
&& !Preferences.getStringValue(R.string.gcal_p_default).equals(
|
|
|
|
|
|
|
|
"-1");
|
|
|
|
if (title.length() > 0 && gcalCreateEventEnabled) {
|
|
|
|
if (title.length() > 0 && gcalCreateEventEnabled) {
|
|
|
|
Uri calendarUri = GCalHelper.createTaskEvent(task, getActivity().getContentResolver(), new ContentValues());
|
|
|
|
Uri calendarUri = GCalHelper.createTaskEvent(task,
|
|
|
|
|
|
|
|
getActivity().getContentResolver(), new ContentValues());
|
|
|
|
task.setValue(Task.CALENDAR_URI, calendarUri.toString());
|
|
|
|
task.setValue(Task.CALENDAR_URI, calendarUri.toString());
|
|
|
|
taskService.save(task);
|
|
|
|
taskService.save(task);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TextView quickAdd = (TextView)getView().findViewById(R.id.quickAddText);
|
|
|
|
TextView quickAdd = (TextView) getView().findViewById(
|
|
|
|
|
|
|
|
R.id.quickAddText);
|
|
|
|
quickAdd.setText(""); //$NON-NLS-1$
|
|
|
|
quickAdd.setText(""); //$NON-NLS-1$
|
|
|
|
|
|
|
|
|
|
|
|
if (selectNewTask) {
|
|
|
|
if (selectNewTask) {
|
|
|
@ -1035,21 +1128,23 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
StatisticsService.reportEvent(StatisticsConstants.TASK_CREATED_TASKLIST);
|
|
|
|
StatisticsService.reportEvent(StatisticsConstants.TASK_CREATED_TASKLIST);
|
|
|
|
return task;
|
|
|
|
return task;
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
exceptionService.displayAndReportError(getActivity(), "quick-add-task", e);
|
|
|
|
exceptionService.displayAndReportError(getActivity(),
|
|
|
|
|
|
|
|
"quick-add-task", e);
|
|
|
|
return new Task();
|
|
|
|
return new Task();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Create task from the given content values, saving it.
|
|
|
|
* Create task from the given content values, saving it.
|
|
|
|
|
|
|
|
*
|
|
|
|
* @param values
|
|
|
|
* @param values
|
|
|
|
* @param title
|
|
|
|
* @param title
|
|
|
|
* @param taskService
|
|
|
|
* @param taskService
|
|
|
|
* @param metadataService
|
|
|
|
* @param metadataService
|
|
|
|
* @return
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public static Task createWithValues(ContentValues values, String title, TaskService taskService,
|
|
|
|
public static Task createWithValues(ContentValues values, String title,
|
|
|
|
MetadataService metadataService) {
|
|
|
|
TaskService taskService, MetadataService metadataService) {
|
|
|
|
Task task = new Task();
|
|
|
|
Task task = new Task();
|
|
|
|
if (title != null)
|
|
|
|
if (title != null)
|
|
|
|
task.setValue(Task.TITLE, title);
|
|
|
|
task.setValue(Task.TITLE, title);
|
|
|
@ -1111,16 +1206,18 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
Object label = contextItemExposers[i].getLabel(task);
|
|
|
|
Object label = contextItemExposers[i].getLabel(task);
|
|
|
|
if (label != null) {
|
|
|
|
if (label != null) {
|
|
|
|
if (label instanceof Integer)
|
|
|
|
if (label instanceof Integer)
|
|
|
|
menu.add(id, CONTEXT_MENU_PLUGIN_ID_FIRST + i, Menu.NONE, (Integer)label);
|
|
|
|
menu.add(id, CONTEXT_MENU_PLUGIN_ID_FIRST + i,
|
|
|
|
|
|
|
|
Menu.NONE, (Integer) label);
|
|
|
|
else
|
|
|
|
else
|
|
|
|
menu.add(id, CONTEXT_MENU_PLUGIN_ID_FIRST + i, Menu.NONE, (String)label);
|
|
|
|
menu.add(id, CONTEXT_MENU_PLUGIN_ID_FIRST + i,
|
|
|
|
|
|
|
|
Menu.NONE, (String) label);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
long taskId = task.getId();
|
|
|
|
long taskId = task.getId();
|
|
|
|
for (ContextMenuItem item : contextMenuExtensionLoader.getList()) {
|
|
|
|
for (ContextMenuItem item : contextMenuExtensionLoader.getList()) {
|
|
|
|
android.view.MenuItem menuItem = menu.add(id, CONTEXT_MENU_BROADCAST_INTENT_ID, Menu.NONE,
|
|
|
|
android.view.MenuItem menuItem = menu.add(id,
|
|
|
|
item.title);
|
|
|
|
CONTEXT_MENU_BROADCAST_INTENT_ID, Menu.NONE, item.title);
|
|
|
|
item.intent.putExtra(AstridApiConstants.EXTRAS_TASK_ID, taskId);
|
|
|
|
item.intent.putExtra(AstridApiConstants.EXTRAS_TASK_ID, taskId);
|
|
|
|
menuItem.setIntent(item.intent);
|
|
|
|
menuItem.setIntent(item.intent);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1133,30 +1230,31 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
|
|
|
|
|
|
|
|
/** Show a dialog box and delete the task specified */
|
|
|
|
/** Show a dialog box and delete the task specified */
|
|
|
|
private void deleteTask(final Task task) {
|
|
|
|
private void deleteTask(final Task task) {
|
|
|
|
new AlertDialog.Builder(getActivity()).setTitle(R.string.DLG_confirm_title)
|
|
|
|
new AlertDialog.Builder(getActivity()).setTitle(
|
|
|
|
.setMessage(R.string.DLG_delete_this_task_question).setIcon(
|
|
|
|
R.string.DLG_confirm_title).setMessage(
|
|
|
|
|
|
|
|
R.string.DLG_delete_this_task_question).setIcon(
|
|
|
|
android.R.drawable.ic_dialog_alert).setPositiveButton(
|
|
|
|
android.R.drawable.ic_dialog_alert).setPositiveButton(
|
|
|
|
android.R.string.ok,
|
|
|
|
android.R.string.ok, new DialogInterface.OnClickListener() {
|
|
|
|
new DialogInterface.OnClickListener() {
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
public void onClick(DialogInterface dialog,
|
|
|
|
|
|
|
|
int which) {
|
|
|
|
|
|
|
|
taskService.delete(task);
|
|
|
|
taskService.delete(task);
|
|
|
|
loadTaskListContent(true);
|
|
|
|
loadTaskListContent(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}).setNegativeButton(android.R.string.cancel, null)
|
|
|
|
}).setNegativeButton(android.R.string.cancel, null).show();
|
|
|
|
.show();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Intent object with custom label returned by toString.
|
|
|
|
* Intent object with custom label returned by toString.
|
|
|
|
|
|
|
|
*
|
|
|
|
* @author joshuagross <joshua.gross@gmail.com>
|
|
|
|
* @author joshuagross <joshua.gross@gmail.com>
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
protected static class IntentWithLabel extends Intent {
|
|
|
|
protected static class IntentWithLabel extends Intent {
|
|
|
|
private final String label;
|
|
|
|
private final String label;
|
|
|
|
|
|
|
|
|
|
|
|
public IntentWithLabel(Intent in, String labelIn) {
|
|
|
|
public IntentWithLabel(Intent in, String labelIn) {
|
|
|
|
super(in);
|
|
|
|
super(in);
|
|
|
|
label = labelIn;
|
|
|
|
label = labelIn;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public String toString() {
|
|
|
|
public String toString() {
|
|
|
|
return label;
|
|
|
|
return label;
|
|
|
@ -1166,7 +1264,8 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
private static final String PREF_LAST_AUTO_SYNC = "taskListLastAutoSync"; //$NON-NLS-1$
|
|
|
|
private static final String PREF_LAST_AUTO_SYNC = "taskListLastAutoSync"; //$NON-NLS-1$
|
|
|
|
|
|
|
|
|
|
|
|
protected void initiateAutomaticSync() {
|
|
|
|
protected void initiateAutomaticSync() {
|
|
|
|
if (filter == null || filter.title == null || !filter.title.equals(getString(R.string.BFE_Active)))
|
|
|
|
if (filter == null || filter.title == null
|
|
|
|
|
|
|
|
|| !filter.title.equals(getString(R.string.BFE_Active)))
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
long lastAutoSync = Preferences.getLong(PREF_LAST_AUTO_SYNC, 0);
|
|
|
|
long lastAutoSync = Preferences.getLong(PREF_LAST_AUTO_SYNC, 0);
|
|
|
@ -1204,9 +1303,11 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
intent.setClassName(resolveInfo.activityInfo.packageName,
|
|
|
|
intent.setClassName(resolveInfo.activityInfo.packageName,
|
|
|
|
resolveInfo.activityInfo.name);
|
|
|
|
resolveInfo.activityInfo.name);
|
|
|
|
|
|
|
|
|
|
|
|
String category = MetadataHelper.resolveActivityCategoryName(resolveInfo, pm);
|
|
|
|
String category = MetadataHelper.resolveActivityCategoryName(
|
|
|
|
if(MilkPreferences.class.getName().equals(resolveInfo.activityInfo.name) &&
|
|
|
|
resolveInfo, pm);
|
|
|
|
!MilkUtilities.INSTANCE.isLoggedIn())
|
|
|
|
if (MilkPreferences.class.getName().equals(
|
|
|
|
|
|
|
|
resolveInfo.activityInfo.name)
|
|
|
|
|
|
|
|
&& !MilkUtilities.INSTANCE.isLoggedIn())
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
if (category.equals(desiredCategory)) {
|
|
|
|
if (category.equals(desiredCategory)) {
|
|
|
@ -1242,13 +1343,15 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
if (actions[which] instanceof SyncAction) {
|
|
|
|
if (actions[which] instanceof SyncAction) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
((SyncAction) actions[which]).intent.send();
|
|
|
|
((SyncAction) actions[which]).intent.send();
|
|
|
|
Toast.makeText(getActivity(), R.string.SyP_progress_toast,
|
|
|
|
Toast.makeText(getActivity(),
|
|
|
|
|
|
|
|
R.string.SyP_progress_toast,
|
|
|
|
Toast.LENGTH_LONG).show();
|
|
|
|
Toast.LENGTH_LONG).show();
|
|
|
|
} catch (CanceledException e) {
|
|
|
|
} catch (CanceledException e) {
|
|
|
|
//
|
|
|
|
//
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
((SyncV2Provider)actions[which]).synchronizeActiveTasks(true, syncResultCallback);
|
|
|
|
((SyncV2Provider) actions[which]).synchronizeActiveTasks(
|
|
|
|
|
|
|
|
true, syncResultCallback);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -1257,13 +1360,15 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Show menu of sync options. This is shown when you're not logged into any services, or logged into
|
|
|
|
* Show menu of sync options. This is shown when you're not logged into any
|
|
|
|
* more than one.
|
|
|
|
* services, or logged into more than one.
|
|
|
|
|
|
|
|
*
|
|
|
|
* @param <TYPE>
|
|
|
|
* @param <TYPE>
|
|
|
|
* @param items
|
|
|
|
* @param items
|
|
|
|
* @param listener
|
|
|
|
* @param listener
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private <TYPE> void showSyncOptionMenu(TYPE[] items, DialogInterface.OnClickListener listener) {
|
|
|
|
private <TYPE> void showSyncOptionMenu(TYPE[] items,
|
|
|
|
|
|
|
|
DialogInterface.OnClickListener listener) {
|
|
|
|
if (items.length == 1) {
|
|
|
|
if (items.length == 1) {
|
|
|
|
listener.onClick(null, 0);
|
|
|
|
listener.onClick(null, 0);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
@ -1273,14 +1378,16 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
android.R.layout.simple_spinner_dropdown_item, items);
|
|
|
|
android.R.layout.simple_spinner_dropdown_item, items);
|
|
|
|
|
|
|
|
|
|
|
|
// show a menu of available options
|
|
|
|
// show a menu of available options
|
|
|
|
new AlertDialog.Builder(getActivity())
|
|
|
|
new AlertDialog.Builder(getActivity()).setTitle(R.string.SyP_label).setAdapter(
|
|
|
|
.setTitle(R.string.SyP_label)
|
|
|
|
adapter, listener).show().setOwnerActivity(getActivity());
|
|
|
|
.setAdapter(adapter, listener)
|
|
|
|
|
|
|
|
.show().setOwnerActivity(getActivity());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* (non-Javadoc)
|
|
|
|
/*
|
|
|
|
* @see android.support.v4.app.ListFragment#onListItemClick(android.widget.ListView, android.view.View, int, long)
|
|
|
|
* (non-Javadoc)
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @see
|
|
|
|
|
|
|
|
* android.support.v4.app.ListFragment#onListItemClick(android.widget.ListView
|
|
|
|
|
|
|
|
* , android.view.View, int, long)
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onListItemClick(ListView l, View v, int position, long id) {
|
|
|
|
public void onListItemClick(ListView l, View v, int position, long id) {
|
|
|
@ -1314,8 +1421,8 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
case MENU_SORT_ID:
|
|
|
|
case MENU_SORT_ID:
|
|
|
|
StatisticsService.reportEvent(StatisticsConstants.TLA_MENU_SORT);
|
|
|
|
StatisticsService.reportEvent(StatisticsConstants.TLA_MENU_SORT);
|
|
|
|
AlertDialog dialog = SortSelectionActivity.createDialog(getActivity(),
|
|
|
|
AlertDialog dialog = SortSelectionActivity.createDialog(
|
|
|
|
this, sortFlags, sortSort);
|
|
|
|
getActivity(), this, sortFlags, sortSort);
|
|
|
|
dialog.show();
|
|
|
|
dialog.show();
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
case MENU_SYNC_ID:
|
|
|
|
case MENU_SYNC_ID:
|
|
|
@ -1329,7 +1436,8 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
case MENU_ADDON_INTENT_ID:
|
|
|
|
case MENU_ADDON_INTENT_ID:
|
|
|
|
intent = item.getIntent();
|
|
|
|
intent = item.getIntent();
|
|
|
|
AndroidUtilities.startExternalIntent(getActivity(), intent, ACTIVITY_MENU_EXTERNAL);
|
|
|
|
AndroidUtilities.startExternalIntent(getActivity(), intent,
|
|
|
|
|
|
|
|
ACTIVITY_MENU_EXTERNAL);
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
|
|
// --- context menu items
|
|
|
|
// --- context menu items
|
|
|
@ -1435,7 +1543,8 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
|
|
|
|
editor.putInt(SortHelper.PREF_SORT_FLAGS, flags);
|
|
|
|
editor.putInt(SortHelper.PREF_SORT_FLAGS, flags);
|
|
|
|
editor.putInt(SortHelper.PREF_SORT_SORT, sort);
|
|
|
|
editor.putInt(SortHelper.PREF_SORT_SORT, sort);
|
|
|
|
editor.commit();
|
|
|
|
editor.commit();
|
|
|
|
ContextManager.getContext().startService(new Intent(ContextManager.getContext(),
|
|
|
|
ContextManager.getContext().startService(
|
|
|
|
|
|
|
|
new Intent(ContextManager.getContext(),
|
|
|
|
TasksWidget.WidgetUpdateService.class));
|
|
|
|
TasksWidget.WidgetUpdateService.class));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|