@Test public void onSharedPreferenceChanged() { boolean isEnabled = exceptionHanlder.isEnabled(); exceptionHanlder.onSharedPreferenceChanged( getMockedSharedPrefs(MAPBOX_PREF_ENABLE_CRASH_REPORTER, false), MAPBOX_PREF_ENABLE_CRASH_REPORTER); assertThat(exceptionHanlder.isEnabled()).isNotEqualTo(isEnabled); }
@Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { if (!MAPBOX_PREF_ENABLE_CRASH_REPORTER.equals(key)) { return; } try { isEnabled.set(sharedPreferences.getBoolean(MAPBOX_PREF_ENABLE_CRASH_REPORTER, false)); } catch (Exception ex) { Log.e(TAG, ex.toString()); } }
MapboxUncaughtExceptionHanlder implements Thread.UncaughtExceptionHandler,
  SharedPreferences.OnSharedPreferenceChangeListener { @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { if (!MAPBOX_PREF_ENABLE_CRASH_REPORTER.equals(key)) { return; } try { isEnabled.set(sharedPreferences.getBoolean(MAPBOX_PREF_ENABLE_CRASH_REPORTER, false)); } catch (Exception ex) { Log.e(TAG, ex.toString()); } } }
MapboxUncaughtExceptionHanlder implements Thread.UncaughtExceptionHandler,
  SharedPreferences.OnSharedPreferenceChangeListener { @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { if (!MAPBOX_PREF_ENABLE_CRASH_REPORTER.equals(key)) { return; } try { isEnabled.set(sharedPreferences.getBoolean(MAPBOX_PREF_ENABLE_CRASH_REPORTER, false)); } catch (Exception ex) { Log.e(TAG, ex.toString()); } } @VisibleForTesting  MapboxUncaughtExceptionHanlder(@NonNull Context applicationContext,
                                 @NonNull SharedPreferences sharedPreferences,
                                 @NonNull String mapboxPackage,
                                 @NonNull String version,
                                 Thread.UncaughtExceptionHandler defaultExceptionHandler); }
MapboxUncaughtExceptionHanlder implements Thread.UncaughtExceptionHandler,
  SharedPreferences.OnSharedPreferenceChangeListener { @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { if (!MAPBOX_PREF_ENABLE_CRASH_REPORTER.equals(key)) { return; } try { isEnabled.set(sharedPreferences.getBoolean(MAPBOX_PREF_ENABLE_CRASH_REPORTER, false)); } catch (Exception ex) { Log.e(TAG, ex.toString()); } } @VisibleForTesting  MapboxUncaughtExceptionHanlder(@NonNull Context applicationContext,
                                 @NonNull SharedPreferences sharedPreferences,
                                 @NonNull String mapboxPackage,
                                 @NonNull String version,
                                 Thread.UncaughtExceptionHandler defaultExceptionHandler); static void install(@NonNull Context context, @NonNull String mapboxPackage, @NonNull String version); @Override void uncaughtException(Thread thread, Throwable throwable); @Override void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key); }
MapboxUncaughtExceptionHanlder implements Thread.UncaughtExceptionHandler,
  SharedPreferences.OnSharedPreferenceChangeListener { @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { if (!MAPBOX_PREF_ENABLE_CRASH_REPORTER.equals(key)) { return; } try { isEnabled.set(sharedPreferences.getBoolean(MAPBOX_PREF_ENABLE_CRASH_REPORTER, false)); } catch (Exception ex) { Log.e(TAG, ex.toString()); } } @VisibleForTesting  MapboxUncaughtExceptionHanlder(@NonNull Context applicationContext,
                                 @NonNull SharedPreferences sharedPreferences,
                                 @NonNull String mapboxPackage,
                                 @NonNull String version,
                                 Thread.UncaughtExceptionHandler defaultExceptionHandler); static void install(@NonNull Context context, @NonNull String mapboxPackage, @NonNull String version); @Override void uncaughtException(Thread thread, Throwable throwable); @Override void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key); static final String MAPBOX_PREF_ENABLE_CRASH_REPORTER; static final String MAPBOX_CRASH_REPORTER_PREFERENCES; }