From b6eb95eb3c9978ae333462747014cad7713d99cf Mon Sep 17 00:00:00 2001 From: GittyB Date: Thu, 23 Apr 2026 10:36:49 +0300 Subject: [PATCH 1/2] Added Loading spinner --- .../Style/src/main/resources/defaults.css | 4 + .../src/main/resources/style-manifest.xml | 2 + .../royale/org/apache/royale/style/Loading.as | 41 ++++++++++ .../apache/royale/style/skins/LoadingSkin.as | 80 +++++++++++++++++++ 4 files changed, 127 insertions(+) create mode 100644 frameworks/projects/Style/src/main/royale/org/apache/royale/style/Loading.as create mode 100644 frameworks/projects/Style/src/main/royale/org/apache/royale/style/skins/LoadingSkin.as diff --git a/frameworks/projects/Style/src/main/resources/defaults.css b/frameworks/projects/Style/src/main/resources/defaults.css index d244396ccb..1ee9f2b4ef 100644 --- a/frameworks/projects/Style/src/main/resources/defaults.css +++ b/frameworks/projects/Style/src/main/resources/defaults.css @@ -87,6 +87,10 @@ CardActions { IStyleSkin: ClassReference("org.apache.royale.style.skins.CardActionsSkin"); } +Loading +{ + IStyleSkin: ClassReference("org.apache.royale.style.skins.LoadingSkin"); +} Modal { IStyleSkin: ClassReference("org.apache.royale.style.skins.ModalSkin"); diff --git a/frameworks/projects/Style/src/main/resources/style-manifest.xml b/frameworks/projects/Style/src/main/resources/style-manifest.xml index 1ce74e9a98..e421454880 100644 --- a/frameworks/projects/Style/src/main/resources/style-manifest.xml +++ b/frameworks/projects/Style/src/main/resources/style-manifest.xml @@ -37,6 +37,7 @@ + @@ -315,6 +316,7 @@ + diff --git a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/Loading.as b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/Loading.as new file mode 100644 index 0000000000..c28451961f --- /dev/null +++ b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/Loading.as @@ -0,0 +1,41 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 org.apache.royale.style +{ + + public class Loading extends StyleUIBase + { + public function Loading() + { + super(); + } + + private var _animation:Object; + + public function get animation():Object + { + return _animation; + } + + public function set animation(value:Object):void + { + _animation = value; + } + } +} \ No newline at end of file diff --git a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/skins/LoadingSkin.as b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/skins/LoadingSkin.as new file mode 100644 index 0000000000..cb3632cc54 --- /dev/null +++ b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/skins/LoadingSkin.as @@ -0,0 +1,80 @@ +// /////////////////////////////////////////////////////////////////////////////// +// +// 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 org.apache.royale.style.skins +{ + import org.apache.royale.core.IStrand; + import org.apache.royale.style.StyleSkin; + import org.apache.royale.style.StyleUIBase; + import org.apache.royale.style.colors.ThemeColorSet; + import org.apache.royale.style.stylebeads.anim.Animation; + import org.apache.royale.style.stylebeads.border.Border; + import org.apache.royale.style.stylebeads.sizing.HeightStyle; + import org.apache.royale.style.stylebeads.sizing.WidthStyle; + import org.apache.royale.style.util.ThemeManager; + import org.apache.royale.style.Loading; + import org.apache.royale.style.colors.ColorSwatch; + + public class LoadingSkin extends StyleSkin + { + public function LoadingSkin() + { + super(); + } + override public function set strand(value:IStrand):void + { + super.strand = value; + if (_styles) + return; + var host:Loading = _strand as Loading; + var colorSet:ThemeColorSet = ThemeManager.instance.activeTheme.themeColorSet; + var spinnerSize:String = computeSize(getSpinnerSize(host), host.unit); + var spinnerColor:ColorSwatch = (host.theme && host.theme != "default") ? colorSet.getSwatch(host.theme, 500) : colorSet.getSwatch(ThemeColorSet.NEUTRAL, 900); + var border:Border = new Border(); + border.width = computeSize(3, host.unit); + border.color = "transparent"; + border.topColor = border.rightColor = spinnerColor.colorSpecifier; + border.radius = "full"; + _styles = [ + new HeightStyle(spinnerSize), + new WidthStyle(spinnerSize), + new Animation(host.animation || "spin"), + border + ]; + host.setStyles(_styles); + } + + private function getSpinnerSize(host:StyleUIBase):Number + { + switch(host.size) + { + case "xs": + return 12; + case "sm": + return 16; + case "lg": + return 24; + case "xl": + return 32; + case "md": + default: + return 20; + } + } + } +} \ No newline at end of file From 858a5f8da7fd47ca40f82062e28ccb98da13dfeb Mon Sep 17 00:00:00 2001 From: GittyB Date: Mon, 25 May 2026 10:18:52 +0300 Subject: [PATCH 2/2] Changed animation type --- .../src/main/royale/org/apache/royale/style/Loading.as | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/Loading.as b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/Loading.as index c28451961f..5e387f1789 100644 --- a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/Loading.as +++ b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/Loading.as @@ -26,14 +26,14 @@ package org.apache.royale.style super(); } - private var _animation:Object; + private var _animation:String; - public function get animation():Object + public function get animation():String { return _animation; } - public function set animation(value:Object):void + public function set animation(value:String):void { _animation = value; }