Overview

Features

LG QSlide APIs help developers to make their applications shown in the floating window. The basic features of LG QSlide are as follows:

  • Switching the mode between floating and full screen window
  • Adjusting transparency, size and position of the floating window
  • Customizing styles of the floating window
  • Adding the application’s launch icon to Notification bar

Activity Lifecycle

To make an activity support LG QSlide features, the activity must extend from the FloatableActivity.

FloatableActivity has two additional callbacks to get events for mode switching between full screen mode and floating window mode. It also provides callbacks inherited from Activity.

The following figures show the lifecycle of FloatableActivity.

 

mobile_qslide_develop_1.png

 

When the activity is requested to switch into the floating window mode, the task of the activity is brought back to background and the activity itself is destroyed. This means that its onPause(), onStop() and onDestroy() callbacks are invoked during the switching.

 

When the switching is completed, activity's onAttachedToFloatingWindow() callback is invoked. The floating window will close when the display mode switches back to the full screen mode or the activity shuts down. Activity’s onDetachedFromFloatingWindow() is invoked whenever the window closes.

If users have requested to switch back to the full screen mode, the activity is re-launched with the same intent that was used to start the original activity. On the other hand, the activity shuts down directly and is eligible for garbage collection if the floating window is finished.

 

Even if the activity's onDestroy() is invoked, the instance of FloatableActivity class is NOT removed from memory while in floating window mode. It is because a service named FloatingWindowService holds the reference to the instance. Since the reference is being held, the instance is not eligible for garbage collection. This means that developers can still use methods defined in the Activity class such as startActivity(), sendBroadcast() and so on, while running in floating mode.

 

If activity’s setDontFinishOnFloatingMode(true) is invoked, the activity lifecycle becomes slightly different from the above. The following figure shows the lifecycle in that case.

 

mobile_qslide_develop_2.png

 

The activity is not destroyed when switching into the floating mode. Instead, it remains in the stopped state. When returning to the full screen mode, the same activity is awaken.

For detailed description for setDontFinishOnFloatingMode(), please refer to the API references.

Navigation