|
|
@ -13,8 +13,8 @@ import android.util.DisplayMetrics;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
import android.view.ViewGroup.MarginLayoutParams;
|
|
|
|
import android.view.ViewGroup.MarginLayoutParams;
|
|
|
|
import android.widget.ImageView;
|
|
|
|
|
|
|
|
import android.widget.TextView;
|
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
|
|
import androidx.core.widget.TextViewCompat;
|
|
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
|
|
import butterknife.BindView;
|
|
|
|
import butterknife.BindView;
|
|
|
|
import butterknife.ButterKnife;
|
|
|
|
import butterknife.ButterKnife;
|
|
|
@ -44,6 +44,7 @@ public class ViewHolder extends RecyclerView.ViewHolder {
|
|
|
|
private final DisplayMetrics metrics;
|
|
|
|
private final DisplayMetrics metrics;
|
|
|
|
private final int background;
|
|
|
|
private final int background;
|
|
|
|
private final int selectedColor;
|
|
|
|
private final int selectedColor;
|
|
|
|
|
|
|
|
private final int rowPadding;
|
|
|
|
private final Linkify linkify;
|
|
|
|
private final Linkify linkify;
|
|
|
|
private final int textColorOverdue;
|
|
|
|
private final int textColorOverdue;
|
|
|
|
private final ChipProvider chipProvider;
|
|
|
|
private final ChipProvider chipProvider;
|
|
|
@ -71,9 +72,6 @@ public class ViewHolder extends RecyclerView.ViewHolder {
|
|
|
|
@BindView(R.id.chip_group)
|
|
|
|
@BindView(R.id.chip_group)
|
|
|
|
ChipGroup chipGroup;
|
|
|
|
ChipGroup chipGroup;
|
|
|
|
|
|
|
|
|
|
|
|
@BindView(R.id.hidden_status)
|
|
|
|
|
|
|
|
ImageView hidden;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private int indent;
|
|
|
|
private int indent;
|
|
|
|
private boolean selected;
|
|
|
|
private boolean selected;
|
|
|
|
private boolean moving;
|
|
|
|
private boolean moving;
|
|
|
@ -106,6 +104,7 @@ public class ViewHolder extends RecyclerView.ViewHolder {
|
|
|
|
this.metrics = metrics;
|
|
|
|
this.metrics = metrics;
|
|
|
|
this.background = background;
|
|
|
|
this.background = background;
|
|
|
|
this.selectedColor = selectedColor;
|
|
|
|
this.selectedColor = selectedColor;
|
|
|
|
|
|
|
|
this.rowPadding = rowPadding;
|
|
|
|
this.linkify = linkify;
|
|
|
|
this.linkify = linkify;
|
|
|
|
ButterKnife.bind(this, view);
|
|
|
|
ButterKnife.bind(this, view);
|
|
|
|
|
|
|
|
|
|
|
@ -122,7 +121,8 @@ public class ViewHolder extends RecyclerView.ViewHolder {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (atLeastKitKat()) {
|
|
|
|
if (atLeastKitKat()) {
|
|
|
|
rowBody.setPadding(0, rowPadding, 0, rowPadding);
|
|
|
|
setTopPadding(rowPadding, nameView, completeBox);
|
|
|
|
|
|
|
|
setBottomPadding(rowPadding, completeBox);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
MarginLayoutParams lp = (MarginLayoutParams) rowBody.getLayoutParams();
|
|
|
|
MarginLayoutParams lp = (MarginLayoutParams) rowBody.getLayoutParams();
|
|
|
|
lp.setMargins(lp.leftMargin, rowPadding, lp.rightMargin, rowPadding);
|
|
|
|
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() {
|
|
|
|
boolean isMoving() {
|
|
|
|
return moving;
|
|
|
|
return moving;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -188,7 +200,8 @@ public class ViewHolder extends RecyclerView.ViewHolder {
|
|
|
|
this.indent = task.indent;
|
|
|
|
this.indent = task.indent;
|
|
|
|
|
|
|
|
|
|
|
|
nameView.setText(task.getTitle());
|
|
|
|
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();
|
|
|
|
setupTitleAndCheckbox();
|
|
|
|
setupDueDate();
|
|
|
|
setupDueDate();
|
|
|
|
if (preferences.getBoolean(R.string.p_show_list_indicators, true)) {
|
|
|
|
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.setOnClickListener(view -> onRowBodyClick());
|
|
|
|
description.setOnLongClickListener(view -> onRowBodyLongClick());
|
|
|
|
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() {
|
|
|
|
private void setupTitleAndCheckbox() {
|
|
|
|