AppDress is a android library that change app ui color with sample code. coextensive with App 黑白化实现探索,有一行代码实现的方案吗?_Hongyang-CSDN博客
Implementation documentation:https://www.yuque.com/lenebf/fl1svo/sagoxt
case R.id.rb_gray: {
AppDress.tint(new GrayColor());
break;
}
case R.id.rb_eye_protection: {
AppDress.tint(new EyeProtectionColor(0.3f));
break;
}
case R.id.rb_night_mode: {
AppDress.tint(new NightColor());
break;
}
default: {
AppDress.tint(null);
break;
}
Step 1. Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
implementation 'com.github.lenebf:AppDress:Tag'
}
1. SDK Init
public class DemoApp extends Application {
@Override
public void onCreate() {
super.onCreate();
AppDress.wear(this);
}
}
2. Tint the dress
// Gray mode
AppDress.tint(new GrayColor());
// Eye protection mode
// AppDress.tint(new EyeProtectionColor(0.3f));
// Night mode
// AppDress.tint(new NightColor());
// Original
// AppDress.tint(null);
3. Exclude view when using night mode
// For Activity
public class MainActivity extends AppCompatActivity implements NightColorFilter {
......
......
......
@Override
public boolean excludeView(@NonNull View view) {
return view instanceof ImageView;
}
}
// For single view
NightColor.revert(view)
GNU General Public License v3.0. See the LICENSE file for details.