Search in sources :

Example 1 with LineColorPicker

use of uz.shift.colorpicker.LineColorPicker in project LeafPic by HoraApps.

the class SettingsActivity method customizePictureViewer.

private void customizePictureViewer() {
    final AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(SettingsActivity.this, getDialogStyle());
    View dialogLayout = getLayoutInflater().inflate(R.layout.dialog_media_viewer_theme, null);
    final SwitchCompat swApplyTheme_Viewer = (SwitchCompat) dialogLayout.findViewById(R.id.apply_theme_3th_act_enabled);
    ((CardView) dialogLayout.findViewById(R.id.third_act_theme_card)).setCardBackgroundColor(getCardBackgroundColor());
    //or GetPrimary
    dialogLayout.findViewById(R.id.third_act_theme_title).setBackgroundColor(getPrimaryColor());
    ((TextView) dialogLayout.findViewById(R.id.apply_theme_3thAct_title)).setTextColor(getTextColor());
    ((TextView) dialogLayout.findViewById(R.id.apply_theme_3thAct_title_Sub)).setTextColor(getSubTextColor());
    ((IconicsImageView) dialogLayout.findViewById(R.id.ll_apply_theme_3thAct_icon)).setColor(getIconColor());
    swApplyTheme_Viewer.setChecked(isApplyThemeOnImgAct());
    swApplyTheme_Viewer.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            updateSwitchColor(swApplyTheme_Viewer, getAccentColor());
        }
    });
    updateSwitchColor(swApplyTheme_Viewer, getAccentColor());
    final LineColorPicker transparencyColorPicker = (LineColorPicker) dialogLayout.findViewById(R.id.pickerTransparent);
    transparencyColorPicker.setColors(ColorPalette.getTransparencyShadows(getPrimaryColor()));
    transparencyColorPicker.setSelectedColor(ColorPalette.getTransparentColor(getPrimaryColor(), getTransparency()));
    /**TEXT VIEWS**/
    ((TextView) dialogLayout.findViewById(R.id.seek_bar_alpha_title)).setTextColor(getTextColor());
    ((TextView) dialogLayout.findViewById(R.id.seek_bar_alpha_title_Sub)).setTextColor(getSubTextColor());
    dialogBuilder.setView(dialogLayout);
    dialogBuilder.setNeutralButton(getString(R.string.cancel).toUpperCase(), null);
    dialogBuilder.setPositiveButton(getString(R.string.ok_action).toUpperCase(), new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int which) {
            SharedPreferences.Editor editor = SP.getEditor();
            editor.putBoolean(getString(R.string.preference_apply_theme_pager), swApplyTheme_Viewer.isChecked());
            int c = Color.alpha(transparencyColorPicker.getColor());
            editor.putInt(getString(R.string.preference_transparency), 255 - c);
            editor.commit();
            updateTheme();
        }
    });
    dialogBuilder.show();
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) DialogInterface(android.content.DialogInterface) CardView(android.support.v7.widget.CardView) View(android.view.View) CardView(android.support.v7.widget.CardView) TextView(android.widget.TextView) ScrollView(android.widget.ScrollView) IconicsImageView(com.mikepenz.iconics.view.IconicsImageView) LineColorPicker(uz.shift.colorpicker.LineColorPicker) IconicsImageView(com.mikepenz.iconics.view.IconicsImageView) TextView(android.widget.TextView) CompoundButton(android.widget.CompoundButton) SwitchCompat(android.support.v7.widget.SwitchCompat)

Example 2 with LineColorPicker

use of uz.shift.colorpicker.LineColorPicker in project LeafPic by HoraApps.

the class ColorsSetting method chooseColor.

public void chooseColor(@StringRes int title, final ColorChooser chooser, int defaultColor) {
    final AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getActivity(), getActivity().getDialogStyle());
    View dialogLayout = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_color_picker, null);
    final LineColorPicker colorPicker = (LineColorPicker) dialogLayout.findViewById(R.id.color_picker_primary);
    final LineColorPicker colorPicker2 = (LineColorPicker) dialogLayout.findViewById(R.id.color_picker_primary_2);
    final TextView dialogTitle = (TextView) dialogLayout.findViewById(R.id.dialog_title);
    dialogTitle.setText(title);
    ((CardView) dialogLayout.findViewById(R.id.dialog_card)).setCardBackgroundColor(getActivity().getCardBackgroundColor());
    colorPicker2.setOnColorChangedListener(new OnColorChangedListener() {

        @Override
        public void onColorChanged(int c) {
            dialogTitle.setBackgroundColor(c);
            chooser.onColorChanged(c);
        }
    });
    colorPicker.setOnColorChangedListener(new OnColorChangedListener() {

        @Override
        public void onColorChanged(int c) {
            colorPicker2.setColors(ColorPalette.getColors(getActivity(), colorPicker.getColor()));
            colorPicker2.setSelectedColor(colorPicker.getColor());
        }
    });
    int[] baseColors = ColorPalette.getBaseColors(getActivity());
    colorPicker.setColors(baseColors);
    for (int i : baseColors) {
        for (int i2 : ColorPalette.getColors(getActivity(), i)) if (i2 == defaultColor) {
            colorPicker.setSelectedColor(i);
            colorPicker2.setColors(ColorPalette.getColors(getActivity(), i));
            colorPicker2.setSelectedColor(i2);
            break;
        }
    }
    dialogBuilder.setView(dialogLayout);
    dialogBuilder.setNegativeButton(getActivity().getString(R.string.cancel).toUpperCase(), new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.cancel();
            chooser.onDialogDismiss();
        }
    });
    dialogBuilder.setPositiveButton(getActivity().getString(R.string.ok_action).toUpperCase(), new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int which) {
            AlertDialog alertDialog = (AlertDialog) dialog;
            alertDialog.setOnDismissListener(null);
            chooser.onColorSelected(colorPicker2.getColor());
        }
    });
    dialogBuilder.setOnDismissListener(new DialogInterface.OnDismissListener() {

        @Override
        public void onDismiss(DialogInterface dialog) {
            chooser.onDialogDismiss();
        }
    });
    dialogBuilder.show();
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) DialogInterface(android.content.DialogInterface) CardView(android.support.v7.widget.CardView) CardView(android.support.v7.widget.CardView) TextView(android.widget.TextView) View(android.view.View) LineColorPicker(uz.shift.colorpicker.LineColorPicker) OnColorChangedListener(uz.shift.colorpicker.OnColorChangedListener) TextView(android.widget.TextView)

Example 3 with LineColorPicker

use of uz.shift.colorpicker.LineColorPicker in project LeafPic by HoraApps.

the class SinglePhotoSetting method show.

public void show() {
    final AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getActivity(), getActivity().getDialogStyle());
    View dialogLayout = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_media_viewer_theme, null);
    final SwitchCompat swApplyTheme = (SwitchCompat) dialogLayout.findViewById(R.id.sw_apply_theme);
    ((CardView) dialogLayout.findViewById(R.id.dialog_card_)).setCardBackgroundColor(getActivity().getCardBackgroundColor());
    dialogLayout.findViewById(R.id.dialog_title).setBackgroundColor(getActivity().getPrimaryColor());
    ((TextView) dialogLayout.findViewById(R.id.apply_theme)).setTextColor(getActivity().getTextColor());
    ((TextView) dialogLayout.findViewById(R.id.apply_theme_3thAct_title_Sub)).setTextColor(getActivity().getSubTextColor());
    ((ThemedIcon) dialogLayout.findViewById(R.id.ll_apply_theme_icon)).setColor(getActivity().getIconColor());
    swApplyTheme.setChecked(getActivity().themeOnSingleImgAct());
    swApplyTheme.setClickable(false);
    dialogLayout.findViewById(R.id.ll_apply_theme).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            swApplyTheme.setChecked(!swApplyTheme.isChecked());
            getActivity().setSwitchColor(getActivity().getAccentColor(), swApplyTheme);
        }
    });
    getActivity().setSwitchColor(getActivity().getAccentColor(), swApplyTheme);
    final LineColorPicker transparencyColorPicker = (LineColorPicker) dialogLayout.findViewById(R.id.pickerTransparent);
    transparencyColorPicker.setColors(ColorPalette.getTransparencyShadows(getActivity().getPrimaryColor()));
    transparencyColorPicker.setSelectedColor(ColorPalette.getTransparentColor(getActivity().getPrimaryColor(), 255 - Hawk.get(getActivity().getString(R.string.preference_transparency), 0)));
    /**
     *TEXT VIEWS*
     */
    ((TextView) dialogLayout.findViewById(R.id.seek_bar_alpha_title)).setTextColor(getActivity().getTextColor());
    ((TextView) dialogLayout.findViewById(R.id.seek_bar_alpha_title_Sub)).setTextColor(getActivity().getSubTextColor());
    dialogBuilder.setView(dialogLayout);
    dialogBuilder.setNeutralButton(getActivity().getString(R.string.cancel).toUpperCase(), null);
    dialogBuilder.setPositiveButton(getActivity().getString(R.string.ok_action).toUpperCase(), new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int which) {
            boolean applyTheme = swApplyTheme.isChecked();
            Hawk.put(getActivity().getString(R.string.preference_apply_theme_pager), applyTheme);
            if (applyTheme) {
                int c = Color.alpha(transparencyColorPicker.getColor());
                Hawk.put(getActivity().getString(R.string.preference_transparency), 255 - c);
            }
            getActivity().updateTheme();
        }
    });
    dialogBuilder.show();
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) DialogInterface(android.content.DialogInterface) CardView(android.support.v7.widget.CardView) CardView(android.support.v7.widget.CardView) TextView(android.widget.TextView) View(android.view.View) LineColorPicker(uz.shift.colorpicker.LineColorPicker) ThemedIcon(org.horaapps.liz.ui.ThemedIcon) TextView(android.widget.TextView) SwitchCompat(android.support.v7.widget.SwitchCompat)

Example 4 with LineColorPicker

use of uz.shift.colorpicker.LineColorPicker in project LeafPic by HoraApps.

the class SettingsActivity method primaryColorPiker.

private void primaryColorPiker() {
    final AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(SettingsActivity.this, getDialogStyle());
    final View dialogLayout = getLayoutInflater().inflate(R.layout.color_piker_primary, null);
    final LineColorPicker colorPicker = (LineColorPicker) dialogLayout.findViewById(R.id.color_picker_primary);
    final LineColorPicker colorPicker2 = (LineColorPicker) dialogLayout.findViewById(R.id.color_picker_primary_2);
    final TextView dialogTitle = (TextView) dialogLayout.findViewById(R.id.cp_primary_title);
    CardView dialogCardView = (CardView) dialogLayout.findViewById(R.id.cp_primary_card);
    dialogCardView.setCardBackgroundColor(getCardBackgroundColor());
    colorPicker.setColors(ColorPalette.getBaseColors(getApplicationContext()));
    for (int i : colorPicker.getColors()) for (int i2 : ColorPalette.getColors(getBaseContext(), i)) if (i2 == getPrimaryColor()) {
        colorPicker.setSelectedColor(i);
        colorPicker2.setColors(ColorPalette.getColors(getBaseContext(), i));
        colorPicker2.setSelectedColor(i2);
        break;
    }
    dialogTitle.setBackgroundColor(getPrimaryColor());
    colorPicker.setOnColorChangedListener(new OnColorChangedListener() {

        @Override
        public void onColorChanged(int c) {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                if (isTranslucentStatusBar()) {
                    getWindow().setStatusBarColor(ColorPalette.getObscuredColor(getPrimaryColor()));
                } else
                    getWindow().setStatusBarColor(c);
            }
            toolbar.setBackgroundColor(c);
            dialogTitle.setBackgroundColor(c);
            colorPicker2.setColors(ColorPalette.getColors(getApplicationContext(), colorPicker.getColor()));
            colorPicker2.setSelectedColor(colorPicker.getColor());
        }
    });
    colorPicker2.setOnColorChangedListener(new OnColorChangedListener() {

        @Override
        public void onColorChanged(int c) {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                if (isTranslucentStatusBar()) {
                    getWindow().setStatusBarColor(ColorPalette.getObscuredColor(c));
                } else
                    getWindow().setStatusBarColor(c);
                if (isNavigationBarColored())
                    getWindow().setNavigationBarColor(c);
                else
                    getWindow().setNavigationBarColor(ContextCompat.getColor(getApplicationContext(), R.color.md_black_1000));
            }
            toolbar.setBackgroundColor(c);
            dialogTitle.setBackgroundColor(c);
        }
    });
    dialogBuilder.setView(dialogLayout);
    dialogBuilder.setNeutralButton(getString(R.string.cancel).toUpperCase(), new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                if (isTranslucentStatusBar()) {
                    getWindow().setStatusBarColor(ColorPalette.getObscuredColor(getPrimaryColor()));
                } else
                    getWindow().setStatusBarColor(getPrimaryColor());
            }
            toolbar.setBackgroundColor(getPrimaryColor());
            dialog.cancel();
        }
    });
    dialogBuilder.setPositiveButton(getString(R.string.ok_action).toUpperCase(), new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int which) {
            SP.putInt(getString(R.string.preference_primary_color), colorPicker2.getColor());
            updateTheme();
            setNavBarColor();
            setScrollViewColor(scr);
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                if (isTranslucentStatusBar()) {
                    getWindow().setStatusBarColor(ColorPalette.getObscuredColor(getPrimaryColor()));
                } else {
                    getWindow().setStatusBarColor(getPrimaryColor());
                }
            }
        }
    });
    dialogBuilder.setOnDismissListener(new DialogInterface.OnDismissListener() {

        @Override
        public void onDismiss(DialogInterface dialog) {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                if (isTranslucentStatusBar()) {
                    getWindow().setStatusBarColor(ColorPalette.getObscuredColor(getPrimaryColor()));
                } else
                    getWindow().setStatusBarColor(getPrimaryColor());
                if (isNavigationBarColored())
                    getWindow().setNavigationBarColor(getPrimaryColor());
                else
                    getWindow().setNavigationBarColor(ContextCompat.getColor(getApplicationContext(), R.color.md_black_1000));
            }
            toolbar.setBackgroundColor(getPrimaryColor());
        }
    });
    dialogBuilder.show();
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) DialogInterface(android.content.DialogInterface) CardView(android.support.v7.widget.CardView) View(android.view.View) CardView(android.support.v7.widget.CardView) TextView(android.widget.TextView) ScrollView(android.widget.ScrollView) IconicsImageView(com.mikepenz.iconics.view.IconicsImageView) LineColorPicker(uz.shift.colorpicker.LineColorPicker) OnColorChangedListener(uz.shift.colorpicker.OnColorChangedListener) TextView(android.widget.TextView)

Example 5 with LineColorPicker

use of uz.shift.colorpicker.LineColorPicker in project LeafPic by HoraApps.

the class SettingsActivity method accentColorPiker.

private void accentColorPiker() {
    final AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(SettingsActivity.this, getDialogStyle());
    final View dialogLayout = getLayoutInflater().inflate(R.layout.color_piker_accent, null);
    final LineColorPicker colorPicker = (LineColorPicker) dialogLayout.findViewById(R.id.color_picker_accent);
    final TextView dialogTitle = (TextView) dialogLayout.findViewById(R.id.cp_accent_title);
    CardView cv = (CardView) dialogLayout.findViewById(R.id.cp_accent_card);
    cv.setCardBackgroundColor(getCardBackgroundColor());
    colorPicker.setColors(ColorPalette.getAccentColors(getApplicationContext()));
    colorPicker.setSelectedColor(getAccentColor());
    dialogTitle.setBackgroundColor(getAccentColor());
    colorPicker.setOnColorChangedListener(new OnColorChangedListener() {

        @Override
        public void onColorChanged(int c) {
            dialogTitle.setBackgroundColor(c);
            updateViewswithAccentColor(colorPicker.getColor());
        }
    });
    dialogBuilder.setView(dialogLayout);
    dialogBuilder.setNeutralButton(getString(R.string.cancel).toUpperCase(), new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.cancel();
            updateViewswithAccentColor(getAccentColor());
        }
    });
    dialogBuilder.setPositiveButton(getString(R.string.ok_action).toUpperCase(), new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int which) {
            SP.putInt(getString(R.string.preference_accent_color), colorPicker.getColor());
            updateTheme();
            updateViewswithAccentColor(getAccentColor());
        }
    });
    dialogBuilder.setOnDismissListener(new DialogInterface.OnDismissListener() {

        @Override
        public void onDismiss(DialogInterface dialog) {
            updateViewswithAccentColor(getAccentColor());
        }
    });
    dialogBuilder.show();
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) DialogInterface(android.content.DialogInterface) CardView(android.support.v7.widget.CardView) View(android.view.View) CardView(android.support.v7.widget.CardView) TextView(android.widget.TextView) ScrollView(android.widget.ScrollView) IconicsImageView(com.mikepenz.iconics.view.IconicsImageView) LineColorPicker(uz.shift.colorpicker.LineColorPicker) OnColorChangedListener(uz.shift.colorpicker.OnColorChangedListener) TextView(android.widget.TextView)

Aggregations

DialogInterface (android.content.DialogInterface)5 AlertDialog (android.support.v7.app.AlertDialog)5 CardView (android.support.v7.widget.CardView)5 View (android.view.View)5 TextView (android.widget.TextView)5 LineColorPicker (uz.shift.colorpicker.LineColorPicker)5 ScrollView (android.widget.ScrollView)3 IconicsImageView (com.mikepenz.iconics.view.IconicsImageView)3 OnColorChangedListener (uz.shift.colorpicker.OnColorChangedListener)3 SwitchCompat (android.support.v7.widget.SwitchCompat)2 CompoundButton (android.widget.CompoundButton)1 ThemedIcon (org.horaapps.liz.ui.ThemedIcon)1