本文整理汇总了Java中com.afollestad.materialdialogs.internal.ThemeSingleton.get方法的典型用法代码示例。如果您正苦于以下问题:Java ThemeSingleton.get方法的具体用法?Java ThemeSingleton.get怎么用?Java ThemeSingleton.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.afollestad.materialdialogs.internal.ThemeSingleton
的用法示例。
在下文中一共展示了ThemeSingleton.get方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onColorSelection
import com.afollestad.materialdialogs.internal.ThemeSingleton; //导入方法依赖的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.internal.ThemeSingleton; //导入方法依赖的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);
}
}
}
示例3: commit
import com.afollestad.materialdialogs.internal.ThemeSingleton; //导入方法依赖的package包/类
@Override
public void commit() {
mEditor.putLong(VALUES_CHANGED, System.currentTimeMillis())
.putBoolean(IS_CONFIGURED_KEY, true)
.commit();
// MD integration
if (Config.usingMaterialDialogs(mContext, mKey)) {
final ThemeSingleton md = ThemeSingleton.get();
md.titleColor = Config.textColorPrimary(mContext, mKey);
md.contentColor = Config.textColorSecondary(mContext, mKey);
md.itemColor = md.titleColor;
md.widgetColor = Config.accentColor(mContext, mKey);
md.linkColor = ColorStateList.valueOf(md.widgetColor);
md.positiveColor = ColorStateList.valueOf(md.widgetColor);
md.neutralColor = ColorStateList.valueOf(md.widgetColor);
md.negativeColor = ColorStateList.valueOf(md.widgetColor);
}
}
示例4: onColorSelection
import com.afollestad.materialdialogs.internal.ThemeSingleton; //导入方法依赖的package包/类
@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);
}
}
}
示例5: showCustomWebView
import com.afollestad.materialdialogs.internal.ThemeSingleton; //导入方法依赖的package包/类
@OnClick(R.id.customView_webView) public void showCustomWebView() {
int accentColor = ThemeSingleton.get().widgetColor;
if (accentColor == 0)
accentColor = ContextCompat.getColor(this, R.color.accent);
ChangelogDialog.create(false, accentColor)
.show(getSupportFragmentManager(), "changelog");
}
示例6: initMaterialDialogTheme
import com.afollestad.materialdialogs.internal.ThemeSingleton; //导入方法依赖的package包/类
public void initMaterialDialogTheme() {
final ThemeSingleton md = ThemeSingleton.get();
md.titleColor = ATHUtil.resolveColor(this, android.R.attr.textColorPrimaryInverse);
md.contentColor = ATHUtil.resolveColor(this, android.R.attr.textColorSecondaryInverse);
md.itemColor = md.titleColor;
md.widgetColor = getResources().getColor(R.color.colorAccent);
md.linkColor = ColorStateList.valueOf(md.widgetColor);
md.positiveColor = ColorStateList.valueOf(md.widgetColor);
md.neutralColor = ColorStateList.valueOf(md.widgetColor);
md.negativeColor = ColorStateList.valueOf(md.widgetColor);
md.darkTheme = true;
md.backgroundColor = getResources().getColor(R.color.dialog_background);
}
示例7: initMdSupport
import com.afollestad.materialdialogs.internal.ThemeSingleton; //导入方法依赖的package包/类
public static void initMdSupport(@NonNull Context context, @Nullable String key) {
final ThemeSingleton md = ThemeSingleton.get();
md.titleColor = Config.textColorPrimary(context, key);
md.contentColor = Config.textColorSecondary(context, key);
md.itemColor = md.titleColor;
md.widgetColor = Config.accentColor(context, key);
md.linkColor = ColorStateList.valueOf(md.widgetColor);
md.positiveColor = ColorStateList.valueOf(md.widgetColor);
md.neutralColor = ColorStateList.valueOf(md.widgetColor);
md.negativeColor = ColorStateList.valueOf(md.widgetColor);
}
示例8: showCustomWebView
import com.afollestad.materialdialogs.internal.ThemeSingleton; //导入方法依赖的package包/类
@OnClick(R.id.customView_webView)
public void showCustomWebView() {
int accentColor = ThemeSingleton.get().widgetColor;
if (accentColor == 0) {
accentColor = ContextCompat.getColor(this, R.color.accent);
}
ChangelogDialog.create(false, accentColor).show(getSupportFragmentManager(), "changelog");
}
示例9: checkSingleton
import com.afollestad.materialdialogs.internal.ThemeSingleton; //导入方法依赖的package包/类
private void checkSingleton() {
if (ThemeSingleton.get(false) == null) return;
ThemeSingleton s = ThemeSingleton.get();
if (s.darkTheme)
this.theme = Theme.DARK;
if (s.titleColor != 0)
this.titleColor = s.titleColor;
if (s.contentColor != 0)
this.contentColor = s.contentColor;
if (s.positiveColor != null)
this.positiveColor = s.positiveColor;
if (s.neutralColor != null)
this.neutralColor = s.neutralColor;
if (s.negativeColor != null)
this.negativeColor = s.negativeColor;
if (s.itemColor != 0)
this.itemColor = s.itemColor;
if (s.icon != null)
this.icon = s.icon;
if (s.backgroundColor != 0)
this.backgroundColor = s.backgroundColor;
if (s.dividerColor != 0)
this.dividerColor = s.dividerColor;
if (s.btnSelectorStacked != 0)
this.btnSelectorStacked = s.btnSelectorStacked;
if (s.listSelector != 0)
this.listSelector = s.listSelector;
if (s.btnSelectorPositive != 0)
this.btnSelectorPositive = s.btnSelectorPositive;
if (s.btnSelectorNeutral != 0)
this.btnSelectorNeutral = s.btnSelectorNeutral;
if (s.btnSelectorNegative != 0)
this.btnSelectorNegative = s.btnSelectorNegative;
if (s.widgetColor != 0)
this.widgetColor = s.widgetColor;
if (s.linkColor != null)
this.linkColor = s.linkColor;
this.titleGravity = s.titleGravity;
this.contentGravity = s.contentGravity;
this.btnStackedGravity = s.btnStackedGravity;
this.itemsGravity = s.itemsGravity;
this.buttonsGravity = s.buttonsGravity;
}
示例10: preApply
import com.afollestad.materialdialogs.internal.ThemeSingleton; //导入方法依赖的package包/类
public static void preApply(@NonNull Activity activity, @Nullable String key) {
didPreApply = activity.getClass();
mToolbar = null;
int activityTheme = activity instanceof ATEActivityThemeCustomizer ?
((ATEActivityThemeCustomizer) activity).getActivityTheme() : Config.activityTheme(activity, key);
if (activityTheme != 0) activity.setTheme(activityTheme);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
final Window window = activity.getWindow();
if (Config.coloredStatusBar(activity, key))
window.setStatusBarColor(Config.statusBarColor(activity, key));
else window.setStatusBarColor(Color.BLACK);
if (Config.coloredNavigationBar(activity, key))
window.setNavigationBarColor(Config.navigationBarColor(activity, key));
else window.setNavigationBarColor(Color.BLACK);
applyTaskDescription(activity, key);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
final View decorView = activity.getWindow().getDecorView();
boolean lightStatusEnabled = false;
if (Config.coloredStatusBar(activity, key)) {
final int lightStatusMode = Config.lightStatusBarMode(activity, key);
switch (lightStatusMode) {
case Config.LIGHT_STATUS_BAR_OFF:
default:
break;
case Config.LIGHT_STATUS_BAR_ON:
lightStatusEnabled = true;
break;
case Config.LIGHT_STATUS_BAR_AUTO:
lightStatusEnabled = Util.isColorLight(Config.primaryColor(activity, key));
break;
}
}
final int systemUiVisibility = decorView.getSystemUiVisibility();
if (lightStatusEnabled) {
decorView.setSystemUiVisibility(systemUiVisibility | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
} else {
decorView.setSystemUiVisibility(systemUiVisibility & ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
}
// MD integration
if (Config.usingMaterialDialogs(activity, key)) {
final ThemeSingleton md = ThemeSingleton.get();
md.titleColor = Config.textColorPrimary(activity, key);
md.contentColor = Config.textColorSecondary(activity, key);
md.itemColor = md.titleColor;
md.widgetColor = Config.accentColor(activity, key);
md.linkColor = ColorStateList.valueOf(md.widgetColor);
md.positiveColor = ColorStateList.valueOf(md.widgetColor);
md.neutralColor = ColorStateList.valueOf(md.widgetColor);
md.negativeColor = ColorStateList.valueOf(md.widgetColor);
}
}
示例11: checkSingleton
import com.afollestad.materialdialogs.internal.ThemeSingleton; //导入方法依赖的package包/类
private void checkSingleton() {
if (ThemeSingleton.get(false) == null) return;
ThemeSingleton s = ThemeSingleton.get();
if (s.darkTheme)
this.theme = Theme.DARK;
if (s.titleColor != 0)
this.titleColor = s.titleColor;
if (s.contentColor != 0)
this.contentColor = s.contentColor;
if (s.positiveColor != null)
this.positiveColor = s.positiveColor;
if (s.neutralColor != null)
this.neutralColor = s.neutralColor;
if (s.negativeColor != null)
this.negativeColor = s.negativeColor;
if (s.itemColor != 0)
this.itemColor = s.itemColor;
if (s.icon != null)
this.icon = s.icon;
if (s.backgroundColor != 0)
this.backgroundColor = s.backgroundColor;
if (s.dividerColor != 0)
this.dividerColor = s.dividerColor;
if (s.btnSelectorStacked != 0)
this.btnSelectorStacked = s.btnSelectorStacked;
if (s.listSelector != 0)
this.listSelector = s.listSelector;
if (s.btnSelectorPositive != 0)
this.btnSelectorPositive = s.btnSelectorPositive;
if (s.btnSelectorNeutral != 0)
this.btnSelectorNeutral = s.btnSelectorNeutral;
if (s.btnSelectorNegative != 0)
this.btnSelectorNegative = s.btnSelectorNegative;
if (s.widgetColor != 0)
this.widgetColor = s.widgetColor;
this.titleGravity = s.titleGravity;
this.contentGravity = s.contentGravity;
this.btnStackedGravity = s.btnStackedGravity;
this.itemsGravity = s.itemsGravity;
this.buttonsGravity = s.buttonsGravity;
}
示例12: checkSingleton
import com.afollestad.materialdialogs.internal.ThemeSingleton; //导入方法依赖的package包/类
@SuppressWarnings("ConstantConditions")
private void checkSingleton() {
if (ThemeSingleton.get(false) == null) {
return;
}
ThemeSingleton s = ThemeSingleton.get();
if (s.darkTheme) {
this.theme = Theme.DARK;
}
if (s.titleColor != 0) {
this.titleColor = s.titleColor;
}
if (s.contentColor != 0) {
this.contentColor = s.contentColor;
}
if (s.positiveColor != null) {
this.positiveColor = s.positiveColor;
}
if (s.neutralColor != null) {
this.neutralColor = s.neutralColor;
}
if (s.negativeColor != null) {
this.negativeColor = s.negativeColor;
}
if (s.itemColor != 0) {
this.itemColor = s.itemColor;
}
if (s.icon != null) {
this.icon = s.icon;
}
if (s.backgroundColor != 0) {
this.backgroundColor = s.backgroundColor;
}
if (s.dividerColor != 0) {
this.dividerColor = s.dividerColor;
}
if (s.btnSelectorStacked != 0) {
this.btnSelectorStacked = s.btnSelectorStacked;
}
if (s.listSelector != 0) {
this.listSelector = s.listSelector;
}
if (s.btnSelectorPositive != 0) {
this.btnSelectorPositive = s.btnSelectorPositive;
}
if (s.btnSelectorNeutral != 0) {
this.btnSelectorNeutral = s.btnSelectorNeutral;
}
if (s.btnSelectorNegative != 0) {
this.btnSelectorNegative = s.btnSelectorNegative;
}
if (s.widgetColor != 0) {
this.widgetColor = s.widgetColor;
}
if (s.linkColor != null) {
this.linkColor = s.linkColor;
}
this.titleGravity = s.titleGravity;
this.contentGravity = s.contentGravity;
this.btnStackedGravity = s.btnStackedGravity;
this.itemsGravity = s.itemsGravity;
this.buttonsGravity = s.buttonsGravity;
}