@Override
  protected void onCreate(Bundle savedInstanceState) {
    getDelegate().installViewFactory();
    getDelegate().onCreate(savedInstanceState);

    SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
    if (preferences.getBoolean(AuthenticatorActivity.KEY_DARK_MODE_ENABLED, false)) {
      setTheme(R.style.AuthenticatorTheme_Dark);
    } else {
      setTheme(R.style.AuthenticatorTheme);
    }

    super.onCreate(savedInstanceState);
  }
A {@link android.preference.PreferenceActivity} which implements and proxies the necessary calls
to be used with AppCompat. Largely inspired from the AOSP support-v7 demos.
java/com/google/android/apps/authenticator/settings/AppCompatPreferenceActivity.java