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;
}
public TagUpdatesFragment getTagUpdatesFragment() {
TagUpdatesFragment frag = (TagUpdatesFragment) getSupportFragmentManager()
.findFragmentByTag(TagUpdatesFragment.TAG_UPDATES_FRAGMENT);
return frag;
}
@Override
@ -155,10 +161,11 @@ public class AstridActivity extends FragmentActivity
}
public void setupActivityFragment(TagData tagData) {
if (fragmentLayout != LAYOUT_TRIPLE)
if (fragmentLayout == LAYOUT_SINGLE)
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();
FragmentTransaction transaction = manager.beginTransaction();

@ -21,6 +21,7 @@ import com.timsu.astrid.R;
import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.astrid.actfm.ActFmLoginActivity;
import com.todoroo.astrid.actfm.TagSettingsActivity;
import com.todoroo.astrid.actfm.TagUpdatesFragment;
import com.todoroo.astrid.api.Filter;
import com.todoroo.astrid.api.FilterListItem;
import com.todoroo.astrid.reminders.NotificationFragment;
@ -43,6 +44,7 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
private FragmentPopover listsPopover;
private FragmentPopover editPopover;
private FragmentPopover commentsPopover;
private MainMenuPopover mainMenuPopover;
private final OnClickListener mainMenuClickListener = new OnClickListener() {
@ -64,9 +66,18 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
private final OnClickListener commentsButtonClickListener = new OnClickListener() {
@Override
public void onClick(View v) {
TaskListFragment tlf = getTaskListFragment();
if (tlf != null)
tlf.commentsButtonClicked();
if (fragmentLayout == LAYOUT_DOUBLE) {
TagUpdatesFragment frag = getTagUpdatesFragment();
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 {
fragmentLayout = LAYOUT_DOUBLE;
createEditPopover();
createCommentsPopover();
}
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() {
mainMenuPopover = new MainMenuPopover(this, R.layout.main_menu_popover);
mainMenuPopover.setMenuListener(this);
@ -260,6 +276,8 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
editPopover.dismiss();
if (mainMenuPopover != null)
mainMenuPopover.dismiss();
if (commentsPopover != null)
commentsPopover.dismiss();
}
public void setSelectedItem(Filter item) {

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

Loading…
Cancel
Save