Skip to main content
Samsung Developer Program

Implement an Edge Immersive Panel

You can implement an Edge Immersive panel into your app and distribute your app to users. 

Requirements

Implementing an Edge Immersive panel in your app requires:

  • Your Edge-integrated app:
    • Must specify the panel layout in activity code.
    • Must set a subview.
  • User devices must have either right and left curved Edge screens or right-only curved Edge screens.

Note: We recommend that you have a single depth (default setting).

Set an Edge Immersive Panel Subwindow

To make available an Edge Immersive panel as a subwindow in the curved Edge screen area of your app's UI, set a layout resource or a view into the subwindow via SlookCocktailSubWindow class setSubContentView method. To display or hide the panel, set the boolean com.samsung.android.cocktail.subwindow.enable metadata in the AndroidManifest.xml file.

The following example code shows how to specify a layout resource for an Edge Immersive Panel:

public class ImmersiveModeActivity extends Activity { 
    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
        super.onCreate(savedInstanceState); 
        Slook slook = new Slook(); 
        try { 
            slook.initialize(this); 
        } catch (SsdkUnsupportedException e) { 
            return; 
        } 
        if (slook.isFeatureEnabled(Slook.COCKTAIL_BAR)) { 
            /* If the device supports Edge Immersive Panels, set up the sub-window. */ 
            setContentView(R.layout.expaneded_activity_main); 
            SlookCocktailSubWindow.setSubContentView(this, R.layout.sub_view); 
        } else { 
            /* If the device does not support Edge Immersive panels. */
            setContentView(R.layout.activity_main); 
            ...
        } 
    }
}

The following example code shows how to enable an Edge Immersive Panel subwindow:

/AndroidManifest.xml 
<activity 
...
<meta-data 
    android:name="com.samsung.android.cocktail.subwindow.enable" 
    android:value="true" /> 

</activity>

The following example code shows how to disable an Edge Immersive Panel subview:

/AndroidManifest.xml 
<activity 
...
<meta-data 
    android:name="com.samsung.android.cocktail.subwindow.enable" 
    android:value="false" /> 

</activity>

Vertical and Horizontal Layout Resources

Edge Immersive panels should have a vertical layout and a horizontal layout. When implementing a ListView in RemoteViews, you must implement a ListView for the horizontal layout.

The Android Framework does not support HorizontalListView for widgets; therefore, the Samsung Framework has included a HorizontalListView widget for RemoteViews. You can add layout.xml code that implements HorizontalListView in the layout-land folder in the res directory.

The following example code shows how to specify a vertical layout in /res/layout/layout.xml:

<ListView
    android:id="@+id/widgetlist"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

The following example code shows how to specify a horizontal layout in /res/layout-land/layout.xml:

<HorizontalListView
    android:id="@+id/widgetlist"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />
  • Was this article helpful?