Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Choosing the Floating player mode in the dashboard, allows the player to stay present on the screen and keep playing even after its original position has been scrolled out of view by “floating” at a fixed position on the screen. The floating position can also be selected in the dashboard from a pre defined set of options.

Floating Scope

In general, the floating behavior and configuration is controlled from the dashboard but in order to provide flexibility to the application developers, they are the ones who define the borders that will limit the floating behavior by providing a Floating Scope. Her's a visual illustration:

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/main_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <include
        android:id="@+id/app_bar"
        layout="@layout/app_bar"
        />

    <FrameLayout
        android:id="@+id/floating_scope"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/aniview_gray"
        >

        <androidx.core.widget.NestedScrollView
            android:id="@+id/screen_content"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            >

            <!--Screen content here-->

        </androidx.core.widget.NestedScrollView>

    </FrameLayout>

</androidx.constraintlayout.widget.ConstraintLayout>

The scope is a ViewGroup, preferably a FrameLayout, that should be provided by invoking AdPlayerPlacement.setFloatingScope(scopeViewGroup):

Important: Floating behavior will not be available without providing a scope!

A scope that extends beyond the limits of the displayed area will cause the player to float off the screen and be cut off or even not visible at all.

Kotlin

val floatingScope = root.findViewById<ViewGroup>(R.id.floating_scope)
root.findViewById<AdPlayerPlacementView>(R.id.ad_1).setFloatingScope(floatingScope)

Java

ViewGroup floatingScope = root.findViewById(R.id.floating_scope)
root.findViewById(R.id.ad_1).setFloatingScope(floatingScope)

Note that a floating scope must allow more than one child view and therefore cannot be one of the following types: RecyclerView, ListView, ScrollView, NestedScrollView.

A floating scope can be set only once and cannot be changed.

  • No labels