From a229cf631d1b0d80c4fe2264e75d3ded8f8f3dfe Mon Sep 17 00:00:00 2001 From: Alex Baker Date: Mon, 1 Feb 2016 13:12:03 -0600 Subject: [PATCH] Remove QuickAddBar --- .../astrid/activity/TaskListActivity.java | 4 +- .../astrid/activity/TaskListFragment.java | 11 ++-- .../com/todoroo/astrid/ui/QuickAddBar.java | 59 ------------------- .../org/tasks/injection/FragmentModule.java | 12 +--- .../tasks/injection/InjectingFragment.java | 2 +- .../injection/InjectingListFragment.java | 2 +- src/main/res/values-ar/strings.xml | 1 - src/main/res/values-bg-rBG/strings.xml | 1 - src/main/res/values-cs/strings.xml | 1 - src/main/res/values-da/strings.xml | 1 - src/main/res/values-de/strings.xml | 1 - src/main/res/values-el/strings.xml | 1 - src/main/res/values-es/strings.xml | 1 - src/main/res/values-fa/strings.xml | 1 - src/main/res/values-fi/strings.xml | 1 - src/main/res/values-fr/strings.xml | 1 - src/main/res/values-hu/strings.xml | 1 - src/main/res/values-it/strings.xml | 1 - src/main/res/values-iw/strings.xml | 1 - src/main/res/values-ja/strings.xml | 1 - src/main/res/values-ko/strings.xml | 1 - src/main/res/values-nl/strings.xml | 1 - src/main/res/values-pl/strings.xml | 1 - src/main/res/values-pt-rBR/strings.xml | 1 - src/main/res/values-pt/strings.xml | 1 - src/main/res/values-ru/strings.xml | 1 - src/main/res/values-sk/strings.xml | 1 - src/main/res/values-sl-rSI/strings.xml | 1 - src/main/res/values-sv/strings.xml | 1 - src/main/res/values-tr/strings.xml | 1 - src/main/res/values-uk/strings.xml | 1 - src/main/res/values-zh-rCN/strings.xml | 1 - src/main/res/values-zh-rTW/strings.xml | 1 - src/main/res/values/strings.xml | 3 - 34 files changed, 10 insertions(+), 110 deletions(-) delete mode 100644 src/main/java/com/todoroo/astrid/ui/QuickAddBar.java diff --git a/src/main/java/com/todoroo/astrid/activity/TaskListActivity.java b/src/main/java/com/todoroo/astrid/activity/TaskListActivity.java index 1c5aeff41..736bcc48a 100644 --- a/src/main/java/com/todoroo/astrid/activity/TaskListActivity.java +++ b/src/main/java/com/todoroo/astrid/activity/TaskListActivity.java @@ -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(); diff --git a/src/main/java/com/todoroo/astrid/activity/TaskListFragment.java b/src/main/java/com/todoroo/astrid/activity/TaskListFragment.java index 01687ecd7..d3bb2b2dc 100644 --- a/src/main/java/com/todoroo/astrid/activity/TaskListFragment.java +++ b/src/main/java/com/todoroo/astrid/activity/TaskListFragment.java @@ -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 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. diff --git a/src/main/java/com/todoroo/astrid/ui/QuickAddBar.java b/src/main/java/com/todoroo/astrid/ui/QuickAddBar.java deleted file mode 100644 index 14ed94cc9..000000000 --- a/src/main/java/com/todoroo/astrid/ui/QuickAddBar.java +++ /dev/null @@ -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 - * - */ -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; - } -} diff --git a/src/main/java/org/tasks/injection/FragmentModule.java b/src/main/java/org/tasks/injection/FragmentModule.java index e572efc9b..c1f54e36a 100644 --- a/src/main/java/org/tasks/injection/FragmentModule.java +++ b/src/main/java/org/tasks/injection/FragmentModule.java @@ -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 diff --git a/src/main/java/org/tasks/injection/InjectingFragment.java b/src/main/java/org/tasks/injection/InjectingFragment.java index 99575056d..436c9da21 100644 --- a/src/main/java/org/tasks/injection/InjectingFragment.java +++ b/src/main/java/org/tasks/injection/InjectingFragment.java @@ -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; } diff --git a/src/main/java/org/tasks/injection/InjectingListFragment.java b/src/main/java/org/tasks/injection/InjectingListFragment.java index 9615bcca4..f0f512f4e 100644 --- a/src/main/java/org/tasks/injection/InjectingListFragment.java +++ b/src/main/java/org/tasks/injection/InjectingListFragment.java @@ -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; } diff --git a/src/main/res/values-ar/strings.xml b/src/main/res/values-ar/strings.xml index fcaf15d77..eac6d3b3d 100644 --- a/src/main/res/values-ar/strings.xml +++ b/src/main/res/values-ar/strings.xml @@ -158,7 +158,6 @@ من تاريخ الموعد من تاريخ الاتمام - أدخل اسم للقائمة أولاً غير مصنف مؤقت بدء هذه المهمة: diff --git a/src/main/res/values-bg-rBG/strings.xml b/src/main/res/values-bg-rBG/strings.xml index 8a265d06f..8dde1841a 100644 --- a/src/main/res/values-bg-rBG/strings.xml +++ b/src/main/res/values-bg-rBG/strings.xml @@ -275,7 +275,6 @@ Повтаряй до %s %1$s е насрочено за %2$s Нов таг - Моля, първо въведете име за този списък! Без категория Изтрий %s? Таймерите са Активни за %s! diff --git a/src/main/res/values-cs/strings.xml b/src/main/res/values-cs/strings.xml index 401983999..99ed12132 100644 --- a/src/main/res/values-cs/strings.xml +++ b/src/main/res/values-cs/strings.xml @@ -239,7 +239,6 @@ Každý %1$s\n až do %2$s Opakovat stále Opakovat až do %s - Prosím zadejte jméno pro první seznam Nezařazené Aktivní časovače pro %s! Termínované úkoly diff --git a/src/main/res/values-da/strings.xml b/src/main/res/values-da/strings.xml index 1199cae09..7069c145d 100644 --- a/src/main/res/values-da/strings.xml +++ b/src/main/res/values-da/strings.xml @@ -127,7 +127,6 @@ Hver %1$s\nindtil %2$s Gentag uendeligt Gentag indtil %s - Start venligst med at give denne liste et navn! Slet opgave 1 opgave diff --git a/src/main/res/values-de/strings.xml b/src/main/res/values-de/strings.xml index 42fe33d88..40748a685 100644 --- a/src/main/res/values-de/strings.xml +++ b/src/main/res/values-de/strings.xml @@ -255,7 +255,6 @@ Wiederhole bis %s %1$s verschoben um %2$s Neues Schlagwort - Bitte gib zuerst einen Namen für die Liste ein! Nicht kategorisiert %s löschen? Timer ist aktiv für %s! diff --git a/src/main/res/values-el/strings.xml b/src/main/res/values-el/strings.xml index 3f6d9e90a..626220973 100644 --- a/src/main/res/values-el/strings.xml +++ b/src/main/res/values-el/strings.xml @@ -241,7 +241,6 @@ Κάθε %1$s\nμέχρι %2$s Επανάληψη επ\'αορίστου Επανάληψη μέχρι %s - Παρακαλώ εισάγετε ενα όνομα για την λίστα πρώτα! Μη κατηγοριοποιημένο Χρονοδιακόπτες ενεργοί για %s! Καθήκοντα με χρονικό όριο diff --git a/src/main/res/values-es/strings.xml b/src/main/res/values-es/strings.xml index ad54dc261..1cf7145c1 100644 --- a/src/main/res/values-es/strings.xml +++ b/src/main/res/values-es/strings.xml @@ -265,7 +265,6 @@ Repetir hasta %s %1$s He reprogramado esta tarea recurrente para %2$s Nueva Etiqueta - Por favor, ¡introduce un nombre para la primera lista! Sin Categoría ¿Eliminar %s? Temporizadores activos para %s! diff --git a/src/main/res/values-fa/strings.xml b/src/main/res/values-fa/strings.xml index 3fdf5792d..193cdf45f 100644 --- a/src/main/res/values-fa/strings.xml +++ b/src/main/res/values-fa/strings.xml @@ -193,7 +193,6 @@ تکرار بینهایت تگ جدید - لطفا ابتدا یک نام برای لیست انتخاب نمایید دسته بندی نشده وظایف زمانبندی شده تایمر diff --git a/src/main/res/values-fi/strings.xml b/src/main/res/values-fi/strings.xml index 59c1431d4..fe8d20829 100644 --- a/src/main/res/values-fi/strings.xml +++ b/src/main/res/values-fi/strings.xml @@ -61,7 +61,6 @@ Joka %1$s\nkunnes %2$s Toista loputtomiin Toista kunnes %s - Ole hyvä syötä ensin nimi tälle listalle! Poista tehtävä Lähdekoodi Näytä piilotetut diff --git a/src/main/res/values-fr/strings.xml b/src/main/res/values-fr/strings.xml index 0b09e5374..0ace54293 100644 --- a/src/main/res/values-fr/strings.xml +++ b/src/main/res/values-fr/strings.xml @@ -267,7 +267,6 @@ Répéter jusqu\'à %s %1$s replanifiée à %2$s Nouveau tag - Veuillez d\'abord entrer un nom pour cette liste. Non classé Effacer %s ? Chronomètre actif pour %s ! diff --git a/src/main/res/values-hu/strings.xml b/src/main/res/values-hu/strings.xml index ecb6b4a35..81191d777 100644 --- a/src/main/res/values-hu/strings.xml +++ b/src/main/res/values-hu/strings.xml @@ -107,7 +107,6 @@ Minden %1$s\neddig: %2$s Ismétlés örökké Ismétlés eddig: %s - Kérlek, először add meg a lista nevét! Feladat törlése 1 feladat diff --git a/src/main/res/values-it/strings.xml b/src/main/res/values-it/strings.xml index cc3de787b..a7161e579 100644 --- a/src/main/res/values-it/strings.xml +++ b/src/main/res/values-it/strings.xml @@ -268,7 +268,6 @@ Se visualizzi questo errore più volte, ti consigliamo di cancellare tutti i dat Ripeti fino %s %1$s ripianificata per %2$s Nuova etichetta - Per cortesia, prima inserisci un nome per questa lista Non classificato Elimino %s? Timer attivi per %s! diff --git a/src/main/res/values-iw/strings.xml b/src/main/res/values-iw/strings.xml index b26241583..2afd26b7f 100644 --- a/src/main/res/values-iw/strings.xml +++ b/src/main/res/values-iw/strings.xml @@ -241,7 +241,6 @@ כל %1$s\nעד %2$s חזור לנצח חזרה עד %s - אנא הכנס שם לרשימה זו קוצב זמן הופעל עבור %s משימות משימות עם הערכת זמן טיימר diff --git a/src/main/res/values-ja/strings.xml b/src/main/res/values-ja/strings.xml index 8c5b19c47..d4e395d39 100644 --- a/src/main/res/values-ja/strings.xml +++ b/src/main/res/values-ja/strings.xml @@ -274,7 +274,6 @@ %s まで繰り返す %1$s を %2$s にスケジュール変更しました 新しいタグ - まずリスト名を記入してください! 未分類 %s を削除しますか? %s のタイマーがアクティブです diff --git a/src/main/res/values-ko/strings.xml b/src/main/res/values-ko/strings.xml index 60924fe0f..457d010ac 100644 --- a/src/main/res/values-ko/strings.xml +++ b/src/main/res/values-ko/strings.xml @@ -275,7 +275,6 @@ Tasks의 백업에서 당신의 일정을 복구하시기 바랍니다. %s 까지 반복 %1$s 이 %2$s 로 변경되었습니다 새 태그 - 이 목록의 이름을 먼저 입력하세요! 미분류 일정 %s 삭제할까요? %s 동안 타이머 작동함! diff --git a/src/main/res/values-nl/strings.xml b/src/main/res/values-nl/strings.xml index 5644fa8e1..25212ef01 100644 --- a/src/main/res/values-nl/strings.xml +++ b/src/main/res/values-nl/strings.xml @@ -271,7 +271,6 @@ Herhalen tot %s %1$s opnieuw ingepland op %2$s Nieuwe Label - Voer a.u.b. eerst een naam in voor deze lijst! Niet gecategoriseerd Verwijder %s? Timers ingeschakeld voor %s! diff --git a/src/main/res/values-pl/strings.xml b/src/main/res/values-pl/strings.xml index 6bfab901b..3786097ad 100644 --- a/src/main/res/values-pl/strings.xml +++ b/src/main/res/values-pl/strings.xml @@ -244,7 +244,6 @@ i odzyskanie zadań z kopi zapasowej (Settings->Sync and backup->Backup-&g Co %1$s\ndo %2$s Powtarzaj bez końca Powtarzaj do %s - Wpisz nazwę dla tej listy najpierw! Na żadnej liście Minutnkiki aktywne przez %s! Zadania zostały spracyzowane czasowo diff --git a/src/main/res/values-pt-rBR/strings.xml b/src/main/res/values-pt-rBR/strings.xml index 60ffbd215..3750d4df2 100644 --- a/src/main/res/values-pt-rBR/strings.xml +++ b/src/main/res/values-pt-rBR/strings.xml @@ -241,7 +241,6 @@ Todo %1$s\naté %2$s Repetir para sempre Repetir até %s - Entre com o nome da lista primeiro! Sem categoria Temporizador ativado para %s! Tarefas com contagem de tempo diff --git a/src/main/res/values-pt/strings.xml b/src/main/res/values-pt/strings.xml index adab75a22..5bbc47084 100644 --- a/src/main/res/values-pt/strings.xml +++ b/src/main/res/values-pt/strings.xml @@ -266,7 +266,6 @@ das tarefas através de um backup em Definições->Sincronização e backup-& Repetir até %s %1$s agendada para %2$s Nova etiqueta - Introduza o nome para esta lista! Sem categoria Apagar %s? Temporizador ativo para %s! diff --git a/src/main/res/values-ru/strings.xml b/src/main/res/values-ru/strings.xml index a37fa8ba9..c987fb8b5 100644 --- a/src/main/res/values-ru/strings.xml +++ b/src/main/res/values-ru/strings.xml @@ -273,7 +273,6 @@ Повторять до %s «%1$s» перенесено на %2$s Новый тег - Пожалуйста, для начала введите название списка! Без тега Удалить %s? Для %s действуют таймеры! diff --git a/src/main/res/values-sk/strings.xml b/src/main/res/values-sk/strings.xml index ab95167bf..f17dc45b1 100644 --- a/src/main/res/values-sk/strings.xml +++ b/src/main/res/values-sk/strings.xml @@ -259,7 +259,6 @@ Opakovať do %s %1$s preplánované na %2$s Nasledujúci tag - Prosím, uveďte najprv názov pre tento zoznam! Nezaradené Vymazať %s? Časovač aktívny pre %s! diff --git a/src/main/res/values-sl-rSI/strings.xml b/src/main/res/values-sl-rSI/strings.xml index 3e929d6d0..bae9e1314 100644 --- a/src/main/res/values-sl-rSI/strings.xml +++ b/src/main/res/values-sl-rSI/strings.xml @@ -245,7 +245,6 @@ Vsak %1$s\n do %2$s Ponavljaj do preklica Ponavljaj do %s - Prosimo, vnesite naziv tega seznama najprej! Nerazvrščen Merilniki časa aktivni za %s! Opravki katerim se meri čas diff --git a/src/main/res/values-sv/strings.xml b/src/main/res/values-sv/strings.xml index 9d9ba7cdb..424f15dfc 100644 --- a/src/main/res/values-sv/strings.xml +++ b/src/main/res/values-sv/strings.xml @@ -237,7 +237,6 @@ och återställer dina aktuella uppgifter från en backup Varje %1$s\ntill %2$s Repetera oändligt Repetera till %s - Ange först ett namn på listan! Ingen kategori Tidtagarur aktivt för %s! Uppgifter med tidtagning diff --git a/src/main/res/values-tr/strings.xml b/src/main/res/values-tr/strings.xml index 40869bf39..3576d1104 100644 --- a/src/main/res/values-tr/strings.xml +++ b/src/main/res/values-tr/strings.xml @@ -216,7 +216,6 @@ Her %1$s\n%2$s \'e kadar Sürekli yinele %s\'e kadar yinele - Lütfen bu liste için isim girin! %s için kronometre etkin! Zaman Ölçümü Olan Görevler başlanan görev: diff --git a/src/main/res/values-uk/strings.xml b/src/main/res/values-uk/strings.xml index 78df1a7a6..87dbc68a8 100644 --- a/src/main/res/values-uk/strings.xml +++ b/src/main/res/values-uk/strings.xml @@ -245,7 +245,6 @@ Кожні %1$s\nпоки %2$s Повторювати завжди Повторювати до %s - Введіть назву списку спочатку! Без категорії Для %s діють таймери! Таймер diff --git a/src/main/res/values-zh-rCN/strings.xml b/src/main/res/values-zh-rCN/strings.xml index cd5e4f99b..265b61583 100644 --- a/src/main/res/values-zh-rCN/strings.xml +++ b/src/main/res/values-zh-rCN/strings.xml @@ -195,7 +195,6 @@ 每隔 %1$s\n直到 %2$s 永远重复 重复到 %s - 请先为此列表键入一个名称! 秒表启动了 %s! 任务已开始计时 已经开始了这项任务: diff --git a/src/main/res/values-zh-rTW/strings.xml b/src/main/res/values-zh-rTW/strings.xml index 6af1dc898..9c7978737 100644 --- a/src/main/res/values-zh-rTW/strings.xml +++ b/src/main/res/values-zh-rTW/strings.xml @@ -226,7 +226,6 @@ 每隔 %1$s\n直到 %2$s 永遠重複 重複到 %s - 請先為此列表鍵入一個名稱! 未分類 秒錶啟動了 %s! 任務工作已開始計時 diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index b2f5b11c3..40e11fe06 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -738,9 +738,6 @@ File %1$s contained %2$s.\n\n New Tag - - Please enter a name for this list first! -