AirPurgeView

AirPurgeView

项目地址:mochixuan/AirPurgeView 

简介:AirPurgeView

更多:作者   提 Bug   

标签:

 

效果图两个

main.png

mode.gif

引用


Maven

<dependency>
  <groupId>com.wx.library</groupId>
  <artifactId>airpurgeview</artifactId>
  <version>1.0</version>
  <type>pom</type>
</dependency>

Gradle

compile 'com.wx.library:airpurgeview:1.0'

可设置的参数


<declare-styleable name="AirPurgeLayoutView">
    <attr name="granule_num" format="integer"/>    <!--颗粒物数-->
    <attr name="granule_radius" format="float"/>   <!--颗粒物数-->
    <attr name="granule_color" format="color"/>    <!--颗粒颜色,最好不透明的-->

    <attr name="circle_proportion" format="float"/>  <!--圆的直径大小占宽高中最小的那个的比例-->
    <attr name="main_color" format="color"/>            <!--实体圆环和扇叶圆环和字体的颜色-->
    <attr name="solidring_width" format="float"/>    <!--最外圈实线圆环的宽度,最好不要太大-->
    <attr name="dashedring_width" format="float"/>    <!--扇叶圆环的宽度,经测量是 solidwidth 四倍最好,可以适当调节-->
    <attr name="toptitle" format="string"/>
    <attr name="centertitle" format="string"/>
    <attr name="bottomtitle" format="string"/>
    <attr name="toptitle_textsize" format="dimension"/>
    <attr name="centertitle_textsize" format="dimension"/>
    <attr name="bottomtitle_textsize" format="dimension"/>
    <attr name="speed_level" format="integer"/>     <!--风速默认 3000,可以修改-->
    <attr name="eachpan_angle" format="float"/>    <!--每片扇叶的角度 自己要计算好加间隙 一共 360-->
    <attr name="eachpan_anglegap" format="float"/>    <!--相邻扇叶的间隙-->
</declare-styleable>

sample

XML


<com.wx.airpurgeview.AirPurgeLayoutView
        android:id="@+id/airpurge_view"
        android:layout_width="match_parent"
        android:layout_height="400dp"
        app:toptitle="PM2.5"
        app:centertitle="521"
        app:bottomtitle="空气优"/>

Java


btnChangeNum.setOnClickListener {
            clearMode1Anim()
            mAirPurgeView.setCenterTitle(random.nextInt(600).toString())
        }
        btnChangeBg.setOnClickListener {
            clearMode1Anim()
            if (colorIndex >= bgColors.size) colorIndex = 0
            mAirPurgeView.setBackgroundColor(bgColors[colorIndex],1000)
            colorIndex += 1
        }
        btnChangeStart.setOnClickListener {
            clearMode1Anim()
            mAirPurgeView.onOpenAirPurge()
        }
        btnChangeEnd.setOnClickListener {
            clearMode1Anim()
            mAirPurgeView.onCloseAirPurge()
        }
        btnChangeSpeed.setOnClickListener {
            clearMode1Anim()
            if (colorIndex >= bgColors.size || colorIndex <= 0) colorIndex = bgColors.size - 1
            mAirPurgeView.setSpeedLevel(colorIndex*1000.toLong())
            colorIndex -= 1
        }
        btnOpenGranlue.setOnClickListener {
            clearMode1Anim()
            mAirPurgeView.onOpenGranule(false)
        }
        btnCloseGranlue.setOnClickListener {
            clearMode1Anim()
            mAirPurgeView.onClearAllGranule()
        }
        btnChangeGranuleMode.setOnClickListener {
            clearMode1Anim()
            mAirPurgeView.onChangeGranuleMode(!mAirPurgeView.getGranuleMode())
        }
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值