Remove QuickAddBar

pull/384/head
Alex Baker 9 years ago
parent 0696e630f6
commit a229cf631d

@ -434,7 +434,7 @@ public class TaskListActivity extends InjectingAppCompatActivity implements
} else {
TaskListFragment tlf = getTaskListFragment();
if (tlf != null) {
Task task = tlf.quickAddBar.quickAddTask("");//$NON-NLS-1$
Task task = tlf.addTask("");//$NON-NLS-1$
onTaskListItemClicked(task.getId());
}
}
@ -553,7 +553,7 @@ public class TaskListActivity extends InjectingAppCompatActivity implements
@Override
public void apply(String title) {
TaskListFragment taskListFragment = getTaskListFragment();
Task task = taskListFragment.quickAddBar.quickAddTask(title);
Task task = taskListFragment.addTask(title);
taskCreator.addToCalendar(task);
onTaskListItemClicked(task.getId());
taskListFragment.loadTaskListContent();

@ -65,13 +65,11 @@ import com.todoroo.astrid.subtasks.SubtasksTagListFragment;
import com.todoroo.astrid.subtasks.SubtasksUpdater;
import com.todoroo.astrid.tags.TaskToTagMetadata;
import com.todoroo.astrid.timers.TimerPlugin;
import com.todoroo.astrid.ui.QuickAddBar;
import org.tasks.R;
import org.tasks.dialogs.DialogBuilder;
import org.tasks.injection.ForActivity;
import org.tasks.injection.InjectingListFragment;
import org.tasks.injection.Injector;
import org.tasks.notifications.NotificationManager;
import org.tasks.preferences.ActivityPreferences;
@ -123,7 +121,6 @@ public class TaskListFragment extends InjectingListFragment implements SwipeRefr
@Inject ActivityPreferences preferences;
@Inject NotificationManager notificationManager;
@Inject TaskAttachmentDao taskAttachmentDao;
@Inject Injector injector;
@Inject GtasksPreferenceService gtasksPreferenceService;
@Inject DialogBuilder dialogBuilder;
@ -132,7 +129,6 @@ public class TaskListFragment extends InjectingListFragment implements SwipeRefr
protected final AtomicReference<String> sqlQueryTemplate = new AtomicReference<>();
protected SyncActionHelper syncActionHelper;
protected Filter filter;
protected QuickAddBar quickAddBar = new QuickAddBar();
protected Bundle extras;
protected boolean isInbox;
@ -206,7 +202,7 @@ public class TaskListFragment extends InjectingListFragment implements SwipeRefr
parent.findViewById(R.id.fab).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Task task = quickAddBar.quickAddTask("");
Task task = addTask("");
onTaskListItemClicked(task.getId());
}
});
@ -220,6 +216,10 @@ public class TaskListFragment extends InjectingListFragment implements SwipeRefr
return parent;
}
public Task addTask(String title) {
return taskService.createWithValues(filter.valuesForNewTasks, title);
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
@ -247,7 +247,6 @@ public class TaskListFragment extends InjectingListFragment implements SwipeRefr
syncActionHelper = new SyncActionHelper(gtasksPreferenceService, syncService, getActivity(), preferences);
setUpUiComponents();
initializeData();
quickAddBar.initialize(injector, this);
if (getResources().getBoolean(R.bool.two_pane_layout)) {
// In dual-pane mode, the list view highlights the selected item.

@ -1,59 +0,0 @@
/**
* Copyright (c) 2012 Todoroo Inc
*
* See the file "LICENSE" for the full license governing this code.
*/
package com.todoroo.astrid.ui;
import com.todoroo.astrid.activity.TaskListFragment;
import com.todoroo.astrid.data.TagData;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.service.TaskCreator;
import com.todoroo.astrid.service.TaskService;
import org.tasks.R;
import org.tasks.dialogs.DialogBuilder;
import org.tasks.injection.Injector;
import javax.inject.Inject;
import timber.log.Timber;
/**
* Quick Add Bar lets you add tasks.
*
* @author Tim Su <tim@astrid.com>
*
*/
public class QuickAddBar {
@Inject TaskService taskService;
@Inject DialogBuilder dialogBuilder;
private TaskListFragment fragment;
public void initialize(Injector injector, TaskListFragment myFragment) {
injector.inject(this); // TODO: get rid of this
fragment = myFragment;
}
/**
* Quick-add a new task
*/
public Task quickAddTask(String title) {
TagData tagData = fragment.getActiveTagData();
if(tagData != null && (!tagData.containsNonNullValue(TagData.NAME) || tagData.getName().length() == 0)) {
dialogBuilder.newMessageDialog(R.string.tag_no_title_error)
.setPositiveButton(android.R.string.ok, null)
.show();
return null;
}
try {
return taskService.createWithValues(fragment.getFilter().valuesForNewTasks, title);
} catch (Exception e) {
Timber.e(e, e.getMessage());
}
return null;
}
}

@ -16,7 +16,6 @@ import com.todoroo.astrid.tags.TagsControlSet;
import com.todoroo.astrid.timers.TimerControlSet;
import com.todoroo.astrid.ui.EditTitleControlSet;
import com.todoroo.astrid.ui.HideUntilControlSet;
import com.todoroo.astrid.ui.QuickAddBar;
import com.todoroo.astrid.ui.ReminderControlSet;
import org.tasks.ui.CalendarControlSet;
@ -39,7 +38,6 @@ import dagger.Provides;
TagViewFragment.class,
TaskEditFragment.class,
NavigationDrawerFragment.class,
QuickAddBar.class,
CalendarControlSet.class,
DeadlineControlSet.class,
PriorityControlSet.class,
@ -55,17 +53,9 @@ import dagger.Provides;
public class FragmentModule {
private final Fragment fragment;
private final Injector injector;
public FragmentModule(Fragment fragment, Injector injector) {
public FragmentModule(Fragment fragment) {
this.fragment = fragment;
this.injector = injector;
}
@Singleton
@Provides
public Injector getInjector() {
return injector;
}
@Provides

@ -15,7 +15,7 @@ public class InjectingFragment extends Fragment implements Injector {
super.onAttach(activity);
if (!injected) {
objectGraph = ((Injector) activity).getObjectGraph().plus(new FragmentModule(this, this));
objectGraph = ((Injector) activity).getObjectGraph().plus(new FragmentModule(this));
inject(this);
injected = true;
}

@ -15,7 +15,7 @@ public class InjectingListFragment extends ListFragment implements Injector {
super.onAttach(activity);
if (!injected) {
objectGraph = ((Injector) activity).getObjectGraph().plus(new FragmentModule(this, this));
objectGraph = ((Injector) activity).getObjectGraph().plus(new FragmentModule(this));
inject(this);
injected = true;
}

@ -158,7 +158,6 @@
<item>من تاريخ الموعد</item>
<item>من تاريخ الاتمام</item>
</string-array>
<string name="tag_no_title_error">أدخل اسم للقائمة أولاً</string>
<string name="tag_FEx_untagged">غير مصنف</string>
<string name="TEA_timer_controls">مؤقت</string>
<string name="TEA_timer_comment_started">بدء هذه المهمة:</string>

@ -275,7 +275,6 @@
<string name="repeat_until">Повтаряй до %s</string>
<string name="repeat_snackbar">%1$s е насрочено за %2$s</string>
<string name="new_tag">Нов таг</string>
<string name="tag_no_title_error">Моля, първо въведете име за този списък!</string>
<string name="tag_FEx_untagged">Без категория</string>
<string name="delete_tag_confirmation">Изтрий %s?</string>
<string name="TPl_notification">Таймерите са Активни за %s!</string>

@ -239,7 +239,6 @@
<string name="repeat_detail_duedate_until">Každý %1$s\n až do %2$s</string>
<string name="repeat_forever">Opakovat stále</string>
<string name="repeat_until">Opakovat až do %s</string>
<string name="tag_no_title_error">Prosím zadejte jméno pro první seznam</string>
<string name="tag_FEx_untagged">Nezařazené</string>
<string name="TPl_notification">Aktivní časovače pro %s!</string>
<string name="TFE_workingOn">Termínované úkoly</string>

@ -127,7 +127,6 @@
<string name="repeat_detail_duedate_until">Hver %1$s\nindtil %2$s</string>
<string name="repeat_forever">Gentag uendeligt</string>
<string name="repeat_until">Gentag indtil %s</string>
<string name="tag_no_title_error">Start venligst med at give denne liste et navn!</string>
<string name="delete_task">Slet opgave</string>
<plurals name="Ntasks">
<item quantity="one">1 opgave</item>

@ -255,7 +255,6 @@
<string name="repeat_until">Wiederhole bis %s</string>
<string name="repeat_snackbar">%1$s verschoben um %2$s</string>
<string name="new_tag">Neues Schlagwort</string>
<string name="tag_no_title_error">Bitte gib zuerst einen Namen für die Liste ein!</string>
<string name="tag_FEx_untagged">Nicht kategorisiert</string>
<string name="delete_tag_confirmation">%s löschen?</string>
<string name="TPl_notification">Timer ist aktiv für %s!</string>

@ -241,7 +241,6 @@
<string name="repeat_detail_duedate_until">Κάθε %1$s\nμέχρι %2$s</string>
<string name="repeat_forever">Επανάληψη επ\'αορίστου</string>
<string name="repeat_until">Επανάληψη μέχρι %s</string>
<string name="tag_no_title_error">Παρακαλώ εισάγετε ενα όνομα για την λίστα πρώτα!</string>
<string name="tag_FEx_untagged">Μη κατηγοριοποιημένο</string>
<string name="TPl_notification">Χρονοδιακόπτες ενεργοί για %s!</string>
<string name="TFE_workingOn">Καθήκοντα με χρονικό όριο</string>

@ -265,7 +265,6 @@
<string name="repeat_until">Repetir hasta %s</string>
<string name="repeat_snackbar">%1$s He reprogramado esta tarea recurrente para %2$s</string>
<string name="new_tag">Nueva Etiqueta</string>
<string name="tag_no_title_error">Por favor, ¡introduce un nombre para la primera lista!</string>
<string name="tag_FEx_untagged">Sin Categoría</string>
<string name="delete_tag_confirmation">¿Eliminar %s?</string>
<string name="TPl_notification">Temporizadores activos para %s!</string>

@ -193,7 +193,6 @@
</string-array>
<string name="repeat_forever">تکرار بینهایت</string>
<string name="new_tag">تگ جدید</string>
<string name="tag_no_title_error">لطفا ابتدا یک نام برای لیست انتخاب نمایید</string>
<string name="tag_FEx_untagged">دسته بندی نشده</string>
<string name="TFE_workingOn">وظایف زمانبندی شده</string>
<string name="TEA_timer_controls">تایمر</string>

@ -61,7 +61,6 @@
<string name="repeat_detail_duedate_until">Joka %1$s\nkunnes %2$s</string>
<string name="repeat_forever">Toista loputtomiin</string>
<string name="repeat_until">Toista kunnes %s</string>
<string name="tag_no_title_error">Ole hyvä syötä ensin nimi tälle listalle!</string>
<string name="delete_task">Poista tehtävä</string>
<string name="source_code">Lähdekoodi</string>
<string name="show_hidden">Näytä piilotetut</string>

@ -267,7 +267,6 @@
<string name="repeat_until">Répéter jusqu\'à %s</string>
<string name="repeat_snackbar">%1$s replanifiée à %2$s</string>
<string name="new_tag">Nouveau tag</string>
<string name="tag_no_title_error">Veuillez d\'abord entrer un nom pour cette liste.</string>
<string name="tag_FEx_untagged">Non classé</string>
<string name="delete_tag_confirmation">Effacer %s ?</string>
<string name="TPl_notification">Chronomètre actif pour %s !</string>

@ -107,7 +107,6 @@
<string name="repeat_detail_duedate_until">Minden %1$s\neddig: %2$s</string>
<string name="repeat_forever">Ismétlés örökké</string>
<string name="repeat_until">Ismétlés eddig: %s</string>
<string name="tag_no_title_error">Kérlek, először add meg a lista nevét!</string>
<string name="delete_task">Feladat törlése</string>
<plurals name="Ntasks">
<item quantity="one">1 feladat</item>

@ -268,7 +268,6 @@ Se visualizzi questo errore più volte, ti consigliamo di cancellare tutti i dat
<string name="repeat_until">Ripeti fino %s</string>
<string name="repeat_snackbar">%1$s ripianificata per %2$s</string>
<string name="new_tag">Nuova etichetta</string>
<string name="tag_no_title_error">Per cortesia, prima inserisci un nome per questa lista</string>
<string name="tag_FEx_untagged">Non classificato</string>
<string name="delete_tag_confirmation">Elimino %s?</string>
<string name="TPl_notification">Timer attivi per %s!</string>

@ -241,7 +241,6 @@
<string name="repeat_detail_duedate_until">כל %1$s\nעד %2$s</string>
<string name="repeat_forever">חזור לנצח</string>
<string name="repeat_until">חזרה עד %s</string>
<string name="tag_no_title_error">אנא הכנס שם לרשימה זו</string>
<string name="TPl_notification">קוצב זמן הופעל עבור %s משימות</string>
<string name="TFE_workingOn">משימות עם הערכת זמן</string>
<string name="TEA_timer_controls">טיימר</string>

@ -274,7 +274,6 @@
<string name="repeat_until">%s まで繰り返す</string>
<string name="repeat_snackbar">%1$s を %2$s にスケジュール変更しました</string>
<string name="new_tag">新しいタグ</string>
<string name="tag_no_title_error">まずリスト名を記入してください!</string>
<string name="tag_FEx_untagged">未分類</string>
<string name="delete_tag_confirmation">%s を削除しますか?</string>
<string name="TPl_notification">%s のタイマーがアクティブです</string>

@ -275,7 +275,6 @@ Tasks의 백업에서 당신의 일정을 복구하시기 바랍니다.
<string name="repeat_until">%s 까지 반복</string>
<string name="repeat_snackbar">%1$s 이 %2$s 로 변경되었습니다</string>
<string name="new_tag">새 태그</string>
<string name="tag_no_title_error">이 목록의 이름을 먼저 입력하세요!</string>
<string name="tag_FEx_untagged">미분류 일정</string>
<string name="delete_tag_confirmation">%s 삭제할까요?</string>
<string name="TPl_notification">%s 동안 타이머 작동함!</string>

@ -271,7 +271,6 @@
<string name="repeat_until">Herhalen tot %s</string>
<string name="repeat_snackbar">%1$s opnieuw ingepland op %2$s</string>
<string name="new_tag">Nieuwe Label</string>
<string name="tag_no_title_error">Voer a.u.b. eerst een naam in voor deze lijst!</string>
<string name="tag_FEx_untagged">Niet gecategoriseerd</string>
<string name="delete_tag_confirmation">Verwijder %s?</string>
<string name="TPl_notification">Timers ingeschakeld voor %s!</string>

@ -244,7 +244,6 @@ i odzyskanie zadań z kopi zapasowej (Settings-&gt;Sync and backup-&gt;Backup-&g
<string name="repeat_detail_duedate_until">Co %1$s\ndo %2$s</string>
<string name="repeat_forever">Powtarzaj bez końca</string>
<string name="repeat_until">Powtarzaj do %s</string>
<string name="tag_no_title_error">Wpisz nazwę dla tej listy najpierw!</string>
<string name="tag_FEx_untagged">Na żadnej liście</string>
<string name="TPl_notification">Minutnkiki aktywne przez %s!</string>
<string name="TFE_workingOn">Zadania zostały spracyzowane czasowo</string>

@ -241,7 +241,6 @@
<string name="repeat_detail_duedate_until">Todo %1$s\naté %2$s</string>
<string name="repeat_forever">Repetir para sempre</string>
<string name="repeat_until">Repetir até %s</string>
<string name="tag_no_title_error">Entre com o nome da lista primeiro!</string>
<string name="tag_FEx_untagged">Sem categoria</string>
<string name="TPl_notification">Temporizador ativado para %s!</string>
<string name="TFE_workingOn">Tarefas com contagem de tempo</string>

@ -266,7 +266,6 @@ das tarefas através de um backup em Definições-&gt;Sincronização e backup-&
<string name="repeat_until">Repetir até %s</string>
<string name="repeat_snackbar">%1$s agendada para %2$s</string>
<string name="new_tag">Nova etiqueta</string>
<string name="tag_no_title_error">Introduza o nome para esta lista!</string>
<string name="tag_FEx_untagged">Sem categoria</string>
<string name="delete_tag_confirmation">Apagar %s?</string>
<string name="TPl_notification">Temporizador ativo para %s!</string>

@ -273,7 +273,6 @@
<string name="repeat_until">Повторять до %s</string>
<string name="repeat_snackbar">«%1$s» перенесено на %2$s</string>
<string name="new_tag">Новый тег</string>
<string name="tag_no_title_error">Пожалуйста, для начала введите название списка!</string>
<string name="tag_FEx_untagged">Без тега</string>
<string name="delete_tag_confirmation">Удалить %s?</string>
<string name="TPl_notification">Для %s действуют таймеры!</string>

@ -259,7 +259,6 @@
<string name="repeat_until">Opakovať do %s</string>
<string name="repeat_snackbar">%1$s preplánované na %2$s</string>
<string name="new_tag">Nasledujúci tag</string>
<string name="tag_no_title_error">Prosím, uveďte najprv názov pre tento zoznam!</string>
<string name="tag_FEx_untagged">Nezaradené</string>
<string name="delete_tag_confirmation">Vymazať %s?</string>
<string name="TPl_notification">Časovač aktívny pre %s!</string>

@ -245,7 +245,6 @@
<string name="repeat_detail_duedate_until">Vsak %1$s\n do %2$s</string>
<string name="repeat_forever">Ponavljaj do preklica</string>
<string name="repeat_until">Ponavljaj do %s</string>
<string name="tag_no_title_error">Prosimo, vnesite naziv tega seznama najprej!</string>
<string name="tag_FEx_untagged">Nerazvrščen</string>
<string name="TPl_notification">Merilniki časa aktivni za %s!</string>
<string name="TFE_workingOn">Opravki katerim se meri čas</string>

@ -237,7 +237,6 @@ och återställer dina aktuella uppgifter från en backup
<string name="repeat_detail_duedate_until">Varje %1$s\ntill %2$s </string>
<string name="repeat_forever">Repetera oändligt</string>
<string name="repeat_until">Repetera till %s</string>
<string name="tag_no_title_error">Ange först ett namn på listan!</string>
<string name="tag_FEx_untagged">Ingen kategori</string>
<string name="TPl_notification">Tidtagarur aktivt för %s!</string>
<string name="TFE_workingOn">Uppgifter med tidtagning</string>

@ -216,7 +216,6 @@
<string name="repeat_detail_duedate_until">Her %1$s\n%2$s \'e kadar</string>
<string name="repeat_forever">Sürekli yinele</string>
<string name="repeat_until">%s\'e kadar yinele</string>
<string name="tag_no_title_error">Lütfen bu liste için isim girin!</string>
<string name="TPl_notification">%s için kronometre etkin!</string>
<string name="TFE_workingOn">Zaman Ölçümü Olan Görevler</string>
<string name="TEA_timer_comment_started">başlanan görev:</string>

@ -245,7 +245,6 @@
<string name="repeat_detail_duedate_until">Кожні %1$s\nпоки %2$s</string>
<string name="repeat_forever">Повторювати завжди</string>
<string name="repeat_until">Повторювати до %s</string>
<string name="tag_no_title_error">Введіть назву списку спочатку!</string>
<string name="tag_FEx_untagged">Без категорії</string>
<string name="TPl_notification">Для %s діють таймери!</string>
<string name="TEA_timer_controls">Таймер</string>

@ -195,7 +195,6 @@
<string name="repeat_detail_duedate_until">每隔 %1$s\n直到 %2$s</string>
<string name="repeat_forever">永远重复</string>
<string name="repeat_until">重复到 %s</string>
<string name="tag_no_title_error">请先为此列表键入一个名称!</string>
<string name="TPl_notification">秒表启动了 %s</string>
<string name="TFE_workingOn">任务已开始计时</string>
<string name="TEA_timer_comment_started">已经开始了这项任务:</string>

@ -226,7 +226,6 @@
<string name="repeat_detail_duedate_until">每隔 %1$s\n直到 %2$s</string>
<string name="repeat_forever">永遠重複</string>
<string name="repeat_until">重複到 %s</string>
<string name="tag_no_title_error">請先為此列表鍵入一個名稱!</string>
<string name="tag_FEx_untagged">未分類</string>
<string name="TPl_notification">秒錶啟動了 %s</string>
<string name="TFE_workingOn">任務工作已開始計時</string>

@ -738,9 +738,6 @@ File %1$s contained %2$s.\n\n
<string name="new_tag">New Tag</string>
<!-- Dialog: task created without title -->
<string name="tag_no_title_error">Please enter a name for this list first!</string>
<!-- ========================================================== Filters == -->
<!-- slide 10d: filter for untagged tasks -->

Loading…
Cancel
Save