<commit_before>package com.MitchellLustig.rooms_and_items.ui;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.database.Cursor;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

import com.MitchellLustig.rooms_and_items.R;
import com.MitchellLustig.rooms_and_items.database.RoomsAndItemsDB.Schema;
import com.MitchellLustig.rooms_and_items.game.GameController;
import com.MitchellLustig.rooms_and_items.game.LevelGenerator;
import com.MitchellLustig.rooms_and_items.ui.ControllerFragment.ControllerListener;

public class MainActivity extends Activity implements ControllerListener{

	DisplayFragment mDisplayFragment;
	ControllerFragment mControllerFragment;
	GameController mGameController;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		if (savedInstanceState == null) {
			mDisplayFragment = new DisplayFragment();
			mControllerFragment = new ControllerFragment();
			getFragmentManager().beginTransaction().add(R.id.display_container, mDisplayFragment, "display").commit();
			getFragmentManager().beginTransaction().add(R.id.controller_container, mControllerFragment, "controller").commit();
		}else{
			mDisplayFragment = (DisplayFragment)getFragmentManager().findFragmentByTag("display");
			mControllerFragment = (ControllerFragment)getFragmentManager().findFragmentByTag("controller");
		}
		mGameController = new GameController(this);
	}
	
	protected void updateUI(){
		updateDisplay();
		updateController();
	}
	
	protected void updateDisplay(){
		mDisplayFragment.setUser(mGameController.getCurrentUserName());
		mDisplayFragment.setInventory(""+mGameController.getCurrentUserItemCount());
		mDisplayFragment.setRoom(mGameController.getCurrentUserRoomName() + " " + mGameController.getUserCurrentLocationPoint());
		mDisplayFragment.setItems(""+mGameController.getCurrentRoomItemCount());
	}
	
	protected void updateController(){
		mControllerFragment.setDirectionButtons(
				mGameController.getCurrentUserRoomUp() != null, 
				mGameController.getCurrentUserRoomRight() != null, 
				mGameController.getCurrentUserRoomDown() != null, 
				mGameController.getCurrentUserRoomLeft() != null);
		mControllerFragment.setItemButtons(
				mGameController.getCurrentRoomItemCount() > 0,
				mGameController.getCurrentUserItemCount() > 0);
	}<commit_msg>Cleans up location display<commit_after>package com.MitchellLustig.rooms_and_items.ui;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.database.Cursor;
import android.graphics.Point;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

import com.MitchellLustig.rooms_and_items.R;
import com.MitchellLustig.rooms_and_items.database.RoomsAndItemsDB.Schema;
import com.MitchellLustig.rooms_and_items.game.GameController;
import com.MitchellLustig.rooms_and_items.game.LevelGenerator;
import com.MitchellLustig.rooms_and_items.ui.ControllerFragment.ControllerListener;

public class MainActivity extends Activity implements ControllerListener{

	DisplayFragment mDisplayFragment;
	ControllerFragment mControllerFragment;
	GameController mGameController;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		if (savedInstanceState == null) {
			mDisplayFragment = new DisplayFragment();
			mControllerFragment = new ControllerFragment();
			getFragmentManager().beginTransaction().add(R.id.display_container, mDisplayFragment, "display").commit();
			getFragmentManager().beginTransaction().add(R.id.controller_container, mControllerFragment, "controller").commit();
		}else{
			mDisplayFragment = (DisplayFragment)getFragmentManager().findFragmentByTag("display");
			mControllerFragment = (ControllerFragment)getFragmentManager().findFragmentByTag("controller");
		}
		mGameController = new GameController(this);
	}
	
	protected void updateUI(){
		updateDisplay();
		updateController();
	}
	
	protected void updateDisplay(){
		mDisplayFragment.setUser(mGameController.getCurrentUserName());
		mDisplayFragment.setInventory(""+mGameController.getCurrentUserItemCount());
		Point location = mGameController.getUserCurrentLocationPoint();
		mDisplayFragment.setRoom(mGameController.getCurrentUserRoomName() + " (" + location.x + "," + location.y + ")");
		mDisplayFragment.setItems(""+mGameController.getCurrentRoomItemCount());
	}
	
	protected void updateController(){
		mControllerFragment.setDirectionButtons(
				mGameController.getCurrentUserRoomUp() != null, 
				mGameController.getCurrentUserRoomRight() != null, 
				mGameController.getCurrentUserRoomDown() != null, 
				mGameController.getCurrentUserRoomLeft() != null);
		mControllerFragment.setItemButtons(
				mGameController.getCurrentRoomItemCount() > 0,
				mGameController.getCurrentUserItemCount() > 0);
	}
{'fraction_non_alphanumeric': 0.10173118070414316, 'fraction_numerical': 0.0007780587434351293, 'mean_word_length': 7.457236842105263, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '1789830', 'n_tokens_mistral': 1497, 'n_tokens_neox': 1386, 'n_words': 211}