本帖最后由 smss 于 2019-6-17 13:51 编辑
回复 13# WHY 图1为转换前
图2为转换后
没有像之前一样生成一行
以下为测试文本- <?xml version="1.0" encoding="utf-8"?>
- <Clock frameRate="30" scaleByDensity="false" screenWidth="720" type="awesome" useVariableUpdater="DateTime.Minute" version="1">
- <ExternalCommands/>
- <VariableBinders>
- <ContentProviderBinder name="weather" uri="content://weather/weather" columns="city_id">
- <Variable name="city_id" type="string" column="city_id"/>
- </ContentProviderBinder>
- <ContentProviderBinder dependency="weather" uriFormat="content://weather/daily_weather/%s" uriParas="@city_id" columns="city_name,publish_time,temperature,temperature_range,description,wind,humidity,weather_type" countName="hasweather">
- <Variable name="weather_id" type="int" column="weather_type"/>
- <Variable name="weather_location" type="string" column="city_name"/>
- <Variable name="weather_temperature" type="int" column="temperature"/>
- <Variable name="weather_temperature_str" type="string" column="temperature"/>
- <Variable name="weather_temperature_range" type="string" column="temperature_range"/>
- <Variable name="weather_description" type="string" column="description"/>
- </ContentProviderBinder>
- <ContentProviderBinder name="weather_aqi" dependency="weather" uriFormat="content://weatherinfo/aqi/%s" uriParas="@city_id" columns="aqi" countName="hasweatherinfo">
- <Variable name="aqi" type="int" column="aqi"/>
- </ContentProviderBinder>
- </VariableBinders>
- <Var name="Kqzl" expression="ifelse(ge(#aqi,0)*lt(#aqi,0),@aqi_pure,ge(#aqi,1)*lt(#aqi,50),@aqi_good,ge(#aqi,50)*lt(#aqi,100),@aqi_moderate,ge(#aqi,100)*lt(#aqi,150),@aqi_pollution,ge(#aqi,150)*lt(#aqi,200),@aqi_unhealthy,ge(#aqi,200)*lt(#aqi,300),@aqi_dangerous,ge(#aqi,300)*le(#aqi,500),@aqi_hazardous,@aqi_break)" type="string"/>
- <!--提醒-->
- <VarArray type="string">
- <Vars>
- <Var name="Remind" index="#weather_id"/>
- </Vars>
- <Items>
- <Item value="今天阳光明媚,祝你也有个好心情!"/>
- <Item value="今天多云,愿你的心情依然撒满阳光!"/>
- <Item value="今天阴天,大家可以不用怕晒黑啦!"/>
- <Item value="今天有雾,开车的朋友请注意安全!"/>
- <Item value="今天有特大暴雨,我们一起玩LOL吧!"/>
- <Item value="今天有大暴雨,宅在家里会不会很惬意呢?"/>
- <Item value="今天有暴雨,还在外边的同学,还是快点回家吧!"/>
- <Item value="今天有雷阵雨,爱那啥的同学建议不要在郊外活动!"/>
- <Item value="今天有阵雨,也许能看到雨后彩虹欧!"/>
- <Item value="大雨倾盆,你有淋雨一直走的勇气吗?"/>
- <Item value="细雨纷纷,外出的话建议带上伞噢!"/>
- <Item value="在这样细雨连绵的天气里你会想起谁呢?"/>
- <Item value="雨夹雪,出门记得带伞。"/>
- <Item value="今天将有暴雪,还是宅在家里,45度角仰望窗外吧!"/>
- <Item value="阵雪的天气将点缀着美好的一天"/>
- <Item value="今天大雪可以期待堆个雪人玩啦"/>
- <Item value="今天有中雪哦!期待一下迷人的雪景吧。"/>
- <Item value="今天有小雪哦!放心出门,享受一下吧。"/>
- <Item value="今天有强沙天气袭来!宅着吧同学。"/>
- <Item value="今天有沙尘暴,出门务必带口罩"/>
- <Item value="今天室外将有沙尘,请注意防护!"/>
- <Item value="今天室外的扬沙,是否打消了你外出的念头呢?"/>
- <Item value="今天有冰雹,请把你的爱车放于地下停车库"/>
- <Item value="想想北京阴霾天气,还有什么不开心的?"/>
- </Items>
- </VarArray>
- <Var name="night" expression="eq(#weather_id,0)+eq(#weather_id,1)+eq(#weather_id,2)+eq(#weather_id,3)+eq(#weather_id,7)+eq(#weather_id,8)+eq(#weather_id,9)+eq(#weather_id,11)"/>
- <Var name="Day_night" expression="ifelse(#night,'_'+not(ge(#hour24,6)*le(#hour24,17)),'')" type="string" />
- <Group w="#view_width" h="#view_height" layered="true">
- <Image x="#view_width/2" y="#view_height/2" w="610" h="610/640*341" align="center" alignV="center" src="bg.webp"/>
- <Image x="#view_width/2" y="#view_height/2" w="610" h="610/640*341" align="center" alignV="center" srcExp="'weather_'+#weather_id+@Day_night+'.webp'"/>
- <Image x="#view_width/2" y="#view_height/2" w="610" h="610/640*341" align="center" alignV="center" src="Mask.webp" xfermode="dst_in"/>
- </Group>
- <Time x="#view_width/2-276" y="#view_height/2-82" alignV="center" src="Time.webp"/>
- <Text x="#view_width/2-276" y="#view_height/2+90" alignV="center" color="#DEFFFFFF" size="28" text="@Remind" w="600-#KQZL.text_width" marqueeSpeed="30"/>
- <DateTime x="#view_width/2-276" y="#view_height/2+117" format="M月d日 N月e E" color="#DEFFFFFF" size="28"/>
- <Text name="KQZL" x="#view_width/2+276" y="#view_height/2+90" size="28" color="#DEFFFFFF" align="right" alignV="center" textExp="@Kqzl"/>
- <Text x="#view_width/2+276" y="#view_height/2-88" size="70" color="#9E000000" align="right" alignV="center" format="%s" paras="@weather_location"/>
- <Text x="#view_width/2+276" y="#view_height/2-92" size="70" color="#DEFFFFFF" align="right" alignV="center" format="%s" paras="@weather_location"/>
- <Text x="#view_width/2+266" y="#view_height/2+12" size="54" color="#9E000000" align="right" alignV="center" format="%s" paras="@weather_description"/>
- <Text x="#view_width/2+266" y="#view_height/2+10" size="54" color="#DEFFFFFF" align="right" alignV="center" format="%s" paras="@weather_description"/>
- <Text x="#view_width/2+276" y="#view_height/2+117" size="28" color="#DEFFFFFF" align="right" format="%s" paras="@weather_temperature_range"/>
- <!--温度-->
- <Image name="Fu" x="#view_width/2-266" y="#view_height/2+25" alignV="center" src="fu.webp" visibility="lt(#weather_temperature,0)"/>
- <ImageNumber name="Wd" x="#view_width/2-266+#Fu.bmp_width" y="#view_height/2" number="abs(#weather_temperature)" src="du.webp"/>
- <Image x="#view_width/2-266+#Fu.bmp_width+#Wd.bmp_width" y="#view_height/2" src="du.webp"/>
- <Button name="clock_button"/>
- <!--天气播报-->
- <Var name="air_quality" expression="ifelse(ge(#aqi,0)*lt(#aqi,50),0,ge(#aqi,50)*lt(#aqi,100),1,ge(#aqi,100)*lt(#aqi,150),2,ge(#aqi,150)*lt(#aqi,200),3,ge(#aqi,200)*lt(#aqi,300),4,ge(#aqi,300)*le(#aqi,500),5,6)" type="int" const="false"/>
- <Var name="temperature_level" expression="ifelse(lt(#weather_temperature,0),0,ge(#weather_temperature,0)*lt(#weather_temperature,10),1,ge(#weather_temperature,10)*lt(#weather_temperature,20),2,ge(#weather_temperature,20)*lt(#weather_temperature,30),3,4)" type="int"/>
- <Button x="320" y="170" w="320" h="170">
- <Triggers>
- <Trigger action="up">
- <VariableCommand name="click_count" expression="#click_count%3+1" type="int" const="false"/>
- <SoundCommand sound="weather_0.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,0)"/>
- <SoundCommand sound="weather_1.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,1)"/>
- <SoundCommand sound="weather_2.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,2)"/>
- <SoundCommand sound="weather_3.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,3)"/>
- <SoundCommand sound="weather_4.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,4)"/>
- <SoundCommand sound="weather_5.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,5)"/>
- <SoundCommand sound="weather_6.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,6)"/>
- <SoundCommand sound="weather_7.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,7)"/>
- <SoundCommand sound="weather_8.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,8)"/>
- <SoundCommand sound="weather_9.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,9)"/>
- <SoundCommand sound="weather_10.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,10)"/>
- <SoundCommand sound="weather_11.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,11)"/>
- <SoundCommand sound="weather_12.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,12)"/>
- <SoundCommand sound="weather_13.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,13)"/>
- <SoundCommand sound="weather_14.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,14)"/>
- <SoundCommand sound="weather_15.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,15)"/>
- <SoundCommand sound="weather_16.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,16)"/>
- <SoundCommand sound="weather_17.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,17)"/>
- <SoundCommand sound="weather_18.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,18)"/>
- <SoundCommand sound="weather_19.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,19)"/>
- <SoundCommand sound="weather_20.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,20)"/>
- <SoundCommand sound="weather_21.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,21)"/>
- <SoundCommand sound="weather_22.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,22)"/>
- <SoundCommand sound="weather_23.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,23)"/>
- <SoundCommand sound="weather_24.mp3" volume="1" keepCur="true" condition="eq(#click_count,1)*eq(#weather_id,24)"/>
- <SoundCommand sound="temperature_0.mp3" volume="1" keepCur="true" condition="eq(#click_count,2)*eq(#temperature_level,0)"/>
- <SoundCommand sound="temperature_1.mp3" volume="1" keepCur="true" condition="eq(#click_count,2)*eq(#temperature_level,1)"/>
- <SoundCommand sound="temperature_2.mp3" volume="1" keepCur="true" condition="eq(#click_count,2)*eq(#temperature_level,2)"/>
- <SoundCommand sound="temperature_3.mp3" volume="1" keepCur="true" condition="eq(#click_count,2)*eq(#temperature_level,3)"/>
- <SoundCommand sound="temperature_4.mp3" volume="1" keepCur="true" condition="eq(#click_count,2)*eq(#temperature_level,4)"/>
- <SoundCommand sound="air_0.mp3" volume="1" keepCur="true" condition="eq(#click_count,3)*eq(#air_quality,0)"/>
- <SoundCommand sound="air_1.mp3" volume="1" keepCur="true" condition="eq(#click_count,3)*eq(#air_quality,1)"/>
- <SoundCommand sound="air_2.mp3" volume="1" keepCur="true" condition="eq(#click_count,3)*eq(#air_quality,2)"/>
- <SoundCommand sound="air_3.mp3" volume="1" keepCur="true" condition="eq(#click_count,3)*eq(#air_quality,3)"/>
- <SoundCommand sound="air_4.mp3" volume="1" keepCur="true" condition="eq(#click_count,3)*eq(#air_quality,4)"/>
- <SoundCommand sound="air_5.mp3" volume="1" keepCur="true" condition="eq(#click_count,3)*eq(#air_quality,5)"/>
- <SoundCommand sound="air_6.mp3" volume="1" keepCur="true" condition="eq(#click_count,3)*eq(#air_quality,6)"/>
- </Trigger>
- </Triggers>
- </Button>
- <!--时钟-->
- <Button x="#view_width/2-320" y="#view_height/2-170" w="320" h="170">
- <Triggers>
- <Trigger action="up">
- <IntentCommand action="android.intent.action.MAIN" class="com.android.deskclock.DeskClockTabActivity" package="com.android.deskclock"/>
- </Trigger>
- </Triggers>
- </Button>
- <!-- 日历 -->
- <Button x="#view_width/2-320" y="#view_height/2" w="320" h="170">
- <Triggers>
- <Trigger action="up">
- <IntentCommand action="android.intent.action.MAIN" class="com.android.calendar.AllInOneActivity" package="com.android.calendar"/>
- </Trigger>
- </Triggers>
- </Button>
- <!--天气-->
- <Button x="#view_width/2" y="#view_height/2-170" w="320" h="170">
- <Triggers>
- <Trigger action="up">
- <IntentCommand action="android.intent.action.MAIN" class="com.miui.weather2.ActivityWeatherCycle" package="com.miui.weather2"/>
- <IntentCommand action="android.intent.action.MAIN" class="com.miui.weather2.ActivityWeatherMain" package="com.miui.weather2"/>
- </Trigger>
- </Triggers>
- </Button>
- </Clock>
复制代码
|