You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ca...@apache.org on 2020/06/15 17:23:50 UTC
[royale-asjs] 04/08: jewel-responsivesize: simplify code and make
it extendable
This is an automated email from the ASF dual-hosted git repository.
carlosrovira pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
commit 072c7e01e67a0d9dc7e46cec434c5b205515cc39
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Mon Jun 15 18:08:35 2020 +0200
jewel-responsivesize: simplify code and make it extendable
---
.../jewel/beads/layouts/ResponsiveVisibility.as | 77 +++++++---------------
1 file changed, 25 insertions(+), 52 deletions(-)
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/ResponsiveVisibility.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/ResponsiveVisibility.as
index 1a509e6..9db7973 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/ResponsiveVisibility.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/ResponsiveVisibility.as
@@ -20,7 +20,7 @@ package org.apache.royale.jewel.beads.layouts
{
import org.apache.royale.core.IBead;
import org.apache.royale.core.IStrand;
- import org.apache.royale.core.StyledUIBase;
+ import org.apache.royale.utils.IClassSelectorListSupport;
/**
* The ResponsiveVisibility bead class is a specialty bead that
@@ -162,7 +162,7 @@ package org.apache.royale.jewel.beads.layouts
}
}
- private var _strand:IStrand;
+ protected var _strand:IStrand;
/**
* @copy org.apache.royale.core.IBead#strand
@@ -180,69 +180,42 @@ package org.apache.royale.jewel.beads.layouts
showOrHideHost();
}
- private function showOrHideHost():void
+ protected function showOrHideHost():void
{
- var host:StyledUIBase = _strand as StyledUIBase;
+ var host:IClassSelectorListSupport = _strand as IClassSelectorListSupport;
if (host)
{
- if(_phoneVisible != null)
+ if(phoneVisible != null)
{
- if(_phoneVisible)
- {
- if (host.containsClass("hidden-phone"))
- host.removeClass("hidden-phone");
- host.addClass("visible-phone");
- } else
- {
- if (host.containsClass("visible-phone"))
- host.removeClass("visible-phone");
- host.addClass("hidden-phone");
- }
+ if(phoneVisible)
+ host.replaceClass("hidden-phone", "visible-phone");
+ else
+ host.replaceClass("visible-phone", "hidden-phone");
}
- if(_tabletVisible != null)
+ if(tabletVisible != null)
{
- if(_tabletVisible)
- {
- if (host.containsClass("hidden-tablet"))
- host.removeClass("hidden-tablet");
- host.addClass("visible-tablet");
- } else
- {
- if (host.containsClass("visible-tablet"))
- host.removeClass("visible-tablet");
- host.addClass("hidden-tablet");
- }
+ if(tabletVisible)
+ host.replaceClass("hidden-tablet", "visible-tablet");
+ else
+ host.replaceClass("visible-tablet", "hidden-tablet");
+
}
- if(_desktopVisible != null)
+ if(desktopVisible != null)
{
- if(_desktopVisible)
- {
- if (host.containsClass("hidden-desktop"))
- host.removeClass("hidden-desktop");
- host.addClass("visible-desktop");
- } else
- {
- if (host.containsClass("visible-desktop"))
- host.removeClass("visible-desktop");
- host.addClass("hidden-desktop");
- }
+ if(desktopVisible)
+ host.replaceClass("hidden-desktop", "visible-desktop");
+ else
+ host.replaceClass("visible-desktop", "hidden-desktop");
}
- if(_wideScreenVisible != null)
+ if(wideScreenVisible != null)
{
- if(_wideScreenVisible)
- {
- if (host.containsClass("hidden-widescreen"))
- host.removeClass("hidden-widescreen");
- host.addClass("visible-widescreen");
- } else
- {
- if (host.containsClass("visible-widescreen"))
- host.removeClass("visible-widescreen");
- host.addClass("hidden-widescreen");
- }
+ if(wideScreenVisible)
+ host.replaceClass("hidden-widescreen", "visible-widescreen");
+ else
+ host.replaceClass("visible-widescreen", "hidden-widescreen");
}
}
}