public class

SliceUtils.SerializeOptions

extends java.lang.Object

 java.lang.Object

↳androidx.slice.SliceUtils.SerializeOptions

Overview

Holds options for how to handle SliceItems that cannot be serialized.

Summary

Fields
public static final intMODE_CONVERT

Constant indicating that the SliceItem should be serialized as much as possible.

public static final intMODE_REMOVE

Constant indicating that the SliceItem should be removed when this format is encountered.

public static final intMODE_THROW

Constant indicating that the an java.lang.IllegalArgumentException should be thrown when this format is encountered.

Constructors
publicSerializeOptions()

Methods
public voidcheckThrow(java.lang.String format)

public intgetActionMode()

public Bitmap.CompressFormatgetFormat()

public intgetImageMode()

public intgetMaxHeight()

public intgetMaxWidth()

public intgetQuality()

public SliceUtils.SerializeOptionssetActionMode(int mode)

Sets how items should be handled.

public SliceUtils.SerializeOptionssetImageConversionFormat(Bitmap.CompressFormat format, int quality)

Sets the options to use when converting icons to be serialized.

public SliceUtils.SerializeOptionssetImageMode(int mode)

Sets how items should be handled.

public SliceUtils.SerializeOptionssetMaxImageHeight(int height)

Set the maximum height of an image to use when serializing.

public SliceUtils.SerializeOptionssetMaxImageWidth(int width)

Set the maximum width of an image to use when serializing.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Fields

public static final int MODE_THROW

Constant indicating that the an java.lang.IllegalArgumentException should be thrown when this format is encountered.

public static final int MODE_REMOVE

Constant indicating that the SliceItem should be removed when this format is encountered.

public static final int MODE_CONVERT

Constant indicating that the SliceItem should be serialized as much as possible.

For images this means they will be attempted to be serialized. For actions, the action will be removed but the content of the action will be serialized. The action may be triggered later on a de-serialized slice by binding the slice again and activating a pending-intent at the same location as the serialized action.

Constructors

public SerializeOptions()

Methods

public void checkThrow(java.lang.String format)

public int getActionMode()

public int getImageMode()

public int getMaxWidth()

public int getMaxHeight()

public Bitmap.CompressFormat getFormat()

public int getQuality()

public SliceUtils.SerializeOptions setActionMode(int mode)

Sets how items should be handled. The default mode is SliceUtils.SerializeOptions.MODE_THROW.

Parameters:

mode: The desired mode.

public SliceUtils.SerializeOptions setImageMode(int mode)

Sets how items should be handled. The default mode is SliceUtils.SerializeOptions.MODE_THROW.

Parameters:

mode: The desired mode.

public SliceUtils.SerializeOptions setMaxImageWidth(int width)

Set the maximum width of an image to use when serializing.

Will only be used if the SliceUtils.SerializeOptions.setImageMode(int) is set to SliceUtils.SerializeOptions.MODE_CONVERT. Any images larger than the maximum size will be scaled down to fit within that size. The default value is 1000.

public SliceUtils.SerializeOptions setMaxImageHeight(int height)

Set the maximum height of an image to use when serializing.

Will only be used if the SliceUtils.SerializeOptions.setImageMode(int) is set to SliceUtils.SerializeOptions.MODE_CONVERT. Any images larger than the maximum size will be scaled down to fit within that size. The default value is 1000.

public SliceUtils.SerializeOptions setImageConversionFormat(Bitmap.CompressFormat format, int quality)

Sets the options to use when converting icons to be serialized. Only used if the image mode is set to SliceUtils.SerializeOptions.MODE_CONVERT.

Parameters:

format: The format to encode images with, default is .
quality: The quality to use when encoding images.