Skip to content

Latest commit

 

History

History
107 lines (81 loc) · 2.08 KB

README.md

File metadata and controls

107 lines (81 loc) · 2.08 KB

AppDress

AppDress is a android library that change app ui color with simple code. coextensive with App 黑白化实现探索,有一行代码实现的方案吗?_Hongyang-CSDN博客

Implementation documentation给App装上漂亮的裙子

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;
}

graygray eye_protectnight

Download

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'
}

How to use

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)

License

GNU General Public License v3.0. See the LICENSE file for details.