2017.1-TOP5 Android开源库

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();
2017.1-TOP5 Android开源库

Stencil (Github)

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

dependencies {
compile 'com.github.thoughtbot:stencil:1.0'
}
2017.1-TOP5 Android开源库

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.
2017.1-TOP5 Android开源库

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>
2017.1-TOP5 Android开源库
2017.1-TOP5 Android开源库
2017.1-TOP5 Android开源库

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开源库

原文

上一篇:Java 与C++区别:复写(override)


下一篇:codeforces Round #260(div2) D解决报告