码迷,mamicode.com
首页 > 移动开发 > 详细

2017.1-TOP5 Android开源库

时间:2017-03-27 16:33:00      阅读:276      评论:0      收藏:0      [点我收藏+]

标签:eterm   over   ade   complete   初始化   tla   github   eth   stop   

Colorful (Github)

Colorful简单实用,通过这个开源库可以通过编码的方式来改变应用的主题,不再需要定义不同的style

dependencies {
    compile ‘com.github.garretyoder:Colorful:1.1‘
}
public class SampleApp extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        Colorful.init(this);
    }
}

你需要改变主题的Activity必须继承CActivity

public class MainActivity extends CActivity

或者在 setContentView()之前调用下面的方法

Colorful.applyTheme(Activity activity);

也可以调用 Colorful.applyTheme(Activity activity, Boolean overrideBase); 参数 overrideBase 说明是否要覆盖本身的主题

可以在初始化时,设置默认的主题

public class SampleApp extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        Colorful.defaults()
                .primaryColor(Colorful.ThemeColor.RED)
                .accentColor(Colorful.ThemeColor.BLUE)
                .translucent(false)
                .dark(true);
        Colorful.init(this);
    }
}

在代码中可以使用配置随时修改

Colorful.config(this)
                .primaryColor(Colorful.ThemeColor.RED)
                .accentColor(Colorful.ThemeColor.BLUE)
                .translucent(false)
                .dark(true)
                .apply();
技术分享

Stencil (Github)

是时候给你的文字来点花样了

dependencies {
  compile ‘com.github.thoughtbot:stencil:1.0‘
}
技术分享

WaveLoading (Github)

波浪形动画

compile ‘com.race604.waveloading:library:1.1.1‘

使用

Drawable mWaveDrawable = new WaveDrawable(otherDrawable);

// Use as common drawable
imageView.setImageDrawable(mWaveDrawable);

其他的配置方法

public void setWaveAmplitude(int amplitude), set wave amplitude (in pixels)
public void setWaveLength(int length), set wave length (in pixels)
public void setWaveSpeed(int step), set wave move speed (in pixels)
public void setIndeterminate(boolean indeterminate), like progress bar, if run in indeterminate mode, it‘ll increase water level over and over again, otherwise, you can use boolean setLevel(int level) to set the water level, acting as loading progress.
public void setIndeterminateAnimator(ValueAnimator animator), set you customised animator for wave loading animation in indeterminate mode.
技术分享

BufferTextInputLayout (Github)

一个简单的定制化的TextInputLayout

<org.buffer.android.buffertextinputlayout.BufferTextInputLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:counterEnabled="true"
        app:counterMaxLength="10"
        app:counterOverflowTextAppearance="@style/counterOverride"
        app:counterTextAppearance="@style/counterText"
        app:hintEnabled="true"
        app:counterMode="ascending">

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="@string/text_hint" />

</org.buffer.android.buffertextinputlayout.BufferTextInputLayout>
技术分享
技术分享
技术分享

PageLoader (Github)

定制页面加载的一个开源库

dependencies {
    compile ‘id.arieridwan:pageloader:0.0.2‘
}
<id.arieridwan.lib.PageLoader
    android:id="@+id/pageloader"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
SomeMethod(){
pageLoader.startProgress();
...
    onComplete(){
        ...
    }
    onNext(){
        ...
        pageLoader.stopProgress();
    }
    onError(){
        ...
        pageLoader.stopProgressAndFailed();
    }
}
技术分享

原文

2017.1-TOP5 Android开源库

标签:eterm   over   ade   complete   初始化   tla   github   eth   stop   

原文地址:http://www.cnblogs.com/Free-Thinker/p/6627347.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!