Giter VIP home page Giter VIP logo

daynightloadingview's Introduction

DayNightLoadingView

A day night loading view(一个日夜切换的loading view).

Api reqeust MIT Licence Blog



gif1


中文

使用

在根目录的build.gradle添加这一句代码:

allprojects {
    repositories {
        //...
        maven { url 'https://jitpack.io' }
    }
}

在app目录下的build.gradle添加依赖使用:

dependencies {
    implementation 'com.github.samlss:DayNightLoadingView:1.1'
}

布局中使用:

<com.iigo.library.DayNightLoadingView
        android:id="@+id/dn_loading"
        app:background_color="#66000000"
        app:moon_color="#D0D2DF"
        app:star_color="#F3EBB8"
        app:sun_color="#FFF600"
        app:sunshine_color="#DB261B"
        android:layout_width="400dp"
        android:layout_height="300dp"/>

代码中使用:

  dayNightLoadingView.resume(); //恢复动画
  dayNightLoadingView.pause(); //暂停动画
  
  dayNightLoadingView.stop(); //停止和释放动画,可在activity销毁时调用

属性说明:

属性 说明
background_color 背景颜色
sun_color 太阳颜色
sunshine_color 阳光颜色
moon_color 月亮颜色
star_color 星星颜色

由于使用了Animator和AnimaterSet的resume和pause方法,因此api要求为 >= 19,如果你想兼容更低的api, 方法有:

  • 不调用该库的resume和pause接口,最低可兼容到api12
  • 你自己修改代码
  • 联系我,等我有时间的时候尽量完善一下


English

Use

Add it in your root build.gradle at the end of repositories:

allprojects {
    repositories {
        //...
        maven { url 'https://jitpack.io' }
    }
}

Add it in your app build.gradle at the end of repositories:

dependencies {
    implementation 'com.github.samlss:DayNightLoadingView:1.1'
}

in layout.xml:

<com.iigo.library.DayNightLoadingView
        android:id="@+id/dn_loading"
        app:background_color="#66000000"
        app:moon_color="#D0D2DF"
        app:star_color="#F3EBB8"
        app:sun_color="#FFF600"
        app:sunshine_color="#DB261B"
        android:layout_width="400dp"
        android:layout_height="300dp"/>

in java code:

  dayNightLoadingView.resume(); //resume animator
  dayNightLoadingView.pause(); //pause animator
  
  dayNightLoadingView.stop(); //Stop and release the animation, can be called when the activity is destroyed

Attributes description:

attr description
background_color the background color
sun_color the sun color
sunshine_color the sunshine color
moon_color the moon color
star_color the stars color

Due to use of the resume and pause methods of Animator and AnimalSet, the api requirement is >= 19, if you want to be compatible with lower apis, the methods are:

  • Do not call the resume and pause method of this library, the minimum compatible with api 12.
  • Modify the code by yourself.
  • Contact me, i will try to improve it when I have time.

daynightloadingview's People

Contributors

samlss avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.