|
|
|
@ -51,6 +51,7 @@ import butterknife.BindView;
|
|
|
|
import butterknife.ButterKnife;
|
|
|
|
import butterknife.ButterKnife;
|
|
|
|
import butterknife.OnClick;
|
|
|
|
import butterknife.OnClick;
|
|
|
|
import com.google.android.material.snackbar.Snackbar;
|
|
|
|
import com.google.android.material.snackbar.Snackbar;
|
|
|
|
|
|
|
|
import com.google.common.base.Joiner;
|
|
|
|
import com.google.common.primitives.Longs;
|
|
|
|
import com.google.common.primitives.Longs;
|
|
|
|
import com.todoroo.astrid.adapter.TaskAdapter;
|
|
|
|
import com.todoroo.astrid.adapter.TaskAdapter;
|
|
|
|
import com.todoroo.astrid.adapter.TaskAdapterProvider;
|
|
|
|
import com.todoroo.astrid.adapter.TaskAdapterProvider;
|
|
|
|
@ -484,6 +485,9 @@ public final class TaskListFragment extends InjectingFragment
|
|
|
|
case R.id.menu_open_map:
|
|
|
|
case R.id.menu_open_map:
|
|
|
|
((PlaceFilter) filter).openMap(context);
|
|
|
|
((PlaceFilter) filter).openMap(context);
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
|
|
|
|
case R.id.menu_share:
|
|
|
|
|
|
|
|
send(transform(taskDao.fetchTasks(preferences, filter), TaskContainer::getTask));
|
|
|
|
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
return onOptionsItemSelected(item);
|
|
|
|
return onOptionsItemSelected(item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -757,6 +761,9 @@ public final class TaskListFragment extends InjectingFragment
|
|
|
|
updateModeTitle();
|
|
|
|
updateModeTitle();
|
|
|
|
recyclerAdapter.notifyDataSetChanged();
|
|
|
|
recyclerAdapter.notifyDataSetChanged();
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
|
|
|
|
case R.id.menu_share:
|
|
|
|
|
|
|
|
send(taskDao.fetch(taskAdapter.getSelected()));
|
|
|
|
|
|
|
|
return true;
|
|
|
|
case R.id.delete:
|
|
|
|
case R.id.delete:
|
|
|
|
dialogBuilder
|
|
|
|
dialogBuilder
|
|
|
|
.newDialog(R.string.delete_selected_tasks)
|
|
|
|
.newDialog(R.string.delete_selected_tasks)
|
|
|
|
@ -778,6 +785,21 @@ public final class TaskListFragment extends InjectingFragment
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void send(List<Task> tasks) {
|
|
|
|
|
|
|
|
Intent intent = new Intent(Intent.ACTION_SEND);
|
|
|
|
|
|
|
|
String output =
|
|
|
|
|
|
|
|
Joiner.on("\n")
|
|
|
|
|
|
|
|
.join(
|
|
|
|
|
|
|
|
transform(
|
|
|
|
|
|
|
|
tasks, t -> String.format("%s %s", t.isCompleted() ? "☑" : "☐", t.getTitle())));
|
|
|
|
|
|
|
|
intent.putExtra(Intent.EXTRA_TEXT, output);
|
|
|
|
|
|
|
|
intent.setType("text/plain");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
startActivity(Intent.createChooser(intent, null));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
taskAdapter.clearSelections();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onDestroyActionMode(ActionMode mode) {
|
|
|
|
public void onDestroyActionMode(ActionMode mode) {
|
|
|
|
this.mode = null;
|
|
|
|
this.mode = null;
|
|
|
|
|