本文整理汇总了Java中com.afollestad.materialdialogs.color.ColorChooserDialog类的典型用法代码示例。如果您正苦于以下问题:Java ColorChooserDialog类的具体用法?Java ColorChooserDialog怎么用?Java ColorChooserDialog使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ColorChooserDialog类属于com.afollestad.materialdialogs.color包,在下文中一共展示了ColorChooserDialog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onColorSelection
import com.afollestad.materialdialogs.color.ColorChooserDialog; //导入依赖的package包/类
@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);
}
}
}
示例2: onColorSelection
import com.afollestad.materialdialogs.color.ColorChooserDialog; //导入依赖的package包/类
@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();
}
示例3: onCreate
import com.afollestad.materialdialogs.color.ColorChooserDialog; //导入依赖的package包/类
@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);
}
示例4: onColorSelection
import com.afollestad.materialdialogs.color.ColorChooserDialog; //导入依赖的package包/类
@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();
}
示例5: onColorSelection
import com.afollestad.materialdialogs.color.ColorChooserDialog; //导入依赖的package包/类
@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);
}
}
}
示例6: onColorSelection
import com.afollestad.materialdialogs.color.ColorChooserDialog; //导入依赖的package包/类
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));
}
示例7: onColorSelection
import com.afollestad.materialdialogs.color.ColorChooserDialog; //导入依赖的package包/类
@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;
}
}
示例8: onTagCardAction
import com.afollestad.materialdialogs.color.ColorChooserDialog; //导入依赖的package包/类
/**
* 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;
}
}
示例9: onColorSelection
import com.afollestad.materialdialogs.color.ColorChooserDialog; //导入依赖的package包/类
@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
}
示例10: onColorSelection
import com.afollestad.materialdialogs.color.ColorChooserDialog; //导入依赖的package包/类
@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
}
示例11: onColorSelection
import com.afollestad.materialdialogs.color.ColorChooserDialog; //导入依赖的package包/类
@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);
}
}
示例12: onResume
import com.afollestad.materialdialogs.color.ColorChooserDialog; //导入依赖的package包/类
@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();
}
示例13: onResume
import com.afollestad.materialdialogs.color.ColorChooserDialog; //导入依赖的package包/类
@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();
}
示例14: addNavThemeItem
import com.afollestad.materialdialogs.color.ColorChooserDialog; //导入依赖的package包/类
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();
}
});
}
示例15: onColorSelection
import com.afollestad.materialdialogs.color.ColorChooserDialog; //导入依赖的package包/类
@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();
}