flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@apache.org
Subject [6/8] git commit: [flex-asjs] [refs/heads/develop] - Mobile framework changes.
Date Fri, 14 Apr 2017 20:47:25 GMT
Mobile framework changes.


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/fd5eaae5
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/fd5eaae5
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/fd5eaae5

Branch: refs/heads/develop
Commit: fd5eaae541f5740d80bcf77aaa657c4eeb59a07a
Parents: 6256851
Author: Peter Ent <pent@apache.org>
Authored: Fri Apr 14 08:53:04 2017 -0400
Committer: Peter Ent <pent@apache.org>
Committed: Fri Apr 14 08:53:04 2017 -0400

----------------------------------------------------------------------
 .../apache/flex/mobile/StackedViewManager.as    |  30 +-----
 .../org/apache/flex/mobile/TabbedViewManager.as |  32 ------
 .../org/apache/flex/mobile/ViewManagerBase.as   |   4 -
 .../flex/mobile/beads/StackedViewManagerView.as | 105 +++++++++----------
 .../flex/mobile/beads/TabbedViewManagerView.as  |  69 ++++--------
 .../flex/mobile/beads/ViewManagerViewBase.as    |  18 +++-
 .../Mobile/src/main/resources/defaults.css      |  16 +++
 7 files changed, 100 insertions(+), 174 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fd5eaae5/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/StackedViewManager.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/StackedViewManager.as
b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/StackedViewManager.as
index 79368fd..8f1eeea 100644
--- a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/StackedViewManager.as
+++ b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/StackedViewManager.as
@@ -135,14 +135,6 @@ package org.apache.flex.mobile
 		override public function addedToParent():void
 		{
 			super.addedToParent();
-			
-//			var tabbedView:StackedViewManagerView = getBeadByType(StackedViewManagerView) as StackedViewManagerView;
-//			
-//			var n:int = ViewManagerModel(model).views.length;
-//			if (n > 0) {
-//				var view:IViewManagerView = ViewManagerModel(model).views[0] as IViewManagerView;
-//				push(view);
-//			}
 		}
 
 		
@@ -158,16 +150,6 @@ package org.apache.flex.mobile
 		{
 			nextView.viewManager = this;
 			ViewManagerModel(model).pushView(nextView);
-			
-//			var stackedView:StackedViewManagerView = getBeadByType(StackedViewManagerView) as StackedViewManagerView;
-//			
-//			if (_topView != null) {
-//				stackedView.contentArea.removeElement(_topView);
-//			}
-//			_topView = nextView;
-//			stackedView.contentArea.addElement(_topView);
-//			
-//			dispatchEvent( new Event("viewChanged") );
 		}
 		
 		/**
@@ -178,18 +160,10 @@ package org.apache.flex.mobile
 		 *  @playerversion AIR 2.6
 		 *  @productversion FlexJS 0.0
 		 */
-		public function pop():void
+		public function pop():IChild
 		{
 			var stackedView:StackedViewManagerView = getBeadByType(StackedViewManagerView) as StackedViewManagerView;
-			
-//			if (ViewManagerModel(model).views.length > 1) {
-//				var lastView:IChild = ViewManagerModel(model).popView() as IChild;
-//				stackedView.contentArea.removeElement(_topView);
-//				stackedView.contentArea.addElement(lastView);
-//				_topView = lastView as IViewManagerView;
-//				
-//				dispatchEvent( new Event("viewChanged") );
-//			}
+			return ViewManagerModel(model).popView();
 		}
 
 	}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fd5eaae5/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/TabbedViewManager.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/TabbedViewManager.as
b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/TabbedViewManager.as
index 3b0d89d..5a895d5 100644
--- a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/TabbedViewManager.as
+++ b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/TabbedViewManager.as
@@ -91,38 +91,6 @@ package org.apache.flex.mobile
 		override public function addedToParent():void
 		{
 			super.addedToParent();
-			
-//			var tabbedView:TabbedViewManagerView = getBeadByType(TabbedViewManagerView) as TabbedViewManagerView;
-//			
-//			var n:int = ViewManagerModel(model).views.length;
-//			if (n > 0) {
-//				for (var i:int = 0; i < n; i++)
-//				{
-//					var view:IViewManagerView = ViewManagerModel(model).views[i] as IViewManagerView;
-//					view.viewManager = this;
-//					if (i == 0) {
-//						tabbedView.contentArea.addElement(view, true);
-//					}
-//				}
-//				ViewManagerModel(model).selectedIndex = 0;
-//			}
-		}
-		
-		/**
-		 * @private
-		 */
-		override protected function changeView( event:Event ):void
-		{
-//			var tabbedView:TabbedViewManagerView = getBeadByType(TabbedViewManagerView) as TabbedViewManagerView;
-//			
-//			var index:Number = ViewManagerModel(model).selectedIndex;
-//			if (currentView) {
-//				tabbedView.contentArea.removeElement(currentView);
-//			}
-//			currentView = views[index];
-//			tabbedView.contentArea.addElement(currentView);
-//
-//			dispatchEvent( new Event("viewChanged") );
 		}
 
 	}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fd5eaae5/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/ViewManagerBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/ViewManagerBase.as
b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/ViewManagerBase.as
index cc16ae3..549891d 100644
--- a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/ViewManagerBase.as
+++ b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/ViewManagerBase.as
@@ -53,10 +53,6 @@ package org.apache.flex.mobile
 		{
 			super();
 			
-			// views always fill their space
-			percentWidth = 100;
-			percentHeight = 100;
-			
 			model.addEventListener("selectedIndexChanged", changeView);
 
 		}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fd5eaae5/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/StackedViewManagerView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/StackedViewManagerView.as
b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/StackedViewManagerView.as
index bd99b00..2e4e009 100644
--- a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/StackedViewManagerView.as
+++ b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/StackedViewManagerView.as
@@ -26,6 +26,7 @@ package org.apache.flex.mobile.beads
 	import org.apache.flex.events.Event;
 	import org.apache.flex.html.beads.ContainerView;
 	import org.apache.flex.html.beads.layouts.HorizontalLayout;
+	import org.apache.flex.mobile.IViewManager;
 	import org.apache.flex.mobile.IViewManagerView;
 	import org.apache.flex.mobile.ManagedContentArea;
 	import org.apache.flex.mobile.chrome.NavigationBar;
@@ -57,6 +58,11 @@ package org.apache.flex.mobile.beads
 		}
 		
 		private var _strand:IStrand;
+		
+		/*
+		 * Children
+		 */
+		
 		private var _contentArea:ManagedContentArea;
 		
 		public function get contentArea():ManagedContentArea
@@ -75,6 +81,10 @@ package org.apache.flex.mobile.beads
 			model.toolBar = value;
 		}
 		
+		/*
+		 * ViewBead
+		 */
+		
 		override public function get strand():IStrand
 		{
 			return _strand;
@@ -102,9 +112,12 @@ package org.apache.flex.mobile.beads
 		{			
 			super.handleInitComplete(event);
 			
+			var model:ViewManagerModel = _strand.getBeadByType(IBeadModel) as ViewManagerModel;
+			IEventDispatcher(model).addEventListener("viewPushed", handlePushEvent);
+			IEventDispatcher(model).addEventListener("viewPopped", handlePopEvent);
+			
 			COMPILE::SWF {
 				_contentArea.percentWidth = 100;
-				_contentArea.percentHeight = 100;
 			}
 			UIBase(_strand).addElement(_contentArea);
 			
@@ -112,13 +125,40 @@ package org.apache.flex.mobile.beads
 				UIBase(_strand).addElement(toolBar);
 			}
 			
-			performLayout(event);
-			
 			showViewByIndex(0);
 		}
 		
 		private var _topView:IViewManagerView;
 		
+		private function handlePushEvent(event:Event):void
+		{
+			var model:ViewManagerModel = _strand.getBeadByType(IBeadModel) as ViewManagerModel;
+			var n:int = model.views.length;
+			if (n > 0) {
+				showViewByIndex(n-1);
+			}
+		}
+		
+		private function handlePopEvent(event:Event):void
+		{
+			var model:ViewManagerModel = _strand.getBeadByType(IBeadModel) as ViewManagerModel;
+			var n:int = model.views.length;
+			if (n > 0) {
+				showViewByIndex(n-1);
+			}
+		}
+		
+		public function showView(view:IViewManagerView):void
+		{
+			var model:ViewManagerModel = _strand.getBeadByType(IBeadModel) as ViewManagerModel;
+			for(var i:int=0; i < model.views.length; i++) {
+				if (view == model.views[i]) {
+					showViewByIndex(i);
+					break;
+				}
+			}
+		}
+		
 		protected function showViewByIndex(index:int):void
 		{
 			var model:ViewManagerModel = _strand.getBeadByType(IBeadModel) as ViewManagerModel;
@@ -127,6 +167,7 @@ package org.apache.flex.mobile.beads
 				contentArea.removeElement(_topView);
 			}
 			_topView = model.views[index] as IViewManagerView;
+			_topView.viewManager = _strand as IViewManager;
 			contentArea.addElement(_topView);
 			
 			COMPILE::JS {
@@ -134,11 +175,16 @@ package org.apache.flex.mobile.beads
 					UIBase(_topView).element.style["flex-grow"] = "1";
 				}
 			}
+			COMPILE::SWF {
+				UIBase(_topView).percentWidth = 100;
+				UIBase(_topView).percentHeight = 100;
+				contentArea.layoutNeeded();
+			}
 		}
 		
-		override protected function layoutViewAfterContentLayout():void
+		override public function afterLayout():void
 		{
-			super.layoutViewAfterContentLayout();
+			super.afterLayout();
 			
 			COMPILE::SWF {
 				if (_topView) {
@@ -147,54 +193,5 @@ package org.apache.flex.mobile.beads
 				}
 			}
 		}
-		
-		/**
-		 * @private
-		 */
-//		override protected function layoutChromeElements():void
-//		{
-//			var host:UIBase = strand as UIBase;
-//			var contentAreaY:Number = 0;
-//			var contentAreaHeight:Number = host.height;
-//			var toolbarHeight:Number = _toolBar == null ? 0 : _toolBar.height;
-//			
-//			var model:ViewManagerModel = strand.getBeadByType(IBeadModel) as ViewManagerModel;
-//			
-//			if (navigationBar)
-//			{
-//				navigationBar.x = 0;
-//				navigationBar.y = 0;
-//				navigationBar.width = host.width;
-//				
-//				contentAreaHeight -= navigationBar.height;
-//				contentAreaY = navigationBar.height;
-//				
-//				model.navigationBar = navigationBar;
-//			}
-//			
-//			if (_toolBar)
-//			{
-//				_toolBar.x = 0;
-//				_toolBar.y = host.height - toolbarHeight;
-//				_toolBar.width = host.width;
-//				
-//				contentAreaHeight -= toolbarHeight;
-//				
-//				model.toolBar = _toolBar;
-//			}
-//			
-//			if (contentAreaY < 0) contentAreaY = 0;
-//			if (contentAreaHeight < 0) contentAreaHeight = 0;
-//			
-//			model.contentX = 0;
-//			model.contentY = contentAreaY;
-//			model.contentWidth = host.width;
-//			model.contentHeight = contentAreaHeight;
-//			
-//			sizeViewsToFitContentArea();
-//			
-//			// notify the views that the content size has changed
-//			IEventDispatcher(strand).dispatchEvent( new Event("contentSizeChanged") );
-//		}
 	}
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fd5eaae5/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/TabbedViewManagerView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/TabbedViewManagerView.as
b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/TabbedViewManagerView.as
index 227ae74..7959da0 100644
--- a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/TabbedViewManagerView.as
+++ b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/TabbedViewManagerView.as
@@ -26,6 +26,7 @@ package org.apache.flex.mobile.beads
 	import org.apache.flex.events.Event;
 	import org.apache.flex.html.beads.ContainerView;
 	import org.apache.flex.html.beads.layouts.HorizontalLayout;
+	import org.apache.flex.mobile.IViewManager;
 	import org.apache.flex.mobile.IViewManagerView;
 	import org.apache.flex.mobile.ManagedContentArea;
 	import org.apache.flex.mobile.chrome.NavigationBar;
@@ -58,6 +59,11 @@ package org.apache.flex.mobile.beads
 		}
 		
 		private var _strand:IStrand;
+		
+		/*
+		 * Children
+		 */
+		
 		private var _contentArea:ManagedContentArea;
 		
 		public function get tabBar():TabBar
@@ -76,6 +82,10 @@ package org.apache.flex.mobile.beads
 			return _contentArea;
 		}
 		
+		/*
+		 * ViewBead
+		 */
+		
 		override public function get strand():IStrand
 		{
 			return _strand;
@@ -104,7 +114,6 @@ package org.apache.flex.mobile.beads
 			
 			COMPILE::SWF {
 				_contentArea.percentWidth = 100;
-				_contentArea.percentHeight = 100;
 			}
 			UIBase(_strand).addElement(_contentArea);
 			
@@ -112,8 +121,6 @@ package org.apache.flex.mobile.beads
 				UIBase(_strand).addElement(tabBar);
 			}
 			
-			performLayout(event);
-			
 			showViewByIndex(0);
 		}
 		
@@ -127,6 +134,7 @@ package org.apache.flex.mobile.beads
 				contentArea.removeElement(_currentView);
 			}
 			_currentView = model.views[index] as IViewManagerView;
+			_currentView.viewManager = _strand as IViewManager;
 			contentArea.addElement(_currentView);
 			
 			COMPILE::JS {
@@ -134,11 +142,16 @@ package org.apache.flex.mobile.beads
 					UIBase(_currentView).element.style["flex-grow"] = "1";
 				}
 			}
+			COMPILE::SWF {
+				UIBase(_currentView).percentWidth = 100;
+				UIBase(_currentView).percentHeight = 100;
+				contentArea.layoutNeeded();
+			}
 		}
 		
-		override protected function layoutViewAfterContentLayout():void
+		override public function afterLayout():void
 		{
-			super.layoutViewAfterContentLayout();
+			super.afterLayout();
 			
 			COMPILE::SWF {
 				if (_currentView) {
@@ -162,51 +175,5 @@ package org.apache.flex.mobile.beads
 			
 			showViewByIndex(newIndex);
 		}
-		
-		/**
-		 * @private
-		 */
-//		override protected function layoutChromeElements():void
-//		{
-//			var host:UIBase = _strand as UIBase;
-//			var contentAreaY:Number = 0;
-//			var contentAreaHeight:Number = host.height;
-//			
-//			var model:ViewManagerModel = strand.getBeadByType(IBeadModel) as ViewManagerModel;
-//			
-//			if (navigationBar)
-//			{
-//				navigationBar.x = 0;
-//				navigationBar.y = 0;
-//				navigationBar.width = host.width;
-//				
-//				contentAreaHeight -= navigationBar.height;
-//				contentAreaY = navigationBar.height;
-//				
-//				model.navigationBar = navigationBar;
-//			}
-//			
-//			if (_tabBar)
-//			{
-//				_tabBar.x = 0;
-//				_tabBar.y = host.height - _tabBar.height;
-//				_tabBar.width = host.width;
-//				_tabBar.dispatchEvent(new Event("layoutNeeded"));
-//				
-//				contentAreaHeight -= _tabBar.height;
-//				
-//				model.tabBar = _tabBar;
-//			}
-//			
-//			model.contentX = 0;
-//			model.contentY = contentAreaY;
-//			model.contentWidth = host.width;
-//			model.contentHeight = contentAreaHeight;
-//			
-//			sizeViewsToFitContentArea();
-//			
-//			// notify the views that the content size has changed
-//			IEventDispatcher(strand).dispatchEvent( new Event("contentSizeChanged") );
-//		}
 	}
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fd5eaae5/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/ViewManagerViewBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/ViewManagerViewBase.as
b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/ViewManagerViewBase.as
index 5599ad9..82337c4 100644
--- a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/ViewManagerViewBase.as
+++ b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/ViewManagerViewBase.as
@@ -57,6 +57,10 @@ package org.apache.flex.mobile.beads
 			super();
 		}
 		
+		/*
+		 * Children
+		 */
+		
 		public function get navigationBar():NavigationBar
 		{
 			var model:ViewManagerModel = strand.getBeadByType(IBeadModel) as ViewManagerModel;
@@ -68,6 +72,10 @@ package org.apache.flex.mobile.beads
 			model.navigationBar = value;
 		}
 		
+		/*
+		 * ViewBead
+		 */
+		
 		private var _strand:IStrand;
 		public function get strand():IStrand
 		{
@@ -79,7 +87,7 @@ package org.apache.flex.mobile.beads
 			_strand = value;
 			
 			var model:ViewManagerModel = value.getBeadByType(IBeadModel) as ViewManagerModel;
-			model.addEventListener("selectedIndexChanged", viewsChangedHandler);
+//			model.addEventListener("selectedIndexChanged", viewsChangedHandler);
 
 			if (model.navigationBarItems)
 			{
@@ -102,10 +110,10 @@ package org.apache.flex.mobile.beads
 		/**
 		 * @private
 		 */
-		protected function viewsChangedHandler(event:Event):void
-		{
-			layoutChromeElements();
-		}
+//		protected function viewsChangedHandler(event:Event):void
+//		{
+//			layoutChromeElements();
+//		}
 		
 		/**
 		 * @private

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fd5eaae5/frameworks/projects/Mobile/src/main/resources/defaults.css
----------------------------------------------------------------------
diff --git a/frameworks/projects/Mobile/src/main/resources/defaults.css b/frameworks/projects/Mobile/src/main/resources/defaults.css
index 405a3a5..f360d5c 100644
--- a/frameworks/projects/Mobile/src/main/resources/defaults.css
+++ b/frameworks/projects/Mobile/src/main/resources/defaults.css
@@ -22,7 +22,10 @@
 
 NavigationBar
 {
+	height: 55px;
+	min-height: 55px;
 	IBeadLayout: ClassReference("org.apache.flex.html.beads.layouts.HorizontalFlexLayout");
+	flex-grow: 0;
 }
 
 StackedViewManager 
@@ -43,6 +46,19 @@ ManagedContentArea
 {
 	display: flex;
 	flex-grow: 1;
+	IBeadLayout: ClassReference("org.apache.flex.html.beads.layouts.BasicLayout");
+}
+
+TabBar {
+	flex-grow: 0;
+	height: 40px;
+	min-height: 40px;
+}
+
+ToolBar {
+	flex-grow: 0;
+	height: 40px;
+	min-height: 40px;
 }
 
 ToggleSwitch


Mime
View raw message