SettingActivity.java 文件源码

java
阅读 32 收藏 0 点赞 0 评论 0

项目:Toutiao 作者:
@Override
public void onColorSelection(@NonNull ColorChooserDialog dialog, @ColorInt int selectedColor) {
    if (getSupportActionBar() != null)
        getSupportActionBar().setBackgroundDrawable(new ColorDrawable(selectedColor));
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        // 状态栏上色
        getWindow().setStatusBarColor(CircleView.shiftColorDown(selectedColor));
        // 最近任务栏上色
        ActivityManager.TaskDescription tDesc = new ActivityManager.TaskDescription(
                getString(R.string.app_name),
                BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher_rect),
                selectedColor);
        setTaskDescription(tDesc);
        // 导航栏上色
        if (SettingUtil.getInstance().getNavBar()) {
            getWindow().setNavigationBarColor(CircleView.shiftColorDown(selectedColor));
        } else {
            getWindow().setNavigationBarColor(Color.BLACK);
        }
    }
    if (!dialog.isAccentMode()) {
        SettingUtil.getInstance().setColor(selectedColor);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号