From 970f05dd8c9b1340d5fc20a999f162273d261d3d Mon Sep 17 00:00:00 2001 From: Sam Bosley Date: Mon, 30 Jan 2012 13:25:13 -0800 Subject: [PATCH] Fixed some popover layout issues on tablet, added a popover for list dropdown --- .../todoroo/astrid/actfm/TagViewActivity.java | 6 +++- astrid/res/values/strings-intro.xml | 7 ++-- .../astrid/activity/FilterListFragment.java | 10 ++++++ .../astrid/activity/TaskListActivity.java | 2 +- .../astrid/activity/TaskListFragment.java | 33 +++++++++++-------- .../astrid/welcome/HelpInfoPopover.java | 5 +++ .../greendroid/widget/QuickActionWidget.java | 2 +- 7 files changed, 47 insertions(+), 18 deletions(-) diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/TagViewActivity.java b/astrid/plugin-src/com/todoroo/astrid/actfm/TagViewActivity.java index 73f2e2bff..8e4be88dd 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/TagViewActivity.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/TagViewActivity.java @@ -34,6 +34,7 @@ import com.todoroo.andlib.service.NotificationManager; import com.todoroo.andlib.service.NotificationManager.AndroidNotificationManager; import com.todoroo.andlib.sql.Criterion; import com.todoroo.andlib.sql.Query; +import com.todoroo.andlib.utility.AndroidUtilities; import com.todoroo.andlib.utility.DateUtilities; import com.todoroo.andlib.utility.DialogUtilities; import com.todoroo.andlib.utility.Preferences; @@ -137,6 +138,9 @@ public class TagViewActivity extends TaskListFragment { Intent intent = new Intent(getActivity(), TagSettingsActivity.class); intent.putExtra(EXTRA_TAG_DATA, tagData); startActivityForResult(intent, REQUEST_CODE_SETTINGS); + if (!AndroidUtilities.isTabletSized(getActivity())) { + AndroidUtilities.callOverridePendingTransition(getActivity(), R.anim.slide_left_in, R.anim.slide_left_out); + } } }; @@ -157,7 +161,7 @@ public class TagViewActivity extends TaskListFragment { private void showListSettingsPopover() { if (!Preferences.getBoolean(R.string.p_showed_list_settings_help, false)) { - View tabView = getView().findViewById(R.id.members_edit); + View tabView = getView().findViewById(R.id.shared_with); HelpInfoPopover.showPopover(getActivity(), tabView, R.string.help_popover_list_settings, null); Preferences.setBoolean(R.string.p_showed_list_settings_help, true); } diff --git a/astrid/res/values/strings-intro.xml b/astrid/res/values/strings-intro.xml index 119fd6e7c..d1195a9dc 100644 --- a/astrid/res/values/strings-intro.xml +++ b/astrid/res/values/strings-intro.xml @@ -53,8 +53,11 @@ People you share with can help you build your list or finish tasks - - Tap to edit or share lists + + Tap add a list + + + Tap to add a list or switch between lists Tap this shortcut to quick select date and time diff --git a/astrid/src/com/todoroo/astrid/activity/FilterListFragment.java b/astrid/src/com/todoroo/astrid/activity/FilterListFragment.java index c0f38f742..3be7a3a19 100644 --- a/astrid/src/com/todoroo/astrid/activity/FilterListFragment.java +++ b/astrid/src/com/todoroo/astrid/activity/FilterListFragment.java @@ -56,6 +56,7 @@ import com.todoroo.astrid.data.Task; import com.todoroo.astrid.service.StartupService; import com.todoroo.astrid.service.StatisticsService; import com.todoroo.astrid.tags.TagsPlugin; +import com.todoroo.astrid.welcome.HelpInfoPopover; /** * Activity that displays a user's task lists and allows users @@ -479,11 +480,20 @@ public class FilterListFragment extends ListFragment { .show().setOwnerActivity(getActivity()); } + public void clear() { + adapter.clear(); + } + public void refresh() { adapter.clear(); adapter.getLists(); } + public void showAddListPopover() { + View anchor = getView().findViewById(R.id.new_list_button); + HelpInfoPopover.showPopover(getActivity(), anchor, R.string.help_popover_add_lists, null); + } + /** * Receiver which receives refresh intents * diff --git a/astrid/src/com/todoroo/astrid/activity/TaskListActivity.java b/astrid/src/com/todoroo/astrid/activity/TaskListActivity.java index e78664108..c5df29e92 100644 --- a/astrid/src/com/todoroo/astrid/activity/TaskListActivity.java +++ b/astrid/src/com/todoroo/astrid/activity/TaskListActivity.java @@ -285,7 +285,7 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener getIntent().putExtra(TaskListFragment.TOKEN_FILTER, newList); FilterListFragment fla = getFilterListFragment(); if (fla != null) - fla.refresh(); + fla.clear(); } } diff --git a/astrid/src/com/todoroo/astrid/activity/TaskListFragment.java b/astrid/src/com/todoroo/astrid/activity/TaskListFragment.java index 34105f7b5..085f9183a 100644 --- a/astrid/src/com/todoroo/astrid/activity/TaskListFragment.java +++ b/astrid/src/com/todoroo/astrid/activity/TaskListFragment.java @@ -29,6 +29,7 @@ import android.database.Cursor; import android.graphics.PixelFormat; import android.net.Uri; import android.os.Bundle; +import android.support.v4.app.ActionBar; import android.support.v4.app.Fragment; import android.support.v4.app.ListFragment; import android.support.v4.app.SupportActivity; @@ -840,9 +841,14 @@ public class TaskListFragment extends ListFragment implements OnScrollListener, super.onActivityResult(requestCode, resultCode, data); if (!Preferences.getBoolean(R.string.p_showed_add_task_help, false)) { - HelpInfoPopover.showPopover(getActivity(), quickAddBox, - R.string.help_popover_add_task, null); - Preferences.setBoolean(R.string.p_showed_add_task_help, true); + quickAddBox.postDelayed(new Runnable() { + @Override + public void run() { + HelpInfoPopover.showPopover(getActivity(), quickAddBox, + R.string.help_popover_add_task, null); + Preferences.setBoolean(R.string.p_showed_add_task_help, true); + } + }, 1000); } if (resultCode != Activity.RESULT_CANCELED) { @@ -1034,31 +1040,32 @@ public class TaskListFragment extends ListFragment implements OnScrollListener, private void showTaskEditHelpPopover() { if (!Preferences.getBoolean(R.string.p_showed_tap_task_help, false)) { - Preferences.setBoolean(R.string.p_showed_tap_task_help, true); InputMethodManager imm = (InputMethodManager) getActivity().getSystemService( Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(quickAddBox.getWindowToken(), 0); getListView().postDelayed(new Runnable() { public void run() { - if (taskAdapter.getCount() > 0) { + if (taskAdapter != null && taskAdapter.getCount() > 0) { + Preferences.setBoolean(R.string.p_showed_tap_task_help, true); final View view = getListView().getChildAt( getListView().getChildCount() - 1); if (view != null) { OnDismissListener onDismiss = new OnDismissListener() { @Override public void onDismiss() { - if (!Preferences.isSet(getString(R.string.p_showed_lists_help))) { - Preferences.setBoolean( - R.string.p_showed_lists_help, - false); - } else if (!Preferences.getBoolean( + if (!Preferences.getBoolean( R.string.p_showed_lists_help, false)) { + if (AndroidUtilities.isTabletSized(getActivity())) { + ((AstridActivity) getActivity()).getFilterListFragment().showAddListPopover(); + } else { + ActionBar ab = ((AstridActivity) getActivity()).getSupportActionBar(); + View anchor = ab.getCustomView().findViewById(R.id.lists_nav); + HelpInfoPopover.showPopover(getActivity(), + anchor, R.string.help_popover_switch_lists, null); + } Preferences.setBoolean( R.string.p_showed_lists_help, true); - // HelpInfoPopover.showPopover(getActivity(), - // getView().findViewById(R.id.back), - // R.string.help_popover_lists, null); } } }; diff --git a/astrid/src/com/todoroo/astrid/welcome/HelpInfoPopover.java b/astrid/src/com/todoroo/astrid/welcome/HelpInfoPopover.java index d9f4efd43..c019859dd 100644 --- a/astrid/src/com/todoroo/astrid/welcome/HelpInfoPopover.java +++ b/astrid/src/com/todoroo/astrid/welcome/HelpInfoPopover.java @@ -57,6 +57,11 @@ public class HelpInfoPopover extends QuickActionWidget { // Do nothing } + @Override + protected int getArrowLeftMargin(View arrow) { + return mRect.width() / 2; + } + @Override protected void onMeasureAndLayout(Rect anchorRect, View contentView) { contentView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); diff --git a/greendroid/GreenDroid/src/greendroid/widget/QuickActionWidget.java b/greendroid/GreenDroid/src/greendroid/widget/QuickActionWidget.java index 338058384..6e2d461bd 100644 --- a/greendroid/GreenDroid/src/greendroid/widget/QuickActionWidget.java +++ b/greendroid/GreenDroid/src/greendroid/widget/QuickActionWidget.java @@ -244,7 +244,7 @@ public abstract class QuickActionWidget extends PopupWindow { prepareAnimationStyle(); try { - showAtLocation(anchor, Gravity.NO_GRAVITY, 0, mPopupY); + showAtLocation(anchor, Gravity.NO_GRAVITY, mRect.left, mPopupY); } catch (Exception e) { Log.w("quick-action-show", e); }