Java 类com.afollestad.materialdialogs.internal.ThemeSingleton 实例源码

项目:GitHub    文件:MainActivity.java   
@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);
        }
    }
}
项目:mesh-core-on-android    文件:AttributeActivity.java   
@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);
        }
    }
}
项目:app-theme-engine-master    文件:Config.java   
@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);
    }
}
项目:material-dialogs    文件:MainActivity.java   
@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);
    }
  }
}
项目:GitHub    文件:MainActivity.java   
@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");
}
项目:Orin    文件:DonationsDialog.java   
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    billingProcessor = new BillingProcessor(getContext(), App.GOOGLE_PLAY_LICENSE_KEY, this);

    @SuppressLint("InflateParams")
    View customView = LayoutInflater.from(getContext()).inflate(R.layout.dialog_donation, null);
    ProgressBar progressBar = ButterKnife.findById(customView, R.id.progress);
    MDTintHelper.setTint(progressBar, ThemeSingleton.get().positiveColor.getDefaultColor());

    return new MaterialDialog.Builder(getContext())
            .title(R.string.support_development)
            .customView(customView, false)
            .build();
}
项目:Orin    文件:AboutActivity.java   
private void showLicenseDialog() {
    new LicensesDialog.Builder(this)
            .setNotices(R.raw.notices)
            .setTitle(R.string.licenses)
            .setNoticesCssStyle(getString(R.string.license_dialog_style)
                    .replace("{bg-color}", ThemeSingleton.get().darkTheme ? "424242" : "ffffff")
                    .replace("{text-color}", ThemeSingleton.get().darkTheme ? "ffffff" : "000000")
                    .replace("{license-bg-color}", ThemeSingleton.get().darkTheme ? "535353" : "eeeeee")
            )
            .setIncludeOwnLicense(true)
            .build()
            .showAppCompat();
}
项目:MetadataEditor    文件:MainApplication.java   
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);
}
项目:MusicX-music-player    文件:MDUtil.java   
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);
}
项目:app-theme-engine    文件:MDUtil.java   
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);
}
项目:Phonograph    文件:DonationsDialog.java   
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    billingProcessor = new BillingProcessor(getContext(), App.GOOGLE_PLAY_LICENSE_KEY, this);

    @SuppressLint("InflateParams")
    View customView = LayoutInflater.from(getContext()).inflate(R.layout.dialog_donation, null);
    ProgressBar progressBar = ButterKnife.findById(customView, R.id.progress);
    MDTintHelper.setTint(progressBar, ThemeSingleton.get().positiveColor.getDefaultColor());

    return new MaterialDialog.Builder(getContext())
            .title(R.string.support_development)
            .customView(customView, false)
            .build();
}
项目:Phonograph    文件:AboutActivity.java   
private void showLicenseDialog() {
    new LicensesDialog.Builder(this)
            .setNotices(R.raw.notices)
            .setTitle(R.string.licenses)
            .setNoticesCssStyle(getString(R.string.license_dialog_style)
                    .replace("{bg-color}", ThemeSingleton.get().darkTheme ? "424242" : "ffffff")
                    .replace("{text-color}", ThemeSingleton.get().darkTheme ? "ffffff" : "000000")
                    .replace("{license-bg-color}", ThemeSingleton.get().darkTheme ? "535353" : "eeeeee")
            )
            .setIncludeOwnLicense(true)
            .build()
            .showAppCompat();
}
项目:material-dialogs    文件:MainActivity.java   
@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");
}
项目:GitHub    文件:MaterialDialog.java   
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;
}
项目:app-theme-engine-master    文件:ATE.java   
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);
    }
}
项目:EasyFrame    文件:MaterialDialog.java   
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;
}
项目:material-dialogs    文件:MaterialDialog.java   
@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;
}