11package com .btn .pronotes ;
22
33
4+ import static com .btn .pronotes .R .*;
5+
46import androidx .appcompat .app .AppCompatActivity ;
57
68
79import android .content .Intent ;
810import android .graphics .Color ;
911import android .os .Bundle ;
1012import android .view .View ;
13+ import android .widget .AdapterView ;
1114import android .widget .CompoundButton ;
1215import android .widget .ImageView ;
1316
2225import android .view .View ;
2326import android .widget .EditText ;
2427import android .widget .ImageView ;
28+ import android .widget .Spinner ;
29+ import android .widget .TextView ;
2530import android .widget .Toast ;
2631
32+ import com .btn .pronotes .Adapters .NotesListAdapter ;
33+ import com .btn .pronotes .R ;
2734import com .btn .pronotes .Models .Notes ;
2835import com .btn .pronotes .utils .SharedPreferenceHelper ;
2936import com .github .dhaval2404 .colorpicker .ColorPickerDialog ;
@@ -43,17 +50,38 @@ public class OpenSettings extends AppCompatActivity {
4350 private SwitchCompat colorTilesSwitch ;
4451 private ShapeableImageView ivSelectColor ;
4552 private String selectedColor ;
53+ TextView textView_title ;
54+
4655
4756
4857 @ Override
4958 protected void onCreate (Bundle savedInstanceState ) {
5059 super .onCreate (savedInstanceState );
51- setContentView (R . layout .settings );
60+ setContentView (layout .settings );
5261 selectedColor = new SharedPreferenceHelper (this ).getSelectedColor ();
5362
54- findViewById (R .id .imageView_back1 ).setOnClickListener (view -> finish ());
55- colorTilesSwitch = findViewById (R .id .color_tile_switch );
56- ivSelectColor = findViewById (R .id .iv_select_color );
63+ Spinner spinner = findViewById (id .color_spinner );
64+ TextView textViewTitle = findViewById (id .textView_title );
65+
66+
67+
68+ spinner .setOnItemSelectedListener (new AdapterView .OnItemSelectedListener () {
69+ @ Override
70+ public void onItemSelected (AdapterView <?> parent , View view , int position , long id ) {
71+ String selectedOption = spinner .getSelectedItem ().toString ();
72+ changeTextViewBackground (selectedOption );
73+ textView_title .setText (selectedOption );
74+ }
75+
76+ @ Override
77+ public void onNothingSelected (AdapterView <?> parent ) {
78+ // Handle if nothing is selected, if needed
79+ }
80+ });
81+
82+ findViewById (id .imageView_back1 ).setOnClickListener (view -> finish ());
83+ colorTilesSwitch = findViewById (id .color_tile_switch );
84+ ivSelectColor = findViewById (id .iv_select_color );
5785 if (!selectedColor .isEmpty ()) {
5886 ivSelectColor .setBackgroundColor (Color .parseColor (selectedColor ));
5987 }
@@ -74,6 +102,28 @@ protected void onCreate(Bundle savedInstanceState) {
74102 .show ();
75103 });
76104 }
105+ private void changeTextViewBackground (String selectedOption ) {
106+ switch (selectedOption ) {
107+ case "Default" :
108+ // Use default background color (e.g., from your app's theme)
109+ textView_title .setBackgroundResource (android .R .color .transparent ); // Example
110+ break ;
111+ case "Faded Black" :
112+ textView_title .setBackgroundResource (drawable .multiblack );
113+ break ;
114+ case "Faded Grey" :
115+ textView_title .setBackgroundResource (drawable .multigrey );
116+ break ;
117+ case "Faded Red" :
118+ textView_title .setBackgroundResource (drawable .multired );
119+ break ;
120+ case "Faded Blue" :
121+ textView_title .setBackgroundResource (drawable .multiblue );
122+ break ;
123+ default :
124+ // Handle if an unexpected option is selected
125+ }
126+ }
77127}
78128
79129
0 commit comments