package blogr.vpm.fr.blogr.activity;

import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentTransaction;
import android.os.Bundle;

import blogr.vpm.fr.blogr.R;
import blogr.vpm.fr.blogr.bean.Post;


public class PostActivity extends Activity implements PostSelectionListener{

    private PostEditionFragment postEditionFragment;
    private Fragment postListFragment;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_post);
        postEditionFragment = (PostEditionFragment) getFragmentManager().findFragmentById(R.id.postEditionFragment);
        postListFragment = getFragmentManager().findFragmentById(R.id.postListFragment);
        FragmentTransaction displayPostList = getFragmentManager().beginTransaction();
        displayPostList.hide(postEditionFragment);
        displayPostList.commit();
        setTitle("");
    }

    @Override
    public void onPostSelection(Post post) {
        postEditionFragment.editPost(post);
        FragmentTransaction displayPostEdition = getFragmentManager().beginTransaction();
        displayPostEdition.hide(postListFragment);
        displayPostEdition.show(postEditionFragment);
        displayPostEdition.commit();
    }
}

@@ -154,16 +154,48 @@
 .Bundle;
+%0Aimport android.view.ActionMode;
 %0A%0Aimport
@@ -1337,11 +1337,125 @@
 );%0A    %7D
+%0A%0A    @Override%0A    public void onActionModeFinished(ActionMode mode) %7B%0A        postListFragment.onResume();%0A    %7D
 %0A%7D%0A

update activity lifecycle to refresh the list view