Repository: flex-sdk Updated Branches: refs/heads/new_android_skins 79f528b3e -> f4c6c0df3
Android 4.x skin for TabbedViewNavigatorTabBar. This ensures that the TabbedViewNavigatorApplication gets the new skin as well. Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/f4c6c0df Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/f4c6c0df Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/f4c6c0df Branch: refs/heads/new_android_skins Commit: f4c6c0df3ab30ea8fb21132ade698c5f1911fd74 Parents: 79f528b Author: Om <bigosma...@gmail.com> Authored: Thu Apr 10 13:11:24 2014 -0700 Committer: Om <bigosma...@gmail.com> Committed: Thu Apr 10 13:11:24 2014 -0700 ---------------------------------------------------------------------- .../android4/TabbedViewNavigatorTabBarSkin.as | 122 +++++++++++++++++++ 1 file changed, 122 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f4c6c0df/frameworks/projects/mobiletheme/src/spark/skins/android4/TabbedViewNavigatorTabBarSkin.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/mobiletheme/src/spark/skins/android4/TabbedViewNavigatorTabBarSkin.as b/frameworks/projects/mobiletheme/src/spark/skins/android4/TabbedViewNavigatorTabBarSkin.as new file mode 100644 index 0000000..eea5948 --- /dev/null +++ b/frameworks/projects/mobiletheme/src/spark/skins/android4/TabbedViewNavigatorTabBarSkin.as @@ -0,0 +1,122 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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. +// +//////////////////////////////////////////////////////////////////////////////// + +package spark.skins.android4 +{ +import spark.components.ButtonBarButton; +import spark.components.DataGroup; +import spark.skins.mobile.supportClasses.ButtonBarButtonClassFactory; +import spark.skins.mobile.supportClasses.TabbedViewNavigatorTabBarHorizontalLayout; + +/** + * The Android 4.x specific skin class for the Spark TabbedViewNavigator tabBar skin part. + * It uses the ButtonBarFirstButtonSkin and ButtonBarMiddleButtonSkin as skins for first + * middle buttons + * + * @see spark.components.TabbedViewNavigator#tabBar + * + * @langversion 3.0 + * @playerversion Flash 10 + * @playerversion AIR 2.5 + * @productversion Flex 4.5 + */ +public class TabbedViewNavigatorTabBarSkin extends ButtonBarSkin +{ + //-------------------------------------------------------------------------- + // + // Constructor + // + //-------------------------------------------------------------------------- + + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10 + * @playerversion AIR 2.5 + * @productversion Flex 4.5 + * + */ + public function TabbedViewNavigatorTabBarSkin() + { + super(); + } + + //-------------------------------------------------------------------------- + // + // Overridden methods + // + //-------------------------------------------------------------------------- + + /** + * @private + */ + override protected function createChildren():void + { + if (!firstButton) + { + firstButton = new ButtonBarButtonClassFactory(ButtonBarButton); + firstButton.skinClass = spark.skins.android4.ButtonBarFirstButtonSkin; + } + + if (!lastButton) + { + lastButton = new ButtonBarButtonClassFactory(ButtonBarButton); + lastButton.skinClass = spark.skins.android4.ButtonBarFirstButtonSkin; + } + + if (!middleButton) + { + middleButton = new ButtonBarButtonClassFactory(ButtonBarButton); + middleButton.skinClass = spark.skins.android4.ButtonBarMiddleButtonSkin; + } + + if (!dataGroup) + { + // TabbedViewNavigatorButtonBarHorizontalLayout for even percent layout + var tabLayout:TabbedViewNavigatorTabBarHorizontalLayout = + new TabbedViewNavigatorTabBarHorizontalLayout(); + tabLayout.useVirtualLayout = false; + + dataGroup = new DataGroup(); + dataGroup.layout = tabLayout; + addChild(dataGroup); + } + } + + /** + * @private + */ + override protected function drawBackground(unscaledWidth:Number, unscaledHeight:Number):void + { + super.drawBackground(unscaledWidth, unscaledHeight); + + // backgroundAlpha style is not supported by ButtonBar + // TabbedViewNavigatorSkin sets a hard-coded value to support + // overlayControls + var backgroundAlphaValue:* = getStyle("backgroundAlpha"); + var backgroundAlpha:Number = (backgroundAlphaValue === undefined) + ? 1 : getStyle("backgroundAlpha"); + + graphics.beginFill(getStyle("chromeColor"), backgroundAlpha); + graphics.drawRect(0, 0, unscaledWidth, unscaledHeight); + graphics.endFill(); + } +} +} \ No newline at end of file