/*
 * Base fragment for NewAnswer, NewQuestion Fragments, implements common members and colors
 */

package cs.ualberta.CMPUT301F14T08.stackunderflow;

import java.util.UUID;

import android.app.Fragment;
import android.os.Bundle;
import android.os.StrictMode;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.TextView;


public class NewPostFragment extends Fragment {
	
	public static final String EXTRA_POST_ID = "cs.ualberta.CMPUT301F14T08.stackunderflow.post_id";
	protected static final String DIALOG_USERNAME = "username";
    protected static final int REQUEST_USERNAME = 0;
    
	protected PostController sPostController;
	protected UUID mPostId;
	
	protected EditText mPostTitle;
	protected EditText mPostBody;
	protected ImageButton mUploadPictureButton;
	protected Button mSubmitButton;
	
	protected int mBlackColor;
	protected int mWhiteColor;
	protected int mBlueColor;
	
	@Override
	public void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
		
		mBlackColor = getResources().getColor(R.color.black);
		mWhiteColor = getResources().getColor(R.color.white);
		mBlueColor = getResources().getColor(R.color.blue);
	}
	
	@Override
	public void onCreateOptionsMenu(Menu menu, MenuInflater menuInflater){
		super.onCreateOptionsMenu(menu, menuInflater);
		menuInflater.inflate(R.menu.post_menu, menu);
	}
	
	@Override
	public boolean onOptionsItemSelected(MenuItem menuItem){
	    switch (menuItem.getItemId()) {
		
        case R.id.menu_item_new_reply:
//        	if(sPostController.getPostManager().getUserProfileManager().getUserProfile().getUsername.equals(null)){
//        		FragmentManager fm = getActivity().getFragmentManager();
//        		UsernameFragment dialog = new UsernameFragment();
//        		dialog.setTargetFragment(PostFragment.this, REQUEST_USERNAME);
//        		dialog.show(fm, DIALOG_USERNAME);
//        	}
//        	else{
//        		//new reply
//        		String toastString = "Someone needs to implement code to show add replies";
//                Toast toast = Toast.makeText(getActivity().getApplicationContext(), toastString, Toast.LENGTH_LONG);
//                toast.show(); 
//        	}
        	return true;
        	
        default:
            return super.onOptionsItemSelected(menuItem);
    	}
	}
    	
    	
	
	
}

@@ -1,104 +1,4 @@
-/*%0A * Base fragment for NewAnswer, NewQuestion Fragments, implements common members and colors%0A */%0A%0A
 pack
@@ -143,21 +143,27 @@
 oid.
-os.StrictMode
+view.LayoutInflater
 ;%0Aim
@@ -250,16 +250,73 @@
 nuItem;%0A
+import android.view.View;%0Aimport android.view.ViewGroup;%0A
 import a
@@ -373,83 +373,296 @@
 xt;%0A
-import android.widget.ImageButton;%0Aimport android.widget.TextView;%0A%0A%0Apublic
+/**%0A * This is used when a user would like to make a new post. This will also allow the user to input a new user name if the user has not yet chosen one%0A * If the user does not choose a user name it will simply default to User. %0A * @author Cmput301 Winter 2014 Group 8%0A */%0Apublic abstract
  cla
@@ -1065,13 +1065,8 @@
 ted 
-Image
 Butt
@@ -1314,178 +1314,147 @@
 );%0A%09
+%7D%0A
 %09%0A%09
-%09mBlackColor = getResources().getColor(R.color.black);%0A%09%09mWhiteColor = getResources().getColor(R.color.white);%0A%09%09mBlueColor = getResources().getColor(R.color.blue);%0A%09%7D
+abstract int getViewID();%0A%09abstract int getBodyTextViewID();%0A%09abstract int getAddPictureButtonID();%0A%09abstract int getSubmitButtonID();
 %0A%09%0A%09
@@ -2572,20 +2572,807 @@
 ;%0A    %09%7D
+ 
 %0A%09%7D%0A
+%09%0A%09   @Override%0A%09    public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState)%7B%0A%09        %0A%09        View v = inflater.inflate(getViewID(), parent, false);     %0A%0A%09        // Get Views IDs%0A%09        mPostBody = (EditText)v.findViewById(getBodyTextViewID());%0A%09        mUploadPictureButton = (Button) v.findViewById(getAddPictureButtonID());%0A%09        mSubmitButton = (Button) v.findViewById(getSubmitButtonID());%0A%09        %0A%0A%09        //TODO Implement picture dialog/upload%0A%09        mUploadPictureButton.setOnClickListener(new View.OnClickListener() %7B            %0A%09            @Override%0A%09            public void onClick(View v) %7B%0A%09                // Implement picture dialog%0A%09                %0A%09            %7D%0A%09        %7D);%0A%09        %0A%09        return v;%0A%09    %7D%0A
     %09%0A  
@@ -3380,9 +3380,8 @@
  %09%0A%09%0A%09%0A%7D
-%0A

Correct version of NewPostFragment