|
|
@ -19,7 +19,6 @@ import android.text.method.LinkMovementMethod;
|
|
|
|
import android.text.style.BackgroundColorSpan;
|
|
|
|
import android.text.style.BackgroundColorSpan;
|
|
|
|
import android.text.style.ForegroundColorSpan;
|
|
|
|
import android.text.style.ForegroundColorSpan;
|
|
|
|
import android.text.util.Linkify;
|
|
|
|
import android.text.util.Linkify;
|
|
|
|
import android.util.DisplayMetrics;
|
|
|
|
|
|
|
|
import android.util.TypedValue;
|
|
|
|
import android.util.TypedValue;
|
|
|
|
import android.view.LayoutInflater;
|
|
|
|
import android.view.LayoutInflater;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.View;
|
|
|
@ -140,10 +139,6 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
|
|
|
|
|
|
|
|
|
|
|
|
private final AtomicReference<String> query;
|
|
|
|
private final AtomicReference<String> query;
|
|
|
|
|
|
|
|
|
|
|
|
// measure utilities
|
|
|
|
|
|
|
|
private final DisplayMetrics displayMetrics;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final int minRowHeight;
|
|
|
|
|
|
|
|
private final float tagCharacters;
|
|
|
|
private final float tagCharacters;
|
|
|
|
|
|
|
|
|
|
|
|
private final Map<String, TagData> tagMap = new HashMap<>();
|
|
|
|
private final Map<String, TagData> tagMap = new HashMap<>();
|
|
|
@ -176,30 +171,14 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
|
|
|
|
tagCharacters = typedValue.getFloat();
|
|
|
|
tagCharacters = typedValue.getFloat();
|
|
|
|
|
|
|
|
|
|
|
|
fontSize = preferences.getIntegerFromString(R.string.p_fontSize, 18);
|
|
|
|
fontSize = preferences.getIntegerFromString(R.string.p_fontSize, 18);
|
|
|
|
displayMetrics = new DisplayMetrics();
|
|
|
|
|
|
|
|
fragment.getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
textColorSecondary = getData(context, android.R.attr.textColorSecondary);
|
|
|
|
textColorSecondary = getData(context, android.R.attr.textColorSecondary);
|
|
|
|
textColorHint = getData(context, android.R.attr.textColorTertiary);
|
|
|
|
textColorHint = getData(context, android.R.attr.textColorTertiary);
|
|
|
|
textColorOverdue = getColor(context, R.color.overdue);
|
|
|
|
textColorOverdue = getColor(context, R.color.overdue);
|
|
|
|
|
|
|
|
|
|
|
|
updateTagMap();
|
|
|
|
updateTagMap();
|
|
|
|
this.minRowHeight = computeMinRowHeight();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private int computeMinRowHeight() {
|
|
|
|
|
|
|
|
DisplayMetrics metrics = resources.getDisplayMetrics();
|
|
|
|
|
|
|
|
return (int) (metrics.density * 40);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int computeFullRowHeight() {
|
|
|
|
|
|
|
|
DisplayMetrics metrics = resources.getDisplayMetrics();
|
|
|
|
|
|
|
|
if (fontSize < 16) {
|
|
|
|
|
|
|
|
return (int) (39 * metrics.density);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return minRowHeight + (int) (10 * metrics.density);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* ======================================================================
|
|
|
|
/* ======================================================================
|
|
|
|
* =========================================================== filterable
|
|
|
|
* =========================================================== filterable
|
|
|
@ -261,7 +240,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
|
|
|
|
boolean showFullTaskTitle = preferences.getBoolean(R.string.p_fullTaskTitle, false);
|
|
|
|
boolean showFullTaskTitle = preferences.getBoolean(R.string.p_fullTaskTitle, false);
|
|
|
|
|
|
|
|
|
|
|
|
// create view holder
|
|
|
|
// create view holder
|
|
|
|
new ViewHolder(view, showFullTaskTitle);
|
|
|
|
new ViewHolder(view, showFullTaskTitle, fontSize);
|
|
|
|
|
|
|
|
|
|
|
|
// add UI component listeners
|
|
|
|
// add UI component listeners
|
|
|
|
addListeners(view);
|
|
|
|
addListeners(view);
|
|
|
@ -297,13 +276,6 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
|
|
|
|
public synchronized void setFieldContentsAndVisibility(View view) {
|
|
|
|
public synchronized void setFieldContentsAndVisibility(View view) {
|
|
|
|
ViewHolder viewHolder = (ViewHolder)view.getTag();
|
|
|
|
ViewHolder viewHolder = (ViewHolder)view.getTag();
|
|
|
|
Task task = viewHolder.task;
|
|
|
|
Task task = viewHolder.task;
|
|
|
|
if (fontSize < 16) {
|
|
|
|
|
|
|
|
viewHolder.rowBody.setMinimumHeight(0);
|
|
|
|
|
|
|
|
viewHolder.completeBox.setMinimumHeight(0);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
viewHolder.rowBody.setMinimumHeight(minRowHeight);
|
|
|
|
|
|
|
|
viewHolder.completeBox.setMinimumHeight(minRowHeight);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// name
|
|
|
|
// name
|
|
|
|
final TextView nameView = viewHolder.nameView; {
|
|
|
|
final TextView nameView = viewHolder.nameView; {
|
|
|
@ -422,7 +394,6 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void notifyDataSetChanged() {
|
|
|
|
public void notifyDataSetChanged() {
|
|
|
|
super.notifyDataSetChanged();
|
|
|
|
super.notifyDataSetChanged();
|
|
|
|
fontSize = preferences.getIntegerFromString(R.string.p_fontSize, 18);
|
|
|
|
|
|
|
|
updateTagMap();
|
|
|
|
updateTagMap();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -633,5 +604,4 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|