diff --git a/actionbarsherlock/library/.classpath b/actionbarsherlock/library/.classpath new file mode 100644 index 000000000..a4763d1ee --- /dev/null +++ b/actionbarsherlock/library/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/actionbarsherlock/library/.project b/actionbarsherlock/library/.project new file mode 100644 index 000000000..be2b2c053 --- /dev/null +++ b/actionbarsherlock/library/.project @@ -0,0 +1,33 @@ + + + actionbarsherlock + + + + + + com.android.ide.eclipse.adt.ResourceManagerBuilder + + + + + com.android.ide.eclipse.adt.PreCompilerBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + com.android.ide.eclipse.adt.ApkBuilder + + + + + + com.android.ide.eclipse.adt.AndroidNature + org.eclipse.jdt.core.javanature + + diff --git a/actionbarsherlock/library/bin/actionbarsherlock.jar b/actionbarsherlock/library/bin/actionbarsherlock.jar new file mode 100644 index 000000000..3dd76be0e Binary files /dev/null and b/actionbarsherlock/library/bin/actionbarsherlock.jar differ diff --git a/actionbarsherlock/library/bin/res/drawable-hdpi/abs__ab_stacked_transparent_dark_holo.9.png b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__ab_stacked_transparent_dark_holo.9.png new file mode 100644 index 000000000..48bc53693 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__ab_stacked_transparent_dark_holo.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-hdpi/abs__ab_stacked_transparent_light_holo.9.png b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__ab_stacked_transparent_light_holo.9.png new file mode 100644 index 000000000..46fcf7183 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__ab_stacked_transparent_light_holo.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-hdpi/abs__cab_background_holo_dark.9.png b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__cab_background_holo_dark.9.png new file mode 100644 index 000000000..26816ae48 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__cab_background_holo_dark.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-hdpi/abs__cab_background_holo_light.9.png b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__cab_background_holo_light.9.png new file mode 100644 index 000000000..db78cc217 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__cab_background_holo_light.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-hdpi/abs__cab_ic_close_focused_holo.png b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__cab_ic_close_focused_holo.png new file mode 100644 index 000000000..abcc8eb1e Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__cab_ic_close_focused_holo.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-hdpi/abs__cab_ic_close_normal_holo.png b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__cab_ic_close_normal_holo.png new file mode 100644 index 000000000..f0df90d8f Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__cab_ic_close_normal_holo.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-hdpi/abs__cab_ic_close_pressed_holo.png b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__cab_ic_close_pressed_holo.png new file mode 100644 index 000000000..e689d42c7 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__cab_ic_close_pressed_holo.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-hdpi/abs__ic_ab_back_holo_dark.png b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__ic_ab_back_holo_dark.png new file mode 100644 index 000000000..f54eb1871 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__ic_ab_back_holo_dark.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-hdpi/abs__ic_ab_back_holo_light.png b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__ic_ab_back_holo_light.png new file mode 100644 index 000000000..96d888731 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__ic_ab_back_holo_light.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-hdpi/abs__list_focused_holo.9.png b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__list_focused_holo.9.png new file mode 100644 index 000000000..1820612c3 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__list_focused_holo.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-hdpi/abs__list_longpressed_holo.9.png b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__list_longpressed_holo.9.png new file mode 100644 index 000000000..28ef22375 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__list_longpressed_holo.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-hdpi/abs__list_pressed_holo_dark.9.png b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__list_pressed_holo_dark.9.png new file mode 100644 index 000000000..80509cdfd Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__list_pressed_holo_dark.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-hdpi/abs__list_pressed_holo_light.9.png b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__list_pressed_holo_light.9.png new file mode 100644 index 000000000..e4f4e44a9 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__list_pressed_holo_light.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-hdpi/abs__list_selector_disabled_holo_dark.9.png b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__list_selector_disabled_holo_dark.9.png new file mode 100644 index 000000000..cb1289628 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__list_selector_disabled_holo_dark.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-hdpi/abs__list_selector_disabled_holo_light.9.png b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__list_selector_disabled_holo_light.9.png new file mode 100644 index 000000000..233da8e3a Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__list_selector_disabled_holo_light.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-hdpi/abs__spinner_default_holo_dark.9.png b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__spinner_default_holo_dark.9.png new file mode 100644 index 000000000..ed820cbbb Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__spinner_default_holo_dark.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-hdpi/abs__spinner_default_holo_light.9.png b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__spinner_default_holo_light.9.png new file mode 100644 index 000000000..8d42e32d9 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__spinner_default_holo_light.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-hdpi/abs__spinner_disabled_holo_dark.9.png b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__spinner_disabled_holo_dark.9.png new file mode 100644 index 000000000..fc08574cc Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__spinner_disabled_holo_dark.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-hdpi/abs__spinner_disabled_holo_light.9.png b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__spinner_disabled_holo_light.9.png new file mode 100644 index 000000000..f6cef0e88 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__spinner_disabled_holo_light.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-hdpi/abs__spinner_focused_holo_dark.9.png b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__spinner_focused_holo_dark.9.png new file mode 100644 index 000000000..ed84951e7 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__spinner_focused_holo_dark.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-hdpi/abs__spinner_focused_holo_light.9.png b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__spinner_focused_holo_light.9.png new file mode 100644 index 000000000..b17ba12f4 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__spinner_focused_holo_light.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-hdpi/abs__spinner_pressed_holo_dark.9.png b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__spinner_pressed_holo_dark.9.png new file mode 100644 index 000000000..5305fa270 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__spinner_pressed_holo_dark.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-hdpi/abs__spinner_pressed_holo_light.9.png b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__spinner_pressed_holo_light.9.png new file mode 100644 index 000000000..db9795b9f Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__spinner_pressed_holo_light.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-hdpi/abs__tab_selected_focused_holo.9.png b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__tab_selected_focused_holo.9.png new file mode 100644 index 000000000..e32e685f4 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__tab_selected_focused_holo.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-hdpi/abs__tab_selected_holo.9.png b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__tab_selected_holo.9.png new file mode 100644 index 000000000..ec10b59bf Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__tab_selected_holo.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-hdpi/abs__tab_selected_pressed_focused_holo.9.png b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__tab_selected_pressed_focused_holo.9.png new file mode 100644 index 000000000..6eea722c6 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__tab_selected_pressed_focused_holo.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-hdpi/abs__tab_selected_pressed_holo.9.png b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__tab_selected_pressed_holo.9.png new file mode 100644 index 000000000..86a18383f Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__tab_selected_pressed_holo.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-hdpi/abs__tab_unselected_focused_holo.9.png b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__tab_unselected_focused_holo.9.png new file mode 100644 index 000000000..4206afbc5 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__tab_unselected_focused_holo.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-hdpi/abs__tab_unselected_holo.9.png b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__tab_unselected_holo.9.png new file mode 100644 index 000000000..2ffb0bbc5 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__tab_unselected_holo.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-hdpi/abs__tab_unselected_pressed_focused_holo.9.png b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__tab_unselected_pressed_focused_holo.9.png new file mode 100644 index 000000000..dd8a74931 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__tab_unselected_pressed_focused_holo.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-hdpi/abs__tab_unselected_pressed_holo.9.png b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__tab_unselected_pressed_holo.9.png new file mode 100644 index 000000000..199464b69 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-hdpi/abs__tab_unselected_pressed_holo.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-mdpi/abs__ab_stacked_transparent_dark_holo.9.png b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__ab_stacked_transparent_dark_holo.9.png new file mode 100644 index 000000000..6584f9561 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__ab_stacked_transparent_dark_holo.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-mdpi/abs__ab_stacked_transparent_light_holo.9.png b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__ab_stacked_transparent_light_holo.9.png new file mode 100644 index 000000000..f3a769b2b Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__ab_stacked_transparent_light_holo.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-mdpi/abs__cab_background_holo_dark.9.png b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__cab_background_holo_dark.9.png new file mode 100644 index 000000000..d152cdf66 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__cab_background_holo_dark.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-mdpi/abs__cab_background_holo_light.9.png b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__cab_background_holo_light.9.png new file mode 100644 index 000000000..fb30a707d Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__cab_background_holo_light.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-mdpi/abs__cab_ic_close_focused_holo.png b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__cab_ic_close_focused_holo.png new file mode 100644 index 000000000..9e590b1d6 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__cab_ic_close_focused_holo.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-mdpi/abs__cab_ic_close_normal_holo.png b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__cab_ic_close_normal_holo.png new file mode 100644 index 000000000..9c8025310 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__cab_ic_close_normal_holo.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-mdpi/abs__cab_ic_close_pressed_holo.png b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__cab_ic_close_pressed_holo.png new file mode 100644 index 000000000..623629418 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__cab_ic_close_pressed_holo.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-mdpi/abs__ic_ab_back_holo_dark.png b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__ic_ab_back_holo_dark.png new file mode 100644 index 000000000..56720f338 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__ic_ab_back_holo_dark.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-mdpi/abs__ic_ab_back_holo_light.png b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__ic_ab_back_holo_light.png new file mode 100644 index 000000000..3df7657e8 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__ic_ab_back_holo_light.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-mdpi/abs__list_focused_holo.9.png b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__list_focused_holo.9.png new file mode 100644 index 000000000..2287f398f Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__list_focused_holo.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-mdpi/abs__list_longpressed_holo.9.png b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__list_longpressed_holo.9.png new file mode 100644 index 000000000..a39c79f77 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__list_longpressed_holo.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-mdpi/abs__list_pressed_holo_dark.9.png b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__list_pressed_holo_dark.9.png new file mode 100644 index 000000000..bf0175fea Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__list_pressed_holo_dark.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-mdpi/abs__list_pressed_holo_light.9.png b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__list_pressed_holo_light.9.png new file mode 100644 index 000000000..7608d866c Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__list_pressed_holo_light.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-mdpi/abs__list_selector_disabled_holo_dark.9.png b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__list_selector_disabled_holo_dark.9.png new file mode 100644 index 000000000..9428f21a1 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__list_selector_disabled_holo_dark.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-mdpi/abs__list_selector_disabled_holo_light.9.png b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__list_selector_disabled_holo_light.9.png new file mode 100644 index 000000000..80cd8e617 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__list_selector_disabled_holo_light.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-mdpi/abs__spinner_default_holo_dark.9.png b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__spinner_default_holo_dark.9.png new file mode 100644 index 000000000..ff88f7b21 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__spinner_default_holo_dark.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-mdpi/abs__spinner_default_holo_light.9.png b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__spinner_default_holo_light.9.png new file mode 100644 index 000000000..9e758667a Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__spinner_default_holo_light.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-mdpi/abs__spinner_disabled_holo_dark.9.png b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__spinner_disabled_holo_dark.9.png new file mode 100644 index 000000000..03fa2282b Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__spinner_disabled_holo_dark.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-mdpi/abs__spinner_disabled_holo_light.9.png b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__spinner_disabled_holo_light.9.png new file mode 100644 index 000000000..a94939234 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__spinner_disabled_holo_light.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-mdpi/abs__spinner_focused_holo_dark.9.png b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__spinner_focused_holo_dark.9.png new file mode 100644 index 000000000..6b21ce0f1 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__spinner_focused_holo_dark.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-mdpi/abs__spinner_focused_holo_light.9.png b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__spinner_focused_holo_light.9.png new file mode 100644 index 000000000..4f093152f Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__spinner_focused_holo_light.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-mdpi/abs__spinner_pressed_holo_dark.9.png b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__spinner_pressed_holo_dark.9.png new file mode 100644 index 000000000..c61145108 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__spinner_pressed_holo_dark.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-mdpi/abs__spinner_pressed_holo_light.9.png b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__spinner_pressed_holo_light.9.png new file mode 100644 index 000000000..da9eceef0 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__spinner_pressed_holo_light.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-mdpi/abs__tab_selected_focused_holo.9.png b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__tab_selected_focused_holo.9.png new file mode 100644 index 000000000..e75d6c8cc Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__tab_selected_focused_holo.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-mdpi/abs__tab_selected_holo.9.png b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__tab_selected_holo.9.png new file mode 100644 index 000000000..5856dc5f8 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__tab_selected_holo.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-mdpi/abs__tab_selected_pressed_focused_holo.9.png b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__tab_selected_pressed_focused_holo.9.png new file mode 100644 index 000000000..e26b4f951 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__tab_selected_pressed_focused_holo.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-mdpi/abs__tab_selected_pressed_holo.9.png b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__tab_selected_pressed_holo.9.png new file mode 100644 index 000000000..e58bbc631 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__tab_selected_pressed_holo.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-mdpi/abs__tab_unselected_focused_holo.9.png b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__tab_unselected_focused_holo.9.png new file mode 100644 index 000000000..32575002c Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__tab_unselected_focused_holo.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-mdpi/abs__tab_unselected_holo.9.png b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__tab_unselected_holo.9.png new file mode 100644 index 000000000..e18ac5dd6 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__tab_unselected_holo.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-mdpi/abs__tab_unselected_pressed_focused_holo.9.png b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__tab_unselected_pressed_focused_holo.9.png new file mode 100644 index 000000000..524f8cf96 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__tab_unselected_pressed_focused_holo.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-mdpi/abs__tab_unselected_pressed_holo.9.png b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__tab_unselected_pressed_holo.9.png new file mode 100644 index 000000000..a5aacad70 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-mdpi/abs__tab_unselected_pressed_holo.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-nodpi-v11/abs__action_item_divider.9.png b/actionbarsherlock/library/bin/res/drawable-nodpi-v11/abs__action_item_divider.9.png new file mode 100644 index 000000000..f4b21f8f1 Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-nodpi-v11/abs__action_item_divider.9.png differ diff --git a/actionbarsherlock/library/bin/res/drawable-nodpi/abs__action_item_divider.9.png b/actionbarsherlock/library/bin/res/drawable-nodpi/abs__action_item_divider.9.png new file mode 100644 index 000000000..cac34343e Binary files /dev/null and b/actionbarsherlock/library/bin/res/drawable-nodpi/abs__action_item_divider.9.png differ diff --git a/actionbarsherlock/samples/demos/.classpath b/actionbarsherlock/samples/demos/.classpath new file mode 100644 index 000000000..0e4e50f4b --- /dev/null +++ b/actionbarsherlock/samples/demos/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/actionbarsherlock/samples/demos/.project b/actionbarsherlock/samples/demos/.project new file mode 100644 index 000000000..35b757909 --- /dev/null +++ b/actionbarsherlock/samples/demos/.project @@ -0,0 +1,33 @@ + + + actionbarsherlockdemos + + + + + + com.android.ide.eclipse.adt.ResourceManagerBuilder + + + + + com.android.ide.eclipse.adt.PreCompilerBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + com.android.ide.eclipse.adt.ApkBuilder + + + + + + com.android.ide.eclipse.adt.AndroidNature + org.eclipse.jdt.core.javanature + + diff --git a/astrid/AndroidManifest.xml b/astrid/AndroidManifest.xml index aaf149191..cb545ccb4 100644 --- a/astrid/AndroidManifest.xml +++ b/astrid/AndroidManifest.xml @@ -87,7 +87,7 @@ - @@ -124,7 +124,7 @@ - @@ -343,7 +343,7 @@ - diff --git a/astrid/libs/crittercism1.01.jar b/astrid/libs/crittercism1.01.jar new file mode 100644 index 000000000..bf228660a Binary files /dev/null and b/astrid/libs/crittercism1.01.jar differ diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/TagViewActivity.java b/astrid/plugin-src/com/todoroo/astrid/actfm/TagViewActivity.java index e0d5c93c3..35844e8e3 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/TagViewActivity.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/TagViewActivity.java @@ -8,17 +8,18 @@ import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; +import android.app.Activity; import android.app.ProgressDialog; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.Bundle; +import android.support.v4.view.Menu; +import android.support.v4.view.MenuItem; import android.text.TextUtils; import android.util.DisplayMetrics; import android.util.Log; -import android.view.Menu; -import android.view.MenuItem; import android.view.MotionEvent; import android.view.View; import android.view.View.OnClickListener; @@ -94,7 +95,7 @@ public class TagViewActivity extends TaskListActivity { // --- UI initialization @Override - protected void onCreate(final Bundle savedInstanceState) { + public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); getListView().setOnKeyListener(null); @@ -107,28 +108,28 @@ public class TagViewActivity extends TaskListActivity { return false; } }; - ((EditText) findViewById(R.id.quickAddText)).setOnTouchListener(onTouch); + ((EditText) getView().findViewById(R.id.quickAddText)).setOnTouchListener(onTouch); - View settingsContainer = findViewById(R.id.settingsContainer); + View settingsContainer = getView().findViewById(R.id.settingsContainer); settingsContainer.setVisibility(View.VISIBLE); - View settingsButton = findViewById(R.id.settings); + View settingsButton = getView().findViewById(R.id.settings); settingsButton.setOnClickListener(settingsListener); - View membersEdit = findViewById(R.id.members_edit); + View membersEdit = getView().findViewById(R.id.members_edit); membersEdit.setOnClickListener(settingsListener); - findViewById(R.id.listLabel).setPadding(0, 0, 0, 0); + getView().findViewById(R.id.listLabel).setPadding(0, 0, 0, 0); if (actFmPreferenceService.isLoggedIn()) { - View activityContainer = findViewById(R.id.activityContainer); + View activityContainer = getView().findViewById(R.id.activityContainer); activityContainer.setVisibility(View.VISIBLE); - ImageView activity = (ImageView) findViewById(R.id.activity); + ImageView activity = (ImageView) getView().findViewById(R.id.activity); activity.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - Intent intent = new Intent(TagViewActivity.this, TagUpdatesActivity.class); + Intent intent = new Intent(getActivity(), TagUpdatesActivity.class); intent.putExtra(EXTRA_TAG_DATA, tagData); startActivity(intent); AndroidUtilities.callApiMethod(5, TagViewActivity.this, "overridePendingTransition", //$NON-NLS-1$ @@ -145,7 +146,7 @@ public class TagViewActivity extends TaskListActivity { private final OnClickListener settingsListener = new OnClickListener() { @Override public void onClick(View v) { - Intent intent = new Intent(TagViewActivity.this, TagSettingsActivity.class); + Intent intent = new Intent(getActivity(), TagSettingsActivity.class); intent.putExtra(EXTRA_TAG_DATA, tagData); startActivityForResult(intent, REQUEST_CODE_SETTINGS); AndroidUtilities.callApiMethod(5, TagViewActivity.this, "overridePendingTransition", //$NON-NLS-1$ @@ -159,7 +160,7 @@ public class TagViewActivity extends TaskListActivity { */ @Override protected View getListBody(ViewGroup root) { - ViewGroup parent = (ViewGroup) getLayoutInflater().inflate(R.layout.task_list_body_tag_v2, root, false); + ViewGroup parent = (ViewGroup) getActivity().getLayoutInflater().inflate(R.layout.task_list_body_tag_v2, root, false); taskListView = super.getListBody(parent); if(actFmPreferenceService.isLoggedIn()) @@ -171,8 +172,8 @@ public class TagViewActivity extends TaskListActivity { private void showListSettingsPopover() { if (!Preferences.getBoolean(R.string.p_showed_list_settings_help, false)) { - View tabView = findViewById(R.id.settings); - HelpInfoPopover.showPopover(this, tabView, R.string.help_popover_list_settings); + View tabView = getView().findViewById(R.id.settings); + HelpInfoPopover.showPopover(getActivity(), tabView, R.string.help_popover_list_settings); Preferences.setBoolean(R.string.p_showed_list_settings_help, true); } } @@ -198,8 +199,8 @@ public class TagViewActivity extends TaskListActivity { dataLoaded = true; } - String tag = getIntent().getStringExtra(EXTRA_TAG_NAME); - long remoteId = getIntent().getLongExtra(EXTRA_TAG_REMOTE_ID, 0); + String tag = getActivity().getIntent().getStringExtra(EXTRA_TAG_NAME); + long remoteId = getActivity().getIntent().getLongExtra(EXTRA_TAG_REMOTE_ID, 0); if(tag == null && remoteId == 0) return; @@ -270,7 +271,7 @@ public class TagViewActivity extends TaskListActivity { final ProgressDialog progressDialog; if(manual && !noRemoteId) - progressDialog = DialogUtilities.progressDialog(this, getString(R.string.DLG_please_wait)); + progressDialog = DialogUtilities.progressDialog(getActivity(), getString(R.string.DLG_please_wait)); else progressDialog = null; @@ -282,8 +283,8 @@ public class TagViewActivity extends TaskListActivity { String oldName = tagData.getValue(TagData.NAME); actFmSyncService.fetchTag(tagData); - DialogUtilities.dismissDialog(TagViewActivity.this, progressDialog); - runOnUiThread(new Runnable() { + DialogUtilities.dismissDialog(getActivity(), progressDialog); + getActivity().runOnUiThread(new Runnable() { @Override public void run() { if(noRemoteId && tagData.getValue(TagData.REMOTE_ID) > 0) @@ -315,12 +316,12 @@ public class TagViewActivity extends TaskListActivity { actFmSyncService.fetchTasksForTag(tagData, manual, new Runnable() { @Override public void run() { - runOnUiThread(new Runnable() { + getActivity().runOnUiThread(new Runnable() { @Override public void run() { loadTaskListContent(true); ((TextView)taskListView.findViewById(android.R.id.empty)).setText(R.string.TLA_no_items); - DialogUtilities.dismissDialog(TagViewActivity.this, progressDialog); + DialogUtilities.dismissDialog(getActivity(), progressDialog); } }); } @@ -329,11 +330,11 @@ public class TagViewActivity extends TaskListActivity { actFmSyncService.fetchUpdatesForTag(tagData, manual, new Runnable() { @Override public void run() { - runOnUiThread(new Runnable() { + getActivity().runOnUiThread(new Runnable() { @Override public void run() { //refreshUpdatesList(); - DialogUtilities.dismissDialog(TagViewActivity.this, progressDialog); + DialogUtilities.dismissDialog(getActivity(), progressDialog); } }); } @@ -342,7 +343,7 @@ public class TagViewActivity extends TaskListActivity { } private void setUpMembersGallery() { - LinearLayout membersView = (LinearLayout)findViewById(R.id.shared_with); + LinearLayout membersView = (LinearLayout)getView().findViewById(R.id.shared_with); membersView.setOnClickListener(settingsListener); try { String membersString = tagData.getValue(TagData.MEMBERS); @@ -363,7 +364,7 @@ public class TagViewActivity extends TaskListActivity { } catch (JSONException e) { e.printStackTrace(); } - findViewById(R.id.filter_assigned).setOnClickListener(new OnClickListener() { + getActivity().findViewById(R.id.filter_assigned).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { resetAssignedFilter(); @@ -374,8 +375,8 @@ public class TagViewActivity extends TaskListActivity { @SuppressWarnings("nls") private void addImageForMember(LinearLayout membersView, JSONObject member) { DisplayMetrics displayMetrics = new DisplayMetrics(); - getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); - AsyncImageView image = new AsyncImageView(this); + getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); + AsyncImageView image = new AsyncImageView(getActivity()); image.setLayoutParams(new LinearLayout.LayoutParams((int)(50 * displayMetrics.density), (int)(50 * displayMetrics.density))); image.setDefaultImageResource(R.drawable.icn_default_person_image); @@ -415,9 +416,9 @@ public class TagViewActivity extends TaskListActivity { else assignedCriterion = Task.USER_ID.eq(id); Criterion assigned = Criterion.and(TaskCriteria.activeAndVisible(), assignedCriterion); - filter = TagFilterExposer.filterFromTag(TagViewActivity.this, new Tag(tagData), assigned); - System.err.println("Filter: " + filter.sqlQuery); - TextView filterByAssigned = (TextView) findViewById(R.id.filter_assigned); + filter = TagFilterExposer.filterFromTag(getActivity(), new Tag(tagData), assigned); + System.err.println("Filter: " + filter.sqlQuery); //$NON-NLS-1$ + TextView filterByAssigned = (TextView) getView().findViewById(R.id.filter_assigned); filterByAssigned.setVisibility(View.VISIBLE); filterByAssigned.setText(getString(R.string.actfm_TVA_filtered_by_assign, displayName)); setUpTaskList(); @@ -443,7 +444,7 @@ public class TagViewActivity extends TaskListActivity { private void resetAssignedFilter() { currentId = -1; filter = originalFilter; - findViewById(R.id.filter_assigned).setVisibility(View.GONE); + getView().findViewById(R.id.filter_assigned).setVisibility(View.GONE); setUpTaskList(); } @@ -481,7 +482,7 @@ public class TagViewActivity extends TaskListActivity { if(!Long.toString(tagData.getValue(TagData.REMOTE_ID)).equals(intent.getStringExtra("tag_id"))) return; - runOnUiThread(new Runnable() { + getActivity().runOnUiThread(new Runnable() { @Override public void run() { //refreshUpdatesList(); @@ -495,35 +496,35 @@ public class TagViewActivity extends TaskListActivity { }; @Override - protected void onResume() { + public void onResume() { super.onResume(); IntentFilter intentFilter = new IntentFilter(BROADCAST_TAG_ACTIVITY); - registerReceiver(notifyReceiver, intentFilter); + getActivity().registerReceiver(notifyReceiver, intentFilter); } @Override - protected void onPause() { + public void onPause() { super.onPause(); - unregisterReceiver(notifyReceiver); + getActivity().unregisterReceiver(notifyReceiver); } @Override protected Task quickAddTask(String title, boolean selectNewTask) { if(!tagData.containsNonNullValue(TagData.NAME) || tagData.getValue(TagData.NAME).length() == 0) { - DialogUtilities.okDialog(this, getString(R.string.tag_no_title_error), null); + DialogUtilities.okDialog(getActivity(), getString(R.string.tag_no_title_error), null); return null; } return super.quickAddTask(title, selectNewTask); } @Override - protected void onActivityResult(int requestCode, int resultCode, Intent data) { - if (requestCode == REQUEST_CODE_SETTINGS && resultCode == RESULT_OK) { + public void onActivityResult(int requestCode, int resultCode, Intent data) { + if (requestCode == REQUEST_CODE_SETTINGS && resultCode == Activity.RESULT_OK) { tagData = tagDataService.fetchById(tagData.getId(), TagData.PROPERTIES); - filter = TagFilterExposer.filterFromTagData(this, tagData); + filter = TagFilterExposer.filterFromTagData(getActivity(), tagData); taskAdapter = null; loadTaskListContent(true); } else { @@ -532,7 +533,7 @@ public class TagViewActivity extends TaskListActivity { } @Override - public boolean onMenuItemSelected(int featureId, final MenuItem item) { + public boolean onOptionsItemSelected(MenuItem item) { // handle my own menus switch (item.getItemId()) { case MENU_REFRESH_ID: @@ -540,7 +541,7 @@ public class TagViewActivity extends TaskListActivity { return true; } - return super.onMenuItemSelected(featureId, item); + return super.onOptionsItemSelected(item); } } diff --git a/astrid/plugin-src/com/todoroo/astrid/core/CustomFilterActivity.java b/astrid/plugin-src/com/todoroo/astrid/core/CustomFilterActivity.java index 0f9e48230..4a9655b7a 100644 --- a/astrid/plugin-src/com/todoroo/astrid/core/CustomFilterActivity.java +++ b/astrid/plugin-src/com/todoroo/astrid/core/CustomFilterActivity.java @@ -39,6 +39,7 @@ import com.todoroo.andlib.sql.Field; import com.todoroo.andlib.sql.Query; import com.todoroo.andlib.sql.UnaryCriterion; import com.todoroo.astrid.activity.TaskListActivity; +import com.todoroo.astrid.activity.TaskListWrapperActivity; import com.todoroo.astrid.api.AstridApiConstants; import com.todoroo.astrid.api.CustomFilterCriterion; import com.todoroo.astrid.api.Filter; @@ -412,7 +413,7 @@ public class CustomFilterActivity extends ListActivity { // view Filter filter = new Filter(title, title, sql.toString(), values); - Intent taskListActivity = new Intent(this, TaskListActivity.class); + Intent taskListActivity = new Intent(this, TaskListWrapperActivity.class); taskListActivity.putExtra(TaskListActivity.TOKEN_FILTER, filter); startActivity(taskListActivity); } diff --git a/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksListActivity.java b/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksListActivity.java index 4a0bf130f..3cca8dd5f 100644 --- a/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksListActivity.java +++ b/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksListActivity.java @@ -2,8 +2,9 @@ package com.todoroo.astrid.gtasks; import android.app.ProgressDialog; import android.os.Bundle; -import android.view.Menu; -import android.view.MenuItem; +import android.support.v4.view.Menu; +import android.support.v4.view.MenuItem; +import android.view.MenuInflater; import com.commonsware.cwac.tlv.TouchListView; import com.commonsware.cwac.tlv.TouchListView.DropListener; @@ -44,7 +45,7 @@ public class GtasksListActivity extends DraggableTaskListActivity { if(!Preferences.getBoolean(GtasksPreferenceService.PREF_SHOWN_LIST_HELP, false)) { Preferences.setBoolean(GtasksPreferenceService.PREF_SHOWN_LIST_HELP, true); - DialogUtilities.okDialog(this, + DialogUtilities.okDialog(getActivity(), getString(R.string.gtasks_help_title), android.R.drawable.ic_dialog_info, getString(R.string.gtasks_help_body), null); @@ -92,26 +93,25 @@ public class GtasksListActivity extends DraggableTaskListActivity { }; @Override - public boolean onPrepareOptionsMenu(Menu menu) { - super.onPrepareOptionsMenu(menu); + public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { + super.onCreateOptionsMenu(menu, inflater); MenuItem item = menu.add(Menu.NONE, MENU_CLEAR_COMPLETED_ID, Menu.FIRST, this.getString(R.string.gtasks_GTA_clear_completed)); item.setIcon(android.R.drawable.ic_input_delete); // Needs new icon - return true; } @Override - public boolean onMenuItemSelected(int featureId, final MenuItem item) { + public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == MENU_CLEAR_COMPLETED_ID) { clearCompletedTasks(); return true; } else { - return super.onMenuItemSelected(featureId, item); + return super.onOptionsItemSelected(item); } } private void clearCompletedTasks() { - final ProgressDialog pd = new ProgressDialog(this); + final ProgressDialog pd = new ProgressDialog(getActivity()); final TodorooCursor tasks = taskService.fetchFiltered(filter.sqlQuery, null, Task.ID, Task.COMPLETION_DATE); pd.setMessage(this.getString(R.string.gtasks_GTA_clearing)); pd.show(); @@ -133,12 +133,12 @@ public class GtasksListActivity extends DraggableTaskListActivity { } } finally { tasks.close(); - DialogUtilities.dismissDialog(GtasksListActivity.this, pd); + DialogUtilities.dismissDialog(getActivity(), pd); } if (listId != null) { gtasksTaskListUpdater.correctMetadataForList(listId); } - GtasksListActivity.this.runOnUiThread(new Runnable() { + getActivity().runOnUiThread(new Runnable() { public void run() { loadTaskListContent(true); } @@ -180,7 +180,7 @@ public class GtasksListActivity extends DraggableTaskListActivity { } finally { tasks.close(); } - GtasksListActivity.this.runOnUiThread(new Runnable() { + getActivity().runOnUiThread(new Runnable() { public void run() { loadTaskListContent(true); } diff --git a/astrid/plugin-src/com/todoroo/astrid/reminders/NotificationActivity.java b/astrid/plugin-src/com/todoroo/astrid/reminders/NotificationActivity.java index f76fd5143..2cfc14698 100644 --- a/astrid/plugin-src/com/todoroo/astrid/reminders/NotificationActivity.java +++ b/astrid/plugin-src/com/todoroo/astrid/reminders/NotificationActivity.java @@ -108,43 +108,43 @@ public class NotificationActivity extends TaskListActivity implements OnTimeSetL */ private void displayNotificationPopup() { // hide quick add - findViewById(R.id.taskListFooter).setVisibility(View.GONE); + getView().findViewById(R.id.taskListFooter).setVisibility(View.GONE); // instantiate reminder window - ViewGroup parent = (ViewGroup) findViewById(R.id.taskListParent); - getLayoutInflater().inflate(R.layout.notification_control, parent, true); + ViewGroup parent = (ViewGroup) getView().findViewById(R.id.taskListParent); + getActivity().getLayoutInflater().inflate(R.layout.notification_control, parent, true); String reminder = Notifications.getRandomReminder(getResources().getStringArray(R.array.reminder_responses)); if(Preferences.getBoolean(R.string.p_rmd_nagging, true)) - ((TextView)findViewById(R.id.reminderLabel)).setText(reminder); + ((TextView)getView().findViewById(R.id.reminderLabel)).setText(reminder); else { - findViewById(R.id.reminderLabel).setVisibility(View.GONE); - findViewById(R.id.astridIcon).setVisibility(View.GONE); + getView().findViewById(R.id.reminderLabel).setVisibility(View.GONE); + getView().findViewById(R.id.astridIcon).setVisibility(View.GONE); } // set up listeners - ((Button)findViewById(R.id.goAway)).setOnClickListener(new OnClickListener() { + ((Button)getView().findViewById(R.id.goAway)).setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { - finish(); + getActivity().finish(); } }); - ((Button)findViewById(R.id.snooze)).setOnClickListener(new OnClickListener() { + ((Button)getView().findViewById(R.id.snooze)).setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { snooze(); } }); - ((Button)findViewById(R.id.done)).setOnClickListener(new OnClickListener() { + ((Button)getView().findViewById(R.id.done)).setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Task task = new Task(); task.setId(taskId); PluginServices.getTaskService().setComplete(task, true); - finish(); + getActivity().finish(); } }); } @@ -157,10 +157,10 @@ public class NotificationActivity extends TaskListActivity implements OnTimeSetL NotificationActivity parent; public SnoozeDialog(NotificationActivity parent) { - super(parent); + super(parent.getActivity()); this.parent = parent; - LayoutInflater mInflater = (LayoutInflater) parent.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + LayoutInflater mInflater = (LayoutInflater) parent.getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); mInflater.inflate(R.layout.snooze_dialog, this, true); snoozePicker = (LinearLayout) findViewById(R.id.snoozePicker); @@ -211,18 +211,18 @@ public class NotificationActivity extends TaskListActivity implements OnTimeSetL now.setHours(now.getHours() + 1); int hour = now.getHours(); int minute = now.getMinutes(); - TimePickerDialog tpd = new TimePickerDialog(this, this, hour, minute, - DateUtilities.is24HourFormat(this)); + TimePickerDialog tpd = new TimePickerDialog(getActivity(), this, hour, minute, + DateUtilities.is24HourFormat(getActivity())); tpd.show(); - tpd.setOwnerActivity(this); + tpd.setOwnerActivity(getActivity()); } else { SnoozeDialog sd = new SnoozeDialog(this); - new AlertDialog.Builder(this) + new AlertDialog.Builder(getActivity()) .setTitle(R.string.rmd_NoA_snooze) .setView(sd) .setPositiveButton(android.R.string.ok, sd) .setNegativeButton(android.R.string.cancel, null) - .show().setOwnerActivity(this); + .show().setOwnerActivity(getActivity()); } } @@ -242,7 +242,7 @@ public class NotificationActivity extends TaskListActivity implements OnTimeSetL task.setId(taskId); task.setValue(Task.REMINDER_SNOOZE, time); PluginServices.getTaskService().save(task); - finish(); + getActivity().finish(); StatisticsService.reportEvent(StatisticsConstants.TASK_SNOOZE); } diff --git a/astrid/project.properties b/astrid/project.properties index a2116be0d..d7ae8bbc2 100644 --- a/astrid/project.properties +++ b/astrid/project.properties @@ -9,9 +9,10 @@ # Indicates whether an apk should be generated for each density. split.density=false -android.library.reference.3=../facebook/facebook/ -android.library.reference.1=../api/ -android.library.reference.2=../greendroid/GreenDroid/ +android.library.reference.3=../facebook/facebook +android.library.reference.1=../api +android.library.reference.2=../actionbarsherlock/library # Project target. target=android-14 apk-configurations= +android.library.reference.4=../greendroid/GreenDroid diff --git a/astrid/src/com/todoroo/astrid/activity/DraggableTaskListActivity.java b/astrid/src/com/todoroo/astrid/activity/DraggableTaskListActivity.java index a1f4f57fd..d66ec92ff 100644 --- a/astrid/src/com/todoroo/astrid/activity/DraggableTaskListActivity.java +++ b/astrid/src/com/todoroo/astrid/activity/DraggableTaskListActivity.java @@ -4,9 +4,9 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.concurrent.atomic.AtomicReference; -import android.app.ListActivity; import android.database.Cursor; import android.os.Bundle; +import android.support.v4.app.ListFragment; import android.view.MotionEvent; import android.view.View; import android.view.View.OnTouchListener; @@ -52,7 +52,7 @@ public class DraggableTaskListActivity extends TaskListActivity { @Override protected View getListBody(ViewGroup root) { - return getLayoutInflater().inflate(R.layout.task_list_body_draggable, root, false); + return getActivity().getLayoutInflater().inflate(R.layout.task_list_body_draggable, root, false); } // --- task adapter @@ -66,12 +66,12 @@ public class DraggableTaskListActivity extends TaskListActivity { sqlQueryTemplate.set(SortHelper.adjustQueryForFlagsAndSort(filter.sqlQuery, sortFlags, sortSort)); - ((TextView)findViewById(R.id.listLabel)).setText(filter.title); + ((TextView)getView().findViewById(R.id.listLabel)).setText(filter.title); // perform query TodorooCursor currentCursor = taskService.fetchFiltered( sqlQueryTemplate.get(), null, getProperties()); - startManagingCursor(currentCursor); + getActivity().startManagingCursor(currentCursor); // set up list adapters taskAdapter = new DraggableTaskAdapter(this, R.layout.task_adapter_draggable_row, @@ -100,7 +100,7 @@ public class DraggableTaskListActivity extends TaskListActivity { private final class DraggableTaskAdapter extends TaskAdapter { - private DraggableTaskAdapter(ListActivity activity, int resource, + private DraggableTaskAdapter(ListFragment activity, int resource, Cursor c, AtomicReference query, boolean autoRequery, OnCompletedTaskListener onCompletedTaskListener) { super(activity, resource, c, query, autoRequery, diff --git a/astrid/src/com/todoroo/astrid/activity/FilterListActivity.java b/astrid/src/com/todoroo/astrid/activity/FilterListActivity.java index ef66662ef..91a80670c 100644 --- a/astrid/src/com/todoroo/astrid/activity/FilterListActivity.java +++ b/astrid/src/com/todoroo/astrid/activity/FilterListActivity.java @@ -12,8 +12,8 @@ import org.json.JSONException; import org.weloveastrid.rmilk.MilkPreferences; import org.weloveastrid.rmilk.MilkUtilities; +import android.app.Activity; import android.app.AlertDialog; -import android.app.ExpandableListActivity; import android.app.Notification; import android.app.PendingIntent; import android.app.PendingIntent.CanceledException; @@ -35,11 +35,12 @@ import android.util.DisplayMetrics; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; import android.view.KeyEvent; +import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; -import android.view.Window; +import android.view.ViewGroup; import android.view.inputmethod.EditorInfo; import android.widget.ArrayAdapter; import android.widget.EditText; @@ -47,6 +48,7 @@ import android.widget.ExpandableListView; import android.widget.ExpandableListView.ExpandableListContextMenuInfo; import android.widget.FrameLayout; import android.widget.ImageView; +import android.widget.ListView; import android.widget.TextView; import android.widget.TextView.OnEditorActionListener; import android.widget.Toast; @@ -91,22 +93,22 @@ import com.todoroo.astrid.utility.Constants; * @author Tim Su * */ -public class FilterListActivity extends ExpandableListActivity { +public class FilterListActivity extends ExpandableListFragment { // -- extra codes public static final String SHOW_BACK_BUTTON = "show_back"; //$NON-NLS-1$ // --- menu codes - private static final int MENU_SEARCH_ID = Menu.FIRST + 0; - private static final int MENU_HELP_ID = Menu.FIRST + 1; - private static final int MENU_REFRESH_ID = Menu.FIRST + 2; - private static final int MENU_NEW_FILTER_ID = Menu.FIRST + 3; + private static final int MENU_SEARCH_ID = R.string.FLA_menu_search; + private static final int MENU_HELP_ID = R.string.FLA_menu_help; + private static final int MENU_REFRESH_ID = R.string.actfm_FLA_menu_refresh; + private static final int MENU_NEW_FILTER_ID = R.string.FLA_new_filter; private static final String LAST_TAG_REFRESH_KEY = "last_tag_refresh"; //$NON-NLS-1$ - private static final int CONTEXT_MENU_SHORTCUT = Menu.FIRST + 4; - private static final int CONTEXT_MENU_INTENT = Menu.FIRST + 5; + private static final int CONTEXT_MENU_SHORTCUT = R.string.FLA_context_shortcut; + private static final int CONTEXT_MENU_INTENT = Menu.FIRST + 4; private static final int REQUEST_CUSTOM_INTENT = 1; private static final int REQUEST_VIEW_TASKS = 2; @@ -121,6 +123,7 @@ public class FilterListActivity extends ExpandableListActivity { protected SyncActionReceiver syncActionReceiver = new SyncActionReceiver(); private final LinkedHashSet syncActions = new LinkedHashSet(); protected FilterAdapter adapter = null; + private boolean mDualFragments; /* ====================================================================== * ======================================================= initialization @@ -132,13 +135,34 @@ public class FilterListActivity extends ExpandableListActivity { /** Called when loading up the activity */ @Override - protected void onCreate(Bundle savedInstanceState) { - requestWindowFeature(Window.FEATURE_NO_TITLE); + public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - new StartupService().onStartupApplication(this); - ThemeService.applyTheme(this); - setContentView(R.layout.filter_list_activity); + // Tell the framework to try to keep this fragment around + // during a configuration change. + setRetainInstance(true); + + new StartupService().onStartupApplication(getActivity()); + } + + /* (non-Javadoc) + * @see com.todoroo.astrid.fragment.ExpandableListFragment#onCreateView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle) + */ + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + ViewGroup parent = (ViewGroup) getActivity().getLayoutInflater().inflate(R.layout.filter_list_activity, container, false); + ThemeService.applyTheme(parent); + return parent; + } + + @Override + public void onActivityCreated(Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + getActivity().setDefaultKeyMode(Activity.DEFAULT_KEYS_SEARCH_LOCAL); + // We have a menu item to show in action bar. + setHasOptionsMenu(true); + ImageView backButton = (ImageView) findViewById(R.id.back); if (!getIntent().getBooleanExtra(SHOW_BACK_BUTTON, true)) { backButton.setVisibility(View.GONE); @@ -153,7 +177,17 @@ public class FilterListActivity extends ExpandableListActivity { } }); - onNewIntent(getIntent()); + onContentChanged(); + + onNewIntent(getActivity().getIntent()); + + Fragment tasklistFrame = getFragmentManager().findFragmentById(R.id.tasklist_fragment); + mDualPane = (tasklistFrame != null) && tasklistFrame.isInLayout(); + + if (mDualPane) { + // In dual-pane mode, the list view highlights the selected item. + getExpandableListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE); + } } @Override diff --git a/astrid/src/com/todoroo/astrid/activity/ShareLinkActivity.java b/astrid/src/com/todoroo/astrid/activity/ShareLinkActivity.java index ea475b252..a6df26e2a 100644 --- a/astrid/src/com/todoroo/astrid/activity/ShareLinkActivity.java +++ b/astrid/src/com/todoroo/astrid/activity/ShareLinkActivity.java @@ -19,10 +19,10 @@ public final class ShareLinkActivity extends TaskListActivity { } @Override - protected void onCreate(Bundle savedInstanceState) { + public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - Intent callerIntent = getIntent(); + Intent callerIntent = getActivity().getIntent(); String subject = callerIntent.getStringExtra(Intent.EXTRA_SUBJECT); if(subject == null) @@ -30,7 +30,7 @@ public final class ShareLinkActivity extends TaskListActivity { Task task = quickAddTask(subject, false); task.setValue(Task.NOTES, callerIntent.getStringExtra(Intent.EXTRA_TEXT)); taskService.save(task); - Intent intent = new Intent(this, TaskEditActivity.class); + Intent intent = new Intent(getActivity(), TaskEditActivity.class); intent.putExtra(TaskEditActivity.TOKEN_ID, task.getId()); startActivityForResult(intent, ACTIVITY_EDIT_TASK); } diff --git a/astrid/src/com/todoroo/astrid/activity/TaskListActivity.java b/astrid/src/com/todoroo/astrid/activity/TaskListActivity.java index 567b3186e..3441d38a4 100644 --- a/astrid/src/com/todoroo/astrid/activity/TaskListActivity.java +++ b/astrid/src/com/todoroo/astrid/activity/TaskListActivity.java @@ -11,8 +11,8 @@ import java.util.concurrent.atomic.AtomicReference; import org.weloveastrid.rmilk.MilkPreferences; import org.weloveastrid.rmilk.MilkUtilities; +import android.app.Activity; import android.app.AlertDialog; -import android.app.ListActivity; import android.app.PendingIntent.CanceledException; import android.app.SearchManager; import android.content.BroadcastReceiver; @@ -26,22 +26,23 @@ import android.content.SharedPreferences.Editor; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.database.Cursor; -import android.graphics.PixelFormat; import android.net.Uri; import android.os.Bundle; +import android.support.v4.app.ListFragment; +import android.support.v4.app.SupportActivity; +import android.support.v4.view.Menu; +import android.support.v4.view.MenuItem; import android.text.TextUtils; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; import android.view.KeyEvent; -import android.view.Menu; -import android.view.MenuItem; +import android.view.LayoutInflater; +import android.view.MenuInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnKeyListener; import android.view.View.OnLongClickListener; import android.view.ViewGroup; -import android.view.Window; -import android.view.WindowManager; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodManager; import android.widget.AbsListView; @@ -118,7 +119,7 @@ import com.todoroo.astrid.widget.TasksWidget; * @author Tim Su * */ -public class TaskListActivity extends ListActivity implements OnScrollListener, +public class TaskListActivity extends ListFragment implements OnScrollListener, GestureInterface, OnSortSelectedListener { // --- activities @@ -132,19 +133,19 @@ public class TaskListActivity extends ListActivity implements OnScrollListener, // --- menu codes - protected static final int MENU_LISTS_ID = Menu.FIRST + 1; - protected static final int MENU_ADDONS_ID = Menu.FIRST + 2; - protected static final int MENU_SETTINGS_ID = Menu.FIRST + 3; - protected static final int MENU_SORT_ID = Menu.FIRST + 4; - protected static final int MENU_SYNC_ID = Menu.FIRST + 5; - protected static final int MENU_SUPPORT_ID = Menu.FIRST + 6; - protected static final int MENU_ADDON_INTENT_ID = Menu.FIRST + 7; - - protected static final int CONTEXT_MENU_EDIT_TASK_ID = Menu.FIRST + 20; - protected static final int CONTEXT_MENU_COPY_TASK_ID = Menu.FIRST + 21; - protected static final int CONTEXT_MENU_DELETE_TASK_ID = Menu.FIRST + 22; - protected static final int CONTEXT_MENU_UNDELETE_TASK_ID = Menu.FIRST + 23; - protected static final int CONTEXT_MENU_PURGE_TASK_ID = Menu.FIRST + 24; + protected static final int MENU_LISTS_ID = R.string.tag_TLA_menu; + protected static final int MENU_ADDONS_ID = R.string.TLA_menu_addons; + protected static final int MENU_SETTINGS_ID = R.string.TLA_menu_settings; + protected static final int MENU_SORT_ID = R.string.TLA_menu_sort; + protected static final int MENU_SYNC_ID = R.string.TLA_menu_sync; + protected static final int MENU_SUPPORT_ID = R.string.TLA_menu_support; + protected static final int MENU_ADDON_INTENT_ID = Menu.FIRST + 199; + + protected static final int CONTEXT_MENU_EDIT_TASK_ID = R.string.TAd_contextEditTask; + protected static final int CONTEXT_MENU_COPY_TASK_ID = R.string.TAd_contextCopyTask; + protected static final int CONTEXT_MENU_DELETE_TASK_ID = R.string.TAd_contextDeleteTask; + protected static final int CONTEXT_MENU_UNDELETE_TASK_ID = R.string.TAd_contextUndeleteTask; + protected static final int CONTEXT_MENU_PURGE_TASK_ID = R.string.TAd_contextPurgeTask; protected static final int CONTEXT_MENU_BROADCAST_INTENT_ID = Menu.FIRST + 25; protected static final int CONTEXT_MENU_PLUGIN_ID_FIRST = Menu.FIRST + 26; @@ -201,6 +202,10 @@ public class TaskListActivity extends ListActivity implements OnScrollListener, private final TaskListContextMenuExtensionLoader contextMenuExtensionLoader = new TaskListContextMenuExtensionLoader(); private VoiceInputAssistant voiceInputAssistant; + // --- fragment handling variables + OnItemSelectedListener mListener; + private final boolean mDualFragments = false; + /* ====================================================================== * ======================================================= initialization * ====================================================================== */ @@ -209,6 +214,25 @@ public class TaskListActivity extends ListActivity implements OnScrollListener, AstridDependencyInjector.initialize(); } + /** Container Activity must implement this interface and we ensure + * that it does during the onAttach() callback + */ + public interface OnItemSelectedListener { + public void onItemSelected(int category, int position); + } + + @Override + public void onAttach(SupportActivity activity) { + super.onAttach(activity); + // Check that the container activity has implemented the callback interface + try { + mListener = (OnItemSelectedListener) activity; + } catch (ClassCastException e) { + throw new ClassCastException(activity.toString() + + " must implement OnItemSelectedListener"); //$NON-NLS-1$ + } + } + /** * @return view to attach to the body of the task list. must contain two * elements, a view with id android:id/empty and a list view with id @@ -216,42 +240,72 @@ public class TaskListActivity extends ListActivity implements OnScrollListener, */ protected View getListBody(ViewGroup root) { if(AndroidUtilities.getSdkVersion() > 3) - return getLayoutInflater().inflate(R.layout.task_list_body_standard, root, false); + return getActivity().getLayoutInflater().inflate(R.layout.task_list_body_standard, root, false); else - return getLayoutInflater().inflate(R.layout.task_list_body_api3, root, false); + return getActivity().getLayoutInflater().inflate(R.layout.task_list_body_api3, root, false); } /** Called when loading up the activity */ @Override - protected void onCreate(Bundle savedInstanceState) { - ContextManager.setContext(this); - requestWindowFeature(Window.FEATURE_NO_TITLE); + public void onCreate(Bundle savedInstanceState) { DependencyInjectionService.getInstance().inject(this); super.onCreate(savedInstanceState); + // Tell the framework to try to keep this fragment around + // during a configuration change. + setRetainInstance(true); - new StartupService().onStartupApplication(this); - ThemeService.applyTheme(this); - ViewGroup parent = (ViewGroup) getLayoutInflater().inflate(R.layout.task_list_activity, null); - parent.addView(getListBody(parent), 1); - setContentView(parent); + new StartupService().onStartupApplication(getActivity()); if(database == null) return; database.openForWriting(); + } + + + /* (non-Javadoc) + * @see android.support.v4.app.Fragment#onCreateView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle) + */ + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + ViewGroup parent = (ViewGroup) getActivity().getLayoutInflater().inflate( + R.layout.task_list_activity, container, false); + parent.addView(getListBody(parent), 1); + ThemeService.applyTheme(getActivity()); + + return parent; + } + + @Override + public void onActivityCreated(Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + // We have a menu item to show in action bar. + setHasOptionsMenu(true); + setUpUiComponents(); - onNewIntent(getIntent()); + onNewIntent(getActivity().getIntent()); + + // FIXME move this code into the TaskListWrapperActivity +// Fragment filterFrame = getFragmentManager().findFragmentById(R.id.filterlist_fragment); +// mDualPane = (filterFrame != null) && filterFrame.isInLayout(); +// +// if (mDualPane) { +// // In dual-pane mode, the list view highlights the selected item. +// getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE); +// } + // end of FIXME if(Preferences.getInt(AstridPreferences.P_UPGRADE_FROM, -1) > -1) - upgradeService.showChangeLog(this, Preferences.getInt(AstridPreferences.P_UPGRADE_FROM, -1)); + upgradeService.showChangeLog(getActivity(), Preferences.getInt(AstridPreferences.P_UPGRADE_FROM, -1)); if (!Preferences.getBoolean(R.string.p_showed_add_task_help, false)) { - HelpInfoPopover.showPopover(TaskListActivity.this, quickAddBox, R.string.help_popover_add_task); + HelpInfoPopover.showPopover(getActivity(), quickAddBox, R.string.help_popover_add_task); Preferences.setBoolean(R.string.p_showed_add_task_help, true); } - if(getIntent().hasExtra(TOKEN_SOURCE)) { - switch(getIntent().getIntExtra(TOKEN_SOURCE, Constants.SOURCE_DEFAULT)) { + if(getActivity().getIntent().hasExtra(TOKEN_SOURCE)) { + switch(getActivity().getIntent().getIntExtra(TOKEN_SOURCE, Constants.SOURCE_DEFAULT)) { case Constants.SOURCE_NOTIFICATION: StatisticsService.reportEvent(StatisticsConstants.LAUNCH_FROM_NOTIFICATION); break; @@ -271,10 +325,7 @@ public class TaskListActivity extends ListActivity implements OnScrollListener, } } - @Override protected void onNewIntent(Intent intent) { - super.onNewIntent(intent); - Bundle extras = intent.getExtras(); if (extras != null) { overrideFinishAnim = extras.getBoolean(TOKEN_OVERRIDE_ANIM); @@ -282,32 +333,34 @@ public class TaskListActivity extends ListActivity implements OnScrollListener, overrideFinishAnim = false; } String intentAction = intent.getAction(); + // FIXME maybe SEARCH has to go into the Wrapper-activity and forward to the filterFragment if (Intent.ACTION_SEARCH.equals(intentAction)) { String query = intent.getStringExtra(SearchManager.QUERY).trim(); Filter searchFilter = new Filter(null, getString(R.string.FLA_search_filter, query), new QueryTemplate().where(Functions.upper(Task.TITLE).like("%" + //$NON-NLS-1$ query.toUpperCase() + "%")), //$NON-NLS-1$ null); - intent = new Intent(this, TaskListActivity.class); + intent = new Intent(getActivity(), TaskListActivity.class); intent.putExtra(TaskListActivity.TOKEN_FILTER, searchFilter); startActivity(intent); - finish(); +// finish(); return; } else if(extras != null && extras.containsKey(TOKEN_FILTER)) { filter = extras.getParcelable(TOKEN_FILTER); isFilter = true; } else { filter = CoreFilterExposer.buildInboxFilter(getResources()); - findViewById(R.id.headerLogo).setVisibility(View.VISIBLE); - findViewById(R.id.listLabel).setVisibility(View.GONE); + getView().findViewById(R.id.headerLogo).setVisibility(View.VISIBLE); + getView().findViewById(R.id.listLabel).setVisibility(View.GONE); isFilter = false; } setUpTaskList(); - if(Constants.DEBUG) - setTitle("[D] " + filter.title); //$NON-NLS-1$ + // FIXME put this into the wrapper activity +// if(Constants.DEBUG) +// setTitle("[D] " + filter.title); //$NON-NLS-1$ - contextMenuExtensionLoader.loadInNewThread(this); + contextMenuExtensionLoader.loadInNewThread(getActivity()); } protected void addSyncRefreshMenuItem(Menu menu) { @@ -322,10 +375,7 @@ public class TaskListActivity extends ListActivity implements OnScrollListener, * @return true if menu should be displayed */ @Override - public boolean onPrepareOptionsMenu(Menu menu) { - if(menu.size() > 0) - menu.clear(); - + public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { MenuItem item; if(!(this instanceof DraggableTaskListActivity)) { @@ -339,6 +389,7 @@ public class TaskListActivity extends ListActivity implements OnScrollListener, item = menu.add(Menu.NONE, MENU_LISTS_ID, Menu.NONE, R.string.tag_TLA_menu); item.setIcon(R.drawable.ic_menu_lists); + item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); if(!Constants.MARKET_DISABLED) { item = menu.add(Menu.NONE, MENU_ADDONS_ID, Menu.NONE, @@ -356,7 +407,7 @@ public class TaskListActivity extends ListActivity implements OnScrollListener, // ask about plug-ins Intent queryIntent = new Intent(AstridApiConstants.ACTION_TASK_LIST_MENU); - PackageManager pm = getPackageManager(); + PackageManager pm = getActivity().getPackageManager(); List resolveInfoList = pm.queryIntentActivities(queryIntent, 0); int length = resolveInfoList.size(); for(int i = 0; i < length; i++) { @@ -370,16 +421,17 @@ public class TaskListActivity extends ListActivity implements OnScrollListener, resolveInfo.activityInfo.name); item.setIntent(intent); } - - return true; } private void setUpUiComponents() { - ((ImageView)findViewById(R.id.back)).setOnClickListener(new OnClickListener() { - public void onClick(View v) { - showFilterListActivity(); - } - }); + ImageView backButton = (ImageView)getView().findViewById(R.id.back); + if (backButton != null) { + backButton.setOnClickListener(new OnClickListener() { + public void onClick(View v) { + showFilterListActivity(); + } + }); + } // set listener for quick-changing task priority getListView().setOnKeyListener(new OnKeyListener() { @@ -414,7 +466,7 @@ public class TaskListActivity extends ListActivity implements OnScrollListener, }); // set listener for pressing enter in quick-add box - quickAddBox = (EditText) findViewById(R.id.quickAddText); + quickAddBox = (EditText) getView().findViewById(R.id.quickAddText); quickAddBox.setOnEditorActionListener(new OnEditorActionListener() { /** * When user presses enter, quick-add the task @@ -430,7 +482,7 @@ public class TaskListActivity extends ListActivity implements OnScrollListener, }); - quickAddButton = ((ImageButton)findViewById(R.id.quickAddButton)); + quickAddButton = ((ImageButton)getView().findViewById(R.id.quickAddButton)); // set listener for quick add button quickAddButton.setOnClickListener(new OnClickListener() { @@ -445,11 +497,11 @@ public class TaskListActivity extends ListActivity implements OnScrollListener, }); // prepare and set listener for voice add button - voiceAddButton = (ImageButton) findViewById(R.id.voiceAddButton); + voiceAddButton = (ImageButton) getView().findViewById(R.id.voiceAddButton); int prompt = R.string.voice_edit_title_prompt; if (Preferences.getBoolean(R.string.p_voiceInputCreatesTask, false)) prompt = R.string.voice_create_prompt; - voiceInputAssistant = new VoiceInputAssistant(this,voiceAddButton,quickAddBox); + voiceInputAssistant = new VoiceInputAssistant(getActivity(),voiceAddButton,quickAddBox); voiceInputAssistant.configureMicrophoneButton(prompt); // set listener for extended addbutton @@ -468,18 +520,14 @@ public class TaskListActivity extends ListActivity implements OnScrollListener, // gestures / animation try { - GestureService.registerGestureDetector(this, R.id.gestures, R.raw.gestures, this); + GestureService.registerGestureDetector(getActivity(), R.id.gestures, R.raw.gestures, this); } catch (VerifyError e) { // failed check, no gestures :P } - SharedPreferences publicPrefs = AstridPreferences.getPublicPrefs(this); + SharedPreferences publicPrefs = AstridPreferences.getPublicPrefs(getActivity()); sortFlags = publicPrefs.getInt(SortHelper.PREF_SORT_FLAGS, 0); sortSort = publicPrefs.getInt(SortHelper.PREF_SORT_SORT, 0); - - // dithering - getWindow().setFormat(PixelFormat.RGBA_8888); - getWindow().addFlags(WindowManager.LayoutParams.FLAG_DITHER); } private void initiateAutomaticSync() { @@ -494,20 +542,20 @@ public class TaskListActivity extends ListActivity implements OnScrollListener, @Override public void run() { Preferences.setLong(LAST_AUTOSYNC_ATTEMPT, DateUtilities.now()); - new ActFmSyncProvider().synchronize(TaskListActivity.this); + new ActFmSyncProvider().synchronize(getActivity()); } }.start(); } // Subclasses can override these to customize extras in quickadd intent protected Intent getOnClickQuickAddIntent(Task t) { - Intent intent = new Intent(TaskListActivity.this, TaskEditActivity.class); + Intent intent = new Intent(getActivity(), TaskEditActivity.class); intent.putExtra(TaskEditActivity.TOKEN_ID, t.getId()); return intent; } protected Intent getOnLongClickQuickAddIntent(Task t) { - Intent intent = new Intent(TaskListActivity.this, TaskEditActivity.class); + Intent intent = new Intent(getActivity(), TaskEditActivity.class); intent.putExtra(TaskEditActivity.TOKEN_ID, t.getId()); return intent; } @@ -527,7 +575,7 @@ public class TaskListActivity extends ListActivity implements OnScrollListener, public void run() { // refresh if conditions match Flags.checkAndClear(Flags.REFRESH); - runOnUiThread(new Runnable() { + getActivity().runOnUiThread(new Runnable() { @Override public void run() { loadTaskListContent(true); @@ -542,20 +590,20 @@ public class TaskListActivity extends ListActivity implements OnScrollListener, * ====================================================================== */ @Override - protected void onStart() { + public void onStart() { super.onStart(); } @Override - protected void onStop() { - StatisticsService.sessionStop(this); + public void onStop() { + StatisticsService.sessionStop(getActivity()); super.onStop(); } @Override - protected void onResume() { + public void onResume() { super.onResume(); - StatisticsService.sessionStart(this); + StatisticsService.sessionStart(getActivity()); if (addOnService.hasPowerPack() && Preferences.getBoolean(R.string.p_voiceInputEnabled, true) && voiceInputAssistant.isVoiceInputAvailable()) { @@ -564,15 +612,15 @@ public class TaskListActivity extends ListActivity implements OnScrollListener, voiceAddButton.setVisibility(View.GONE); } - registerReceiver(detailReceiver, + getActivity().registerReceiver(detailReceiver, new IntentFilter(AstridApiConstants.BROADCAST_SEND_DETAILS)); - registerReceiver(detailReceiver, + getActivity().registerReceiver(detailReceiver, new IntentFilter(AstridApiConstants.BROADCAST_SEND_DECORATIONS)); - registerReceiver(detailReceiver, + getActivity().registerReceiver(detailReceiver, new IntentFilter(AstridApiConstants.BROADCAST_SEND_ACTIONS)); - registerReceiver(refreshReceiver, + getActivity().registerReceiver(refreshReceiver, new IntentFilter(AstridApiConstants.BROADCAST_EVENT_REFRESH)); - registerReceiver(syncActionReceiver, + getActivity().registerReceiver(syncActionReceiver, new IntentFilter(AstridApiConstants.BROADCAST_SEND_SYNC_ACTIONS)); setUpBackgroundJobs(); @@ -582,13 +630,13 @@ public class TaskListActivity extends ListActivity implements OnScrollListener, } @Override - protected void onPause() { + public void onPause() { super.onPause(); StatisticsService.sessionPause(); try { - unregisterReceiver(detailReceiver); - unregisterReceiver(refreshReceiver); - unregisterReceiver(syncActionReceiver); + getActivity().unregisterReceiver(detailReceiver); + getActivity().unregisterReceiver(refreshReceiver); + getActivity().unregisterReceiver(syncActionReceiver); } catch (IllegalArgumentException e) { // might not have fully initialized } @@ -617,7 +665,7 @@ public class TaskListActivity extends ListActivity implements OnScrollListener, if(intent == null || !AstridApiConstants.BROADCAST_EVENT_REFRESH.equals(intent.getAction())) return; - runOnUiThread(new Runnable() { + getActivity().runOnUiThread(new Runnable() { @Override public void run() { taskAdapter.flushCaches(); @@ -681,9 +729,9 @@ public class TaskListActivity extends ListActivity implements OnScrollListener, } } - @Override public void onWindowFocusChanged(boolean hasFocus) { - super.onWindowFocusChanged(hasFocus); + // FIXME: move to parent Activity +// super.onWindowFocusChanged(hasFocus); if(hasFocus && Flags.checkAndClear(Flags.REFRESH)) { taskAdapter.flushCaches(); loadTaskListContent(true); @@ -691,7 +739,7 @@ public class TaskListActivity extends ListActivity implements OnScrollListener, } @Override - protected void onActivityResult(int requestCode, int resultCode, Intent data) { + public void onActivityResult(int requestCode, int resultCode, Intent data) { // handle the result of voice recognition, put it into the textfield if (voiceInputAssistant.handleActivityResult(requestCode, resultCode, data)) { // if user wants, create the task directly (with defaultvalues) after saying it @@ -704,13 +752,13 @@ public class TaskListActivity extends ListActivity implements OnScrollListener, } if(requestCode == ACTIVITY_SETTINGS && resultCode == EditPreferences.RESULT_CODE_THEME_CHANGED) { - finish(); - startActivity(getIntent()); + getActivity().finish(); + getActivity().startActivity(getActivity().getIntent()); } super.onActivityResult(requestCode, resultCode, data); - if(resultCode != RESULT_CANCELED) { + if(resultCode != Activity.RESULT_CANCELED) { taskAdapter.flushCaches(); loadTaskListContent(true); taskService.cleanup(); @@ -766,7 +814,7 @@ public class TaskListActivity extends ListActivity implements OnScrollListener, taskAdapter.flushCaches(); taskAdapter.notifyDataSetChanged(); } - startManagingCursor(taskCursor); + getActivity().startManagingCursor(taskCursor); if(oldListItemSelected != ListView.INVALID_POSITION && oldListItemSelected < taskCursor.getCount()) @@ -775,13 +823,14 @@ public class TaskListActivity extends ListActivity implements OnScrollListener, // also load sync actions syncActions.clear(); Intent broadcastIntent = new Intent(AstridApiConstants.BROADCAST_REQUEST_SYNC_ACTIONS); - sendOrderedBroadcast(broadcastIntent, AstridApiConstants.PERMISSION_READ); + getActivity().sendOrderedBroadcast(broadcastIntent, AstridApiConstants.PERMISSION_READ); } - @Override - public void setTitle(CharSequence title) { - ((TextView)findViewById(R.id.listLabel)).setText(title); - } + // FIXME: put this into the wrapper-activity eventually +// @Override +// public void setTitle(CharSequence title) { +// ((TextView)findViewById(R.id.listLabel)).setText(title); +// } /** * Fill in the Task List with current items @@ -793,12 +842,13 @@ public class TaskListActivity extends ListActivity implements OnScrollListener, sqlQueryTemplate.set(SortHelper.adjustQueryForFlagsAndSort(filter.sqlQuery, sortFlags, sortSort)); - setTitle(filter.title); + // FIXME: put this into the wrapper-activity eventually +// setTitle(filter.title); // perform query TodorooCursor currentCursor = taskService.fetchFiltered( sqlQueryTemplate.get(), null, TaskAdapter.PROPERTIES); - startManagingCursor(currentCursor); + getActivity().startManagingCursor(currentCursor); // set up list adapters taskAdapter = new TaskAdapter(this, R.layout.task_adapter_row, @@ -843,13 +893,13 @@ public class TaskListActivity extends ListActivity implements OnScrollListener, currentCursor = taskService.fetchFiltered(sqlQueryTemplate.get(), null, TaskAdapter.PROPERTIES); getListView().setFilterText(""); - startManagingCursor(currentCursor); + getActivity().startManagingCursor(currentCursor); taskAdapter.changeCursor(currentCursor); // update title filter.title = getString(R.string.TLA_custom); - ((TextView)findViewById(R.id.listLabel)).setText(filter.title); + ((TextView)getView().findViewById(R.id.listLabel)).setText(filter.title); // try selecting again for(int i = 0; i < currentCursor.getCount(); i++) { @@ -865,13 +915,13 @@ public class TaskListActivity extends ListActivity implements OnScrollListener, private void showHelpPopover() { if (!Preferences.getBoolean(R.string.p_showed_tap_task_help, false)) { Preferences.setBoolean(R.string.p_showed_tap_task_help, true); - InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); + InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(quickAddBox.getWindowToken(), 0); getListView().postDelayed(new Runnable() { public void run() { final View view = getListView().getChildAt(getListView().getChildCount() - 1); if (view != null) { - HelpInfoPopover.showPopover(TaskListActivity.this, view, R.string.help_popover_tap_task); + HelpInfoPopover.showPopover(getActivity(), view, R.string.help_popover_tap_task); } } }, 1000L); @@ -910,12 +960,12 @@ public class TaskListActivity extends ListActivity implements OnScrollListener, boolean gcalCreateEventEnabled = Preferences.getStringValue(R.string.gcal_p_default) != null && !Preferences.getStringValue(R.string.gcal_p_default).equals("-1"); if (title.length()>0 && gcalCreateEventEnabled) { - Uri calendarUri = GCalHelper.createTaskEvent(task, getContentResolver(), new ContentValues()); + Uri calendarUri = GCalHelper.createTaskEvent(task, getActivity().getContentResolver(), new ContentValues()); task.setValue(Task.CALENDAR_URI, calendarUri.toString()); taskService.save(task); } - TextView quickAdd = (TextView)findViewById(R.id.quickAddText); + TextView quickAdd = (TextView)getView().findViewById(R.id.quickAddText); quickAdd.setText(""); //$NON-NLS-1$ if(selectNewTask) { @@ -926,7 +976,7 @@ public class TaskListActivity extends ListActivity implements OnScrollListener, StatisticsService.reportEvent(StatisticsConstants.TASK_CREATED_TASKLIST); return task; } catch (Exception e) { - exceptionService.displayAndReportError(this, "quick-add-task", e); + exceptionService.displayAndReportError(getActivity(), "quick-add-task", e); return new Task(); } } @@ -1010,7 +1060,7 @@ public class TaskListActivity extends ListActivity implements OnScrollListener, long taskId = task.getId(); for(ContextMenuItem item : contextMenuExtensionLoader.getList()) { - MenuItem menuItem = menu.add(id, CONTEXT_MENU_BROADCAST_INTENT_ID, Menu.NONE, + android.view.MenuItem menuItem = menu.add(id, CONTEXT_MENU_BROADCAST_INTENT_ID, Menu.NONE, item.title); item.intent.putExtra(AstridApiConstants.EXTRAS_TASK_ID, taskId); menuItem.setIntent(item.intent); @@ -1024,7 +1074,7 @@ public class TaskListActivity extends ListActivity implements OnScrollListener, /** Show a dialog box and delete the task specified */ private void deleteTask(final Task task) { - new AlertDialog.Builder(this).setTitle(R.string.DLG_confirm_title) + new AlertDialog.Builder(getActivity()).setTitle(R.string.DLG_confirm_title) .setMessage(R.string.DLG_delete_this_task_question).setIcon( android.R.drawable.ic_dialog_alert).setPositiveButton( android.R.string.ok, @@ -1061,7 +1111,7 @@ public class TaskListActivity extends ListActivity implements OnScrollListener, // Get a list of all sync plugins and bring user to the prefs pane // for one of them Intent queryIntent = new Intent(AstridApiConstants.ACTION_SETTINGS); - PackageManager pm = getPackageManager(); + PackageManager pm = getActivity().getPackageManager(); List resolveInfoList = pm.queryIntentActivities( queryIntent, PackageManager.GET_META_DATA); int length = resolveInfoList.size(); @@ -1100,7 +1150,7 @@ public class TaskListActivity extends ListActivity implements OnScrollListener, SyncAction syncAction = syncActions.iterator().next(); try { syncAction.intent.send(); - Toast.makeText(this, R.string.SyP_progress_toast, + Toast.makeText(getActivity(), R.string.SyP_progress_toast, Toast.LENGTH_LONG).show(); } catch (CanceledException e) { // @@ -1114,7 +1164,7 @@ public class TaskListActivity extends ListActivity implements OnScrollListener, public void onClick(DialogInterface click, int which) { try { actions[which].intent.send(); - Toast.makeText(TaskListActivity.this, R.string.SyP_progress_toast, + Toast.makeText(getActivity(), R.string.SyP_progress_toast, Toast.LENGTH_LONG).show(); } catch (CanceledException e) { // @@ -1133,18 +1183,24 @@ public class TaskListActivity extends ListActivity implements OnScrollListener, * @param listener */ private void showSyncOptionMenu(TYPE[] items, DialogInterface.OnClickListener listener) { - ArrayAdapter adapter = new ArrayAdapter(this, + ArrayAdapter adapter = new ArrayAdapter(getActivity(), android.R.layout.simple_spinner_dropdown_item, items); // show a menu of available options - new AlertDialog.Builder(this) + new AlertDialog.Builder(getActivity()) .setTitle(R.string.SyP_label) .setAdapter(adapter, listener) - .show().setOwnerActivity(this); + .show().setOwnerActivity(getActivity()); + } + + @Override + public boolean onContextItemSelected(MenuItem item) { + // called when context menu appears + return onOptionsItemSelected(item); } @Override - public boolean onMenuItemSelected(int featureId, final MenuItem item) { + public boolean onOptionsItemSelected(final MenuItem item) { Intent intent; long itemId; @@ -1156,17 +1212,17 @@ public class TaskListActivity extends ListActivity implements OnScrollListener, return true; case MENU_ADDONS_ID: StatisticsService.reportEvent(StatisticsConstants.TLA_MENU_ADDONS); - intent = new Intent(this, AddOnActivity.class); + intent = new Intent(getActivity(), AddOnActivity.class); startActivityForResult(intent, ACTIVITY_ADDONS); return true; case MENU_SETTINGS_ID: StatisticsService.reportEvent(StatisticsConstants.TLA_MENU_SETTINGS); - intent = new Intent(this, EditPreferences.class); + intent = new Intent(getActivity(), EditPreferences.class); startActivityForResult(intent, ACTIVITY_SETTINGS); return true; case MENU_SORT_ID: StatisticsService.reportEvent(StatisticsConstants.TLA_MENU_SORT); - AlertDialog dialog = SortSelectionActivity.createDialog(this, + AlertDialog dialog = SortSelectionActivity.createDialog(getActivity(), this, sortFlags, sortSort); dialog.show(); return true; @@ -1176,25 +1232,25 @@ public class TaskListActivity extends ListActivity implements OnScrollListener, return true; case MENU_SUPPORT_ID: StatisticsService.reportEvent(StatisticsConstants.TLA_MENU_HELP); - intent = new Intent(this, FeedbackActivity.class); + intent = new Intent(getActivity(), FeedbackActivity.class); startActivity(intent); return true; case MENU_ADDON_INTENT_ID: intent = item.getIntent(); - AndroidUtilities.startExternalIntent(this, intent, ACTIVITY_MENU_EXTERNAL); + AndroidUtilities.startExternalIntent(getActivity(), intent, ACTIVITY_MENU_EXTERNAL); return true; // --- context menu items case CONTEXT_MENU_BROADCAST_INTENT_ID: { intent = item.getIntent(); - sendBroadcast(intent); + getActivity().sendBroadcast(intent); return true; } case CONTEXT_MENU_EDIT_TASK_ID: { itemId = item.getGroupId(); - intent = new Intent(TaskListActivity.this, TaskEditActivity.class); + intent = new Intent(getActivity(), TaskEditActivity.class); intent.putExtra(TaskEditActivity.TOKEN_ID, itemId); startActivityForResult(intent, ACTIVITY_EDIT_TASK); transitionForTaskEdit(); @@ -1217,7 +1273,7 @@ public class TaskListActivity extends ListActivity implements OnScrollListener, GCalHelper.createTaskEventIfEnabled(clone); taskService.save(clone); - intent = new Intent(TaskListActivity.this, TaskEditActivity.class); + intent = new Intent(getActivity(), TaskEditActivity.class); intent.putExtra(TaskEditActivity.TOKEN_ID, clone.getId()); startActivityForResult(intent, ACTIVITY_EDIT_TASK); transitionForTaskEdit(); @@ -1276,9 +1332,10 @@ public class TaskListActivity extends ListActivity implements OnScrollListener, @SuppressWarnings("nls") private void showFilterListActivity() { - Intent intent = new Intent(TaskListActivity.this, + Intent intent = new Intent(getActivity(), FilterListActivity.class); startActivity(intent); + // FIXME animations AndroidUtilities.callApiMethod(5, this, "overridePendingTransition", new Class[] { Integer.TYPE, Integer.TYPE }, R.anim.slide_right_in, R.anim.slide_right_out); @@ -1290,7 +1347,7 @@ public class TaskListActivity extends ListActivity implements OnScrollListener, sortSort = sort; if(always) { - SharedPreferences publicPrefs = AstridPreferences.getPublicPrefs(this); + SharedPreferences publicPrefs = AstridPreferences.getPublicPrefs(getActivity()); Editor editor = publicPrefs.edit(); editor.putInt(SortHelper.PREF_SORT_FLAGS, flags); editor.putInt(SortHelper.PREF_SORT_SORT, sort); diff --git a/astrid/src/com/todoroo/astrid/adapter/TaskAdapter.java b/astrid/src/com/todoroo/astrid/adapter/TaskAdapter.java index 7250ac9a5..e506a8542 100644 --- a/astrid/src/com/todoroo/astrid/adapter/TaskAdapter.java +++ b/astrid/src/com/todoroo/astrid/adapter/TaskAdapter.java @@ -17,7 +17,6 @@ import java.util.concurrent.atomic.AtomicReference; import org.json.JSONException; import org.json.JSONObject; -import android.app.ListActivity; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; @@ -29,6 +28,7 @@ import android.graphics.Color; import android.graphics.Paint; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; +import android.support.v4.app.ListFragment; import android.text.Html; import android.text.Html.ImageGetter; import android.text.Html.TagHandler; @@ -61,6 +61,7 @@ import com.timsu.astrid.R; import com.todoroo.andlib.data.Property; import com.todoroo.andlib.data.TodorooCursor; import com.todoroo.andlib.service.Autowired; +import com.todoroo.andlib.service.ContextManager; import com.todoroo.andlib.service.DependencyInjectionService; import com.todoroo.andlib.service.ExceptionService; import com.todoroo.andlib.utility.AndroidUtilities; @@ -135,7 +136,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable { @Autowired private TaskService taskService; - protected final ListActivity activity; + protected final ListFragment fragment; protected final HashMap completedItems = new HashMap(0); protected OnCompletedTaskListener onCompletedTaskListener = null; public boolean isFling = false; @@ -164,7 +165,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable { /** * Constructor * - * @param activity + * @param fragment * @param resource * layout resource to inflate * @param c @@ -174,24 +175,24 @@ public class TaskAdapter extends CursorAdapter implements Filterable { * @param onCompletedTaskListener * task listener. can be null */ - public TaskAdapter(ListActivity activity, int resource, + public TaskAdapter(ListFragment fragment, int resource, Cursor c, AtomicReference query, boolean autoRequery, OnCompletedTaskListener onCompletedTaskListener) { - super(activity, c, autoRequery); + super(ContextManager.getContext(), c, autoRequery); DependencyInjectionService.getInstance().inject(this); - inflater = (LayoutInflater) activity.getSystemService( + inflater = (LayoutInflater) fragment.getActivity().getSystemService( Context.LAYOUT_INFLATER_SERVICE); this.query = query; this.resource = resource; - this.activity = activity; + this.fragment = fragment; this.onCompletedTaskListener = onCompletedTaskListener; fontSize = Preferences.getIntegerFromString(R.string.p_fontSize, 20); paint = new Paint(); displayMetrics = new DisplayMetrics(); - activity.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); + fragment.getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); detailLoader = new DetailLoaderThread(); detailLoader.start(); @@ -213,7 +214,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable { // perform query TodorooCursor newCursor = taskService.fetchFiltered( query.get(), constraint, TaskAdapter.PROPERTIES); - activity.startManagingCursor(newCursor); + fragment.getActivity().startManagingCursor(newCursor); return newCursor; } @@ -299,7 +300,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable { /** Helper method to set the contents and visibility of each field */ public synchronized void setFieldContentsAndVisibility(View view) { - Resources r = activity.getResources(); + Resources r = fragment.getResources(); ViewHolder viewHolder = (ViewHolder)view.getTag(); Task task = viewHolder.task; @@ -320,17 +321,17 @@ public class TaskAdapter extends CursorAdapter implements Filterable { if(!task.isCompleted() && task.hasDueDate()) { long dueDate = task.getValue(Task.DUE_DATE); if(dueDate > DateUtilities.now()) - dueDateView.setTextAppearance(activity, R.style.TextAppearance_TAd_ItemDueDate); + dueDateView.setTextAppearance(fragment.getActivity(), R.style.TextAppearance_TAd_ItemDueDate); else - dueDateView.setTextAppearance(activity, R.style.TextAppearance_TAd_ItemDueDate_Overdue); + dueDateView.setTextAppearance(fragment.getActivity(), R.style.TextAppearance_TAd_ItemDueDate_Overdue); String dateValue = formatDate(dueDate); dueDateView.setText(dateValue); dueDateTextWidth = paint.measureText(dateValue); setVisibility(dueDateView); } else if(task.isCompleted()) { - String dateValue = DateUtilities.getDateStringWithTime(activity, new Date(task.getValue(Task.COMPLETION_DATE))); + String dateValue = DateUtilities.getDateStringWithTime(fragment.getActivity(), new Date(task.getValue(Task.COMPLETION_DATE))); dueDateView.setText(r.getString(R.string.TAd_completed, dateValue)); - dueDateView.setTextAppearance(activity, R.style.TextAppearance_TAd_ItemDueDate_Completed); + dueDateView.setTextAppearance(fragment.getActivity(), R.style.TextAppearance_TAd_ItemDueDate_Completed); dueDateTextWidth = paint.measureText(dateValue); setVisibility(dueDateView); } else { @@ -499,10 +500,10 @@ public class TaskAdapter extends CursorAdapter implements Filterable { if(dateCache.containsKey(date)) return dateCache.get(date); - String string = DateUtilities.getRelativeDay(activity, date); + String string = DateUtilities.getRelativeDay(fragment.getActivity(), date); if(Task.hasDueTime(date)) string = String.format("%s, %s", string, //$NON-NLS-1$ - DateUtilities.getTimeString(activity, new Date(date))); + DateUtilities.getTimeString(fragment.getActivity(), new Date(date))); dateCache.put(date, string); return string; @@ -555,7 +556,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable { requestNewDetails(task); } if(taskDetailLoader.size() > 0) { - activity.runOnUiThread(new Runnable() { + fragment.getActivity().runOnUiThread(new Runnable() { @Override public void run() { notifyDataSetChanged(); @@ -582,7 +583,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable { private void requestNewDetails(Task task) { Intent broadcastIntent = new Intent(AstridApiConstants.BROADCAST_REQUEST_DETAILS); broadcastIntent.putExtra(AstridApiConstants.EXTRAS_TASK_ID, task.getId()); - activity.sendOrderedBroadcast(broadcastIntent, AstridApiConstants.PERMISSION_READ); + fragment.getActivity().sendOrderedBroadcast(broadcastIntent, AstridApiConstants.PERMISSION_READ); } } @@ -609,7 +610,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable { taskService.save(task); } - activity.runOnUiThread(new Runnable() { + fragment.getActivity().runOnUiThread(new Runnable() { @Override public void run() { notifyDataSetChanged(); @@ -622,7 +623,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable { new HashMap(3); @SuppressWarnings("nls") public Drawable getDrawable(String source) { - Resources r = activity.getResources(); + Resources r = fragment.getResources(); if(source.equals("silk_clock")) source = "details_alarm"; @@ -682,7 +683,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable { public class DecorationManager extends TaskAdapterAddOnManager { public DecorationManager() { - super(activity); + super(fragment); } private final TaskDecorationExposer[] exposers = new TaskDecorationExposer[] { @@ -737,7 +738,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable { viewHolder.view.setBackgroundColor(decoration.color); } if(decoration.decoration != null) { - View view = decoration.decoration.apply(activity, viewHolder.taskRow); + View view = decoration.decoration.apply(fragment.getActivity(), viewHolder.taskRow); viewHolder.decorations[i] = view; switch(decoration.position) { case TaskDecoration.POSITION_LEFT: { @@ -788,7 +789,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable { private final Intent broadcastIntent = new Intent(AstridApiConstants.BROADCAST_REQUEST_ACTIONS); public TaskActionManager() { - super(activity); + super(fragment); } @Override @@ -801,7 +802,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable { public synchronized void addNew(long taskId, String addOn, final TaskAction item, ViewHolder thisViewHolder) { addIfNotExists(taskId, addOn, item); if(mBar != null) { - ListView listView = activity.getListView(); + ListView listView = fragment.getListView(); ViewHolder myHolder = null; // update view if it is visible @@ -816,7 +817,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable { if(myHolder != null) { final ViewHolder viewHolder = myHolder; - activity.runOnUiThread(new Runnable() { + fragment.getActivity().runOnUiThread(new Runnable() { @Override public void run() { mBarListener.addWithAction(item); @@ -888,16 +889,16 @@ public class TaskAdapter extends CursorAdapter implements Filterable { itemCount = 0; positionActionMap.clear(); mBar.setOnQuickActionClickListener(this); - iconWidth = activity.getResources().getDrawable(R.drawable.ic_qbar_edit).getIntrinsicHeight(); + iconWidth = fragment.getResources().getDrawable(R.drawable.ic_qbar_edit).getIntrinsicHeight(); } public void addWithAction(TaskAction item) { Drawable drawable; if(item.drawable > 0) - drawable = activity.getResources().getDrawable(item.drawable); + drawable = fragment.getResources().getDrawable(item.drawable); else { Bitmap scaledBitmap = Bitmap.createScaledBitmap(item.icon, iconWidth, iconWidth, true); - drawable = new BitmapDrawable(activity.getResources(), scaledBitmap); + drawable = new BitmapDrawable(fragment.getResources(), scaledBitmap); } addWithAction(new QuickAction(drawable, item.text), item); } @@ -913,10 +914,10 @@ public class TaskAdapter extends CursorAdapter implements Filterable { mBar = null; if(position == 0) { - Intent intent = new Intent(activity, TaskEditActivity.class); + Intent intent = new Intent(fragment.getActivity(), TaskEditActivity.class); intent.putExtra(TaskEditActivity.TOKEN_ID, taskId); - activity.startActivityForResult(intent, TaskListActivity.ACTIVITY_EDIT_TASK); - AndroidUtilities.callApiMethod(5, activity, "overridePendingTransition", + fragment.startActivityForResult(intent, TaskListActivity.ACTIVITY_EDIT_TASK); + AndroidUtilities.callApiMethod(5, fragment, "overridePendingTransition", new Class[] { Integer.TYPE, Integer.TYPE }, R.anim.slide_left_in, R.anim.slide_left_out); } else { @@ -927,7 +928,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable { taskAction.intent.send(); } } catch (Exception e) { - exceptionService.displayAndReportError(activity, + exceptionService.displayAndReportError(fragment.getActivity(), "Error launching action", e); //$NON-NLS-1$ } } @@ -940,8 +941,8 @@ public class TaskAdapter extends CursorAdapter implements Filterable { // prepare quick action bar private void prepareQuickActionBar(ViewHolder viewHolder, Collection collection){ mBar = new QuickActionBar(viewHolder.view.getContext()); - QuickAction editAction = new QuickAction(activity, R.drawable.ic_qbar_edit, - activity.getString(R.string.TAd_actionEditTask)); + QuickAction editAction = new QuickAction(fragment.getActivity(), R.drawable.ic_qbar_edit, + fragment.getString(R.string.TAd_actionEditTask)); mBarListener.initialize(viewHolder.task.getId()); mBarListener.addWithAction(editAction, null); @@ -975,18 +976,18 @@ public class TaskAdapter extends CursorAdapter implements Filterable { if (actions.size() > 0) mBar.show(v); else { - Intent intent = new Intent(activity, TaskEditActivity.class); + Intent intent = new Intent(fragment.getActivity(), TaskEditActivity.class); intent.putExtra(TaskEditActivity.TOKEN_ID, taskId); - activity.startActivityForResult(intent, TaskListActivity.ACTIVITY_EDIT_TASK); - AndroidUtilities.callApiMethod(5, activity, "overridePendingTransition", + fragment.getActivity().startActivityForResult(intent, TaskListActivity.ACTIVITY_EDIT_TASK); + AndroidUtilities.callApiMethod(5, fragment, "overridePendingTransition", new Class[] { Integer.TYPE, Integer.TYPE }, R.anim.slide_left_in, R.anim.slide_left_out); } - } else { + } else if (!viewHolder.task.getFlag(Task.FLAGS, Task.FLAG_IS_READONLY)) { // Register a temporary receiver in case we clicked a task with no actions forthcoming and should start IntentFilter filter = new IntentFilter(AstridApiConstants.BROADCAST_REQUEST_ACTIONS); filter.setPriority(-1); - activity.registerReceiver(new TaskActionsFinishedReceiver(), filter); + fragment.getActivity().registerReceiver(new TaskActionsFinishedReceiver(), filter); } taskActionManager.request(viewHolder); @@ -1004,15 +1005,15 @@ public class TaskAdapter extends CursorAdapter implements Filterable { if (taskId != -1) { Collection actions = taskActionManager.get(taskId); if (actions != null && actions.size() == 0) { - Intent editIntent = new Intent(activity, TaskEditActivity.class); + Intent editIntent = new Intent(fragment.getActivity(), TaskEditActivity.class); editIntent.putExtra(TaskEditActivity.TOKEN_ID, taskId); - activity.startActivityForResult(editIntent, TaskListActivity.ACTIVITY_EDIT_TASK); - AndroidUtilities.callApiMethod(5, activity, "overridePendingTransition", + fragment.getActivity().startActivityForResult(editIntent, TaskListActivity.ACTIVITY_EDIT_TASK); + AndroidUtilities.callApiMethod(5, fragment, "overridePendingTransition", new Class[] { Integer.TYPE, Integer.TYPE }, R.anim.slide_left_in, R.anim.slide_left_out); } } - activity.unregisterReceiver(this); + fragment.getActivity().unregisterReceiver(this); } } @@ -1044,10 +1045,10 @@ public class TaskAdapter extends CursorAdapter implements Filterable { TextView name = viewHolder.nameView; if(state) { name.setPaintFlags(name.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); - name.setTextAppearance(activity, R.style.TextAppearance_TAd_ItemTitle_Completed); + name.setTextAppearance(fragment.getActivity(), R.style.TextAppearance_TAd_ItemTitle_Completed); } else { name.setPaintFlags(name.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG); - name.setTextAppearance(activity, R.style.TextAppearance_TAd_ItemTitle); + name.setTextAppearance(fragment.getActivity(), R.style.TextAppearance_TAd_ItemTitle); } name.setTextSize(fontSize); float detailTextSize = Math.max(10, fontSize * 12 / 20); diff --git a/astrid/src/com/todoroo/astrid/helper/TaskAdapterAddOnManager.java b/astrid/src/com/todoroo/astrid/helper/TaskAdapterAddOnManager.java index 9c1cde15e..4675cb1ba 100644 --- a/astrid/src/com/todoroo/astrid/helper/TaskAdapterAddOnManager.java +++ b/astrid/src/com/todoroo/astrid/helper/TaskAdapterAddOnManager.java @@ -9,8 +9,8 @@ import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; -import android.app.ListActivity; import android.content.Intent; +import android.support.v4.app.ListFragment; import android.widget.ListView; import com.todoroo.astrid.adapter.TaskAdapter.ViewHolder; @@ -19,13 +19,13 @@ import com.todoroo.astrid.data.Task; abstract public class TaskAdapterAddOnManager { - private final ListActivity activity; + private final ListFragment fragment; /** * @param taskAdapter */ - protected TaskAdapterAddOnManager(ListActivity activity) { - this.activity = activity; + protected TaskAdapterAddOnManager(ListFragment fragment) { + this.fragment = fragment; } private final Map> cache = @@ -50,7 +50,7 @@ abstract public class TaskAdapterAddOnManager { draw(viewHolder, taskId, get(taskId)); Intent broadcastIntent = createBroadcastIntent(viewHolder.task); if(broadcastIntent != null) - activity.sendOrderedBroadcast(broadcastIntent, AstridApiConstants.PERMISSION_READ); + fragment.getActivity().sendOrderedBroadcast(broadcastIntent, AstridApiConstants.PERMISSION_READ); return true; } @@ -73,7 +73,7 @@ abstract public class TaskAdapterAddOnManager { if(thisViewHolder != null) draw(thisViewHolder, taskId, cacheList); else { - ListView listView = activity.getListView(); + ListView listView = fragment.getListView(); // update view if it is visible int length = listView.getChildCount(); for(int i = 0; i < length; i++) { diff --git a/astrid/src/com/todoroo/astrid/welcome/SplashScreenLauncher.java b/astrid/src/com/todoroo/astrid/welcome/SplashScreenLauncher.java index 696e39f75..cb3132a74 100644 --- a/astrid/src/com/todoroo/astrid/welcome/SplashScreenLauncher.java +++ b/astrid/src/com/todoroo/astrid/welcome/SplashScreenLauncher.java @@ -9,7 +9,7 @@ import com.timsu.astrid.R; import com.todoroo.andlib.service.Autowired; import com.todoroo.andlib.service.ContextManager; import com.todoroo.andlib.service.DependencyInjectionService; -import com.todoroo.astrid.activity.TaskListActivity; +import com.todoroo.astrid.activity.TaskListWrapperActivity; import com.todoroo.astrid.service.AstridDependencyInjector; import com.todoroo.astrid.service.StartupService; import com.todoroo.astrid.service.StatisticsService; @@ -56,7 +56,7 @@ public class SplashScreenLauncher extends Activity { private void mainActivityPath() { Intent intent = new Intent(); - intent.setClass(this, TaskListActivity.class); // Go to task list activity + intent.setClass(this, TaskListWrapperActivity.class); // Go to task list activity startActivity(intent); finish(); }