@Test public void values() { final List<UserPreference<?>> userPreferences = UserPreference.values(); Assert.assertNotNull(userPreferences); Assert.assertFalse(userPreferences.isEmpty()); Assert.assertTrue(userPreferences.contains(UserPreference.General.DefaultReportDuration)); Assert.assertTrue(userPreferences.contains(UserPreference.General.DefaultCurrency)); Assert.assertTrue(userPreferences.contains(UserPreference.General.DateSeparator)); Assert.assertTrue(userPreferences.contains(UserPreference.General.DateFormat)); Assert.assertTrue(userPreferences.contains(UserPreference.General.IncludeCostCenter)); Assert.assertTrue(userPreferences.contains(UserPreference.Receipts.MinimumReceiptPrice)); Assert.assertTrue(userPreferences.contains(UserPreference.Receipts.DefaultTaxPercentage)); Assert.assertTrue(userPreferences.contains(UserPreference.Receipts.PredictCategories)); Assert.assertTrue(userPreferences.contains(UserPreference.Receipts.EnableAutoCompleteSuggestions)); Assert.assertTrue(userPreferences.contains(UserPreference.Receipts.OnlyIncludeReimbursable)); Assert.assertTrue(userPreferences.contains(UserPreference.Receipts.ReceiptsDefaultAsReimbursable)); Assert.assertTrue(userPreferences.contains(UserPreference.Receipts.ReceiptDateDefaultsToReportStartDate)); Assert.assertTrue(userPreferences.contains(UserPreference.Receipts.MatchReceiptNameToCategory)); Assert.assertTrue(userPreferences.contains(UserPreference.Receipts.MatchReceiptCommentToCategory)); Assert.assertTrue(userPreferences.contains(UserPreference.Receipts.ShowReceiptID)); Assert.assertTrue(userPreferences.contains(UserPreference.Receipts.IncludeTaxField)); Assert.assertTrue(userPreferences.contains(UserPreference.Receipts.UsePreTaxPrice)); Assert.assertTrue(userPreferences.contains(UserPreference.Receipts.DefaultToFullPage)); Assert.assertTrue(userPreferences.contains(UserPreference.Receipts.UsePaymentMethods)); Assert.assertTrue(userPreferences.contains(UserPreference.ReportOutput.UserId)); Assert.assertTrue(userPreferences.contains(UserPreference.ReportOutput.PrintUserIdByPdfPhoto)); Assert.assertTrue(userPreferences.contains(UserPreference.ReportOutput.PrintReceiptCommentByPdfPhoto)); Assert.assertTrue(userPreferences.contains(UserPreference.ReportOutput.PrintReceiptsTableInLandscape)); Assert.assertTrue(userPreferences.contains(UserPreference.ReportOutput.DefaultPdfPageSize)); Assert.assertTrue(userPreferences.contains(UserPreference.Email.ToAddresses)); Assert.assertTrue(userPreferences.contains(UserPreference.Email.CcAddresses)); Assert.assertTrue(userPreferences.contains(UserPreference.Email.BccAddresses)); Assert.assertTrue(userPreferences.contains(UserPreference.Email.Subject)); Assert.assertTrue(userPreferences.contains(UserPreference.Camera.SaveImagesInGrayScale)); Assert.assertTrue(userPreferences.contains(UserPreference.Camera.AutomaticallyRotateImages)); Assert.assertTrue(userPreferences.contains(UserPreference.Layout.IncludeReceiptDateInLayout)); Assert.assertTrue(userPreferences.contains(UserPreference.Layout.IncludeReceiptCategoryInLayout)); Assert.assertTrue(userPreferences.contains(UserPreference.Distance.DefaultDistanceRate)); Assert.assertTrue(userPreferences.contains(UserPreference.Distance.PrintDistanceTableInReports)); Assert.assertTrue(userPreferences.contains(UserPreference.Distance.IncludeDistancePriceInReports)); Assert.assertTrue(userPreferences.contains(UserPreference.Distance.PrintDistanceAsDailyReceiptInReports)); Assert.assertTrue(userPreferences.contains(UserPreference.Distance.ShowDistanceAsPriceInSubtotal)); Assert.assertTrue(userPreferences.contains(UserPreference.PlusSubscription.PdfFooterString)); Assert.assertTrue(userPreferences.contains(UserPreference.Privacy.EnableAnalytics)); Assert.assertTrue(userPreferences.contains(UserPreference.Privacy.EnableCrashTracking)); Assert.assertTrue(userPreferences.contains(UserPreference.Privacy.EnableAdPersonalization)); Assert.assertTrue(userPreferences.contains(UserPreference.Misc.AutoBackupOnWifiOnly)); Assert.assertTrue(userPreferences.contains(UserPreference.Misc.OcrIncognitoMode)); Assert.assertTrue(userPreferences.contains(UserPreference.Misc.OcrIsEnabled)); Assert.assertTrue(userPreferences.contains(UserPreference.Internal.ApplicationVersionCode)); }
@NonNull public static synchronized List<UserPreference<?>> values() { if (CACHED_VALUES == null) { CACHED_VALUES = new ArrayList<>(); final Class<?>[] declaredClasses = UserPreference.class.getDeclaredClasses(); if (declaredClasses != null) { for (final Class<?> declaredClass : declaredClasses) { final Field[] fields = declaredClass.getFields(); if (fields != null) { for (final Field field : fields) { if (UserPreference.class.equals(field.getType())) { try { CACHED_VALUES.add((UserPreference<?>) field.get(declaredClass)); } catch (IllegalAccessException e) { Logger.warn(UserPreference.class, "Failed to get field " + field + " due to access exception", e); } } } } } } } return CACHED_VALUES; }
UserPreference { @NonNull public static synchronized List<UserPreference<?>> values() { if (CACHED_VALUES == null) { CACHED_VALUES = new ArrayList<>(); final Class<?>[] declaredClasses = UserPreference.class.getDeclaredClasses(); if (declaredClasses != null) { for (final Class<?> declaredClass : declaredClasses) { final Field[] fields = declaredClass.getFields(); if (fields != null) { for (final Field field : fields) { if (UserPreference.class.equals(field.getType())) { try { CACHED_VALUES.add((UserPreference<?>) field.get(declaredClass)); } catch (IllegalAccessException e) { Logger.warn(UserPreference.class, "Failed to get field " + field + " due to access exception", e); } } } } } } } return CACHED_VALUES; } }
UserPreference { @NonNull public static synchronized List<UserPreference<?>> values() { if (CACHED_VALUES == null) { CACHED_VALUES = new ArrayList<>(); final Class<?>[] declaredClasses = UserPreference.class.getDeclaredClasses(); if (declaredClasses != null) { for (final Class<?> declaredClass : declaredClasses) { final Field[] fields = declaredClass.getFields(); if (fields != null) { for (final Field field : fields) { if (UserPreference.class.equals(field.getType())) { try { CACHED_VALUES.add((UserPreference<?>) field.get(declaredClass)); } catch (IllegalAccessException e) { Logger.warn(UserPreference.class, "Failed to get field " + field + " due to access exception", e); } } } } } } } return CACHED_VALUES; } private  UserPreference(@NonNull Class<T> type, @StringRes int name, @AnyRes int defaultValue); }
UserPreference { @NonNull public static synchronized List<UserPreference<?>> values() { if (CACHED_VALUES == null) { CACHED_VALUES = new ArrayList<>(); final Class<?>[] declaredClasses = UserPreference.class.getDeclaredClasses(); if (declaredClasses != null) { for (final Class<?> declaredClass : declaredClasses) { final Field[] fields = declaredClass.getFields(); if (fields != null) { for (final Field field : fields) { if (UserPreference.class.equals(field.getType())) { try { CACHED_VALUES.add((UserPreference<?>) field.get(declaredClass)); } catch (IllegalAccessException e) { Logger.warn(UserPreference.class, "Failed to get field " + field + " due to access exception", e); } } } } } } } return CACHED_VALUES; } private  UserPreference(@NonNull Class<T> type, @StringRes int name, @AnyRes int defaultValue); @NonNull Class<T> getType(); @StringRes int getName(); @AnyRes int getDefaultValue(); @NonNull static synchronized List<UserPreference<?>> values(); @Override boolean equals(Object o); @Override int hashCode(); }
UserPreference { @NonNull public static synchronized List<UserPreference<?>> values() { if (CACHED_VALUES == null) { CACHED_VALUES = new ArrayList<>(); final Class<?>[] declaredClasses = UserPreference.class.getDeclaredClasses(); if (declaredClasses != null) { for (final Class<?> declaredClass : declaredClasses) { final Field[] fields = declaredClass.getFields(); if (fields != null) { for (final Field field : fields) { if (UserPreference.class.equals(field.getType())) { try { CACHED_VALUES.add((UserPreference<?>) field.get(declaredClass)); } catch (IllegalAccessException e) { Logger.warn(UserPreference.class, "Failed to get field " + field + " due to access exception", e); } } } } } } } return CACHED_VALUES; } private  UserPreference(@NonNull Class<T> type, @StringRes int name, @AnyRes int defaultValue); @NonNull Class<T> getType(); @StringRes int getName(); @AnyRes int getDefaultValue(); @NonNull static synchronized List<UserPreference<?>> values(); @Override boolean equals(Object o); @Override int hashCode();  }