test_class.file: collect_app/src/test/java/org/odk/collect/android/utilities/WidgetAppearanceUtilsTest.java
test_class.identifier: WidgetAppearanceUtilsTest
test_case.body: @Test
      public void getNumberOfColumnsTest() {
          FormEntryPrompt formEntryPrompt = mock(FormEntryPrompt.class);
  
          when(formEntryPrompt.getAppearanceHint()).thenReturn("");
          assertEquals(1, WidgetAppearanceUtils.getNumberOfColumns(formEntryPrompt, null));
  
          when(formEntryPrompt.getAppearanceHint()).thenReturn("columns-2");
          assertEquals(2, WidgetAppearanceUtils.getNumberOfColumns(formEntryPrompt, null));
  
          when(formEntryPrompt.getAppearanceHint()).thenReturn("columns-10");
          assertEquals(10, WidgetAppearanceUtils.getNumberOfColumns(formEntryPrompt, null));
  
          when(formEntryPrompt.getAppearanceHint()).thenReturn("columns-10 quick");
          assertEquals(10, WidgetAppearanceUtils.getNumberOfColumns(formEntryPrompt, null));
  
          when(formEntryPrompt.getAppearanceHint()).thenReturn("columns-5 autocomplete");
          assertEquals(5, WidgetAppearanceUtils.getNumberOfColumns(formEntryPrompt, null));
  
          when(formEntryPrompt.getAppearanceHint()).thenReturn("columns-10quick");
          assertEquals(1, WidgetAppearanceUtils.getNumberOfColumns(formEntryPrompt, null));
  
          when(formEntryPrompt.getAppearanceHint()).thenReturn("columns-5autocomplete");
          assertEquals(1, WidgetAppearanceUtils.getNumberOfColumns(formEntryPrompt, null));
  
          when(formEntryPrompt.getAppearanceHint()).thenReturn("columns-5 ");
          assertEquals(5, WidgetAppearanceUtils.getNumberOfColumns(formEntryPrompt, null));
  
          when(formEntryPrompt.getAppearanceHint()).thenReturn("columns-5  ");
          assertEquals(5, WidgetAppearanceUtils.getNumberOfColumns(formEntryPrompt, null));
  
          when(formEntryPrompt.getAppearanceHint()).thenReturn("  columns-5");
          assertEquals(5, WidgetAppearanceUtils.getNumberOfColumns(formEntryPrompt, null));
  
          when(formEntryPrompt.getAppearanceHint()).thenReturn("quick columns-5");
          assertEquals(5, WidgetAppearanceUtils.getNumberOfColumns(formEntryPrompt, null));
  
          when(formEntryPrompt.getAppearanceHint()).thenReturn("compact-5");
          assertEquals(5, WidgetAppearanceUtils.getNumberOfColumns(formEntryPrompt, null));
  
          when(formEntryPrompt.getAppearanceHint()).thenReturn("compact-9");
          assertEquals(9, WidgetAppearanceUtils.getNumberOfColumns(formEntryPrompt, null));
  
          when(formEntryPrompt.getAppearanceHint()).thenReturn("columns-9");
          assertEquals(9, WidgetAppearanceUtils.getNumberOfColumns(formEntryPrompt, null));
  
          when(formEntryPrompt.getAppearanceHint()).thenReturn("columns--1");
          assertEquals(1, WidgetAppearanceUtils.getNumberOfColumns(formEntryPrompt, null));
  
          when(formEntryPrompt.getAppearanceHint()).thenReturn("columns--10");
          assertEquals(1, WidgetAppearanceUtils.getNumberOfColumns(formEntryPrompt, null));
      }
test_case.class_method_signature: WidgetAppearanceUtilsTest.getNumberOfColumnsTest()
test_case.full_signature: @Test public void getNumberOfColumnsTest()
test_case.identifier: getNumberOfColumnsTest
test_case.invocations: mock thenReturn when getAppearanceHint assertEquals getNumberOfColumns thenReturn when getAppearanceHint assertEquals getNumberOfColumns thenReturn when getAppearanceHint assertEquals getNumberOfColumns thenReturn when getAppearanceHint assertEquals getNumberOfColumns thenReturn when getAppearanceHint assertEquals getNumberOfColumns thenReturn when getAppearanceHint assertEquals getNumberOfColumns thenReturn when getAppearanceHint assertEquals getNumberOfColumns thenReturn when getAppearanceHint assertEquals getNumberOfColumns thenReturn when getAppearanceHint assertEquals getNumberOfColumns thenReturn when getAppearanceHint assertEquals getNumberOfColumns thenReturn when getAppearanceHint assertEquals getNumberOfColumns thenReturn when getAppearanceHint assertEquals getNumberOfColumns thenReturn when getAppearanceHint assertEquals getNumberOfColumns thenReturn when getAppearanceHint assertEquals getNumberOfColumns thenReturn when getAppearanceHint assertEquals getNumberOfColumns thenReturn when getAppearanceHint assertEquals getNumberOfColumns
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void getNumberOfColumnsTest()
focal_class.declarator: EXCEPTION_PARSING_COLUMNS = "Exception parsing columns"
focal_class.modifier: private static final
focal_class.original_string: private static final String EXCEPTION_PARSING_COLUMNS = "Exception parsing columns";
focal_class.type: String
focal_class.var_name: EXCEPTION_PARSING_COLUMNS
focal_class.declarator: ETHIOPIAN                = "ethiopian"
focal_class.modifier: public static final
focal_class.original_string: public static final String ETHIOPIAN                = "ethiopian";
focal_class.type: String
focal_class.var_name: ETHIOPIAN
focal_class.declarator: COPTIC                   = "coptic"
focal_class.modifier: public static final
focal_class.original_string: public static final String COPTIC                   = "coptic";
focal_class.type: String
focal_class.var_name: COPTIC
focal_class.declarator: ISLAMIC                  = "islamic"
focal_class.modifier: public static final
focal_class.original_string: public static final String ISLAMIC                  = "islamic";
focal_class.type: String
focal_class.var_name: ISLAMIC
focal_class.declarator: BIKRAM_SAMBAT            = "bikram-sambat"
focal_class.modifier: public static final
focal_class.original_string: public static final String BIKRAM_SAMBAT            = "bikram-sambat";
focal_class.type: String
focal_class.var_name: BIKRAM_SAMBAT
focal_class.declarator: MYANMAR                  = "myanmar"
focal_class.modifier: public static final
focal_class.original_string: public static final String MYANMAR                  = "myanmar";
focal_class.type: String
focal_class.var_name: MYANMAR
focal_class.declarator: PERSIAN                  = "persian"
focal_class.modifier: public static final
focal_class.original_string: public static final String PERSIAN                  = "persian";
focal_class.type: String
focal_class.var_name: PERSIAN
focal_class.declarator: NO_CALENDAR              = "no-calendar"
focal_class.modifier: public static final
focal_class.original_string: public static final String NO_CALENDAR              = "no-calendar";
focal_class.type: String
focal_class.var_name: NO_CALENDAR
focal_class.declarator: MONTH_YEAR               = "month-year"
focal_class.modifier: public static final
focal_class.original_string: public static final String MONTH_YEAR               = "month-year";
focal_class.type: String
focal_class.var_name: MONTH_YEAR
focal_class.declarator: YEAR                     = "year"
focal_class.modifier: public static final
focal_class.original_string: public static final String YEAR                     = "year";
focal_class.type: String
focal_class.var_name: YEAR
focal_class.declarator: COMPACT      = "compact"
focal_class.modifier: @Deprecated public static final
focal_class.original_string: @Deprecated public static final String COMPACT      = "compact";
focal_class.type: String
focal_class.var_name: COMPACT
focal_class.declarator: COMPACT_N    = "compact-"
focal_class.modifier: @Deprecated public static final
focal_class.original_string: @Deprecated public static final String COMPACT_N    = "compact-";
focal_class.type: String
focal_class.var_name: COMPACT_N
focal_class.declarator: MINIMAL                  = "minimal"
focal_class.modifier: public static final
focal_class.original_string: public static final String MINIMAL                  = "minimal";
focal_class.type: String
focal_class.var_name: MINIMAL
focal_class.declarator: COLUMNS                  = "columns"
focal_class.modifier: public static final
focal_class.original_string: public static final String COLUMNS                  = "columns";
focal_class.type: String
focal_class.var_name: COLUMNS
focal_class.declarator: COLUMNS_N                = "columns-"
focal_class.modifier: public static final
focal_class.original_string: public static final String COLUMNS_N                = "columns-";
focal_class.type: String
focal_class.var_name: COLUMNS_N
focal_class.declarator: COLUMNS_PACK             = "columns-pack"
focal_class.modifier: public static final
focal_class.original_string: public static final String COLUMNS_PACK             = "columns-pack";
focal_class.type: String
focal_class.var_name: COLUMNS_PACK
focal_class.declarator: QUICKCOMPACT = "quickcompact"
focal_class.modifier: @Deprecated public static final
focal_class.original_string: @Deprecated public static final String QUICKCOMPACT = "quickcompact";
focal_class.type: String
focal_class.var_name: QUICKCOMPACT
focal_class.declarator: SEARCH       = "search"
focal_class.modifier: @Deprecated public static final
focal_class.original_string: @Deprecated public static final String SEARCH       = "search";
focal_class.type: String
focal_class.var_name: SEARCH
focal_class.declarator: AUTOCOMPLETE             = "autocomplete"
focal_class.modifier: public static final
focal_class.original_string: public static final String AUTOCOMPLETE             = "autocomplete";
focal_class.type: String
focal_class.var_name: AUTOCOMPLETE
focal_class.declarator: LIST_NO_LABEL            = "list-nolabel"
focal_class.modifier: public static final
focal_class.original_string: public static final String LIST_NO_LABEL            = "list-nolabel";
focal_class.type: String
focal_class.var_name: LIST_NO_LABEL
focal_class.declarator: LIST                     = "list"
focal_class.modifier: public static final
focal_class.original_string: public static final String LIST                     = "list";
focal_class.type: String
focal_class.var_name: LIST
focal_class.declarator: LABEL                    = "label"
focal_class.modifier: public static final
focal_class.original_string: public static final String LABEL                    = "label";
focal_class.type: String
focal_class.var_name: LABEL
focal_class.declarator: IMAGE_MAP                = "image-map"
focal_class.modifier: public static final
focal_class.original_string: public static final String IMAGE_MAP                = "image-map";
focal_class.type: String
focal_class.var_name: IMAGE_MAP
focal_class.declarator: NO_BUTTONS               = "no-buttons"
focal_class.modifier: public static final
focal_class.original_string: public static final String NO_BUTTONS               = "no-buttons";
focal_class.type: String
focal_class.var_name: NO_BUTTONS
focal_class.declarator: QUICK                    = "quick"
focal_class.modifier: public static final
focal_class.original_string: public static final String QUICK                    = "quick";
focal_class.type: String
focal_class.var_name: QUICK
focal_class.declarator: SIGNATURE                = "signature"
focal_class.modifier: public static final
focal_class.original_string: public static final String SIGNATURE                = "signature";
focal_class.type: String
focal_class.var_name: SIGNATURE
focal_class.declarator: ANNOTATE                 = "annotate"
focal_class.modifier: public static final
focal_class.original_string: public static final String ANNOTATE                 = "annotate";
focal_class.type: String
focal_class.var_name: ANNOTATE
focal_class.declarator: DRAW                     = "draw"
focal_class.modifier: public static final
focal_class.original_string: public static final String DRAW                     = "draw";
focal_class.type: String
focal_class.var_name: DRAW
focal_class.declarator: SELFIE       = "selfie"
focal_class.modifier: @Deprecated public static final
focal_class.original_string: @Deprecated public static final String SELFIE       = "selfie";
focal_class.type: String
focal_class.var_name: SELFIE
focal_class.declarator: NEW_FRONT                = "new-front"
focal_class.modifier: public static final
focal_class.original_string: public static final String NEW_FRONT                = "new-front";
focal_class.type: String
focal_class.var_name: NEW_FRONT
focal_class.declarator: NEW                      = "new"
focal_class.modifier: public static final
focal_class.original_string: public static final String NEW                      = "new";
focal_class.type: String
focal_class.var_name: NEW
focal_class.declarator: FRONT                    = "front"
focal_class.modifier: public static final
focal_class.original_string: public static final String FRONT                    = "front";
focal_class.type: String
focal_class.var_name: FRONT
focal_class.declarator: PLACEMENT_MAP            = "placement-map"
focal_class.modifier: public static final
focal_class.original_string: public static final String PLACEMENT_MAP            = "placement-map";
focal_class.type: String
focal_class.var_name: PLACEMENT_MAP
focal_class.declarator: MAPS                     = "maps"
focal_class.modifier: public static final
focal_class.original_string: public static final String MAPS                     = "maps";
focal_class.type: String
focal_class.var_name: MAPS
focal_class.declarator: NO_APPEARANCE            = ""
focal_class.modifier: public static final
focal_class.original_string: public static final String NO_APPEARANCE            = "";
focal_class.type: String
focal_class.var_name: NO_APPEARANCE
focal_class.declarator: BEARING                  = "bearing"
focal_class.modifier: public static final
focal_class.original_string: public static final String BEARING                  = "bearing";
focal_class.type: String
focal_class.var_name: BEARING
focal_class.declarator: EX                       = "ex:"
focal_class.modifier: public static final
focal_class.original_string: public static final String EX                       = "ex:";
focal_class.type: String
focal_class.var_name: EX
focal_class.declarator: THOUSANDS_SEP            = "thousands-sep"
focal_class.modifier: public static final
focal_class.original_string: public static final String THOUSANDS_SEP            = "thousands-sep";
focal_class.type: String
focal_class.var_name: THOUSANDS_SEP
focal_class.declarator: PRINTER                  = "printer"
focal_class.modifier: public static final
focal_class.original_string: public static final String PRINTER                  = "printer";
focal_class.type: String
focal_class.var_name: PRINTER
focal_class.declarator: NUMBERS                  = "numbers"
focal_class.modifier: public static final
focal_class.original_string: public static final String NUMBERS                  = "numbers";
focal_class.type: String
focal_class.var_name: NUMBERS
focal_class.declarator: URL                      = "url"
focal_class.modifier: public static final
focal_class.original_string: public static final String URL                      = "url";
focal_class.type: String
focal_class.var_name: URL
focal_class.declarator: RATING                   = "rating"
focal_class.modifier: public static final
focal_class.original_string: public static final String RATING                   = "rating";
focal_class.type: String
focal_class.var_name: RATING
focal_class.file: collect_app/src/main/java/org/odk/collect/android/utilities/WidgetAppearanceUtils.java
focal_class.identifier: WidgetAppearanceUtils
focal_class.class_method_signature: WidgetAppearanceUtils.WidgetAppearanceUtils()
focal_class.full_signature: private  WidgetAppearanceUtils()
focal_class.identifier: WidgetAppearanceUtils
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.signature:  WidgetAppearanceUtils()
focal_class.class_method_signature: WidgetAppearanceUtils.getSanitizedAppearanceHint(FormEntryPrompt fep)
focal_class.full_signature: public static @NonNull String getSanitizedAppearanceHint(FormEntryPrompt fep)
focal_class.identifier: getSanitizedAppearanceHint
focal_class.modifiers: public static @NonNull
focal_class.parameters: (FormEntryPrompt fep)
focal_class.return: String
focal_class.signature: String getSanitizedAppearanceHint(FormEntryPrompt fep)
focal_class.class_method_signature: WidgetAppearanceUtils.hasAppearance(FormEntryPrompt fep, String appearance)
focal_class.full_signature: public static boolean hasAppearance(FormEntryPrompt fep, String appearance)
focal_class.identifier: hasAppearance
focal_class.modifiers: public static
focal_class.parameters: (FormEntryPrompt fep, String appearance)
focal_class.return: boolean
focal_class.signature: boolean hasAppearance(FormEntryPrompt fep, String appearance)
focal_class.class_method_signature: WidgetAppearanceUtils.getNumberOfColumns(FormEntryPrompt formEntryPrompt, Context context)
focal_class.full_signature: public static int getNumberOfColumns(FormEntryPrompt formEntryPrompt, Context context)
focal_class.identifier: getNumberOfColumns
focal_class.modifiers: public static
focal_class.parameters: (FormEntryPrompt formEntryPrompt, Context context)
focal_class.return: int
focal_class.signature: int getNumberOfColumns(FormEntryPrompt formEntryPrompt, Context context)
focal_class.class_method_signature: WidgetAppearanceUtils.isNoButtonsAppearance(FormEntryPrompt prompt)
focal_class.full_signature: public static boolean isNoButtonsAppearance(FormEntryPrompt prompt)
focal_class.identifier: isNoButtonsAppearance
focal_class.modifiers: public static
focal_class.parameters: (FormEntryPrompt prompt)
focal_class.return: boolean
focal_class.signature: boolean isNoButtonsAppearance(FormEntryPrompt prompt)
focal_class.class_method_signature: WidgetAppearanceUtils.isCompactAppearance(FormEntryPrompt prompt)
focal_class.full_signature: public static boolean isCompactAppearance(FormEntryPrompt prompt)
focal_class.identifier: isCompactAppearance
focal_class.modifiers: public static
focal_class.parameters: (FormEntryPrompt prompt)
focal_class.return: boolean
focal_class.signature: boolean isCompactAppearance(FormEntryPrompt prompt)
focal_class.class_method_signature: WidgetAppearanceUtils.useThousandSeparator(FormEntryPrompt prompt)
focal_class.full_signature: public static boolean useThousandSeparator(FormEntryPrompt prompt)
focal_class.identifier: useThousandSeparator
focal_class.modifiers: public static
focal_class.parameters: (FormEntryPrompt prompt)
focal_class.return: boolean
focal_class.signature: boolean useThousandSeparator(FormEntryPrompt prompt)
focal_method.body: public static int getNumberOfColumns(FormEntryPrompt formEntryPrompt, Context context) {
          int numColumns = 1;
          String appearance = getSanitizedAppearanceHint(formEntryPrompt);
          if (appearance.contains(COLUMNS_N) || appearance.contains(COMPACT_N)) {
              try {
                  String columnsAppearance = appearance.contains(COLUMNS_N) ? COLUMNS_N : COMPACT_N;
                  try {
                      appearance =
                              appearance.substring(appearance.indexOf(columnsAppearance));
                      int idx = appearance.indexOf(columnsAppearance);
                      if (idx != -1) {
                          String substringFromNumColumns = appearance.substring(idx + columnsAppearance.length());
                          numColumns = Integer.parseInt(substringFromNumColumns.substring(0, substringFromNumColumns.contains(" ")
                                  ? substringFromNumColumns.indexOf(' ')
                                  : substringFromNumColumns.length()));
  
                          if (numColumns < 1) {
                              numColumns = 1;
                          }
                      }
                  } catch (Exception e) {
                      Timber.e(EXCEPTION_PARSING_COLUMNS);
                  }
              } catch (Exception e) {
                  Timber.e(EXCEPTION_PARSING_COLUMNS);
              }
          } else if (appearance.contains(COLUMNS)) {
              switch (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) {
                  case Configuration.SCREENLAYOUT_SIZE_SMALL:
                      numColumns = 2;
                      break;
                  case Configuration.SCREENLAYOUT_SIZE_NORMAL:
                      numColumns = 3;
                      break;
                  case Configuration.SCREENLAYOUT_SIZE_LARGE:
                      numColumns = 4;
                      break;
                  case Configuration.SCREENLAYOUT_SIZE_XLARGE:
                      numColumns = 5;
                      break;
                  default:
                      numColumns = 3;
              }
          }
          return numColumns;
      }
focal_method.class_method_signature: WidgetAppearanceUtils.getNumberOfColumns(FormEntryPrompt formEntryPrompt, Context context)
focal_method.full_signature: public static int getNumberOfColumns(FormEntryPrompt formEntryPrompt, Context context)
focal_method.identifier: getNumberOfColumns
focal_method.invocations: getSanitizedAppearanceHint contains contains contains substring indexOf indexOf substring length parseInt substring contains indexOf length e e contains getConfiguration getResources
focal_method.modifiers: public static
focal_method.parameters: (FormEntryPrompt formEntryPrompt, Context context)
focal_method.return: int
focal_method.signature: int getNumberOfColumns(FormEntryPrompt formEntryPrompt, Context context)