java类com.afollestad.materialdialogs.color.ColorChooserDialog的实例源码

MainActivity.java 文件源码 项目:Daily 阅读 17 收藏 0 点赞 0 评论 0
private void createColorChooserDialog() {
    new ColorChooserDialog.Builder(this, R.string.md_color_chooser_title)
            .doneButton(R.string.md_done)
            .cancelButton(R.string.md_cancel)
            .backButton(R.string.md_back)
            .allowUserColorInput(true)
            .allowUserColorInputAlpha(false)
            .theme(mSettingHelper.getIsNightMode() ? Theme.DARK : Theme.LIGHT)
            .customButton(R.string.md_custom)
            .show();
}
MainActivity.java 文件源码 项目:Daily 阅读 16 收藏 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));
        getWindow().setNavigationBarColor(selectedColor);
    }
    if (!dialog.isAccentMode()) {
        mSettingHelper.setColor(selectedColor);
    }
}
PrefsSettings.java 文件源码 项目:Calculator 阅读 16 收藏 0 点赞 0 评论 0
@Override
public void onColorSelection(ColorChooserDialog dialog, int color) {
    int title = dialog.getTitle();
    if (title == R.string.actionbr) {
        actionbar = color;
    } else if (title == R.string.navbr) {
        navbar = color;
    } else if (title == R.string.txt) {
        text = color;
    }
    refresh();
}
TaggingActivity.java 文件源码 项目:Minerva 阅读 16 收藏 0 点赞 0 评论 0
/**
 * Set the new text or background color for {@link #tempTag}.
 * @param dialog        Dialog whose title string's resource ID will determine if we're setting the text or
 *                      background color.
 * @param selectedColor New text or background color.
 */
@Override
public void onColorSelection(@NonNull ColorChooserDialog dialog, @ColorInt int selectedColor) {
    if (dialog.getTitle() == R.string.title_tag_text_color) // Text color dialog.
        ActionHelper.setTagTextColor(realm, tempTag, selectedColor);
    else // Background color dialog.
        ActionHelper.setTagBgColor(realm, tempTag, selectedColor);
    // Notify the adapter that it needs to re-draw the tag's card.
    adapter.notifyItemChanged(items.indexOf(tempTag));
    // Indicate that we might need an explicit update.
    taggingHelper.markForExplicitUpdateIfNecessary();
}
MainActivity.java 文件源码 项目:AndroidFileHost_Browser 阅读 20 收藏 0 点赞 0 评论 0
public void showColourDialog(int type) {
    switch (type) {
        case 1:
            new ColorChooserDialog.Builder(this, R.string.dialog_colour_primary_title)
                    .preselect(Utils.getPrefsColour(1, getApplicationContext()))
                    .show();
            break;
        case 2:
            new ColorChooserDialog.Builder(this, R.string.dialog_colour_accent_title)
                    .accentMode(true)
                    .preselect(Utils.getPrefsColour(2, getApplicationContext()))
                    .show();
            break;
    }
}
MainActivity.java 文件源码 项目:AndroidFileHost_Browser 阅读 16 收藏 0 点赞 0 评论 0
@Override
public void onColorSelection(@NonNull ColorChooserDialog dialog, @ColorInt int color) {
    if (R.string.dialog_colour_primary_title == dialog.getTitle()) {
        prefs.put(Constants.PREFS_COLOR_PRIMARY, String.valueOf(color));
        Utils.resetColours(1);
    } else if (R.string.dialog_colour_accent_title == dialog.getTitle()) {
        prefs.put(Constants.PREFS_COLOR_ACCENT, String.valueOf(color));
        Utils.resetColours(2);
    }
    recreate();
}
ColorActivity.java 文件源码 项目:Tapad 阅读 16 收藏 0 点赞 0 评论 0
private void showColorChooserDialog() {
    new ColorChooserDialog.Builder(this, R.string.settings_color_dialog)
            .accentMode(false)
            .titleSub(R.string.settings_color_dialog)
            .doneButton(R.string.md_done_label)
            .cancelButton(R.string.md_cancel_label)
            .backButton(R.string.md_back_label)
            .dynamicButtonColor(true)
            .show(this);
}
ColorActivity.java 文件源码 项目:Tapad 阅读 17 收藏 0 点赞 0 评论 0
@Override
public void onColorSelection(@NonNull ColorChooserDialog dialog, @ColorInt int colorInt) {
    if (ArrayUtils.indexOf(itemColor.getColorButtonRecents(), colorInt) >= 0) {
        // the value exists, show toast
        Toast.makeText(activity, R.string.settings_color_dialog_duplicate, Toast.LENGTH_SHORT).show();
    } else if (itemColor.getColorButton() == colorInt) {
        // the value is same to current color
        Toast.makeText(activity, R.string.settings_color_dialog_duplicate_current, Toast.LENGTH_SHORT).show();
    } else {
        insertNewColor(colorInt);
    }
}
SettingsActivity.java 文件源码 项目:lens-launcher 阅读 20 收藏 0 点赞 0 评论 0
public void showBackgroundColorDialog() {
    mBackgroundColorDialog = new ColorChooserDialog.Builder(this, R.string.setting_background_color)
            .titleSub(R.string.setting_background_color)
            .accentMode(false)
            .doneButton(R.string.md_done_label)
            .cancelButton(R.string.md_cancel_label)
            .backButton(R.string.md_back_label)
            .preselect(Color.parseColor(mSettings.getString(Settings.KEY_BACKGROUND_COLOR)))
            .dynamicButtonColor(false)
            .allowUserColorInputAlpha(false)
            .tag(COLOR_TAG_BACKGROUND)
            .show();
}
SettingsActivity.java 文件源码 项目:lens-launcher 阅读 38 收藏 0 点赞 0 评论 0
public void showHighlightColorDialog() {
    mHighlightColorDialog = new ColorChooserDialog.Builder(this, R.string.setting_highlight_color)
            .titleSub(R.string.setting_highlight_color)
            .accentMode(true)
            .doneButton(R.string.md_done_label)
            .cancelButton(R.string.md_cancel_label)
            .backButton(R.string.md_back_label)
            .preselect(Color.parseColor(mSettings.getString(Settings.KEY_HIGHLIGHT_COLOR)))
            .dynamicButtonColor(false)
            .allowUserColorInputAlpha(false)
            .tag(COLOR_TAG_HIGHLIGHT)
            .show();
}


问题


面经


文章

微信
公众号

扫码关注公众号