SVG image changing color - java

I'm new to SVG and i need to make an SVG that change his color in 1 second from white to red and than stay red for another 2 seconds.
I know how to change the color in 1 second but i can't find any method to set the color red before restarting.
this is my image.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- The icon can be used freely in both personal and commercial projects with no attribution required, but always appreciated.
You may NOT sub-license, resell, rent, redistribute or otherwise transfer the icon without express written permission from iconmonstr.com -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
x="0px"
y="0px"
width="512px"
height="512px"
viewBox="0 0 512 512"
enable-background="new 0 0 512 512"
xml:space="preserve"
id="svg2"
inkscape:version="0.48.4 r9939"
sodipodi:docname="alarm_animate.svg"><metadata
id="metadata10"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
id="defs8" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1024"
id="namedview6"
showgrid="false"
inkscape:zoom="1.84375"
inkscape:cx="178.41033"
inkscape:cy="264.79565"
inkscape:window-x="-4"
inkscape:window-y="-4"
inkscape:window-maximized="1"
inkscape:current-layer="svg2" />
<animateColor
id="a1"
attributeName="fill"
from="#FFFFFF"
to="#FF0000"
dur="1s"
repeatCount="indefinite" />
<path
id="warning-6-icon"
d="m 237.939,231.352 36.121,0 0,97.421 -36.121,0 z M 256,381.019 c -9.574,0 -19.334,-9.761 -19.334,-19.334 0,-9.574 9.76,-19.335 19.334,-19.335 9.573,0 19.334,9.761 19.334,19.335 0,9.573 -9.761,19.334 -19.334,19.334 z M 256,74.07 46,438.873 l 420,0 z m 0,88 132.718,230.803 -265.436,0 z"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccssssscccccccc" />
</svg>
any suggestions?

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- The icon can be used freely in both personal and commercial projects with no attribution required, but always appreciated.
You may NOT sub-license, resell, rent, redistribute or otherwise transfer the icon without express written permission from iconmonstr.com -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
x="0px"
y="0px"
width="512px"
height="512px"
viewBox="0 0 512 512"
enable-background="new 0 0 512 512"
xml:space="preserve"
id="svg2"
inkscape:version="0.48.4 r9939"
sodipodi:docname="alarm_animate.svg"><metadata
id="metadata10"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
id="defs8" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1024"
id="namedview6"
showgrid="false"
inkscape:zoom="1.84375"
inkscape:cx="178.41033"
inkscape:cy="264.79565"
inkscape:window-x="-4"
inkscape:window-y="-4"
inkscape:window-maximized="1"
inkscape:current-layer="svg2" />
<animate
id="a1"
attributeName="fill"
from="#FFFFFF"
to="#FF0000"
dur="1s"
begin="0s; a2.end" />
<animate
id="a2"
attributeName="fill"
from="#FF0000"
to="#FF0000"
dur="2s"
begin="a1.end"
fill="freeze" />
<path
id="warning-6-icon"
d="m 237.939,231.352 36.121,0 0,97.421 -36.121,0 z M 256,381.019 c -9.574,0 -19.334,-9.761 -19.334,-19.334 0,-9.574 9.76,-19.335 19.334,-19.335
9.573,0 19.334,9.761 19.334,19.335 0,9.573 -9.761,19.334 -19.334,19.334 z M 256,74.07 46,438.873 l 420,0 z m 0,88 132.718,230.803 -265.436,0 z"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccssssscccccccc" />
</svg>

Related

Xml Image to ImageView

Is there method to show xml string into an imageview?
Here is my xml image
<vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt"
android:viewportWidth="32"
android:viewportHeight="32"
android:width="32dp"
android:height="32dp">
<group
android:translateX="2"
android:translateY="2.005">
<group
android:translateX="-0.00000004291534"
android:translateY="-0.0007002193">
<group
android:scaleX="0.8747256"
android:scaleY="0.8747256">
<path
android:pathData="M31.95 16A15.95 11.95 0 0 1 0.05 16A15.95 11.95 0 0 1 31.95 16Z"
android:fillColor="#B3B3B3" />
</group>
</group>
<group
android:translateY="-0.0007002384">
<group
android:scaleX="0.8747256"
android:scaleY="0.8747256">
<path
android:pathData="M16 4.1C24.77 4.1 31.9 9.44 31.9 16C31.9 22.56 24.77 27.9 16 27.9C7.23 27.9 0.1 22.56 0.1 16C0.1 9.44 7.23 4.1 16 4.1M16 4C7.16 4 0 9.37 0 16C0 22.63 7.16 28 16 28C24.84 28 32 22.63 32 16C32 9.37 24.84 4 16 4L16 4z"
android:fillColor="#000000" />
</group>
</group>
<group
android:translateX="-0.0000004005432"
android:translateY="-0.0007002193">
<group
android:scaleX="0.8747256"
android:scaleY="0.8747256">
<path
android:pathData="M5.14 27.95C4.54 27.95 4.05 27.46 4.05 26.86L4.05 5.14C4.05 4.54 4.54 4.05 5.14 4.05L26.87 4.05C27.47 4.05 27.96 4.54 27.96 5.14L27.96 26.87C27.96 27.47 27.47 27.96 26.87 27.96L5.14 27.96z"
android:fillColor="#E6E6E6" />
</group>
</group>
<group
android:translateX="-0.0000004768372"
android:translateY="-0.0007002384">
<group
android:scaleX="0.8747256"
android:scaleY="0.8747256">
<path
android:pathData="M26.86 4.1C27.43 4.1 27.9 4.56 27.9 5.14L27.9 26.87C27.9 27.44 27.44 27.91 26.86 27.91L5.14 27.91C4.57 27.91 4.1 27.45 4.1 26.87L4.1 5.14C4.1 4.57 4.56 4.1 5.14 4.1L26.86 4.1M26.86 4L5.14 4C4.51 4 4 4.51 4 5.14L4 26.87C4 27.49 4.51 28 5.14 28L26.87 28C27.5 28 28.01 27.49 28.01 26.86L28.01 5.14C28 4.51 27.49 4 26.86 4L26.86 4z"
android:fillColor="#000000" />
</group>
</group>
</group>
</vector>
I have search but I didn't found if there is any method I can convert this xml string image to imageview. Image are loaded each time from server as string. And I want to show them into an imageview

Scrollable New GuiBuilder Codename One

I have a new GuiBuilder Form with a Layered Layout and scrollable Y, the problem comes when I set to landscape mode then my 4th button suddenly disappears at the bottom, it seems the autosize is cutting off my 4th button even scrolling down I can't find it, and I set that button to Scroll visible. Why it keeps disappearing? How to fix it?. In Portrait mode it's ok though.
EDITED:
My .gui XML as requested:
<?xml version="1.0" encoding="UTF-8"?>
<component type="Form" layout="LayeredLayout" layeredLayoutPreferredWidthMM="0.0" layeredLayoutPreferredHeightMM="0.0" autolayout="true" title="MainMenu" scrollableX="false" scrollableY="true" name="MainMenu">
<component type="Button" text="First Button" name="Button1">
<layoutConstraint insets="auto 5.0mm auto 5.0mm" referenceComponents="-1 -1 -1 -1" referencePositions="0.0 0.0 0.0 0.0" />
</component>
<component type="Button" text="Second Button" name="Button2">
<layoutConstraint insets="0.0mm -0.026454926mm auto 0.0mm" referenceComponents="0 0 -1 0 " referencePositions="1.0 0.0 0.0 0.0" />
</component>
<component type="Button" text="Exit" name="Button4">
<layoutConstraint insets="0.0mm -0.026454926mm auto 0.0mm" referenceComponents="4 4 -1 4 " referencePositions="1.0 0.0 0.0 0.0" />
</component>
<component type="Label" icon="resFile:mylogo.png" name="Logo">
<layoutConstraint insets="auto auto 0.0mm auto" referenceComponents="-1 0 0 0 " referencePositions="0.0 0.0 1.0 0.0" />
</component>
<component type="Button" text="Change Theme" name="Button3">
<layoutConstraint insets="0.0mm -0.026455045mm auto 0.0mm" referenceComponents="1 1 -1 1 " referencePositions="1.0 0.0 0.0 0.0" />
</component>
</component>
This is the button which is causing the issue: <component type="Button" text="Exit" name="Button4">
This was a bug in how LayeredLayout calculates the preferred size of a container which affects how its children get laid out when they would be below the fold. This has been fixed in git and will be included in the next update on Friday.
You should be able to work around this for now by overriding the preferred height of the form to a size that includes all of the buttons. This can either be done programmatically using myForm.setPreferredH(500) (for example), or using the GUI builder, by pressing the "0 x 0in" button in the lower left bar of the canvas, then pressing the "Match Preview" button .

How to Add a new Column to a group in Quickfix?

Im using quickfix to connect to fix engine and receive data. But the market data that comes in are being rejected by my app, stating that the tag appears twice.
20160624-12:44:36.770 : 8=FIX.4.49=21835=W34=2649=CfhDemoPrices52=20160624-12:44:37.79356=PrimoDEMOFIX55=GBPUSD262=PrimoApp13268=2269=0270=1.37203271=1500000290=164=20160628278=30/34-920771269=1270=1.37228271=1500000290=1278=30/34-92077610=038
20160624-12:44:36.798 : 8=FIX.4.49=12635=334=2749=PrimoDEMOFIX52=20160624-12:44:36.79456=CfhDemoPrices45=2658=Tag appears more than once371=278372=W373=1310=139
After lot of analysis, we found that the tag 278(MDEntryID) is not included in NoMDEntries in fix44. I want to include the field in that group in my quickfix and rebuild it. Any idea how to do that? Or please let me know your suggestions to solve this problem.
You've modified your DD incorrectly, because you don't know how repeating groups work.
This is the standard FIX44 DD for your message. I've added some comments to indicate tag numbers.
<message name="MarketDataSnapshotFullRefresh" msgtype="W" msgcat="app">
<field name="MDReqID" required="N" />
<component name="Instrument" required="Y" />
<group name="NoUnderlyings" required="N">
<component name="UnderlyingInstrument" required="N" />
</group>
<group name="NoLegs" required="N">
<component name="InstrumentLeg" required="N" />
</group>
<field name="FinancialStatus" required="N" />
<field name="CorporateAction" required="N" />
<field name="NetChgPrevDay" required="N" />
<group name="NoMDEntries" required="Y"> <!-- 268 -->
<field name="MDEntryType" required="Y" /> <!-- 269 -->
<field name="MDEntryPx" required="N" /> <!-- 270 -->
<field name="Currency" required="N" />
<field name="MDEntrySize" required="N" /> <!-- 271 -->
<field name="MDEntryDate" required="N" />
... and so on ...
Fields inside of repeating groups must be in the prescribed order. When QF processes a group, if it encounters an unexpected field then it assumes the group is over.
Your DD does not match the order that your sender is sending, so your engine is malfunctioning.
Your sender is sending fields in this order:
268-> (group 1) 269 270 271 290 64 278
(group 2) 269 270 271 290 278
(The above is directly from your rejected message.)
Your DD, however, is expecting 269 278 271 270. As soon as it hits 278, it ends the group and weird things start happening.
Revert your DD back to the default, then add 64/SettlDate and 278/MDEntryID to the end of the NoMDEntries component. Given the evidence you've provided, it's clear that your counterparty has added those fields to the end of the group.
Surely these are not the only modifications that your counterparty has made to the DD. GET THEIR DOCUMENTATION AND READ IT. Then modify your DD accordingly.

How to show the SVG image in the android imageview

I have downloaded the svg-android library from the google code and parsed the SVG image using the SVG parser of svg-android as shown but its displaying nothing.
SVG CODE
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14948) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="500px" height="500px" viewBox="0 0 500 500" enable-background="new 0 0 500 500" xml:space="preserve">
<g id="max_width__x2F__height" display="none">
<path display="inline" d="M499.001,1v498H1V1H499.001 M500.001,0H0v500h500.001V0L500.001,0z"/>
</g>
<g id="androd">
<path fill="#9FBF3B" d="M301.314,83.298l20.159-29.272c1.197-1.74,0.899-4.024-0.666-5.104c-1.563-1.074-3.805-0.543-4.993,1.199
L294.863,80.53c-13.807-5.439-29.139-8.47-45.299-8.47c-16.16,0-31.496,3.028-45.302,8.47l-20.948-30.41
c-1.201-1.74-3.439-2.273-5.003-1.199c-1.564,1.077-1.861,3.362-0.664,5.104l20.166,29.272
c-32.063,14.916-54.548,43.26-57.413,76.34h218.316C355.861,126.557,333.375,98.214,301.314,83.298"/>
<path fill="#FFFFFF" d="M203.956,129.438c-6.673,0-12.08-5.407-12.08-12.079c0-6.671,5.404-12.08,12.08-12.08
c6.668,0,12.073,5.407,12.073,12.08C216.03,124.03,210.624,129.438,203.956,129.438"/>
<path fill="#FFFFFF" d="M295.161,129.438c-6.668,0-12.074-5.407-12.074-12.079c0-6.673,5.406-12.08,12.074-12.08
c6.675,0,12.079,5.409,12.079,12.08C307.24,124.03,301.834,129.438,295.161,129.438"/>
<path fill="#9FBF3B" d="M126.383,297.598c0,13.45-10.904,24.354-24.355,24.354l0,0c-13.45,0-24.354-10.904-24.354-24.354V199.09
c0-13.45,10.904-24.354,24.354-24.354l0,0c13.451,0,24.355,10.904,24.355,24.354V297.598z"/>
<path fill="#9FBF3B" d="M140.396,175.489v177.915c0,10.566,8.566,19.133,19.135,19.133h22.633v54.744
c0,13.451,10.903,24.354,24.354,24.354c13.451,0,24.355-10.903,24.355-24.354v-54.744h37.371v54.744
c0,13.451,10.902,24.354,24.354,24.354s24.354-10.903,24.354-24.354v-54.744h22.633c10.569,0,19.137-8.562,19.137-19.133V175.489
H140.396z"/>
<path fill="#9FBF3B" d="M372.734,297.598c0,13.45,10.903,24.354,24.354,24.354l0,0c13.45,0,24.354-10.904,24.354-24.354V199.09
c0-13.45-10.904-24.354-24.354-24.354l0,0c-13.451,0-24.354,10.904-24.354,24.354V297.598z"/>
</g>
</svg>
If you use this svg-android lib (and I think so), then you can see that there are some tutorials.
In short, you should do in this case something like this:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Create a new ImageView
ImageView imageView = new ImageView(this);
// Set the background color to white
imageView.setBackgroundColor(Color.WHITE);
// Parse the SVG file from the resource
SVG svg = SVGParser.getSVGFromResource(getResources(), R.raw.android);
// Get a drawable from the parsed SVG and set it as the drawable for the ImageView
imageView.setImageDrawable(svg.createPictureDrawable());
// Set the ImageView as the content view for the Activity
setContentView(imageView);
}
If you saw this, and do the same, then there may be problems with your SVG. Did you try to open it somewhere else? Or better paste here source of your SVG, please

How to locate custom html elements using selenium webdriver

I have the following html code
<svg height="600" width="910" xmlns:xlink="http://www.w3.org/1999/xlink"
id="svgcontent" overflow="visible" x="910" y="600" viewBox="0 0 910 600">
<g style="pointer-events:all">
<text fill="rgb(0,0,0)" font-family="Sans-Serif" font-size="13" id="80-155-126"
transform="rotate(-90, 168, 126)" y="126" x="168" style="pointer-
events:inherit">A100A</text>
</g>
</svg>
I tried in the following way but didnt get succeeded
assertEquals(driver.findElements(By.xpath("//*[local-name()='svg'
and namespace-uri()='http://www.w3.org/2000/svg' and #id='svgcontent']//*[local-
name()='g' and namespace-uri()='http://www.w3.org/2000/svg']/text")).size(), 1);
try following
assertEquals(driver.findElements(By.xpath("//*[local-name()='svg' and #id='svgcontent']//*[local-name()='text']")).size(), 1);
it should work, but
assertEquals(driver.findElements(By.xpath("//*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg' and #id='svgcontent']//*[local-name()='g' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='text']")).size(), 1);
should be also ok.

Categories