Fixed some popover layout issues on tablet, added a popover for list dropdown

pull/14/head
Sam Bosley 13 years ago
parent 695c78fd18
commit 970f05dd8c

@ -34,6 +34,7 @@ import com.todoroo.andlib.service.NotificationManager;
import com.todoroo.andlib.service.NotificationManager.AndroidNotificationManager; import com.todoroo.andlib.service.NotificationManager.AndroidNotificationManager;
import com.todoroo.andlib.sql.Criterion; import com.todoroo.andlib.sql.Criterion;
import com.todoroo.andlib.sql.Query; import com.todoroo.andlib.sql.Query;
import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.andlib.utility.DateUtilities; import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.andlib.utility.DialogUtilities; import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.andlib.utility.Preferences; import com.todoroo.andlib.utility.Preferences;
@ -137,6 +138,9 @@ public class TagViewActivity extends TaskListFragment {
Intent intent = new Intent(getActivity(), TagSettingsActivity.class); Intent intent = new Intent(getActivity(), TagSettingsActivity.class);
intent.putExtra(EXTRA_TAG_DATA, tagData); intent.putExtra(EXTRA_TAG_DATA, tagData);
startActivityForResult(intent, REQUEST_CODE_SETTINGS); 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() { private void showListSettingsPopover() {
if (!Preferences.getBoolean(R.string.p_showed_list_settings_help, false)) { 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); HelpInfoPopover.showPopover(getActivity(), tabView, R.string.help_popover_list_settings, null);
Preferences.setBoolean(R.string.p_showed_list_settings_help, true); Preferences.setBoolean(R.string.p_showed_list_settings_help, true);
} }

@ -53,8 +53,11 @@
<!-- Shown the first time a user sees the list settings tab --> <!-- Shown the first time a user sees the list settings tab -->
<string name="help_popover_collaborators">People you share with can help you build your list or finish tasks</string> <string name="help_popover_collaborators">People you share with can help you build your list or finish tasks</string>
<!-- Shown after user adds a task --> <!-- Shown after user adds a task on tablet-->
<string name="help_popover_lists">Tap to edit or share lists</string> <string name="help_popover_add_lists">Tap add a list</string>
<!-- Shown after a user adds a task on phones -->
<string name="help_popover_switch_lists">Tap to add a list or switch between lists</string>
<string name="help_popover_when_shortcut">Tap this shortcut to quick select date and time</string> <string name="help_popover_when_shortcut">Tap this shortcut to quick select date and time</string>

@ -56,6 +56,7 @@ import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.service.StartupService; import com.todoroo.astrid.service.StartupService;
import com.todoroo.astrid.service.StatisticsService; import com.todoroo.astrid.service.StatisticsService;
import com.todoroo.astrid.tags.TagsPlugin; import com.todoroo.astrid.tags.TagsPlugin;
import com.todoroo.astrid.welcome.HelpInfoPopover;
/** /**
* Activity that displays a user's task lists and allows users * Activity that displays a user's task lists and allows users
@ -479,11 +480,20 @@ public class FilterListFragment extends ListFragment {
.show().setOwnerActivity(getActivity()); .show().setOwnerActivity(getActivity());
} }
public void clear() {
adapter.clear();
}
public void refresh() { public void refresh() {
adapter.clear(); adapter.clear();
adapter.getLists(); 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 * Receiver which receives refresh intents
* *

@ -285,7 +285,7 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
getIntent().putExtra(TaskListFragment.TOKEN_FILTER, newList); getIntent().putExtra(TaskListFragment.TOKEN_FILTER, newList);
FilterListFragment fla = getFilterListFragment(); FilterListFragment fla = getFilterListFragment();
if (fla != null) if (fla != null)
fla.refresh(); fla.clear();
} }
} }

@ -29,6 +29,7 @@ import android.database.Cursor;
import android.graphics.PixelFormat; import android.graphics.PixelFormat;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.ActionBar;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.ListFragment; import android.support.v4.app.ListFragment;
import android.support.v4.app.SupportActivity; import android.support.v4.app.SupportActivity;
@ -840,10 +841,15 @@ public class TaskListFragment extends ListFragment implements OnScrollListener,
super.onActivityResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data);
if (!Preferences.getBoolean(R.string.p_showed_add_task_help, false)) { if (!Preferences.getBoolean(R.string.p_showed_add_task_help, false)) {
quickAddBox.postDelayed(new Runnable() {
@Override
public void run() {
HelpInfoPopover.showPopover(getActivity(), quickAddBox, HelpInfoPopover.showPopover(getActivity(), quickAddBox,
R.string.help_popover_add_task, null); R.string.help_popover_add_task, null);
Preferences.setBoolean(R.string.p_showed_add_task_help, true); Preferences.setBoolean(R.string.p_showed_add_task_help, true);
} }
}, 1000);
}
if (resultCode != Activity.RESULT_CANCELED) { if (resultCode != Activity.RESULT_CANCELED) {
if (data != null if (data != null
@ -1034,31 +1040,32 @@ public class TaskListFragment extends ListFragment implements OnScrollListener,
private void showTaskEditHelpPopover() { private void showTaskEditHelpPopover() {
if (!Preferences.getBoolean(R.string.p_showed_tap_task_help, false)) { 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( InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(
Context.INPUT_METHOD_SERVICE); Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(quickAddBox.getWindowToken(), 0); imm.hideSoftInputFromWindow(quickAddBox.getWindowToken(), 0);
getListView().postDelayed(new Runnable() { getListView().postDelayed(new Runnable() {
public void run() { 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( final View view = getListView().getChildAt(
getListView().getChildCount() - 1); getListView().getChildCount() - 1);
if (view != null) { if (view != null) {
OnDismissListener onDismiss = new OnDismissListener() { OnDismissListener onDismiss = new OnDismissListener() {
@Override @Override
public void onDismiss() { public void onDismiss() {
if (!Preferences.isSet(getString(R.string.p_showed_lists_help))) { if (!Preferences.getBoolean(
Preferences.setBoolean(
R.string.p_showed_lists_help,
false);
} else if (!Preferences.getBoolean(
R.string.p_showed_lists_help, false)) { 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( Preferences.setBoolean(
R.string.p_showed_lists_help, R.string.p_showed_lists_help,
true); true);
// HelpInfoPopover.showPopover(getActivity(),
// getView().findViewById(R.id.back),
// R.string.help_popover_lists, null);
} }
} }
}; };

@ -57,6 +57,11 @@ public class HelpInfoPopover extends QuickActionWidget {
// Do nothing // Do nothing
} }
@Override
protected int getArrowLeftMargin(View arrow) {
return mRect.width() / 2;
}
@Override @Override
protected void onMeasureAndLayout(Rect anchorRect, View contentView) { protected void onMeasureAndLayout(Rect anchorRect, View contentView) {
contentView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); contentView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));

@ -244,7 +244,7 @@ public abstract class QuickActionWidget extends PopupWindow {
prepareAnimationStyle(); prepareAnimationStyle();
try { try {
showAtLocation(anchor, Gravity.NO_GRAVITY, 0, mPopupY); showAtLocation(anchor, Gravity.NO_GRAVITY, mRect.left, mPopupY);
} catch (Exception e) { } catch (Exception e) {
Log.w("quick-action-show", e); Log.w("quick-action-show", e);
} }

Loading…
Cancel
Save