Stay organized with collections Save and categorize content based on your preferences.

SizeFCompat

public final class SizeFCompat


Immutable class for describing width and height dimensions in some arbitrary unit. Width and height are finite values stored as a floating point representation.

This is a backward-compatible version of SizeF.

Summary

Public constructors

SizeFCompat(float width, float height)

Public methods

boolean
float

Get the height of the size (as an arbitrary unit).

float

Get the width of the size (as an arbitrary unit).

int
@NonNull SizeF
@RequiresApi(value = 21)
toSizeF()

Converts this SizeFCompat into a SizeF.

static @NonNull SizeFCompat
@RequiresApi(value = 21)
toSizeFCompat(@NonNull SizeF size)

Converts this SizeF into a SizeFCompat.

@NonNull String

Extension functions

final float

Returns "width", the first component of this SizeFCompat.

final float

Returns "height", the second component of this SizeFCompat.

Public constructors

SizeFCompat

public SizeFCompat(float width, float height)

Public methods

equals

public boolean equals(Object o)

getHeight

public float getHeight()

Get the height of the size (as an arbitrary unit).

Returns
float

height

getWidth

public float getWidth()

Get the width of the size (as an arbitrary unit).

Returns
float

width

hashCode

public int hashCode()

toSizeF

@RequiresApi(value = 21)
public @NonNull SizeF toSizeF()

Converts this SizeFCompat into a SizeF.

toSizeFCompat

@RequiresApi(value = 21)
public static @NonNull SizeFCompat toSizeFCompat(@NonNull SizeF size)

Converts this SizeF into a SizeFCompat.

toString

public @NonNull String toString()

Extension functions

SizeKt.component1

public final float SizeKt.component1(@NonNull SizeFCompat receiver)

Returns "width", the first component of this SizeFCompat.

This method allows to use destructuring declarations when working with sizes, for example:

val (w, h) = mySize

SizeKt.component2

public final float SizeKt.component2(@NonNull SizeFCompat receiver)

Returns "height", the second component of this SizeFCompat.

This method allows to use destructuring declarations when working with sizes, for example:

val (w, h) = mySize