@@ -749,22 +749,15 @@ private void accentColorPiker(){
749
749
750
750
final View dialogLayout = getLayoutInflater ().inflate (R .layout .color_piker_accent , null );
751
751
final LineColorPicker colorPicker = (LineColorPicker ) dialogLayout .findViewById (R .id .color_picker_accent );
752
+ final LineColorPicker colorPicker2 =(LineColorPicker )dialogLayout .findViewById (R .id .color_picker_accent_2 );
752
753
final TextView dialogTitle = (TextView ) dialogLayout .findViewById (R .id .cp_accent_title );
753
754
CardView cv = (CardView ) dialogLayout .findViewById (R .id .cp_accent_card );
754
755
cv .setCardBackgroundColor (getCardBackgroundColor ());
755
756
756
- colorPicker .setColors (ColorPalette .getAccentColors (getApplicationContext ()));
757
- colorPicker .setSelectedColor (getAccentColor ());
757
+ setColor2 (colorPicker ,colorPicker2 ,dialogTitle );
758
758
dialogTitle .setBackgroundColor (getAccentColor ());
759
759
760
- colorPicker .setOnColorChangedListener (new OnColorChangedListener () {
761
- @ Override
762
- public void onColorChanged (int c ) {
763
- dialogTitle .setBackgroundColor (c );
764
- updateViewswithAccentColor (colorPicker .getColor ());
765
760
766
- }
767
- });
768
761
dialogBuilder .setView (dialogLayout );
769
762
770
763
dialogBuilder .setNeutralButton (getString (R .string .cancel ).toUpperCase (), new DialogInterface .OnClickListener () {
@@ -776,7 +769,7 @@ public void onClick(DialogInterface dialog, int which) {
776
769
});
777
770
dialogBuilder .setPositiveButton (getString (R .string .ok_action ).toUpperCase (), new DialogInterface .OnClickListener () {
778
771
public void onClick (DialogInterface dialog , int which ) {
779
- SP .putInt (getString (R .string .preference_accent_color ), colorPicker .getColor ());
772
+ SP .putInt (getString (R .string .preference_accent_color ), colorPicker2 .getColor ());
780
773
updateTheme ();
781
774
updateViewswithAccentColor (getAccentColor ());
782
775
}
@@ -791,6 +784,35 @@ public void onDismiss(DialogInterface dialog) {
791
784
alertDialog .show ();
792
785
AlertDialogsHelper .setButtonTextColor (new int []{DialogInterface .BUTTON_POSITIVE , DialogInterface .BUTTON_NEGATIVE , DialogInterface .BUTTON_NEUTRAL }, getAccentColor (), alertDialog );
793
786
}
787
+ private void setColor2 (final LineColorPicker colorPicker , final LineColorPicker colorPicker2 , final TextView dialogTitle ) {
788
+ colorPicker .setColors (ColorPalette .getBaseColors (getApplicationContext ()));
789
+ for (int i : colorPicker .getColors ())
790
+ for (int i2 : ColorPalette .getColors (getBaseContext (), i ))
791
+ if (i2 == getAccentColor ()) {
792
+ colorPicker .setSelectedColor (i );
793
+ colorPicker2 .setColors (ColorPalette .getColors (getBaseContext (), i ));
794
+ colorPicker2 .setSelectedColor (i2 );
795
+ break ;}
796
+
797
+ dialogTitle .setBackgroundColor (getPrimaryColor ());
798
+
799
+ colorPicker .setOnColorChangedListener (new OnColorChangedListener () {
800
+ @ Override
801
+ public void onColorChanged (int c ) {
802
+ dialogTitle .setBackgroundColor (c );
803
+ updateViewswithAccentColor (c );
804
+ colorPicker2 .setColors (ColorPalette .getColors (getApplicationContext (), colorPicker .getColor ()));
805
+ colorPicker2 .setSelectedColor (colorPicker .getColor ());
806
+ }
807
+ });
808
+ colorPicker2 .setOnColorChangedListener (new OnColorChangedListener () {
809
+ @ Override
810
+ public void onColorChanged (int c ) {
811
+ dialogTitle .setBackgroundColor (c );
812
+ updateViewswithAccentColor (c );
813
+ }
814
+ });
815
+ }
794
816
795
817
private void customizePictureViewer (){
796
818
0 commit comments