Skip to main content

Fastboard API

This page provides the API reference for the Fastboard SDK.

FastboardView class

getFastboard


_1
public Fastboard getFastboard()

Get the Fastboard object.

The Fastboard SDK does not support initializing a Fastboard instance directly. To get the Fastboard object, you need to add the FastboardView object to the app's layout, and then call the getFastboard method.

Note

Call this method to obtain the Fastboard object before calling other APIs.

Returns

The Fastboard object is returned when the method call is successful.

Fastboard class

The Fastboard class provides methods for creating FastRoom objects.

createFastRoom


_1
public FastRoom createFastRoom(FastRoomOptions roomOptions)

Create a FastRoom object.

Note

Call this method after obtaining the Fastboard object.

Parameters

  • roomOptions: Configuration options for the whiteboard room. See FastRoomOptions for details.

Returns

A FastRoom object is returned when the method call is successful.

preloadWhiteboardView


_3
public static void preloadWhiteboardView() {
_3
WhiteboardViewManager.get().preload();
_3
}

Preload the whiteboard view.

This method only takes effect when autoPreload in FastboardConfig is set to false. Successfully calling this method will consume memory to perform one whiteboard view preload, improving the speed of joining rooms next time.

destroy


_1
public void destroy()

Destroy the room and release resources.

setConfig


_1
public static void setConfig(FastboardConfig config)

Modifies the auxiliary configuration of the Fastboard object.

Parameters

  • config: The auxiliary configuration of the Fastboard object. See FastboardConfig.

FastRoomOptions

Whiteboard room configuration options.


_26
public class FastRoomOptions {
_26
private final String appId;
_26
private final String uuid;
_26
private final String token;
_26
private final String uid;
_26
private final boolean writable;
_26
_26
private final FastRegion fastRegion;
_26
_26
private Float containerSizeRatio;
_26
_26
private FastUserPayload userPayload;
_26
_26
public FastRoomOptions(String appId, String uuid, String token, String uid, FastRegion fastRegion) {
_26
this(appId, uuid, token, uid, fastRegion, true);
_26
}
_26
_26
public FastRoomOptions(String appId, String uuid, String token, String uid, FastRegion fastRegion, boolean writable) {
_26
this.appId = appId;
_26
this.uuid = uuid;
_26
this.token = token;
_26
this.uid = uid;
_26
this.fastRegion = fastRegion;
_26
this.writable = writable;
_26
}
_26
}

The FastRoomOptions class contains the following properties:

  • appId: String. App Identifier for the interactive whiteboard project. For details, see Get security credentials for your whiteboard project.
  • uuid: String. The UUID of the room, which is the unique identifier of the room. For details, see Create a room (POST) for the value of the uuid parameter in the response package body after the request is successful.
  • token: String. Room Token of the room, used for user authentication when joining the room. It can be obtained in the following ways:
    • Call the Generate a room token (POST) RESTful API.
    • uid: String. The unique identifier of a user in string format. The maximum length is 1,024 bytes. Ensure that the uid of each user in the same room is unique.
    • writable: boolean. Whether the user joins the whiteboard room in interactive mode:
      • true: Join the whiteboard room in interactive mode, that is, with read and write permissions.
      • false: Join the whiteboard room in subscription mode, that is, with read-only permission.
    • fastRegion: The data center, which must be the same as the data center you chose when creating the whiteboard room. See FastRegion.
  • containerSizeRatio: Float. In the local display window, the aspect ratio of the content is 0.56 by default, which is 9:16.
  • userPayload: User information displayed by the user's cursor, including the user's nickname and avatar. See FastUserPayload for details.

FastRegion

Data center, containing the following enumeration values:

  • CN_HZ: Hangzhou, China, the service area covers East Asia, Southeast Asia, and other areas not covered by the data center.

  • US_SV: Silicon Valley, USA, the service area covers North America and South America.

  • SG: Singapore, the service area covers Singapore, East Asia, and Southeast Asia.

  • IN_MUM: Mumbai, India, the service area covers India.

  • EU: London, UK, the service area covers Europe.

FastUserPayload


_13
public class FastUserPayload {
_13
private final String nickName;
_13
private final String avatar;
_13
_13
public FastUserPayload(String nickName) {
_13
this(nickName, null);
_13
}
_13
_13
public FastUserPayload(String nickName, String avatar) {
_13
this.nickName = nickName;
_13
this.avatar = avatar;
_13
}
_13
}

FastUserPayload object, used to store the user information displayed on the cursor, contains the following member variables:

  • nickName: String. The user's nickname displayed on the user's cursor.

  • avatar: String. (Optional) The user avatar displayed on the user cursor, the URL address corresponding to the avatar should be passed in.

FastboardConfig


_5
public class FastboardConfig {
_5
private final boolean enablePreload;
_5
private final int preloadCount;
_5
private final boolean autoPreload;
_5
}

The auxiliary configuration class of the Fastboard object, including the following attributes:

  • enablePreload: Boolean. Whether to enable whiteboard preloading:
    • true: Enable whiteboard preloading.
    • false: (Default) Disable whiteboard preloading.
  • preloadCount: Integer. The number of WebViews to preload, defaults to 0. The actual effect of this attribute is limited by the memory capacity. You need to adjust the settings appropriately according to the actual situation.
  • autoPreload: Boolean. This property only takes effect when enablePreload is true. Whether to enable automatic preloading:
    • true: (Default) Enable automatic preloading. After enabling, whiteboard views will be automatically preloaded to improve loading speed, but will occupy additional memory.
    • false: Disable automatic preloading. After disabling, you can call preloadWhiteboardView to manually perform preloading.

FastRoom class

The FastRoom class provides methods for managing interactive whiteboard real-time rooms.

join [1/2]


_1
public void join()

Join a whiteboard room.

Note

This method needs to be called after the FastRoom object is successfully created.

join [2/2]


_1
public void join(@Nullable OnRoomReadyCallback onRoomReadyCallback)

Join a whiteboard room.

Note

This method needs to be called after the FastRoom object is successfully created.

Parameters

  • onRoomReadyCallback: OnRoomReadyCallback interface instance. Passing in null means not to register the interface.

OnRoomReadyCallback

The OnRoomReadyCallback interface is used to send room event notifications to the app and includes the following member methods:


_1
void onRoomReady(FastRoom fastRoom);

Room ready callback.

Parameters

  • fastRoom: FastRoom object.

isReady


_1
public boolean isReady()

Get whether the room is ready.

After calling the join method, you need to call this method to get whether the room is ready. After the room is ready, other methods in the FastRoom class can be called to operate the whiteboard.

Returns

Is the room ready?

  • true: ready.
  • false: Not ready yet.

isWritable


_1
public boolean isWritable()

Get whether the local user's current interactive whiteboard real-time room is in interactive mode.

Returns

Get whether the local user is in interactive mode:

  • true: interactive mode, that is, with read and write permissions.
  • false: Subscription mode, that is, with read-only permissions.

redo


_1
public void redo()

Redo, that is, roll back the undo operation.

setWritable [1/2]


_1
public void setWritable(boolean writable)

Set whether the user is in interactive mode in the room.

Note

This method needs to be called after the room is ready.

Parameters

  • writable: whether the user is in interactive mode in the room:
    • true: interactive mode, that is, with read and write permissions.
    • false: Subscription mode, that is, with read-only permissions.

setWritable [2/2]


_1
public void setWritable(boolean writable, FastResult<Boolean> result)

Set whether the user is in interactive mode in the room.

Note

This method needs to be called after the room is ready.

Parameters

  • writable: whether the user is in interactive mode in the room:
    • true: interactive mode, that is, with read and write permissions.
    • false: Subscription mode, that is, with read-only permissions.
  • result: The result of the setWritable method call. See FastResult for details. Passing in the FastResult instance, the SDK will trigger the callback implemented in the FastResult interface and report whether the setWritable method call is successful; passing in null means not to listen to the callback.

registerApp

Registers a third-party window application to the whiteboard room.


_1
public void registerApp(FastRegisterAppParams params, FastResult<Boolean> result)

This method allows you to register external applications that can run as independent windows within the whiteboard.

Registration supports two methods:

  1. Local script registration: Uses local JavaScript code (recommended for its high reliability)
  2. Remote package registration: Uses a remote URL (may fail due to network issues)
Caution
  • You must complete the registration before joining the room to ensure the application loads correctly.
  • Ensure that all clients use the same version of the application to avoid runtime issues.
  • Register the application before joining the room.
  • Registered applications can be added to the room using getRoom().addApp().

Parameters

  • params: Registration parameters, including app configurations. See FastRegisterAppParams for details.
  • result: The result of the registerApp method call. See FastResult for details. If you pass a FastResult instance, the SDK triggers the callback implemented in the FastResult interface to report whether the registerApp method call was successful. Passing null means the callback is not listened to.

FastRegisterAppParams

A configuration class for registering third-party window app parameters.


_40
public class FastRegisterAppParams {
_40
private String javascriptString;
_40
private String kind;
_40
private String url;
_40
private Map<String, Object> appOptions;
_40
private String variable;
_40
_40
public FastRegisterAppParams(String javascriptString, String kind, String variable, Map<String, Object> appOptions) {
_40
this.javascriptString = javascriptString;
_40
this.kind = kind;
_40
this.appOptions = appOptions;
_40
this.variable = variable;
_40
}
_40
_40
public FastRegisterAppParams(String url, String kind, Map<String, Object> appOptions) {
_40
this.url = url;
_40
this.kind = kind;
_40
this.appOptions = appOptions;
_40
}
_40
_40
public String getJavascriptString() {
_40
return javascriptString;
_40
}
_40
_40
public String getKind() {
_40
return kind;
_40
}
_40
_40
public String getUrl() {
_40
return url;
_40
}
_40
_40
public Map<String, Object> getAppOptions() {
_40
return appOptions;
_40
}
_40
_40
public String getVariable() {
_40
return variable;
_40
}
_40
}

The FastRegisterAppParams class provides two registration methods:

  1. Local script registration: Registers using a local JavaScript string (recommended for its high reliability)
    • Use the FastRegisterAppParams(String javascriptString, String kind, String variable, Map<String, Object> appOptions) constructor
  2. Remote package registration: Registers using a published package's URL (may fail due to network issues)
    • Use the FastRegisterAppParams(String url, String kind, Map<String, Object> appOptions) constructor

The FastRegisterAppParams class includes the following properties:

  • javascriptString: String. Local JavaScript script code for local script registration.
  • kind: String. The name of the registered app, representing the type name of the app.
  • url: String. The URL address of the remote registration package for remote package registration.
  • appOptions: Map<String, Object>. Parameters passed during the initialization of the app instance. This configuration is not synchronized to other clients and is considered a local setting, often used to toggle debug mode.
  • variable: String. The variable name mounted on the window, appearing as window.variable after mounting.

undo


_1
public void undo()

Undo the previous operation.

setStrokeColor


_1
public void setStrokeColor(@ColorInt int color)

Set the line color.

Parameters

  • color: Integer. Line color, RGB format, for example 0x0000FF means blue

setAppliance


_1
public void setAppliance(FastAppliance fastAppliance)

Set the currently used whiteboard tool.

Parameters

FastAppliance

Whiteboard tool, containing the following enumeration values:

  • CLICKER(Appliance.CLICKER): Click tool. Currently mainly used for clicking content on HTML5 files.

  • SELECTOR(Appliance.SELECTOR): Select tool.

  • HAND(Appliance.HAND): Grab tool, used to move the view.

  • PENCIL(Appliance.PENCIL): Pencil.

  • RECTANGLE(Appliance.RECTANGLE): Rectangle tool.

  • ELLIPSE(Appliance.ELLIPSE): Ellipse tool.

  • TEXT(Appliance.TEXT): text tool.

  • ERASER(Appliance.ERASER): Eraser tool.

  • PENCIL_ERASER(Appliance.PENCIL_ERASER): Pencil eraser tool, used to erase local pencil strokes.

  • LASER_POINTER(Appliance.LASER_POINTER): Laser pointer.

  • ARROW(Appliance.ARROW): Arrow.

  • STRAIGHT(Appliance.STRAIGHT): Straight line.

  • PENTAGRAM(Appliance.SHAPE, ShapeType.Pentagram): Pentagram.

  • RHOMBUS(Appliance.SHAPE, ShapeType.Rhombus): rhombus.

  • TRIANGLE(Appliance.SHAPE, ShapeType.Triangle): triangle.

  • BUBBLE(Appliance.SHAPE, ShapeType.SpeechBalloon): Speech bubble.

  • OTHER_CLEAR(): Clear the whiteboard content.

setStrokeWidth


_1
public void setStrokeWidth(int width)

Set the width of the line.

Parameters

  • width: Integer. Line width (px).

cleanScene


_1
public void cleanScene()

Clear the whiteboard content.

setWritable


_1
public void setWritable(boolean writable)

Set whether the user is in interactive mode in the room.

Parameters

  • writable: boolean. Whether the user is in interactive mode:
    • true: interactive mode, that is, with read and write permissions.
    • false: Subscription mode, that is, with read-only permissions.

insertImage


_1
public void insertImage(String url, int width, int height)

Insert picture.

This method can insert and display the specified network image onto the current whiteboard page.

Parameters

  • url: String. The URL address of the image. Please ensure that the app client can access the URL, otherwise the image will not be displayed properly.
  • width: Integer. The width of the image (px).
  • height: Integer. The height of the image (px).

insertVideo


_1
public void insertVideo(String url, String title)

Insert and play audio and video in the whiteboard sub-window.

Parameters

  • url: URL address of audio and video files. Please ensure that the app client can access the URL, otherwise the audio and video files cannot be loaded normally.
  • title: window title.

insertStaticDoc


_1
public void insertStaticDoc(DocPage[] pages, String title, FastResult<String> result)

Inserts a static document into a whiteboard subwindow.

Parameters

  • pages: DocPage array. The page settings for the inserted document. See DocPage.
  • title: String. The title of the subwindow.
  • result: An object that implements the FastResult interface, used to handle the result of the method call. The SDK will use this object to report the result of the operation. If you do not need to listen to the callback, please pass in null.

DocPage


_6
public class DocPage {
_6
private String src;
_6
private String preview;
_6
private Double width;
_6
private Double height;
_6
}

A class for configuring the page settings for inserting documents. Includes the following attributes

  • src: String. The address of the image or dynamic PPT page.
    • Image: URL address, which can be generated by yourself or by the document conversion function. You can get the address from the image field returned by the query conversion task progress. Make sure the App client can access the URL, otherwise the image cannot be loaded normally.
    • Dynamic PPT page: URI address generated by the document conversion function.
  • preview: String. (Optional) URL address of the image or dynamic PPT preview image. The URL address of the dynamic PPT preview image can be obtained from the preview field returned by the query document conversion progress. After passing in, the preview image will be displayed on the left side of the App. Make sure the App client can access the URL, otherwise the preview image cannot be loaded normally.
  • width: Integer. The width of the inserted document in the whiteboard (px).
  • height: Integer. The height of the inserted document in the whiteboard (px).

insertPptx


_1
public void insertPptx(String taskUuid, String prefixUrl, String title, FastResult<String> result)

Insert a dynamic document in a whiteboard sub-window.

This method can insert dynamic HTML web pages converted by the document conversion function.

Parameters

  • taskUUID: String. The Task UUID of the document conversion task, which is the value of the uuid field in the response body when the initiate document conversion task request is successful.
  • prefixUrl: String. The prefix path of the converted result file address, which is the value of the prefix field in the response body when the query document conversion progress request is successful.
  • title: String. The title of the sub-window.
  • result: An object that implements the FastResult interface, used to handle the result of the method call. The SDK will use this object to report the result of the operation. If you do not need to listen to the callback, please pass in null.

insertDocs


_1
public void insertDocs(FastInsertDocParams params, FastResult<String> result)

Note

This method is deprecated since v1.6.0. Use insertStaticDoc or insertPptx instead.

Insert and display documents in the whiteboard subwindow.

After successfully initiating the document conversion task, you can call this method and pass in the relevant parameters of the converted document. The SDK will automatically create a sub-window, insert and display the converted document in pages.

Parameters

  • params: Insert the parameter settings of the document. See FastInsertDocParams for details.
  • result: insertDocs method call result. See FastResult for details. Passing in the FastResult instance, the SDK will trigger the callback implemented in the FastResult interface and report whether the insertDocs method call is successful; passing in null means not to listen to the callback.

FastInsertDocParams

Document parameter settings.


_9
public class FastInsertDocParams {
_9
private String taskUUID;
_9
private String taskToken;
_9
private FastRegion region;
_9
private ConverterType converterType;
_9
private String fileType;
_9
private Boolean dynamicDoc;
_9
private String title;
_9
}

The FastInsertDocParams class contains the following properties:

  • taskUUID: String. Task UUID of the document conversion task, that is, Initiate document conversion task API. When the request is successful, the uuid parameter in the response package body value.
  • taskToken: String. The Task Token of the document conversion task must be consistent with the Task Token passed in when Initiate document conversion task.
  • converterType: enumeration. The version of the document conversion service, the values are as follows:
  • fileType: String. Document type:
    • pdf: static document.
    • pptx: dynamic document.
  • dynamicDoc: boolean. Whether the document conversion task type is a dynamic conversion task.
  • title: String. Window title.

setFastStyle


_1
public void setFastStyle(FastStyle style)

Style the whiteboard user interface.

Parameters

  • style: The style of the whiteboard user interface. See FastStyle for details.

FastStyle

Whiteboard user interface style.


_30
public class FastStyle {
_30
private int mainColor;
_30
private boolean darkMode;
_30
_30
public FastStyle() {
_30
}
_30
_30
public int getMainColor() {
_30
return mainColor;
_30
}
_30
_30
public void setMainColor(@ColorInt int color) {
_30
this.mainColor = color;
_30
}
_30
_30
public boolean isDarkMode() {
_30
return darkMode;
_30
}
_30
_30
public void setDarkMode(boolean darkMode) {
_30
this.darkMode = darkMode;
_30
}
_30
_30
public FastStyle copy() {
_30
FastStyle style = new FastStyle();
_30
style.mainColor = mainColor;
_30
style.darkMode = darkMode;
_30
return style;
_30
}
_30
}

The FastStyle class contains the following member methods:

getMainColor

Gets the theme color of the whiteboard user interface.

Returns

The theme color for the whiteboard user interface.

setMainColor

Set the theme color of the whiteboard user interface.

This method can set the color of some button borders and prompt text when the whiteboard is loaded.

Parameters

  • color: The theme color of the whiteboard user interface, RGB format, for example 0x0000FF means blue.

isDarkMode

Gets whether the whiteboard user interface is in dark mode.

Returns

  • true: Whiteboard user interface is in dark mode.
  • false: The whiteboard user interface is in light mode.

setDarkMode

Set the whiteboard user interface to dark mode.

Parameters

  • darkMode: whether to use dark mode:

    • true: dark mode.
    • false: light mode.

setResource


_1
public void setResource(FastResource fastResource)

Set resources related to whiteboard color.

Parameters

  • fastResource: Whiteboard color-related resources. See FastResource for details.

FastResource

Resources related to whiteboard colors.


_14
public class FastResource {
_14
@ColorInt
_14
public int getBackgroundColor(boolean darkMode) {
_14
return color(darkMode
_14
? R.color.fast_dark_mode_bg
_14
: R.color.fast_light_mode_bg
_14
);
_14
}
_14
_14
@ColorInt
_14
public int getBoardBackgroundColor(boolean darkMode) {
_14
return getBackgroundColor(darkMode);
_14
}
_14
}

Contains the following member methods, all of which can be overridden to customize colors:

getBackgroundColor

Get the background color of the whiteboard control.

Parameters

  • darkMode: boolean. Whether the background color of the whiteboard control is dark mode:
    • true: dark mode.
    • false: light mode.

Returns

Hexadecimal color value.

getBoardBackgroundColor

Get the whiteboard background color.

Note

If you do not override this method, getBackgroundColor will be called by default.

Parameters

  • darkMode: boolean. Whether the whiteboard background color is dark mode:
    • true: dark mode.
    • false: light mode.

Returns

Hexadecimal color value.

FastUiSettings class

The FastUiSettings class provides methods for setting up the whiteboard user interface.

showRoomController


_1
public void showRoomController(ControllerId... ids)

Demonstrates controls on a whiteboard user interface.

Parameters

  • ids: The identifier of the control. See ControllerId for details.

hideRoomController


_1
public void hideRoomController(ControllerId... ids)

Hides controls on the whiteboard user interface.

Parameters

  • ids: The identifier of the control. See ControllerId for details.

ControllerId

Controls on the whiteboard user interface, including the following enumeration values:

  • RedoUndo: redo and undo buttons.
  • ToolBox: Toolbar.
  • PageIndicator: Page indicator.

setToolsExpandAppliances


_1
public static void setToolsExpandAppliances(List<List<FastAppliance>> toolsExpandAppliances)

Sets the tool set included in the toolbar in expanded mode.

If the default toolbar provided by Fastboard SDK cannot meet your needs, you can call this method to customize the tools contained in the toolbar and set the toolbar to expand mode. You can pass in a secondary tool list in this method. The elements in the primary list will be expanded and displayed on the toolbar, and the elements in the secondary list will be collapsed.

After successfully calling the setToolsExpandAppliances method, if you need to switch the toolbar to collapsed mode, you can call setToolboxExpand.

Note

This method needs to be called before joining the whiteboard room.

Parameters

  • toolsExpandAppliances: Tools included in the toolbar in expanded mode. See FastAppliance for details.

Example


_25
ArrayList<List<FastAppliance>> config = new ArrayList<>();
_25
config.add(Arrays.asList(
_25
FastAppliance.CLICKER,
_25
FastAppliance.PENCIL,
_25
FastAppliance.TEXT,
_25
FastAppliance.SELECTOR,
_25
FastAppliance.ERASER
_25
));
_25
config.add(Arrays.asList(FastAppliance.SELECTOR));
_25
config.add(Arrays.asList(FastAppliance.PENCIL));
_25
config.add(Arrays.asList(FastAppliance.TEXT));
_25
config.add(Arrays.asList(FastAppliance.ERASER));
_25
config.add(Arrays.asList(
_25
FastAppliance.STRAIGHT,
_25
FastAppliance.ARROW,
_25
FastAppliance.RECTANGLE,
_25
FastAppliance.ELLIPSE,
_25
FastAppliance.PENTAGRAM,
_25
FastAppliance.RHOMBUS,
_25
FastAppliance.BUBBLE,
_25
FastAppliance.TRIANGLE
_25
));
_25
config.add(Arrays.asList(FastAppliance.OTHER_CLEAR));
_25
_25
FastUiSettings.setToolsExpandAppliances(config);

setToolsCollapseAppliances


_1
public static void setToolsCollapseAppliances(List<FastAppliance> toolsCollapseAppliances)

Sets the tool set included in the toolbar in collapsed mode.

If the default toolbar provided by Fastboard SDK cannot meet your needs, you can call this method to customize the tools included in the toolbar and set the toolbar to fold mode. You can pass in a first-level tool list in this method, and the elements in the list will be collapsed on the toolbar by default.

After successfully calling the setToolsCollapseAppliances method, if you need to switch the toolbar to expanded mode, you can call setToolboxExpand.

Note

This method needs to be called before joining the whiteboard room.

Parameters

  • toolsCollapseAppliances: Tools included in the whiteboard toolbar. See FastAppliance for details.

Example


_9
ArrayList<FastAppliance> collapseAppliances = new ArrayList<>();
_9
collapseAppliances.add(FastAppliance.PENCIL);
_9
collapseAppliances.add(FastAppliance.ERASER);
_9
collapseAppliances.add(FastAppliance.ARROW);
_9
collapseAppliances.add(FastAppliance.SELECTOR);
_9
collapseAppliances.add(FastAppliance.TEXT);
_9
collapseAppliances.add(FastAppliance.OTHER_CLEAR);
_9
_9
FastUiSettings.setToolsCollapseAppliances(collapseAppliances);

setToolsColors


_1
public static void setToolsColors(List<Integer> toolsColors)

Set the color used by the whiteboard tool.

This method sets the color of graphics, lines, or text drawn using the whiteboard tool.

Note

This method needs to be called before joining the whiteboard room.

Parameters

  • toolsColors: Color of whiteboard tools, RGB format, for example 0x0000FF means blue.

setStrokeRange


_1
public void setStrokeRange(int min, int max)

Sets the range for the line width slider in the toolbox.

This method configures the minimum and maximum values of the line width slider in the toolbox extension panel. Users can adjust the line width within this range when using drawing tools like pencils, rectangles, circles, etc. The default range is [1, 24].

Caution
  • The line width slider will be restricted to the specified range.
  • If the current line width exceeds the new range, it will be constrained within the new range.
  • This setting affects all drawing tools that support line width adjustments.

Parameters

  • min: int. The minimum value for the line width (inclusive).
  • max: int. The maximum value for the line width (inclusive).

setToolboxEdgeMargin


_1
public void setToolboxEdgeMargin(int margin)

Set the margins between the whiteboard toolbar and the sides.

The definition of the margin is determined by the toolbar position set in setToolboxGravity:

  • The toolbar is located on the left side of the whiteboard: the margin refers to the distance between the left side of the toolbar and the left side of the whiteboard.
  • The toolbar is located on the right side of the whiteboard: the margin refers to the distance between the right side of the toolbar and the right side of the whiteboard.

Parameters

  • margin: Integer. The distance between the toolbar and the side of the whiteboard, in px.

setToolboxGravity


_1
public void setToolboxGravity(int gravity)

Set the position of the toolbar on the whiteboard.

Parameters

  • gravity: The position of the toolbar on the whiteboard:

    • Gravity.LEFT: left.
    • Gravity.RIGHT: Right.

setToolboxExpand


_1
public void setToolboxExpand(boolean expand)

Set whether to expand the toolbar.

The default display state of the toolbar is related to the device. It is expanded by default on tablets and collapsed by default on mobile phones. You can call this method to modify the display state of the toolbar.

Parameters

  • expand: Whether to expand the toolbar:
    • true: expand.
    • false: fold.

FastLogger Class

The FastLogger class provides a flexible whiteboard runtime log recording tool that can easily record four different levels of log information: debuginfowarnerror. TheFastLogger class uses a Logger interface and provides a default implementation DefaultLogger to use the system's Log class.

setLogger


_1
public static void setLogger(Logger logger)

Set custom logger.

Parameters

  • logger: The logger instance. If you need to customize the logger, you need to pass in an implementation class of the Logger interface, see Logger; passing in null will result in using the system default logger.

Logger

Logger specification, including recording methods for all log levels.

debug


_1
static void debug(String msg)

Records a debug log.

Parameters

  • msg: String. Log message.

info


_1
static void info(String msg)

Records an info log.

Parameters

  • msg: String. Log message.

warn


_1
static void warn(String msg)

Records a warn log.

Parameters

  • msg: String. Log message.

error


_1
static void error(String msg)

Records an error.

Parameters

  • msg: String. Log message.

FastResult

The result of the method call.


_4
public interface FastResult<T> {
_4
void onSuccess(T value);
_4
void onError(Exception exception);
_4
}

The FastResult interface reports the results of method calls and includes the following callback methods:

  • onSuccess: callback when the method call is successful.
  • onError: callback when an error occurs.