Comments popover in LAYOUT_DOUBLE

pull/14/head
Sam Bosley 13 years ago
parent 9f0f19fdc9
commit 7068177619

@ -77,6 +77,12 @@ public class AstridActivity extends FragmentActivity
return frag; return frag;
} }
public TagUpdatesFragment getTagUpdatesFragment() {
TagUpdatesFragment frag = (TagUpdatesFragment) getSupportFragmentManager()
.findFragmentByTag(TagUpdatesFragment.TAG_UPDATES_FRAGMENT);
return frag;
}
@Override @Override
@ -155,10 +161,11 @@ public class AstridActivity extends FragmentActivity
} }
public void setupActivityFragment(TagData tagData) { public void setupActivityFragment(TagData tagData) {
if (fragmentLayout != LAYOUT_TRIPLE) if (fragmentLayout == LAYOUT_SINGLE)
return; return;
findViewById(R.id.taskedit_fragment_container).setVisibility(View.VISIBLE); if (fragmentLayout == LAYOUT_TRIPLE)
findViewById(R.id.taskedit_fragment_container).setVisibility(View.VISIBLE);
FragmentManager manager = getSupportFragmentManager(); FragmentManager manager = getSupportFragmentManager();
FragmentTransaction transaction = manager.beginTransaction(); FragmentTransaction transaction = manager.beginTransaction();

@ -21,6 +21,7 @@ import com.timsu.astrid.R;
import com.todoroo.andlib.utility.AndroidUtilities; import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.astrid.actfm.ActFmLoginActivity; import com.todoroo.astrid.actfm.ActFmLoginActivity;
import com.todoroo.astrid.actfm.TagSettingsActivity; import com.todoroo.astrid.actfm.TagSettingsActivity;
import com.todoroo.astrid.actfm.TagUpdatesFragment;
import com.todoroo.astrid.api.Filter; import com.todoroo.astrid.api.Filter;
import com.todoroo.astrid.api.FilterListItem; import com.todoroo.astrid.api.FilterListItem;
import com.todoroo.astrid.reminders.NotificationFragment; import com.todoroo.astrid.reminders.NotificationFragment;
@ -43,6 +44,7 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
private FragmentPopover listsPopover; private FragmentPopover listsPopover;
private FragmentPopover editPopover; private FragmentPopover editPopover;
private FragmentPopover commentsPopover;
private MainMenuPopover mainMenuPopover; private MainMenuPopover mainMenuPopover;
private final OnClickListener mainMenuClickListener = new OnClickListener() { private final OnClickListener mainMenuClickListener = new OnClickListener() {
@ -64,9 +66,18 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
private final OnClickListener commentsButtonClickListener = new OnClickListener() { private final OnClickListener commentsButtonClickListener = new OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
TaskListFragment tlf = getTaskListFragment(); if (fragmentLayout == LAYOUT_DOUBLE) {
if (tlf != null) TagUpdatesFragment frag = getTagUpdatesFragment();
tlf.commentsButtonClicked(); if (frag != null) {
setupPopoverWithFragment(commentsPopover, frag, null);
commentsPopover.show(listsNav);
}
} else {
// In this case we should be in LAYOUT_SINGLE--delegate to the task list fragment
TaskListFragment tlf = getTaskListFragment();
if (tlf != null)
tlf.handleCommentsButtonClicked();
}
} }
}; };
@ -130,6 +141,7 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
} else { } else {
fragmentLayout = LAYOUT_DOUBLE; fragmentLayout = LAYOUT_DOUBLE;
createEditPopover(); createEditPopover();
createCommentsPopover();
} }
setupFragment(FilterListFragment.TAG_FILTERLIST_FRAGMENT, setupFragment(FilterListFragment.TAG_FILTERLIST_FRAGMENT,
@ -168,6 +180,10 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
}); });
} }
private void createCommentsPopover() {
commentsPopover = new FragmentPopover(this, R.layout.taskedit_popover);
}
private void createMainMenuPopover() { private void createMainMenuPopover() {
mainMenuPopover = new MainMenuPopover(this, R.layout.main_menu_popover); mainMenuPopover = new MainMenuPopover(this, R.layout.main_menu_popover);
mainMenuPopover.setMenuListener(this); mainMenuPopover.setMenuListener(this);
@ -260,6 +276,8 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
editPopover.dismiss(); editPopover.dismiss();
if (mainMenuPopover != null) if (mainMenuPopover != null)
mainMenuPopover.dismiss(); mainMenuPopover.dismiss();
if (commentsPopover != null)
commentsPopover.dismiss();
} }
public void setSelectedItem(Filter item) { public void setSelectedItem(Filter item) {

@ -1202,7 +1202,7 @@ public class TaskListFragment extends ListFragment implements OnScrollListener,
/** /**
* Comments button in action bar was clicked * Comments button in action bar was clicked
*/ */
protected void commentsButtonClicked() { protected void handleCommentsButtonClicked() {
Intent intent = new Intent(getActivity(), TagUpdatesActivity.class); Intent intent = new Intent(getActivity(), TagUpdatesActivity.class);
intent.putExtra(TagViewFragment.EXTRA_TAG_DATA, getTagDataForUpdates()); intent.putExtra(TagViewFragment.EXTRA_TAG_DATA, getTagDataForUpdates());
startActivity(intent); startActivity(intent);

Loading…
Cancel
Save