<commit_before><?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 
        xmlns:s="library://ns.adobe.com/flex/spark"
		title="Settings" creationComplete="init();" width="100%" height="100%">
	<fx:Script>
		<![CDATA[
		import mx.collections.ArrayList;
		import mx.core.FlexGlobals;
		private function init():void
		{
			roomChooser.dataProvider = FlexGlobals.topLevelApplication.rooms;
			if (FlexGlobals.topLevelApplication.persistenceManager.getProperty("room"))
				roomChooser.selectedItem = FlexGlobals.topLevelApplication.persistenceManager.getProperty("room");
			this.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown_Handler);
		}
		
		protected function onKeyDown_Handler(e:KeyboardEvent):void 
		{
			switch(e.keyCode)
			{
			case Keyboard.BACK:
				navigator.popView();
				break;
			}
		}
		
		public function refresh():void
		{

		}
		
		]]>
	</fx:Script>
	<fx:Declarations>
		<!-- Place non-visual elements (e.g., services, value objects) here -->
	</fx:Declarations>
	<s:actionContent>
		
	</s:actionContent>
	<s:layout>
		<s:VerticalLayout horizontalAlign="justify" paddingBottom="20" paddingLeft="20" paddingTop="20" paddingRight="20" />
	</s:layout>
	<s:Label text="Choose desired room" styleName="Title"/>
	<s:List id="roomChooser" labelField="roomName" height="100%" change="FlexGlobals.topLevelApplication.persistenceManager.setProperty('room',roomChooser.selectedItem);navigator.popView();"
		    touchInteractionStart="stage.frameRate=60;" touchInteractionEnd="stage.frameRate=10;" />
</s:View><commit_msg>If a user tries to exit from HomeSettingsView.mxml, without having a saved room, and without selecting a new room, app exits.<commit_after><?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 
        xmlns:s="library://ns.adobe.com/flex/spark"
		title="Settings" creationComplete="init();" width="100%" height="100%">
	<fx:Script>
		<![CDATA[
		import mx.collections.ArrayList;
		import mx.collections.IList;
		import mx.core.FlexGlobals;
		import spark.managers.PersistenceManager;
		private function init():void
		{
			roomChooser.dataProvider = FlexGlobals.topLevelApplication.rooms;
			if (FlexGlobals.topLevelApplication.persistenceManager.getProperty("room"))
			{
				if (!(roomChooser.dataProvider is IList))
					return;
				for (var i:int = 0; i < roomChooser.dataProvider.length; i++)
				{
					if (roomChooser.dataProvider.getItemAt(i).roomId == FlexGlobals.topLevelApplication.persistenceManager.getProperty("room"))
					{
						roomChooser.selectedIndex = i;
						break;
					}
					
				}
			}
			this.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown_Handler);
		}
		
		protected function onKeyDown_Handler(e:KeyboardEvent):void 
		{
			switch(e.keyCode)
			{
			case Keyboard.BACK:
				back();
				break;
			}
		}
		
		public function back():void
		{
			FlexGlobals.topLevelApplication.persistenceManager.save();
			FlexGlobals.topLevelApplication.persistenceManager.load();
			
			// If no room is chosen, and user tries to go back, exit the app
			if ((FlexGlobals.topLevelApplication.persistenceManager as PersistenceManager).getProperty("room"))
				NativeApplication.nativeApplication.exit();
			else
				navigator.popView();
		}
		
		public function refresh():void
		{

		}
		
		]]>
	</fx:Script>
	<fx:Declarations>
		<!-- Place non-visual elements (e.g., services, value objects) here -->
	</fx:Declarations>
	<s:actionContent>
		
	</s:actionContent>
	<s:layout>
		<s:VerticalLayout horizontalAlign="justify" paddingBottom="20" paddingLeft="20" paddingTop="20" paddingRight="20" />
	</s:layout>
	<s:Label text="Choose desired room" styleName="Title"/>
	<s:List id="roomChooser" labelField="roomName" height="100%" change="FlexGlobals.topLevelApplication.persistenceManager.setProperty('room',roomChooser.selectedItem);navigator.popView();"
		    touchInteractionStart="stage.frameRate=60;" touchInteractionEnd="stage.frameRate=10;" />
</s:View>
{'fraction_non_alphanumeric': 0.14504776269482153, 'fraction_numerical': 0.014328808446455505, 'mean_word_length': 4.766666666666667, 'pattern_counts': {'":': 0, '<': 36, '<?xml version=': 2, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 9}, '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': '5557545', 'n_tokens_mistral': 1508, 'n_tokens_neox': 1278, 'n_words': 209}