title: Change preference fragment colors on preference change
body: <p>I have a dark theme implemented with styles.
  State can be changed via a preference fragment switch.
  <strong>I'd like to give the user a preview of the dark mode when the state changes.</strong></p>
  <hr />
  <p>I managed to get the listener for the event as such:</p>
  <pre><code>// Listen for state changes
      SharedPreferences.OnSharedPreferenceChangeListener listener;
      listener = (SharedPreferences, key) -&gt; {
         if(key.equals(&quot;pref_app_theme&quot;)){
            // todo Change color of items on change
         }
      };
      va.myPref.registerOnSharedPreferenceChangeListener(listener);
  </code></pre>
  <p>Switch element:</p>
  <pre><code>&lt;SwitchPreference
      android:key=&quot;@string/pref_app_theme&quot;
      android:title=&quot;Dark theme&quot;
      android:defaultValue=&quot;false&quot;/&gt;
  </code></pre>
  <p>Thanks in advance</p>