Customer Display ================= 1. Double Screen Display Scheme for RK Platform ++++++++++++++++++++++++++++++++++++++++++++++++ There are two ways of dual screen displaying: Android Presentation and RK dualscreen. We will focus on Android Presentation. Android Presentation is a dual-screen solution provided by Google, which implements the distribution of VOP at the View level. The logic is controlled on the same APP. 1.1 Introduction Android Presentation ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Presentation is a class developed by Android for dual-screen display. It can be achieved in an APK, by giving Presentation a separate layout of view to achieve the same APK in the main screen and sub-screen display different view to achieve remarkable results. It works by calling the getDisplays method of DisplayManagerService to get the second display device. Pass the second display device as a parameter to Presentation, then implement its UI content in Presentation, and finally call the show method of Presentation to display the UI content on the second display device. The iMin models supporting dual screens are D1w-702, D3-504, D3-505, D3-506, D1w-703, D4-502, D4-504 and D4-505 1.2 Introduction API ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ **Official API and sample documentation:** https://developer.android.com/reference/android/app/Presentation.html **Domestic documentation:** http://www.android-doc.com/reference/android/app/Presentation.html Source code & demo: `Link Customer Display demo downloads `_ Presentation is a special dialog type officially provided by Google for displaying specific content on other non-home screen displays. When it is created, it needs to bind the display screen and configure context and resource according to the target display screen and its size. 1.3 Binding Display ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ * Obtain and bind through the **MediaRouter** interface .. code-block:: java :linenos: :emphasize-lines: 1 MediaRouter mediaRouter =(MediaRouter) context.getSystemService(Context.MEDIA_ROUTER_SERVICE); MediaRouter.RouteInfo route = mediaRouter.getSelectedRoute(); if(route !=null){ Display presentationDisplay = route.getPresentationDisplay(); if(presentationDisplay !=null){ Presentation presentation =new MyPresentation(context, presentationDisplay); presentation.show(); * Get and bind through the **DisplayManager** interface .. code-block:: java :linenos: :emphasize-lines: 1 DisplayManager displayManager =(DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE); Display[] presentationDisplays = displayManager.getDisplays(DisplayManager.DISPLAY_CATEGORY_PRESENTATION); if(presentationDisplays.length >0){ // If there is more than one suitable presentation display, then we could consider // giving the user a choice. For this example, we simply choose the first display // which is the one the system recommends as the preferred presentation display. Display display = presentationDisplays[0]; Presentation presentation =new MyPresentation(context, presentationDisplay); presentation.show(); } 1.4 Create Presentation ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. literalinclude:: ../code/Presentation.java :language: java :emphasize-lines: 1-17 :linenos: 1.5 Setting the secondary screen does not exit with the main screen ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Usually Presentation is created to pass in the context of Activity, and the sub-screen will be displayed or hidden with the activity created to create a global sub-screen, which needs to add system pop-up window privileges to Presentation. As mentioned earlier, the context of the incoming Presentation can be Application or Service, provided that the system pop-up window permissions must be added, otherwise it will crash, so that Presentation can be newly created anywhere. * Add permissions to AndroidManifest.XML .. code-block:: java :linenos: :emphasize-lines: 1 * Add code to Presentation .. code-block:: java :linenos: :emphasize-lines: 1 getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT); .. note:: The system bullet window privileges of the Presentation will cover the ordinary Presentation, causing it unable to display; please dismiss the global Presentation before displaying the ordinary secondary screen, in order to make the switching smooth, the following code is recommended: 2. Double Screen Display Scheme for D1/D1 Pro/Falcon 1 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Customers can refer to the demo and operating instructions below for docking `Link Double Screen Display Scheme Demo `_ **D1/D1 Pro/Falcon 1 ScreenSDK** **1. Initialization of SDK calls** Function:sendLCDCommand Remarks:Send LCD control commands .. code-block:: java :linenos: :emphasize-lines: 1 void sendLCDCommand(int flag); transfer:ILcdManager.getInstance(this).sendLCDString(int flag) parameter: flag –> 1 initialization、2 Wake up LCD、3 hibernate LCD、4 clear screen **2. Send a string to display on Secondary screen** Function:sendLCDString Remarks:Send a string to display on Secondary screen .. code-block:: java :linenos: :emphasize-lines: 1 void sendLCDString(String string); transfer:ILcdManager.getInstance(this).sendLCDString(String string); parameter: string –> string The content of the displayed string can display up to 5 Chinese characters or 10 English characters **3. Send a multi-line secondary screen content string** Function:sendLCDMultiString Remarks:Send a multi-line secondary screen content string .. code-block:: java :linenos: :emphasize-lines: 1 void sendLCDMultiString(in String[] text, in int[] align); transfer: ILcdManager.getInstance(this).sendLCDMultiString(in String[] text, in int[] align); parameter: test –> The content of each line of the multi-line secondary screen, the content of each line can be empty, and only occupies space at this time align –> The weight of the content of each row of the secondary screen (0 left, 1 middle, 2 right) **4. Send double-line secondary screen content string** Function:sendLCDDoubleString Remarks:Send double-line secondary screen content string .. code-block:: java :linenos: :emphasize-lines: 1 void sendLCDDoubleString(String topText, String bottomText); transfer: ILcdManager.getInstance(this).sendLCDDoubleString(String topText, String bottomText); parameter: topText/bottomText –> String displayed on the secondary screen **5. Send a picture to display on the secondary screen** Function:sendLCDBitmap Remarks:Send double-line secondary screen content string .. code-block:: java :linenos: :emphasize-lines: 1 void sendLCDBitmap(in Bitmap bitmap) transfer: ILcdManager.getInstance(this).sendLCDBitmap(in Bitmap bitmap); parameter: bitmap –> bitmap The displayed image object, with a maximum size of 240*320 pixels **6. set font size** Function:setTextSize Remarks:set font size .. code-block:: java :linenos: :emphasize-lines: 1 void setTextSize(in size) transfer: ILcdManager.getInstance(this).setTextSize(in size); parameter: size –> size Do not set too small or too large font default 55