@Override public void onColorSelection(@NonNull ColorChooserDialog dialog, @ColorInt int color) { if (dialog.isAccentMode()) { accentPreselect = color; ThemeSingleton.get().positiveColor = DialogUtils.getActionTextStateList(this, color); ThemeSingleton.get().neutralColor = DialogUtils.getActionTextStateList(this, color); ThemeSingleton.get().negativeColor = DialogUtils.getActionTextStateList(this, color); ThemeSingleton.get().widgetColor = color; } else { primaryPreselect = color; if (getSupportActionBar() != null) getSupportActionBar().setBackgroundDrawable(new ColorDrawable(color)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { getWindow().setStatusBarColor(CircleView.shiftColorDown(color)); getWindow().setNavigationBarColor(color); } } }
@Override public void onColorSelection(@NonNull ColorChooserDialog dialog, @ColorInt int color) { if (dialog.isAccentMode()) { accentPreselect = color; ThemeSingleton.get().positiveColor = DialogUtils.getActionTextStateList(this, color); ThemeSingleton.get().neutralColor = DialogUtils.getActionTextStateList(this, color); ThemeSingleton.get().negativeColor = DialogUtils.getActionTextStateList(this, color); ThemeSingleton.get().widgetColor = color; Log.i(TAG, "onColorSelection: #"+ Integer.toHexString(color)); setStateItem(ElementAppItem.APP_TYPE_COLOR, "#"+Integer.toHexString(color)); } else { primaryPreselect = color; if (getSupportActionBar() != null) { getSupportActionBar().setBackgroundDrawable(new ColorDrawable(color)); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { getWindow().setStatusBarColor(CircleView.shiftColorDown(color)); getWindow().setNavigationBarColor(color); } } }
@Override protected void onResume() { super.onResume(); int color = SettingUtil.getInstance().getColor(); int drawable = Constant.ICONS_DRAWABLES[SettingUtil.getInstance().getCustomIconValue()]; if (getSupportActionBar() != null) getSupportActionBar().setBackgroundDrawable(new ColorDrawable(color)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { getWindow().setStatusBarColor(CircleView.shiftColorDown(color)); // 最近任务栏上色 ActivityManager.TaskDescription tDesc = new ActivityManager.TaskDescription( getString(R.string.app_name), BitmapFactory.decodeResource(getResources(), drawable), color); setTaskDescription(tDesc); if (SettingUtil.getInstance().getNavBar()) { getWindow().setNavigationBarColor(CircleView.shiftColorDown(color)); } else { getWindow().setNavigationBarColor(Color.BLACK); } } }
@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); } }
@Override public void onColorSelection(ColorChooserDialog dialog, @ColorInt int color) { if (dialog.isAccentMode()) { accentPreselect = color; ThemeSingleton.get().positiveColor = DialogUtils.getActionTextStateList(this, color); ThemeSingleton.get().neutralColor = DialogUtils.getActionTextStateList(this, color); ThemeSingleton.get().negativeColor = DialogUtils.getActionTextStateList(this, color); ThemeSingleton.get().widgetColor = color; } else { primaryPreselect = color; if (getSupportActionBar() != null) { getSupportActionBar().setBackgroundDrawable(new ColorDrawable(color)); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { getWindow().setStatusBarColor(CircleView.shiftColorDown(color)); getWindow().setNavigationBarColor(color); } } }
@Override public boolean onLongClick(View v) { if (v.getTag() != null) { final String[] tag = ((String) v.getTag()).split(":"); final int color = Integer.parseInt(tag[1]); ((CircleView) v).showHint(color); return true; } return false; }
@Override protected void onResume() { super.onResume(); int color = mSettingHelper.getColor(); if (getSupportActionBar() != null) getSupportActionBar().setBackgroundDrawable(new ColorDrawable(color)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { getWindow().setStatusBarColor(CircleView.shiftColorDown(color)); getWindow().setNavigationBarColor(color); } }
@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)); getWindow().setNavigationBarColor(selectedColor); } if (!dialog.isAccentMode()) { mSettingHelper.setColor(selectedColor); } }