Add hidden icon to task list

pull/757/head
Alex Baker 6 years ago
parent 26fe0a7339
commit 178d22c7f1

@ -13,6 +13,7 @@ import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.HorizontalScrollView;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
@ -40,6 +41,7 @@ class ViewHolder extends RecyclerView.ViewHolder {
private final Preferences preferences;
private final CheckBoxes checkBoxes;
private final int textColorSecondary;
private final int textColorPrimary;
private final TaskDao taskDao;
private final ViewHolderCallbacks callback;
private final DisplayMetrics metrics;
@ -75,6 +77,9 @@ class ViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.chip_group)
ChipGroup chipGroup;
@BindView(R.id.hidden_status)
ImageView hidden;
private int indent;
private boolean selected;
private boolean moving;
@ -88,6 +93,7 @@ class ViewHolder extends RecyclerView.ViewHolder {
ChipProvider chipProvider,
int textColorOverdue,
int textColorSecondary,
int textColorPrimary,
TaskDao taskDao,
ViewHolderCallbacks callback,
DisplayMetrics metrics,
@ -101,6 +107,7 @@ class ViewHolder extends RecyclerView.ViewHolder {
this.chipProvider = chipProvider;
this.textColorOverdue = textColorOverdue;
this.textColorSecondary = textColorSecondary;
this.textColorPrimary = textColorPrimary;
this.taskDao = taskDao;
this.callback = callback;
this.metrics = metrics;
@ -201,22 +208,17 @@ class ViewHolder extends RecyclerView.ViewHolder {
/** Helper method to set the contents and visibility of each field */
private synchronized void setFieldContentsAndVisibility() {
String nameValue = task.getTitle();
long hiddenUntil = task.getHideUntil();
if (hiddenUntil > DateUtilities.now()) {
nameValue = context.getResources().getString(R.string.TAd_hiddenFormat, nameValue);
}
nameView.setText(nameValue);
nameView.setText(task.getTitle());
hidden.setVisibility(task.isHidden() ? View.VISIBLE : View.GONE);
setupDueDateAndTags();
}
private void setTaskAppearance() {
if (task.isCompleted()) {
nameView.setEnabled(false);
nameView.setTextColor(textColorSecondary);
nameView.setPaintFlags(nameView.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
} else {
nameView.setTextColor(task.isHidden() ? textColorSecondary : textColorPrimary);
nameView.setEnabled(true);
nameView.setPaintFlags(nameView.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);
}
@ -244,19 +246,17 @@ class ViewHolder extends RecyclerView.ViewHolder {
private void setupDueDateAndTags() {
// due date / completion date
final TextView dueDateView = dueDate;
if (!task.isCompleted() && task.hasDueDate()) {
long dueDate = task.getDueDate();
if (task.isOverdue()) {
dueDateView.setTextColor(textColorOverdue);
dueDate.setTextColor(textColorOverdue);
} else {
dueDateView.setTextColor(textColorSecondary);
dueDate.setTextColor(textColorSecondary);
}
String dateValue = DateUtilities.getRelativeDateStringWithTime(context, dueDate);
dueDateView.setText(dateValue);
dueDateView.setVisibility(View.VISIBLE);
String dateValue = DateUtilities.getRelativeDateStringWithTime(context, task.getDueDate());
dueDate.setText(dateValue);
dueDate.setVisibility(View.VISIBLE);
} else {
dueDateView.setVisibility(View.GONE);
dueDate.setVisibility(View.GONE);
}
String tags = task.getTagsString();

@ -19,6 +19,7 @@ import org.tasks.ui.ChipProvider;
public class ViewHolderFactory {
private final int textColorPrimary;
private final int textColorSecondary;
private final int textColorOverdue;
private final Context context;
@ -44,6 +45,7 @@ public class ViewHolderFactory {
this.chipProvider = chipProvider;
this.taskDao = taskDao;
this.preferences = preferences;
textColorPrimary = getColor(context, R.color.text_primary);
textColorSecondary = getData(context, android.R.attr.textColorSecondary);
textColorOverdue = getColor(context, R.color.overdue);
background = getResourceId(context, R.attr.selectableItemBackground);
@ -64,6 +66,7 @@ public class ViewHolderFactory {
chipProvider,
textColorOverdue,
textColorSecondary,
textColorPrimary,
taskDao,
callbacks,
metrics,

@ -39,14 +39,28 @@
android:singleLine="true"
android:textSize="14sp"/>
<ImageView
android:id="@+id/hidden_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:layout_toEndOf="@id/completeBox"
android:layout_toRightOf="@id/completeBox"
android:paddingEnd="2dp"
android:paddingRight="2dp"
android:alpha="?attr/alpha_secondary"
android:src="@drawable/ic_visibility_off_24dp"
android:tint="@color/icon_tint"
android:visibility="gone"/>
<TextView
android:id="@+id/title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toEndOf="@id/completeBox"
android:layout_toEndOf="@id/hidden_status"
android:layout_toLeftOf="@id/due_date"
android:layout_toRightOf="@id/completeBox"
android:layout_toRightOf="@id/hidden_status"
android:layout_toStartOf="@id/due_date"
android:paddingStart="0dp"
android:paddingEnd="@dimen/keyline_first"
@ -98,6 +112,7 @@
app:singleLine="true">
</com.google.android.material.chip.ChipGroup>
</HorizontalScrollView>
</LinearLayout>

@ -34,7 +34,6 @@
<string name="TLA_menu_sort">Сортирай</string>
<string name="TLA_menu_search">Търсене</string>
<string name="TLA_menu_settings">Настройки</string>
<string name="TAd_hiddenFormat">%s [скрито]</string>
<string name="TAd_completed">Приключена\n%s</string>
<string name="TAd_actionEditTask">Редактирай</string>
<string name="SSD_sort_drag">Ръчно подреждане с подзадачи</string>

@ -24,7 +24,6 @@
<string name="TLA_menu_sort">Ordenació i subtasques</string>
<string name="TLA_menu_search">Cerca</string>
<string name="TLA_menu_settings">Paràmetres</string>
<string name="TAd_hiddenFormat">%s [ocult]</string>
<string name="TAd_completed">Acabat fa\n%s</string>
<string name="TAd_actionEditTask">Edita</string>
<string name="SSD_sort_drag">Ordre manual amb subtasques</string>

@ -28,7 +28,6 @@
<string name="TLA_menu_sort">Třídit</string>
<string name="TLA_menu_search">Hledat</string>
<string name="TLA_menu_settings">Nastavení</string>
<string name="TAd_hiddenFormat">%s [skrytý]</string>
<string name="TAd_completed">Dokončeno\n%s</string>
<string name="TAd_actionEditTask">Upravit</string>
<string name="SSD_sort_drag">Ručně nebo s podúkoly</string>

@ -24,7 +24,6 @@
<string name="WID_dateButtonUnset">Tryk for at indstille</string>
<string name="TLA_menu_sort">Sorter &amp; skjulte</string>
<string name="TLA_menu_settings">Opsætning</string>
<string name="TAd_hiddenFormat">%s [skjult]</string>
<string name="TAd_actionEditTask">Rediger</string>
<string name="SSD_sort_drag">Manuel ordre med delopgaver</string>
<string name="SSD_sort_auto">Tasks Intelligent sortering</string>

@ -29,7 +29,6 @@
<string name="TLA_menu_sort">Sortieren</string>
<string name="TLA_menu_search">Suchen</string>
<string name="TLA_menu_settings">Einstellungen</string>
<string name="TAd_hiddenFormat">%s [versteckt]</string>
<string name="TAd_completed">Abgeschlossen\n%s</string>
<string name="TAd_actionEditTask">Bearbeiten</string>
<string name="SSD_sort_drag">Manuelle Sortierung mit Unteraufgaben</string>

@ -29,7 +29,6 @@
<string name="TLA_menu_sort">Ταξινόμηση</string>
<string name="TLA_menu_search">Αναζήτηση</string>
<string name="TLA_menu_settings">Ρυθμίσεις</string>
<string name="TAd_hiddenFormat">%s [κρυφό]</string>
<string name="TAd_actionEditTask">Επεξεργασία</string>
<string name="SSD_sort_drag">Χειροκίνητη κατάταξη με υποκαθήκοντα</string>
<string name="SSD_sort_auto">Έξυπνη ταξινόμηση</string>

@ -31,7 +31,6 @@
<string name="TLA_menu_sort">Ordenar</string>
<string name="TLA_menu_search">Buscar</string>
<string name="TLA_menu_settings">Configuración</string>
<string name="TAd_hiddenFormat">%s [oculto]</string>
<string name="TAd_completed">Terminado\n%s</string>
<string name="TAd_actionEditTask">Editar</string>
<string name="SSD_sort_drag">Orden manual con subtareas</string>

@ -34,7 +34,6 @@
<string name="TLA_menu_sort">Järjestä</string>
<string name="TLA_menu_search">Etsi</string>
<string name="TLA_menu_settings">Asetukset</string>
<string name="TAd_hiddenFormat">%s (piilotettu)</string>
<string name="TAd_completed">Lopetettu\n%s</string>
<string name="TAd_actionEditTask">Muokkaa</string>
<string name="SSD_sort_drag">Manuaalinen järjestys osatehtäviin</string>

@ -31,7 +31,6 @@
<string name="TLA_menu_sort">Trier</string>
<string name="TLA_menu_search">Rechercher</string>
<string name="TLA_menu_settings">Paramètres</string>
<string name="TAd_hiddenFormat">%s [masqué(e)]</string>
<string name="TAd_completed">Accomplie\n%s</string>
<string name="TAd_actionEditTask">Modifier</string>
<string name="SSD_sort_drag">Ordonner manuellement avec les sous-tâches</string>

@ -31,7 +31,6 @@
<string name="TLA_menu_sort">Ordenar</string>
<string name="TLA_menu_search">Buscar</string>
<string name="TLA_menu_settings">Configuración</string>
<string name="TAd_hiddenFormat">%s [oculto]</string>
<string name="TAd_completed">Terminado\n%s</string>
<string name="TAd_actionEditTask">Editar</string>
<string name="SSD_sort_drag">Orde manual con subtarefas</string>

@ -34,7 +34,6 @@
<string name="TLA_menu_sort">Rendezés</string>
<string name="TLA_menu_search">Keresés</string>
<string name="TLA_menu_settings">Beállítások</string>
<string name="TAd_hiddenFormat">%s [rejtett]</string>
<string name="TAd_completed">Befejezve\n%s</string>
<string name="TAd_actionEditTask">Szerkesztés</string>
<string name="SSD_sort_drag">Manuális sorrend részfeladatokkal</string>

@ -31,7 +31,6 @@
<string name="TLA_menu_sort">Ordinamento</string>
<string name="TLA_menu_search">Cerca</string>
<string name="TLA_menu_settings">Impostazioni</string>
<string name="TAd_hiddenFormat">%s [Nascosto]</string>
<string name="TAd_completed">Terminata\n%s</string>
<string name="TAd_actionEditTask">Modifica</string>
<string name="SSD_sort_drag">Ordinamento manuale con attività correlate</string>

@ -31,7 +31,6 @@
<string name="TLA_menu_sort">מיון</string>
<string name="TLA_menu_search">חיפוש</string>
<string name="TLA_menu_settings">הגדרות</string>
<string name="TAd_hiddenFormat">%s [מוסתרת]</string>
<string name="TAd_completed">הסתיימה\n%s</string>
<string name="TAd_actionEditTask">עריכה</string>
<string name="SSD_sort_drag">סידור ידני עם תתי-משימות</string>

@ -31,7 +31,6 @@
<string name="TLA_menu_sort">ソート</string>
<string name="TLA_menu_search">検索</string>
<string name="TLA_menu_settings">設定</string>
<string name="TAd_hiddenFormat">%s [非表示]</string>
<string name="TAd_completed">%s\nに完了</string>
<string name="TAd_actionEditTask">編集する</string>
<string name="SSD_sort_drag">サブタスクの手動設定順</string>

@ -34,7 +34,6 @@
<string name="TLA_menu_sort">정렬</string>
<string name="TLA_menu_search">검색</string>
<string name="TLA_menu_settings">설정</string>
<string name="TAd_hiddenFormat">%s [숨김]</string>
<string name="TAd_completed">일정 완료\n%s</string>
<string name="TAd_actionEditTask">편집</string>
<string name="SSD_sort_drag">수동 정렬 (하위할일 포함)</string>

@ -31,7 +31,6 @@
<string name="TLA_menu_sort">Eiliškumas</string>
<string name="TLA_menu_search">Ieškoti</string>
<string name="TLA_menu_settings">Nustatymai</string>
<string name="TAd_hiddenFormat">%s [paslėpta]</string>
<string name="TAd_completed">Užbaigta\n%s</string>
<string name="TAd_actionEditTask">Redaguoti</string>
<string name="SSD_sort_drag">Rankinis eiliškumas su sub-užduotimis</string>

@ -22,7 +22,6 @@
<string name="WID_dateButtonUnset">Klikk for å sette</string>
<string name="TLA_menu_sort">Sorter &amp; Skjult</string>
<string name="TLA_menu_settings">Innstillinger</string>
<string name="TAd_hiddenFormat">%s [skjult]</string>
<string name="TAd_actionEditTask">Rediger</string>
<string name="SSD_sort_drag">Manuell rekkefølge med underoppgaver</string>
<string name="SSD_sort_auto">Tasks intelligent sortering</string>

@ -31,7 +31,6 @@
<string name="TLA_menu_sort">Sorteren</string>
<string name="TLA_menu_search">Zoek</string>
<string name="TLA_menu_settings">Instellingen</string>
<string name="TAd_hiddenFormat">%s [verborgen]</string>
<string name="TAd_completed">Afgerond\n%s</string>
<string name="TAd_actionEditTask">Bewerken</string>
<string name="SSD_sort_drag">Handmatige volgorde met subtaken</string>

@ -31,7 +31,6 @@
<string name="TLA_menu_sort">Sortuj</string>
<string name="TLA_menu_search">Szukaj</string>
<string name="TLA_menu_settings">Ustawienia</string>
<string name="TAd_hiddenFormat">%s [ukryte]</string>
<string name="TAd_completed">Ukończono\n%s</string>
<string name="TAd_actionEditTask">Edytuj</string>
<string name="SSD_sort_drag">Ręczne z podzadaniami</string>

@ -30,7 +30,6 @@
<string name="TLA_menu_sort">Ordenar</string>
<string name="TLA_menu_search">Buscar</string>
<string name="TLA_menu_settings">Configurações</string>
<string name="TAd_hiddenFormat">%s [oculta]</string>
<string name="TAd_completed">Concluída\n%s</string>
<string name="TAd_actionEditTask">Editar</string>
<string name="SSD_sort_drag">Ordem manual com subtarefas</string>

@ -33,7 +33,6 @@
<string name="TLA_menu_sort">Ordenação</string>
<string name="TLA_menu_search">Procura</string>
<string name="TLA_menu_settings">Definições</string>
<string name="TAd_hiddenFormat">%s [oculta]</string>
<string name="TAd_completed">Terminada\n%s</string>
<string name="TAd_actionEditTask">Editar</string>
<string name="SSD_sort_drag">Ordem manual com subtarefas</string>

@ -31,7 +31,6 @@
<string name="TLA_menu_sort">Сортировка</string>
<string name="TLA_menu_search">Поиск</string>
<string name="TLA_menu_settings">Настройки</string>
<string name="TAd_hiddenFormat">%s [скрыто]</string>
<string name="TAd_completed">Завершено\n%s</string>
<string name="TAd_actionEditTask">Редактировать</string>
<string name="SSD_sort_drag">Ручная сортировка с подзадачами</string>

@ -31,7 +31,6 @@
<string name="TLA_menu_sort">Triediť</string>
<string name="TLA_menu_search">Hľadať</string>
<string name="TLA_menu_settings">Nastavenia</string>
<string name="TAd_hiddenFormat">%s [skryté]</string>
<string name="TAd_completed">Dokončené\n%s</string>
<string name="TAd_actionEditTask">Upraviť</string>
<string name="SSD_sort_drag">Ručne triediť s podúlohami</string>

@ -29,7 +29,6 @@
<string name="TLA_menu_sort">Razvrsti</string>
<string name="TLA_menu_search">Iskanje</string>
<string name="TLA_menu_settings">Nastavitve</string>
<string name="TAd_hiddenFormat">%s [skrit]</string>
<string name="TAd_completed">Opravljen\n%s</string>
<string name="TAd_actionEditTask">Uredi</string>
<string name="SSD_sort_drag">Ročna nastavitev s podopravki</string>

@ -31,7 +31,6 @@
<string name="TLA_menu_sort">Sortera</string>
<string name="TLA_menu_search">Sök</string>
<string name="TLA_menu_settings">Inställningar</string>
<string name="TAd_hiddenFormat">%s [dold]</string>
<string name="TAd_completed">Avslutad\n%s</string>
<string name="TAd_actionEditTask">Redigera</string>
<string name="SSD_sort_drag">Manuell sortering med underuppgifter</string>

@ -35,7 +35,6 @@
<string name="TLA_menu_sort">Sırala</string>
<string name="TLA_menu_search">Ara</string>
<string name="TLA_menu_settings">Ayarlar</string>
<string name="TAd_hiddenFormat">%s [gizli]</string>
<string name="TAd_completed">Bitti\n%s</string>
<string name="TAd_actionEditTask">Düzenle</string>
<string name="SSD_sort_drag">Alt görevleri elle sırala</string>

@ -34,7 +34,6 @@
<string name="TLA_menu_sort">Сортувати</string>
<string name="TLA_menu_search">Пошук</string>
<string name="TLA_menu_settings">Налаштування</string>
<string name="TAd_hiddenFormat">%s [приховано]</string>
<string name="TAd_completed">Завершено\n%s</string>
<string name="TAd_actionEditTask">Редагувати</string>
<string name="SSD_sort_drag">Ручний порядок з підзадачами</string>

@ -31,7 +31,6 @@
<string name="TLA_menu_sort">排序</string>
<string name="TLA_menu_search">搜索</string>
<string name="TLA_menu_settings">设置</string>
<string name="TAd_hiddenFormat">%s [已隐藏]</string>
<string name="TAd_completed">完成\n%s 项</string>
<string name="TAd_actionEditTask">编辑</string>
<string name="SSD_sort_drag">手动指定来显示子任务</string>

@ -26,7 +26,6 @@
<string name="TLA_menu_sort">排序</string>
<string name="TLA_menu_search">搜索</string>
<string name="TLA_menu_settings">設定</string>
<string name="TAd_hiddenFormat">%s [隱藏]</string>
<string name="TAd_completed">%s\n完成</string>
<string name="TAd_actionEditTask">編輯</string>
<string name="SSD_sort_auto">Tasks智慧排序</string>

@ -92,11 +92,6 @@ File %1$s contained %2$s.\n\n
<!-- Menu: Settings -->
<string name="TLA_menu_settings">Settings</string>
<!-- ====================================================== TaskAdapter == -->
<!-- Format string to indicate task is hidden (%s => task name) -->
<string name="TAd_hiddenFormat">%s [hidden]</string>
<!-- slide 15a: Action Button: edit task -->
<string name="TAd_actionEditTask">Edit</string>
<string name="action_call">Call</string>

Loading…
Cancel
Save