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:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dip"
android:layout_marginRight="10dip"
android:orientation="vertical"
android:gravity="right|center_vertical">

@ -197,6 +197,7 @@
<string name="p_colorize">colorize</string>
<string name="p_fontSize">font_size</string>
<string name="p_taskRowStyle">p_taskRowStyle</string>
<string name="p_showNotes">notesVisible</string>
<string name="p_beastMode">beastMode</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_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 -->
<string name="EPr_theme_title">Color Theme</string>
<!-- Preference: Theme Description (%s => value) -->

@ -37,6 +37,10 @@
android:title="@string/EPr_fontSize_title"
android:summary="@string/EPr_fontSize_desc" />
<com.todoroo.astrid.ui.MultilineCheckboxPreference
android:key="@string/p_taskRowStyle"
android:defaultValue="false"/>
<com.todoroo.astrid.ui.MultilineCheckboxPreference
android:key="@string/p_fullTaskTitle"
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 = screen.findPreference(getString(R.string.p_showNotes));
preference.setEnabled(!Preferences.getBoolean(R.string.p_taskRowStyle, false));
removeForbiddenPreferences(screen, r);
}
@ -467,6 +470,23 @@ public class EditPreferences extends TodorooPreferenceActivity {
}
preference.setTitle(title);
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())) {
if (value != null && !(Boolean)value)
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) {
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,
new OnCompletedTaskListener() {
@Override

@ -116,7 +116,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
Metadata.ID.name).as("taskRabId"); //$NON-NLS-1$
@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
@ -1046,15 +1046,21 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
name.setTextAppearance(activity, R.style.TextAppearance_TAd_ItemTitle);
}
name.setTextSize(fontSize);
float detailTextSize = Math.max(10, fontSize * 12 / 20);
float detailTextSize = Math.max(10, fontSize * 14 / 20);
if(viewHolder.details1 != null)
viewHolder.details1.setTextSize(detailTextSize);
if(viewHolder.details2 != null)
viewHolder.details2.setTextSize(detailTextSize);
if(viewHolder.dueDate != null)
if(viewHolder.dueDate != null) {
viewHolder.dueDate.setTextSize(detailTextSize);
if (viewHolder.tagsView != null)
if (simpleLayout)
viewHolder.dueDate.setTypeface(null, 0);
}
if (viewHolder.tagsView != null) {
viewHolder.tagsView.setTextSize(detailTextSize);
if (simpleLayout)
viewHolder.tagsView.setTypeface(null, 0);
}
paint.setTextSize(detailTextSize);
// image view
@ -1155,7 +1161,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
if (viewHolder.tagsView != null) {
String tags = viewHolder.tagsString;
if (tags != null && task.hasDueDate())
tags = " | " + tags; //$NON-NLS-1$
tags = " | " + tags; //$NON-NLS-1$
if (!task.isCompleted())
viewHolder.tagsView.setText(tags);
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_SIMPLE_TASK_ROW = "android_simple_task_row"; //$NON-NLS-1$
private void initialize() {
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$
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
}
}

@ -74,6 +74,9 @@ public class AstridPreferences {
Preferences.setIfUnset(prefs, editor, r, R.string.p_showEditToasts,
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;
String swipePerformanceKey = context.getString(R.string.p_swipe_lists_performance_key);
if (Preferences.isSet(swipePerformanceKey)) {

Loading…
Cancel
Save