Brought back the compressed task row preference

pull/14/head
Sam Bosley 12 years ago
parent 30e0f77180
commit fea2d746b2

@ -68,6 +68,7 @@ public class ReusableTaskAdapter extends TaskAdapter {
task.readFromCursor(cursor);
viewHolder.title.setText(task.getValue(Task.TITLE));
view.setMinimumHeight(minRowHeight);
}
public static class ReusableTaskViewHolder {

@ -238,6 +238,8 @@
<string name="p_showSmartConfirmation_key">showSmartConfirmation</string>
<string name="p_allowCompressedTaskRows">allowCompressedTaskRows</string>
<string name="p_taskRowPrefs">taskRowPrefs</string>
<string name="p_fullTaskTitle">fullTaskTitle</string>

@ -46,6 +46,12 @@
android:title="@string/EPr_fullTask_title"
android:defaultValue="false" />
<com.todoroo.astrid.ui.MultilineCheckboxPreference
android:key="@string/p_allowCompressedTaskRows"
android:title="@string/EPr_compressTaskRows_title"
android:summary="@string/EPr_compressTaskRows_desc"
android:defaultValue="false" />
<com.todoroo.astrid.ui.MultilineCheckboxPreference
android:key="@string/p_showNotes"
android:title="@string/EPr_showNotes_title"

@ -635,7 +635,7 @@ public class EditPreferences extends TodorooPreferenceActivity {
}
public void addPreferenceListeners() {
findPreference(getString(R.string.p_theme)).setOnPreferenceChangeListener(new SetResultOnPreferenceChangeListener(RESULT_CODE_THEME_CHANGED));
findPreference(getString(R.string.p_theme)).setOnPreferenceChangeListener(new SetResultOnPreferenceChangeListener(RESULT_CODE_PERFORMANCE_PREF_CHANGED));
findPreference(getString(R.string.p_theme_widget)).setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
@ -646,6 +646,8 @@ public class EditPreferences extends TodorooPreferenceActivity {
}
});
findPreference(getString(R.string.p_allowCompressedTaskRows)).setOnPreferenceChangeListener(new SetResultOnPreferenceChangeListener(RESULT_CODE_THEME_CHANGED));
findPreference(getString(R.string.p_statistics)).setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {

@ -200,6 +200,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
protected final DisplayMetrics displayMetrics;
private final boolean simpleLayout;
protected final int minRowHeight;
// --- task detail and decoration soft caches
@ -239,6 +240,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
fragment.getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
this.simpleLayout = (resource == R.layout.task_adapter_row_simple);
this.minRowHeight = computeMinRowHeight();
startDetailThread();
startTaskActionsThread();
@ -251,6 +253,15 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
}
private int computeMinRowHeight() {
DisplayMetrics metrics = resources.getDisplayMetrics();
if (simpleLayout) {
return (int) (metrics.density * 40);
} else {
return (int) (metrics.density * 45);
}
}
private void startDetailThread() {
if (Preferences.getBoolean(R.string.p_showNotes, false) && !simpleLayout) {
detailLoader = new DetailLoaderThread();
@ -382,6 +393,13 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
public synchronized void setFieldContentsAndVisibility(View view) {
ViewHolder viewHolder = (ViewHolder)view.getTag();
Task task = viewHolder.task;
if (Preferences.getBoolean(R.string.p_allowCompressedTaskRows, false)) {
viewHolder.rowBody.setMinimumHeight(0);
viewHolder.completeBox.setMinimumHeight(0);
} else {
viewHolder.rowBody.setMinimumHeight(minRowHeight);
viewHolder.completeBox.setMinimumHeight(minRowHeight);
}
// name
final TextView nameView = viewHolder.nameView; {

Loading…
Cancel
Save