-
public class SizeSelectorsStatic utilities to create, join and merge SizeSelectors instances.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceSizeSelectors.FilterA size constraint to easily filter outsizes in a list.
-
Method Summary
Modifier and Type Method Description static SizeSelectorwithFilter(@NonNull() SizeSelectors.Filter filter)Returns a new SizeSelector with the given Filter.This kind of selector will respect the order in the source array. static SizeSelectormaxWidth(int width)Returns a new SizeSelector that keeps only sizeswhose width is at most equal to the given width. static SizeSelectorminWidth(int width)Returns a new SizeSelector that keeps only sizeswhose width is at least equal to the given width. static SizeSelectormaxHeight(int height)Returns a new SizeSelector that keeps only sizeswhose height is at most equal to the given height. static SizeSelectorminHeight(int height)Returns a new SizeSelector that keeps only sizeswhose height is at least equal to the given height. static SizeSelectoraspectRatio(AspectRatio ratio, float delta)Returns a new SizeSelector that keeps only sizeswhich respect the given AspectRatio. static SizeSelectorbiggest()Returns a SizeSelector that will order sizes fromthe biggest to the smallest. static SizeSelectorsmallest()Returns a SizeSelector that will order sizes fromthe smallest to the biggest. static SizeSelectormaxArea(int area)Returns a new SizeSelector that keeps only sizeswhose area is at most equal to the given area in pixels. static SizeSelectorminArea(int area)Returns a new SizeSelector that keeps only sizeswhose area is at least equal to the given area in pixels. static SizeSelectorand(Array<SizeSelector> selectors)Joins all the given selectors to create a new one that returnsthe intersection of all the inputs. static SizeSelectoror(Array<SizeSelector> selectors)Creates a new SizeSelector that 'or's the given filters.If the first selector returns an empty list, the next selector is queried,and so on until a non-empty list is found. -
-
Method Detail
-
withFilter
@NonNull() static SizeSelector withFilter(@NonNull() SizeSelectors.Filter filter)
Returns a new SizeSelector with the given Filter.This kind of selector will respect the order in the source array.
- Parameters:
filter- a filter
-
maxWidth
@NonNull() static SizeSelector maxWidth(int width)
Returns a new SizeSelector that keeps only sizeswhose width is at most equal to the given width.
- Parameters:
width- the max width
-
minWidth
@NonNull() static SizeSelector minWidth(int width)
Returns a new SizeSelector that keeps only sizeswhose width is at least equal to the given width.
- Parameters:
width- the min width
-
maxHeight
@NonNull() static SizeSelector maxHeight(int height)
Returns a new SizeSelector that keeps only sizeswhose height is at most equal to the given height.
- Parameters:
height- the max height
-
minHeight
@NonNull() static SizeSelector minHeight(int height)
Returns a new SizeSelector that keeps only sizeswhose height is at least equal to the given height.
- Parameters:
height- the min height
-
aspectRatio
@NonNull() static SizeSelector aspectRatio(AspectRatio ratio, float delta)
Returns a new SizeSelector that keeps only sizeswhich respect the given AspectRatio. You can pass a tolerancevalue to include aspect ratios that are slightly different.
- Parameters:
ratio- the desired aspect ratiodelta- a small tolerance value
-
biggest
@NonNull() static SizeSelector biggest()
Returns a SizeSelector that will order sizes fromthe biggest to the smallest. This means that the biggest size will be taken.
-
smallest
@NonNull() static SizeSelector smallest()
Returns a SizeSelector that will order sizes fromthe smallest to the biggest. This means that the smallest size will be taken.
-
maxArea
@NonNull() static SizeSelector maxArea(int area)
Returns a new SizeSelector that keeps only sizeswhose area is at most equal to the given area in pixels.
- Parameters:
area- the max area
-
minArea
@NonNull() static SizeSelector minArea(int area)
Returns a new SizeSelector that keeps only sizeswhose area is at least equal to the given area in pixels.
- Parameters:
area- the min area
-
and
@NonNull() static SizeSelector and(Array<SizeSelector> selectors)
Joins all the given selectors to create a new one that returnsthe intersection of all the inputs. Basically, all constraints arerespected.Keep in mind there is good chance that the final list will be empty.
- Parameters:
selectors- input selectors
-
or
@NonNull() static SizeSelector or(Array<SizeSelector> selectors)
Creates a new SizeSelector that 'or's the given filters.If the first selector returns an empty list, the next selector is queried,and so on until a non-empty list is found.
- Parameters:
selectors- input selectors
-
-
-
-