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.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);
}

@ -53,8 +53,11 @@
<!-- 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>
<!-- Shown after user adds a task -->
<string name="help_popover_lists">Tap to edit or share lists</string>
<!-- Shown after user adds a task on tablet-->
<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>

@ -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
*

@ -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();
}
}

@ -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);
}
}
};

@ -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));

@ -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);
}

Loading…
Cancel
Save