blob: d7a90ec4a14eab3148e3980cdb48d020c47ff753 [file] [log] [blame]
<?xml version="1.0" encoding="utf-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:comps="comps.*"
creationComplete="(CONFIG::skaha){import qa.Skaha;Skaha.enable()};initAPI();" xmlns:local="*">
<fx:Declarations>
<!-- Skaha settings objects that defines what test file we are currently working on and the favorite properties -->
<fx:Object id="skahaSettings" testDir="gumbo/components/PROJECT_NAME/properties/" testFileName="PROJECT_NAME_properties.mxml" testID="PROJECT_NAME_properties_TODO" testKeywords="PROJECT_NAME, TODO" />
<s:ArrayCollection id="propertiesToInspect">
<fx:Object propName="width" />
<fx:Object propName="height" />
<fx:Object propName="enabled" />
<fx:Object propName="emphasized" />
</s:ArrayCollection>
</fx:Declarations>
<fx:Style source="../../../../Assets/Fonts/MobileFontStyles.css" />
<fx:Script>
<![CDATA[
import views.View3;
import flash.system.Capabilities;
import mx.core.FlexGlobals;
import spark.components.ViewNavigator;
import spark.components.SplitViewNavigator;
import spark.events.PopUpEvent;
import spark.components.Callout;
import mx.events.ResizeEvent;
import mx.events.FlexEvent;
public var currentOS:String;
public var currentDPI:int;
public var currentCalloutPosition:Point = new Point(0,0);
// Each time components resets, make sure other components are invisible
private function initComp(comp:Object):void
{
if(comp==null)
return;
trace(comp.id);
switch(comp.id)
{
case 'svn1': svn1.visible=true; svn2.visible=false;svn3.visible=false;break;
case 'svn2': svn2.visible=true;svn1.visible=false;svn3.visible=false;break;
case 'svn3': svn3.visible=true;svn1.visible=false;svn2.visible=false;break;
}
comp.viewNavigatorPopUp.addEventListener(PopUpEvent.OPEN, calloutOpenHandler);
comp.viewNavigatorPopUp.addEventListener(PopUpEvent.CLOSE, calloutCloseHandler);
}
private function initAPI():void
{
currentOS = Capabilities.os;
currentDPI = FlexGlobals.topLevelApplication.runtimeDPI;
addEventListener(KeyboardEvent.KEY_UP, onKeyUp);
addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
}
private function calloutOpenHandler(event:PopUpEvent):void
{
var co:Callout;
if(event.target is Callout)
{
co = Callout(event.target);
currentCalloutPosition = new Point(co.x, co.y);
}
else{
return;
}
}
private function calloutCloseHandler(event:PopUpEvent):void
{
trace('closed');
}
/* Change order of child navigators randamly
*/
public function reorderNavigators():void
{
var numVN:int = svn1.numViewNavigators;
if(numVN < 2)
return;
var vn0:ViewNavigator = svn1.getViewNavigatorAt(0) as ViewNavigator;
svn1.addElementAt(svn1.getViewNavigatorAt(1) as ViewNavigator, 0);
svn1.addElementAt(vn0, 1);
}
/*public function reorderNavigators():void
{
var numVN:int = svn1.numViewNavigators;
var arr:Array = new Array();
for(var i:int = 0; i < numVN; i++)
{
arr[i] = i;
}
shuffleArray(arr);
for(var j:int=0; j < numVN; j++){
svn1.addElementAt(svn1.getViewNavigatorAt(arr[j]) as ViewNavigator,j);
}
}*/
/* Return randamly shuffled array
*/
private function shuffleArray(arr:Array):void
{
arr.sort(function ():int{
return Math.floor(Math.random()*3)-1;
});
}
private function onKeyUp(e:KeyboardEvent):void
{
if(e.keyCode == Keyboard.BACK){
e.preventDefault();
ViewNavigator(svn1.vn1).pushView(views.View3);
}
}
private function onKeyDown(e:KeyboardEvent):void
{
trace('back key down');
if(e.keyCode == Keyboard.BACK)
{
e.preventDefault();
}
}
]]>
</fx:Script>
<comps:MainTestComp id="svn1" includeInLayout="false" visible="false" width="100%" height="100%" initialize="initComp(svn1)" updateComplete="initComp(svn1)" />
<comps:LayoutTestComp id="svn2" includeInLayout="false" visible="false" initialize="initComp(svn2)" updateComplete="initComp(svn2)" />
<comps:SkinTestComp id="svn3" includeInLayout="false" visible="false" initialize="initComp(svn3)" updateComplete="initComp(svn3)" />
</s:Application>