@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);
}
}
}
java类com.afollestad.materialdialogs.color.ColorChooserDialog的实例源码
MainActivity.java 文件源码
项目:GitHub
阅读 21
收藏 0
点赞 0
评论 0
SettingsActivity.java 文件源码
项目:Orin
阅读 27
收藏 0
点赞 0
评论 0
@Override
public void onColorSelection(@NonNull ColorChooserDialog dialog, @ColorInt int selectedColor) {
switch (dialog.getTitle()) {
case R.string.primary_color:
ThemeStore.editTheme(this)
.primaryColor(selectedColor)
.commit();
break;
case R.string.accent_color:
ThemeStore.editTheme(this)
.accentColor(selectedColor)
.commit();
break;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
new DynamicShortcutManager(this).updateDynamicShortcuts();
}
recreate();
}
ColorSettingsDialogFragment.java 文件源码
项目:RecyclerViewPreferences
阅读 19
收藏 0
点赞 0
评论 0
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Icepick.restoreInstanceState(this, savedInstanceState);
ColorSettingsDialogFragmentBundleBuilder.inject(getArguments(), this);
if (lastValue != null) {
color = lastValue;
} else {
lastValue = color;
}
// Override builder in args
int t = R.string.color; // TODO: Title
ColorChooserDialog.Builder builder = new ColorChooserDialog.Builder(getActivity(), t)
.allowUserColorInputAlpha(true)
.customButton(R.string.md_custom_label)
.presetsButton(R.string.md_presets_label)
.preselect(color)
.titleSub(t);
getArguments().putSerializable("builder", builder);
}
SettingsActivity.java 文件源码
项目:RetroMusicPlayer
阅读 29
收藏 0
点赞 0
评论 0
@Override
public void onColorSelection(@NonNull ColorChooserDialog dialog, @ColorInt int selectedColor) {
switch (dialog.getTitle()) {
case R.string.primary_color:
ThemeStore.editTheme(this).primaryColor(selectedColor).commit();
break;
case R.string.accent_color:
ThemeStore.editTheme(this).accentColor(selectedColor).commit();
break;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
new DynamicShortcutManager(this).updateDynamicShortcuts();
}
recreate();
}
AttributeActivity.java 文件源码
项目:mesh-core-on-android
阅读 22
收藏 0
点赞 0
评论 0
@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);
}
}
}
SettingsFragment.java 文件源码
项目:Pasta-Music
阅读 25
收藏 0
点赞 0
评论 0
public void onColorSelection(@NonNull ColorChooserDialog dialog, @ColorInt int selectedColor) {
switch (dialog.getTitle()) {
case R.string.primary_color:
if (PreferenceUtils.getPrimaryColor(getContext()) == selectedColor) return;
prefs.edit().putInt(PreferenceUtils.PRIMARY, selectedColor).apply();
primary.transition(new ColorDrawable(selectedColor));
break;
case R.string.accent_color:
if (PreferenceUtils.getAccentColor(getContext()) == selectedColor) return;
prefs.edit().putInt(PreferenceUtils.ACCENT, selectedColor).apply();
accent.transition(new ColorDrawable(selectedColor));
break;
default:
return;
}
pasta.showToast(getString(R.string.restart_msg));
}
FindGenerateCodeAty.java 文件源码
项目:myapplication
阅读 21
收藏 0
点赞 0
评论 0
@Override
public void onColorSelection(@NonNull ColorChooserDialog dialog,
@ColorInt int selectedColor) {
Log.d(LOG_TAG, "onColorSelection: " + selectedColor);
switch (mPalette) {
// 前景色
case 0:
mForeColor = selectedColor;
operateColor(selectedColor, AbsentMConstants.FORE_COLOR);
break;
// 背景色
case 1:
mBackColor = selectedColor;
operateColor(selectedColor, AbsentMConstants.BACK_COLOR);
break;
}
}
TaggingActivity.java 文件源码
项目:Minerva
阅读 19
收藏 0
点赞 0
评论 0
/**
* Called when one of the action buttons is clicked on a tag card.
* @param event {@link TagCardClickEvent}.
*/
@Subscribe
public void onTagCardAction(TagCardClickEvent event) {
// Store tag.
tempTag = items.where()
.equalTo("name", event.getName())
.findFirst();
// Open some dialog.
switch (event.getType()) {
case TEXT_COLOR:
new ColorChooserDialog.Builder(this, R.string.title_tag_text_color)
.preselect(tempTag.textColor)
.dynamicButtonColor(false)
.show();
break;
case BG_COLOR:
new ColorChooserDialog.Builder(this, R.string.title_tag_bg_color)
.preselect(tempTag.bgColor)
.dynamicButtonColor(false)
.show();
break;
case ACTIONS:
onCardMenuActionClicked(event.getActionId(), event.getName());
break;
}
}
SettingsActivity.java 文件源码
项目:app-theme-engine-master
阅读 33
收藏 0
点赞 0
评论 0
@Override
public void onColorSelection(@NonNull ColorChooserDialog dialog, @ColorInt int selectedColor) {
final Config config = ATE.config(this, getATEKey());
switch (dialog.getTitle()) {
case R.string.primary_color:
config.primaryColor(selectedColor);
break;
case R.string.accent_color:
config.accentColor(selectedColor);
break;
case R.string.primary_text_color:
config.textColorPrimary(selectedColor);
break;
case R.string.secondary_text_color:
config.textColorSecondary(selectedColor);
break;
}
config.commit();
recreate(); // recreation needed to reach the checkboxes in the preferences layout
}
SettingsActivity.java 文件源码
项目:app-theme-engine
阅读 27
收藏 0
点赞 0
评论 0
@Override
public void onColorSelection(@NonNull ColorChooserDialog dialog, @ColorInt int selectedColor) {
final Config config = ATE.config(this, getATEKey());
switch (dialog.getTitle()) {
case R.string.primary_color:
config.primaryColor(selectedColor);
break;
case R.string.accent_color:
config.accentColor(selectedColor);
// We've overridden the navigation view selected colors in the default config,
// which means we are responsible for keeping those colors up to date.
config.navigationViewSelectedIcon(selectedColor);
config.navigationViewSelectedText(selectedColor);
break;
case R.string.primary_text_color:
config.textColorPrimary(selectedColor);
break;
case R.string.secondary_text_color:
config.textColorSecondary(selectedColor);
break;
}
config.commit();
recreate(); // recreation needed to reach the checkboxes in the preferences layout
}
SettingActivity.java 文件源码
项目:Toutiao
阅读 33
收藏 0
点赞 0
评论 0
@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);
}
}
FragmentNearby.java 文件源码
项目:beaconradar
阅读 22
收藏 0
点赞 0
评论 0
@Override @DebugLog
public void onResume() {
super.onResume();
mPresenter.onResume();
mBus.register(this);
//Restoring dialog callbacks after rotation.
//Return after every 'if' because only 1 dialog may be visible at any moment
ColorChooserNoTitle color = (ColorChooserNoTitle) ColorChooserNoTitle.findVisible((MainActivity)getActivity(), ColorChooserDialog.TAG_PRIMARY);
if(color != null) { color.setCallback(this); color.setDismissCallback(this); return; }
OptionsDialog menu = OptionsDialog.findVisible((MainActivity) getActivity(), "dialog_beacon_context");
if(menu != null) { menu.setSelectionListener(this); return; }
TextDialog name = TextDialog.findVisible((MainActivity) getActivity(), "dialog_beacon_name");
if(name != null) { name.setChangedListener(this); return; }
IconDialog icon = IconDialog.findVisible((MainActivity) getActivity(), "dialog_beacon_icon");
if(icon != null) { icon.setSelectionListener(this); return; }
//Restore FAB
int pos = ((TabHost) getActivity()).getCurrentItem();
if(pos == 0) mPresenter.showFAB();
}
DetailsActivity.java 文件源码
项目:beaconradar
阅读 32
收藏 0
点赞 0
评论 0
@Override @DebugLog
protected void onResume() {
super.onResume();
((App) getApplication()).onResume();
ColorChooserNoTitle color = (ColorChooserNoTitle) ColorChooserNoTitle.findVisible(this, ColorChooserDialog.TAG_PRIMARY);
if(color != null) { color.setCallback(this); return; }
TextDialog name = TextDialog.findVisible(this, "dialog_beacon_name");
if(name != null) { name.setChangedListener(this); return; }
IconDialog icon = IconDialog.findVisible(this, "dialog_beacon_icon");
if(icon != null) { icon.setSelectionListener(this); return; }
mFab.onResume();
//Start ticker
if(mPresenter.getBeacon() != null) {
updateSecondCounter(mPresenter.getBeacon());
}
//updateTicker();
}
MainActivity.java 文件源码
项目:Superuser-UI
阅读 19
收藏 0
点赞 0
评论 0
private void addNavThemeItem(LinearLayout child, final int color, final int title) {
final ImageView preview = (ImageView) child.findViewById(R.id.preview);
preview.setColorFilter(color);
child.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
new ColorChooserDialog.Builder(MainActivity.this, title)
.allowUserColorInput(true)
.allowUserColorInputAlpha(true)
.dynamicButtonColor(false)
.preselect(color)
.show();
}
});
}
MainActivity.java 文件源码
项目:Superuser-UI
阅读 20
收藏 0
点赞 0
评论 0
@Override
public void onColorSelection(@NonNull ColorChooserDialog colorChooserDialog, @ColorInt int i) {
ThemeStore themeStore = ThemeStore.editTheme(this);
switch (colorChooserDialog.getTitle()) {
case R.string.primary_color: themeStore.primaryColor(i); break;
case R.string.toolbar_text : Theme.setTextColorToolbar(prefEdit, i); break;
case R.string.tab_indicator: Theme.setTabIndicatorColor(prefEdit, i); break;
case R.string.accent_color : themeStore.accentColor(i); break;
case R.string.counter_back: Theme.setCounterBackColor(prefEdit, i); break;
case R.string.counter_text: Theme.setCounterTextColor(prefEdit, i); break;
}
prefEdit.commit();
themeStore.commit();
recreate();
}
MainActivity.java 文件源码
项目:IconHandler
阅读 19
收藏 0
点赞 0
评论 0
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.color_holder:
new ColorChooserDialog.Builder(this, R.string.color_palette)
.preselect(selectedColor)
.allowUserColorInput(false)
.customButton(R.string.md_custom_label)
.presetsButton(R.string.md_presets_label)
.show();
break;
case R.id.icon_holder:
selectNewIcon();
load();
break;
case R.id.gravity_holder:
selectNewGravity();
load();
break;
}
}
MainActivity.java 文件源码
项目:NezumimiApp
阅读 21
收藏 0
点赞 0
评论 0
@Override
public void onColorSelection(ColorChooserDialog colorChooserDialog, int chosenColor) {
for (int i = 0; i < color_table.length; i++) {
if (color_table[i] == chosenColor) {
if (mSingleColor) {
rightColor = i;
leftColor = i;
} else {
if (mLeftClicked) {
leftColor = i;
} else {
rightColor = i;
}
}
break;
}
}
mImageLeft.setColorFilter(color_table[leftColor]);
mImageRight.setColorFilter(color_table[rightColor]);
if (!mAdvMode || mGenCode) generateCode();
}
MainActivity.java 文件源码
项目:material-dialogs
阅读 19
收藏 0
点赞 0
评论 0
@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);
}
}
}
MainActivity.java 文件源码
项目:GitHub
阅读 20
收藏 0
点赞 0
评论 0
@OnClick(R.id.colorChooser_accent) public void showColorChooserAccent() {
new ColorChooserDialog.Builder(this, R.string.color_palette)
.titleSub(R.string.colors)
.accentMode(true)
.preselect(accentPreselect)
.show();
}
MainActivity.java 文件源码
项目:GitHub
阅读 20
收藏 0
点赞 0
评论 0
@OnClick(R.id.colorChooser_customColors) public void showColorChooserCustomColors() {
int[][] subColors = new int[][]{
new int[]{Color.parseColor("#EF5350"),
Color.parseColor("#F44336"),
Color.parseColor("#E53935")},
new int[]{Color.parseColor("#EC407A"),
Color.parseColor("#E91E63"),
Color.parseColor("#D81B60")},
new int[]{Color.parseColor("#AB47BC"),
Color.parseColor("#9C27B0"),
Color.parseColor("#8E24AA")},
new int[]{Color.parseColor("#7E57C2"),
Color.parseColor("#673AB7"),
Color.parseColor("#5E35B1")},
new int[]{Color.parseColor("#5C6BC0"),
Color.parseColor("#3F51B5"),
Color.parseColor("#3949AB")},
new int[]{Color.parseColor("#42A5F5"),
Color.parseColor("#2196F3"),
Color.parseColor("#1E88E5")}
};
new ColorChooserDialog.Builder(this, R.string.color_palette)
.titleSub(R.string.colors)
.preselect(primaryPreselect)
.customColors(R.array.custom_colors, subColors)
.show();
}
MainActivity.java 文件源码
项目:GitHub
阅读 21
收藏 0
点赞 0
评论 0
@OnClick(R.id.colorChooser_customColorsNoSub) public void showColorChooserCustomColorsNoSub() {
new ColorChooserDialog.Builder(this, R.string.color_palette)
.titleSub(R.string.colors)
.preselect(primaryPreselect)
.customColors(R.array.custom_colors, null)
.show();
}
CreateEditActivity.java 文件源码
项目:SOS-The-Healthcare-Companion
阅读 22
收藏 0
点赞 0
评论 0
@OnClick(R.id.colour_select)
public void colourSelector() {
DatabaseHelper database = DatabaseHelper.getInstance(this);
int[] colours = database.getColoursArray();
database.close();
new ColorChooserDialog.Builder(this, R.string.select_colour)
.allowUserColorInputAlpha(false)
.customColors(colours, null)
.show();
}
CreateEditActivity.java 文件源码
项目:SOS-The-Healthcare-Companion
阅读 19
收藏 0
点赞 0
评论 0
@Override
public void onColorSelection(@NonNull ColorChooserDialog dialog, @ColorInt int selectedColour) {
colour = String.format("#%06X", (0xFFFFFF & selectedColour));
imageColourSelect.setColorFilter(selectedColour);
colourText.setText(colour);
DatabaseHelper database = DatabaseHelper.getInstance(this);
database.addColour(new Colour(selectedColour, DateAndTimeUtil.toStringDateTimeWithSeconds(Calendar.getInstance())));
database.close();
}
SettingsActivity.java 文件源码
项目:Hello-Music-droid
阅读 28
收藏 0
点赞 0
评论 0
@Override
public void onColorSelection(@NonNull ColorChooserDialog dialog, @ColorInt int selectedColor) {
final Config config = ATE.config(this, getATEKey());
switch (dialog.getTitle()) {
case R.string.primary_color:
config.primaryColor(selectedColor);
break;
case R.string.accent_color:
config.accentColor(selectedColor);
break;
}
config.commit();
recreate(); // recreation needed to reach the checkboxes in the preferences layout
}
SettingActivity.java 文件源码
项目:FakeWeather
阅读 35
收藏 0
点赞 0
评论 0
@Override
public void onColorSelection(@NonNull ColorChooserDialog dialog, @ColorInt int selectedColor) {
if (selectedColor == ThemeUtil.getThemeColor(this, R.attr.colorPrimary))
return;
toolbar.setBackgroundColor(selectedColor);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().setStatusBarColor(selectedColor);
}
if (selectedColor == getResources().getColor(R.color.lapis_blue)) {
setTheme(R.style.LapisBlueTheme);
SettingsUtil.setTheme(0);
} else if (selectedColor == getResources().getColor(R.color.pale_dogwood)) {
setTheme(R.style.PaleDogwoodTheme);
SettingsUtil.setTheme(1);
} else if (selectedColor == getResources().getColor(R.color.greenery)) {
setTheme(R.style.GreeneryTheme);
SettingsUtil.setTheme(2);
} else if (selectedColor == getResources().getColor(R.color.primrose_yellow)) {
setTheme(R.style.PrimroseYellowTheme);
SettingsUtil.setTheme(3);
} else if (selectedColor == getResources().getColor(R.color.flame)) {
setTheme(R.style.FlameTheme);
SettingsUtil.setTheme(4);
} else if (selectedColor == getResources().getColor(R.color.island_paradise)) {
setTheme(R.style.IslandParadiseTheme);
SettingsUtil.setTheme(5);
} else if (selectedColor == getResources().getColor(R.color.kale)) {
setTheme(R.style.KaleTheme);
SettingsUtil.setTheme(6);
} else if (selectedColor == getResources().getColor(R.color.pink_yarrow)) {
setTheme(R.style.PinkYarrowTheme);
SettingsUtil.setTheme(7);
} else if (selectedColor == getResources().getColor(R.color.niagara)) {
setTheme(R.style.NiagaraTheme);
SettingsUtil.setTheme(8);
}
getFragmentManager().beginTransaction().replace(R.id.contentLayout, new SettingFragment()).commit();
EventBus.getDefault().post(new ThemeChangedEvent(selectedColor));
}
SettingFragment.java 文件源码
项目:FakeWeather
阅读 34
收藏 0
点赞 0
评论 0
@Override
public boolean onPreferenceClick(Preference preference) {
if (preference == cleanCache) {
Observable
.just(FileUtil.delete(FileUtil.getInternalCacheDir(App.getContext())))
.map(new Func1<Boolean, Boolean>() {
@Override
public Boolean call(Boolean result) {
return result && FileUtil.delete(FileUtil.getExternalCacheDir(App.getContext()));
}
})
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new SimpleSubscriber<Boolean>() {
@Override
public void onNext(Boolean aBoolean) {
cleanCache.setSummary(FileSizeUtil.getAutoFileOrFilesSize(FileUtil.getInternalCacheDir(App.getContext()), FileUtil.getExternalCacheDir(App.getContext())));
Snackbar.make(getView(), "缓存已清除 (*^__^*)", Snackbar.LENGTH_SHORT).show();
}
});
} else if (preference == theme) {
new ColorChooserDialog.Builder((SettingActivity) getActivity(), R.string.theme)
.customColors(R.array.colors, null)
.doneButton(R.string.done)
.cancelButton(R.string.cancel)
.allowUserColorInput(false)
.allowUserColorInputAlpha(false)
.show();
}
return true;
}
SettingsActivity.java 文件源码
项目:MusicX-music-player
阅读 31
收藏 0
点赞 0
评论 0
@Override
public void onColorSelection(@NonNull ColorChooserDialog dialog, @ColorInt int selectedColor) {
final Config config = ATE.config(this, getATEKey());
switch (dialog.getTitle()) {
case R.string.primary_color:
config.primaryColor(selectedColor);
break;
case R.string.accent_color:
config.accentColor(selectedColor);
break;
}
config.commit();
recreate();
}
AttributeActivity.java 文件源码
项目:mesh-core-on-android
阅读 24
收藏 0
点赞 0
评论 0
private void handleCustomColor(StateItem stateItem){
accentPreselect = Color.parseColor(stateItem.getState());
ColorChooserDialog colorChooserDialog = new ColorChooserDialog.Builder(this, R.string.color_palette)
.titleSub(R.string.colors)
.accentMode(true)
.preselect(accentPreselect)
.show(this);
colorChooserDialog.setCancelable(false);
}
SettingsFragment.java 文件源码
项目:Pasta-Music
阅读 26
收藏 0
点赞 0
评论 0
@OnClick(R.id.primary)
public void setPrimary() {
new ColorChooserDialog.Builder((HomeActivity) getActivity(), R.string.primary_color)
.titleSub(R.string.primary_color)
.doneButton(R.string.save)
.cancelButton(R.string.cancel)
.backButton(R.string.md_back_label)
.preselect(PreferenceUtils.getPrimaryColor(getContext()))
.show();
}
SettingsFragment.java 文件源码
项目:Pasta-Music
阅读 23
收藏 0
点赞 0
评论 0
@OnClick(R.id.accent)
public void setAccent() {
new ColorChooserDialog.Builder((HomeActivity) getActivity(), R.string.accent_color)
.titleSub(R.string.accent_color)
.doneButton(R.string.save)
.cancelButton(R.string.cancel)
.backButton(R.string.md_back_label)
.accentMode(true)
.preselect(PreferenceUtils.getAccentColor(getContext()))
.show();
}