Polish, ab test, and preference for row style

pull/14/head
Sam Bosley 13 years ago
parent ec8afe8bd2
commit 67a57eb5f4

@ -106,6 +106,7 @@
android:id="@+id/taskActionContainer" android:id="@+id/taskActionContainer"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="5dip"
android:layout_marginRight="10dip" android:layout_marginRight="10dip"
android:orientation="vertical" android:orientation="vertical"
android:gravity="right|center_vertical"> android:gravity="right|center_vertical">

@ -197,6 +197,7 @@
<string name="p_colorize">colorize</string> <string name="p_colorize">colorize</string>
<string name="p_fontSize">font_size</string> <string name="p_fontSize">font_size</string>
<string name="p_taskRowStyle">p_taskRowStyle</string>
<string name="p_showNotes">notesVisible</string> <string name="p_showNotes">notesVisible</string>
<string name="p_beastMode">beastMode</string> <string name="p_beastMode">beastMode</string>
<string name="p_transparent_deprecated">transparent</string> <string name="p_transparent_deprecated">transparent</string>

@ -640,6 +640,12 @@
<string name="EPr_ideaAuto_desc_enabled">Web searches for Ideas tab will be performed when tab is clicked</string> <string name="EPr_ideaAuto_desc_enabled">Web searches for Ideas tab will be performed when tab is clicked</string>
<string name="EPr_ideaAuto_desc_disabled">Web searches for Ideas tab will be performed only when manually requested</string> <string name="EPr_ideaAuto_desc_disabled">Web searches for Ideas tab will be performed only when manually requested</string>
<!-- Preferences: task row style -->
<string name="EPr_task_row_style_title_simple">Row Style: Simple</string>
<string name="EPr_task_row_style_title_legacy">Row Style: Original</string>
<string name="EPr_task_row_style_summary_simple">Truncate title to one line with date and lists below</string>
<string name="EPr_task_row_style_summary_legacy">Truncate title to two lines with date on right</string>
<!-- slide 30f/ 36f: Preference: Theme --> <!-- slide 30f/ 36f: Preference: Theme -->
<string name="EPr_theme_title">Color Theme</string> <string name="EPr_theme_title">Color Theme</string>
<!-- Preference: Theme Description (%s => value) --> <!-- Preference: Theme Description (%s => value) -->

@ -37,6 +37,10 @@
android:title="@string/EPr_fontSize_title" android:title="@string/EPr_fontSize_title"
android:summary="@string/EPr_fontSize_desc" /> android:summary="@string/EPr_fontSize_desc" />
<com.todoroo.astrid.ui.MultilineCheckboxPreference
android:key="@string/p_taskRowStyle"
android:defaultValue="false"/>
<com.todoroo.astrid.ui.MultilineCheckboxPreference <com.todoroo.astrid.ui.MultilineCheckboxPreference
android:key="@string/p_fullTaskTitle" android:key="@string/p_fullTaskTitle"
android:title="@string/EPr_fullTask_title" android:title="@string/EPr_fullTask_title"

@ -222,6 +222,9 @@ public class EditPreferences extends TodorooPreferenceActivity {
preference.setEnabled(Preferences.getBoolean(R.string.p_force_phone_layout, false)); preference.setEnabled(Preferences.getBoolean(R.string.p_force_phone_layout, false));
} }
preference = screen.findPreference(getString(R.string.p_showNotes));
preference.setEnabled(!Preferences.getBoolean(R.string.p_taskRowStyle, false));
removeForbiddenPreferences(screen, r); removeForbiddenPreferences(screen, r);
} }
@ -467,6 +470,23 @@ public class EditPreferences extends TodorooPreferenceActivity {
} }
preference.setTitle(title); preference.setTitle(title);
preference.setSummary(summary); preference.setSummary(summary);
} else if (r.getString(R.string.p_taskRowStyle).equals(preference.getKey())) {
if (value != null && !(Boolean)value) {
preference.setTitle(R.string.EPr_task_row_style_title_legacy);
preference.setSummary(R.string.EPr_task_row_style_summary_legacy);
} else {
preference.setTitle(R.string.EPr_task_row_style_title_simple);
preference.setSummary(R.string.EPr_task_row_style_summary_simple);
}
preference.setOnPreferenceChangeListener(new SetResultOnPreferenceChangeListener(RESULT_CODE_PERFORMANCE_PREF_CHANGED) {
@Override
public boolean onPreferenceChange(Preference p, Object newValue) {
Preference notes = findPreference(getString(R.string.p_showNotes));
notes.setEnabled(!(Boolean) newValue);
return super.onPreferenceChange(p, newValue);
};
});
} else if (r.getString(R.string.p_showNotes).equals(preference.getKey())) { } else if (r.getString(R.string.p_showNotes).equals(preference.getKey())) {
if (value != null && !(Boolean)value) if (value != null && !(Boolean)value)
preference.setSummary(R.string.EPr_showNotes_desc_disabled); preference.setSummary(R.string.EPr_showNotes_desc_disabled);

@ -873,7 +873,10 @@ public class TaskListFragment extends ListFragment implements OnScrollListener,
} }
protected TaskAdapter createTaskAdapter(TodorooCursor<Task> cursor) { protected TaskAdapter createTaskAdapter(TodorooCursor<Task> cursor) {
return new TaskAdapter(this, R.layout.task_adapter_row_simple, int resource = Preferences.getBoolean(R.string.p_taskRowStyle, false) ?
R.layout.task_adapter_row_simple : R.layout.task_adapter_row;
return new TaskAdapter(this, resource,
cursor, sqlQueryTemplate, false, cursor, sqlQueryTemplate, false,
new OnCompletedTaskListener() { new OnCompletedTaskListener() {
@Override @Override

@ -116,7 +116,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
Metadata.ID.name).as("taskRabId"); //$NON-NLS-1$ Metadata.ID.name).as("taskRabId"); //$NON-NLS-1$
@SuppressWarnings("nls") @SuppressWarnings("nls")
private static final StringProperty TAGS = new StringProperty(null, "group_concat(" + TaskListFragment.TAGS_METADATA_JOIN + "." + TagService.TAG.name + ", ' | ')").as("tags"); private static final StringProperty TAGS = new StringProperty(null, "group_concat(" + TaskListFragment.TAGS_METADATA_JOIN + "." + TagService.TAG.name + ", ' | ')").as("tags");
// --- other constants // --- other constants
@ -1046,15 +1046,21 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
name.setTextAppearance(activity, R.style.TextAppearance_TAd_ItemTitle); name.setTextAppearance(activity, R.style.TextAppearance_TAd_ItemTitle);
} }
name.setTextSize(fontSize); name.setTextSize(fontSize);
float detailTextSize = Math.max(10, fontSize * 12 / 20); float detailTextSize = Math.max(10, fontSize * 14 / 20);
if(viewHolder.details1 != null) if(viewHolder.details1 != null)
viewHolder.details1.setTextSize(detailTextSize); viewHolder.details1.setTextSize(detailTextSize);
if(viewHolder.details2 != null) if(viewHolder.details2 != null)
viewHolder.details2.setTextSize(detailTextSize); viewHolder.details2.setTextSize(detailTextSize);
if(viewHolder.dueDate != null) if(viewHolder.dueDate != null) {
viewHolder.dueDate.setTextSize(detailTextSize); viewHolder.dueDate.setTextSize(detailTextSize);
if (viewHolder.tagsView != null) if (simpleLayout)
viewHolder.dueDate.setTypeface(null, 0);
}
if (viewHolder.tagsView != null) {
viewHolder.tagsView.setTextSize(detailTextSize); viewHolder.tagsView.setTextSize(detailTextSize);
if (simpleLayout)
viewHolder.tagsView.setTypeface(null, 0);
}
paint.setTextSize(detailTextSize); paint.setTextSize(detailTextSize);
// image view // image view
@ -1155,7 +1161,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
if (viewHolder.tagsView != null) { if (viewHolder.tagsView != null) {
String tags = viewHolder.tagsString; String tags = viewHolder.tagsString;
if (tags != null && task.hasDueDate()) if (tags != null && task.hasDueDate())
tags = " | " + tags; //$NON-NLS-1$ tags = " | " + tags; //$NON-NLS-1$
if (!task.isCompleted()) if (!task.isCompleted())
viewHolder.tagsView.setText(tags); viewHolder.tagsView.setText(tags);
else else

@ -123,10 +123,15 @@ public class ABTests {
public static final String AB_SWIPE_BETWEEN = "android_swipe_v3"; //$NON-NLS-1$ public static final String AB_SWIPE_BETWEEN = "android_swipe_v3"; //$NON-NLS-1$
public static final String AB_SIMPLE_TASK_ROW = "android_simple_task_row"; //$NON-NLS-1$
private void initialize() { private void initialize() {
addTest(AB_TASK_EDIT_TOAST, new int[] { 1, 1 }, addTest(AB_TASK_EDIT_TOAST, new int[] { 1, 1 },
new int[] { 1, 1 }, new String[] { "dont-show-toasts", "show-toasts" }); //$NON-NLS-1$ //$NON-NLS-2$ new int[] { 1, 1 }, new String[] { "dont-show-toasts", "show-toasts" }); //$NON-NLS-1$ //$NON-NLS-2$
addTest(AB_SIMPLE_TASK_ROW, new int[] { 1, 1 },
new int[] { 1, 0 }, new String[] { "original-row-style", "simple-row-style" });//$NON-NLS-1$ //$NON-NLS-2$
// AB_SWIPE_BETWEEN has to be added in the startup service since it needs a non-null context for initialization // AB_SWIPE_BETWEEN has to be added in the startup service since it needs a non-null context for initialization
} }
} }

@ -74,6 +74,9 @@ public class AstridPreferences {
Preferences.setIfUnset(prefs, editor, r, R.string.p_showEditToasts, Preferences.setIfUnset(prefs, editor, r, R.string.p_showEditToasts,
ABChooser.readChoiceForTest(ABTests.AB_TASK_EDIT_TOAST) != 0); ABChooser.readChoiceForTest(ABTests.AB_TASK_EDIT_TOAST) != 0);
Preferences.setIfUnset(prefs, editor, r, R.string.p_taskRowStyle,
ABChooser.readChoiceForTest(ABTests.AB_SIMPLE_TASK_ROW) != 0);
boolean swipeEnabled = false; boolean swipeEnabled = false;
String swipePerformanceKey = context.getString(R.string.p_swipe_lists_performance_key); String swipePerformanceKey = context.getString(R.string.p_swipe_lists_performance_key);
if (Preferences.isSet(swipePerformanceKey)) { if (Preferences.isSet(swipePerformanceKey)) {

Loading…
Cancel
Save