diff --git a/app/src/main/java/org/tasks/tasklist/ViewHolder.java b/app/src/main/java/org/tasks/tasklist/ViewHolder.java index f49c17bde..779002e9c 100644 --- a/app/src/main/java/org/tasks/tasklist/ViewHolder.java +++ b/app/src/main/java/org/tasks/tasklist/ViewHolder.java @@ -13,8 +13,8 @@ import android.util.DisplayMetrics; import android.view.View; import android.view.ViewGroup; import android.view.ViewGroup.MarginLayoutParams; -import android.widget.ImageView; import android.widget.TextView; +import androidx.core.widget.TextViewCompat; import androidx.recyclerview.widget.RecyclerView; import butterknife.BindView; import butterknife.ButterKnife; @@ -44,6 +44,7 @@ public class ViewHolder extends RecyclerView.ViewHolder { private final DisplayMetrics metrics; private final int background; private final int selectedColor; + private final int rowPadding; private final Linkify linkify; private final int textColorOverdue; private final ChipProvider chipProvider; @@ -71,9 +72,6 @@ public 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; @@ -106,6 +104,7 @@ public class ViewHolder extends RecyclerView.ViewHolder { this.metrics = metrics; this.background = background; this.selectedColor = selectedColor; + this.rowPadding = rowPadding; this.linkify = linkify; ButterKnife.bind(this, view); @@ -122,7 +121,8 @@ public class ViewHolder extends RecyclerView.ViewHolder { } if (atLeastKitKat()) { - rowBody.setPadding(0, rowPadding, 0, rowPadding); + setTopPadding(rowPadding, nameView, completeBox); + setBottomPadding(rowPadding, completeBox); } else { MarginLayoutParams lp = (MarginLayoutParams) rowBody.getLayoutParams(); lp.setMargins(lp.leftMargin, rowPadding, lp.rightMargin, rowPadding); @@ -139,6 +139,18 @@ public class ViewHolder extends RecyclerView.ViewHolder { } } + private void setTopPadding(int padding, View... views) { + for (View v : views) { + v.setPadding(v.getPaddingLeft(), padding, v.getPaddingRight(), v.getPaddingBottom()); + } + } + + private void setBottomPadding(int padding, View... views) { + for (View v : views) { + v.setPadding(v.getPaddingLeft(), v.getPaddingTop(), v.getPaddingRight(), padding); + } + } + boolean isMoving() { return moving; } @@ -188,7 +200,8 @@ public class ViewHolder extends RecyclerView.ViewHolder { this.indent = task.indent; nameView.setText(task.getTitle()); - hidden.setVisibility(task.isHidden() ? View.VISIBLE : View.GONE); + TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds( + nameView, task.isHidden() ? R.drawable.ic_outline_visibility_off_24px : 0, 0, 0, 0); setupTitleAndCheckbox(); setupDueDate(); if (preferences.getBoolean(R.string.p_show_list_indicators, true)) { @@ -206,6 +219,17 @@ public class ViewHolder extends RecyclerView.ViewHolder { description.setOnClickListener(view -> onRowBodyClick()); description.setOnLongClickListener(view -> onRowBodyLongClick()); } + if (atLeastKitKat()) { + if (chipGroup.getVisibility() == View.VISIBLE) { + setBottomPadding(rowPadding, chipGroup); + setBottomPadding(0, description, nameView); + } else if (description.getVisibility() == View.VISIBLE) { + setBottomPadding(rowPadding, description); + setBottomPadding(0, nameView); + } else { + setBottomPadding(rowPadding, nameView); + } + } } private void setupTitleAndCheckbox() { diff --git a/app/src/main/res/layout/task_adapter_row_body.xml b/app/src/main/res/layout/task_adapter_row_body.xml index d4c67e753..bc6454a59 100644 --- a/app/src/main/res/layout/task_adapter_row_body.xml +++ b/app/src/main/res/layout/task_adapter_row_body.xml @@ -35,27 +35,13 @@ android:singleLine="true" android:textSize="14sp"/> - - + android:textSize="@dimen/task_edit_text_size" + android:drawablePadding="2dp" + app:drawableTint="@color/icon_tint_with_alpha"/> @color/grey_800 @color/grey_800 @color/icon_tint_dark + @color/icon_tint_dark_alpha @color/drawer_background_dark @color/drawer_background_dark_selected @color/white_70 diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 58e9aa235..1ef95d1ff 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -101,6 +101,8 @@ #000000 @android:color/black @android:color/white + @color/black_54 + @color/white_70 #f9f9f9 #e8e8e8 @@ -126,6 +128,7 @@ @android:color/white @android:color/white @color/icon_tint_light + @color/icon_tint_light_alpha @color/drawer_background_light @color/drawer_background_light_selected @color/black_54