<commit_before>package ca.ualberta.cs.views;

import ca.ualberta.cs.controllers.AuthorController;
import ca.ualberta.cs.controllers.BrowseController;
import ca.ualberta.cs.f14t07_application.R;
import ca.ualberta.cs.f14t07_application.R.id;
import ca.ualberta.cs.f14t07_application.R.layout;
import ca.ualberta.cs.f14t07_application.R.menu;
import ca.ualberta.cs.intent_singletons.BrowseRequestSingleton;
import ca.ualberta.cs.intent_singletons.ContextSingleton;
import ca.ualberta.cs.intent_singletons.ForumEntrySingleton;
import ca.ualberta.cs.models.AuthorModel;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
/**
 * This class is the view for the first screen that the user sees.
 * It is an observer to the authorModel
 * It has an instance of the AuthorController
 * From this class, many other screens can be reached.
 * 
 * @author Dayna
 * @author Brendan
 *
 */
public class MainScreenActivity extends Activity implements Observer<AuthorModel>
{

	private AuthorController authorController;
	public static final String TEXT_KEY = "TEXT";
	public static final String NEW_QUESTION_KEY = "NEW_QUESTION";
	public Intent intent2; //FOR TESTING
	public AlertDialog alert2;//FOR TESTING
	public EditText name;
	public TextView nameDisplayed;

/**
 * This function contains all the main screen on click listeners.
 */
	public void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main_activity_screen);

		this.authorController = new AuthorController(this);
		this.authorController.setSessionAuthor(AuthorModel.NO_AUTHOR);

		/*
		 * Set the context in the context singleton to be this activity. Since
		 * this is the first activity that starts up when this app starts
		 * this will ensure that the context singleton has a valid context
		 * in it for doing context stuff.
		 */
		ContextSingleton.getInstance().setContext(this.getApplicationContext());
		
		/* Ask Button on click listener */
		Button ask_button = (Button) findViewById(R.id.askButton);
		ask_button.setOnClickListener(new View.OnClickListener()
		{
			@Override
			public void onClick(View v)
			{
				askButton();
			}
		});
		
		/* Browse Button on click listener*/
		Button browse_button = (Button) findViewById(R.id.browseButton);
		browse_button.setOnClickListener(new View.OnClickListener()
		{
			@Override
			public void onClick(View v)
			{
				browseButton();
			}
		});
		
		/* Search Button on click listener */
		Button search_button = (Button) findViewById(R.id.searchButton);
		search_button.setOnClickListener(new View.OnClickListener()
		{
			@Override
			public void onClick(View v)
			{
				searchButton();
			}
		});
		
		/* Sign In Button on click listener */
		Button sign_in_button = (Button) findViewById(R.id.signInButton);
		sign_in_button.setOnClickListener(new View.OnClickListener()
		{
			@Override
			public void onClick(View v)
			{
				signInButton();
			}
		});
		
		/* Sign Out Button on click listener*/
		Button sign_out_button = (Button) findViewById(R.id.signOutButton);
		sign_out_button.setOnClickListener(new View.OnClickListener()
		{
			@Override
			public void onClick(View v)
			{
				signOutButton();
			}
		});
	}
/**
 * Refreshes the view to reflect the author name
 */
	@Override
	protected void onRestart()
	{
		super.onRestart();

		/* Refresh the view, the authors name may have changed you know :) */
		this.authorController.refresh();
	}

	/**
	 * adds items to the menu bar
	 */
	@Override<commit_msg>didn't really change anything... just added a comment<commit_after>package ca.ualberta.cs.views;

import ca.ualberta.cs.controllers.AuthorController;
import ca.ualberta.cs.controllers.BrowseController;
import ca.ualberta.cs.f14t07_application.R;
import ca.ualberta.cs.f14t07_application.R.id;
import ca.ualberta.cs.f14t07_application.R.layout;
import ca.ualberta.cs.f14t07_application.R.menu;
import ca.ualberta.cs.intent_singletons.BrowseRequestSingleton;
import ca.ualberta.cs.intent_singletons.ContextSingleton;
import ca.ualberta.cs.intent_singletons.ForumEntrySingleton;
import ca.ualberta.cs.models.AuthorModel;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
/**
 * This class is the view for the first screen that the user sees.
 * It is an observer to the authorModel
 * It has an instance of the AuthorController
 * From this class, many other screens can be reached.
 * 
 * @author Dayna
 * @author Brendan
 *
 */
public class MainScreenActivity extends Activity implements Observer<AuthorModel>
{

	private AuthorController authorController;
	public static final String TEXT_KEY = "TEXT";
	public static final String NEW_QUESTION_KEY = "NEW_QUESTION";
	public Intent intent2; //FOR TESTING
	public AlertDialog alert2;//FOR TESTING
	public EditText name;
	public TextView nameDisplayed;

/**
 * This function contains all the main screen on click listeners.
 */
	public void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main_activity_screen);

		this.authorController = new AuthorController(this);
		this.authorController.setSessionAuthor(AuthorModel.NO_AUTHOR);

		/*
		 * Set the context in the context singleton to be this activity. Since
		 * this is the first activity that starts up when this app starts
		 * this will ensure that the context singleton has a valid context
		 * in it for doing context stuff.
		 */
		ContextSingleton.getInstance().setContext(this.getApplicationContext());
		
		/* Ask Button on click listener */
		Button ask_button = (Button) findViewById(R.id.askButton);
		ask_button.setOnClickListener(new View.OnClickListener()
		{
			@Override
			public void onClick(View v)
			{
				askButton();
			}
		});
		
		/* Browse Button on click listener*/
		Button browse_button = (Button) findViewById(R.id.browseButton);
		browse_button.setOnClickListener(new View.OnClickListener()
		{
			@Override
			public void onClick(View v)
			{
				browseButton();
			}
		});
		
		/* Search Button on click listener */
		Button search_button = (Button) findViewById(R.id.searchButton);
		search_button.setOnClickListener(new View.OnClickListener()
		{
			@Override
			public void onClick(View v)
			{
				searchButton();
			}
		});
		
		/* Sign In Button on click listener */
		Button sign_in_button = (Button) findViewById(R.id.signInButton);
		sign_in_button.setOnClickListener(new View.OnClickListener()
		{
			@Override
			public void onClick(View v)
			{
				signInButton();
			}
		});
		
		/* Sign Out Button on click listener*/
		Button sign_out_button = (Button) findViewById(R.id.signOutButton);
		sign_out_button.setOnClickListener(new View.OnClickListener()
		{
			@Override
			public void onClick(View v)
			{
				signOutButton();
			}
		});
	}
/**
 * Refreshes the view to reflect the author name
 */
	@Override
	protected void onRestart()
	{
		super.onRestart();

		/* Refresh the view, the authors name may have changed you know :) */
		/* no... no... no.... They can only change their name on this screen! >:-|*/
		this.authorController.refresh();
	}

	/**
	 * adds items to the menu bar
	 */
	@Override
{'fraction_non_alphanumeric': 0.09726918075422626, 'fraction_numerical': 0.0046814044213263975, 'mean_word_length': 4.1756393001345895, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4627423', 'n_tokens_mistral': 2561, 'n_tokens_neox': 2235, 'n_words': 624}