Search in sources :

Example 1 with MainActivity

use of org.awesomeapp.messenger.MainActivity in project Zom-Android by zom.

the class MoreFragment method showColors.

private void showColors() {
    final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(getActivity());
    int selColor = settings.getInt("themeColor", -1);
    ColorPickerDialogBuilder.with(getContext()).setTitle("Choose color").initialColor(selColor).wheelType(ColorPickerView.WHEEL_TYPE.FLOWER).density(12).lightnessSliderOnly().setOnColorSelectedListener(new OnColorSelectedListener() {

        @Override
        public void onColorSelected(int selectedColor) {
        }
    }).setPositiveButton(getString(R.string.ok), new ColorPickerClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int selectedColor, Integer[] allColors) {
            settings.edit().putInt("themeColor", selectedColor).commit();
            /**
             *                        int textColor = getContrastColor(selectedColor);
             *                        int bgColor = getContrastColor(textColor);
             *
             *                        settings.edit().putInt("themeColorBg",bgColor).commit();
             *                        settings.edit().putInt("themeColorText",textColor).commit();
             */
            MainActivity activity = (MainActivity) getActivity();
            activity.applyStyle();
        }
    }).setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
        }
    }).build().show();
}
Also used : SharedPreferences(android.content.SharedPreferences) DialogInterface(android.content.DialogInterface) ColorPickerClickListener(com.flask.colorpicker.builder.ColorPickerClickListener) MainActivity(org.awesomeapp.messenger.MainActivity) OnColorSelectedListener(com.flask.colorpicker.OnColorSelectedListener)

Aggregations

DialogInterface (android.content.DialogInterface)1 SharedPreferences (android.content.SharedPreferences)1 OnColorSelectedListener (com.flask.colorpicker.OnColorSelectedListener)1 ColorPickerClickListener (com.flask.colorpicker.builder.ColorPickerClickListener)1 MainActivity (org.awesomeapp.messenger.MainActivity)1