@Test public void testGetLoadingState() { Uri uri = Uri.parse("content: Slice s1 = new ListBuilder(mContext, uri, INFINITY).build(); SliceMetadata SliceMetadata1 = SliceMetadata.from(mContext, s1); int actualState1 = SliceMetadata1.getLoadingState(); assertEquals(LOADED_NONE, actualState1); ListBuilder lb = new ListBuilder(mContext, uri, INFINITY); Slice s2 = lb.addRow(new ListBuilder.RowBuilder(lb) .setTitle(null, true )) .build(); SliceMetadata SliceMetadata2 = SliceMetadata.from(mContext, s2); int actualState2 = SliceMetadata2.getLoadingState(); assertEquals(LOADED_PARTIAL, actualState2); ListBuilder lb2 = new ListBuilder(mContext, uri, INFINITY); Slice s3 = lb2.addRow(new ListBuilder.RowBuilder(lb2) .setTitle("Title", false )) .build(); SliceMetadata SliceMetadata3 = SliceMetadata.from(mContext, s3); int actualState3 = SliceMetadata3.getLoadingState(); assertEquals(LOADED_ALL, actualState3); }
public int getLoadingState() { boolean hasHintPartial = SliceQuery.find(mSlice, null, HINT_PARTIAL, null) != null; if (!mListContent.isValid()) { return LOADED_NONE; } else if (hasHintPartial) { return LOADED_PARTIAL; } else { return LOADED_ALL; } }
SliceMetadata { public int getLoadingState() { boolean hasHintPartial = SliceQuery.find(mSlice, null, HINT_PARTIAL, null) != null; if (!mListContent.isValid()) { return LOADED_NONE; } else if (hasHintPartial) { return LOADED_PARTIAL; } else { return LOADED_ALL; } } }
SliceMetadata { public int getLoadingState() { boolean hasHintPartial = SliceQuery.find(mSlice, null, HINT_PARTIAL, null) != null; if (!mListContent.isValid()) { return LOADED_NONE; } else if (hasHintPartial) { return LOADED_PARTIAL; } else { return LOADED_ALL; } } private  SliceMetadata(@NonNull Context context, @NonNull Slice slice); }
SliceMetadata { public int getLoadingState() { boolean hasHintPartial = SliceQuery.find(mSlice, null, HINT_PARTIAL, null) != null; if (!mListContent.isValid()) { return LOADED_NONE; } else if (hasHintPartial) { return LOADED_PARTIAL; } else { return LOADED_ALL; } } private  SliceMetadata(@NonNull Context context, @NonNull Slice slice); static SliceMetadata from(@NonNull Context context, @NonNull Slice slice); @Nullable List<SliceItem> getSliceActions(); @Nullable SliceAction getPrimaryAction(); @EventInfo.SliceRowType int getHeaderType(); boolean hasLargeMode(); List<SliceAction> getToggles(); @Nullable PendingIntent getInputRangeAction(); @Nullable Pair<Integer, Integer> getRange(); @NonNull int getRangeValue(); @Nullable List<String> getSliceKeywords(); int getLoadingState(); long getExpiry(); long getLastUpdatedTime(); boolean isPermissionSlice(); @Nullable @RestrictTo(RestrictTo.Scope.LIBRARY) static List<SliceItem> getSliceActions(@NonNull Slice slice); }
SliceMetadata { public int getLoadingState() { boolean hasHintPartial = SliceQuery.find(mSlice, null, HINT_PARTIAL, null) != null; if (!mListContent.isValid()) { return LOADED_NONE; } else if (hasHintPartial) { return LOADED_PARTIAL; } else { return LOADED_ALL; } } private  SliceMetadata(@NonNull Context context, @NonNull Slice slice); static SliceMetadata from(@NonNull Context context, @NonNull Slice slice); @Nullable List<SliceItem> getSliceActions(); @Nullable SliceAction getPrimaryAction(); @EventInfo.SliceRowType int getHeaderType(); boolean hasLargeMode(); List<SliceAction> getToggles(); @Nullable PendingIntent getInputRangeAction(); @Nullable Pair<Integer, Integer> getRange(); @NonNull int getRangeValue(); @Nullable List<String> getSliceKeywords(); int getLoadingState(); long getExpiry(); long getLastUpdatedTime(); boolean isPermissionSlice(); @Nullable @RestrictTo(RestrictTo.Scope.LIBRARY) static List<SliceItem> getSliceActions(@NonNull Slice slice); static final int LOADED_NONE; static final int LOADED_PARTIAL; static final int LOADED_ALL; }