Nonstop Kotlin SDK

Points Widget

How to Use

Include via XML:

Centered

    <com.nonstop.widget.NonstopPointsView
        android:id="@+id/demo_widget"
        android:layout_width="match_parent"
        android:layout_height="80dp"
        android:gravity="center"/>

Left Aligned

    <com.nonstop.widget.NonstopPointsView
        android:id="@+id/demo_widget"
        android:layout_width="match_parent"
        android:layout_height="80dp"
        app:roundingStyle="left"
        android:gravity="end|center_vertical"
        app:dropdownAlignment="left"/>

Note: android:gravity is subject to the usual limitations of this property (e.g. it works well inside a LinearLayout but not inside a FrameLayout)

Additional Attributes

  • app:backgroundBorderWidth - (Default value: 4) Changing this allows the app to customise how wide the border of the widget is. In general, we'd recommend leaving this at it's default value on mobile and potentially increasing on OTT.
  • app:canBeDisabled - (Default value: true) Determines whether the widget will change appearance when the user exceeds their points limit for the day. This should be set to false in the app's menu.
  • app:roundingStyle - (Default value: BOTH) Determines which sides of the widget are rounded.
  • app:dropdownAlignment - (Default value: BOTTOM) Determines where the dropdown message is displayed relative to the widget. In general, this should either be BOTTOM for center aligned widgets or LEFT for left aligned widgets.
  • app:dropdownEnabled - (Default value: true) Determines whether the widget will display dropdown messages to the user in certain scenarios.
  • app:clickable - (Default value: true) Determines whether the widget can be tapped to display dropdown message.

Methods

showMessage

    var pointsWidget = findViewById(R.id.demo_widget)
    pointsWidget.showMessage()

This function can be used to force the points widget to display the message it most recently received from the server. Note that if no message has been received then no message will be displayed.

removeMessage

    var pointsWidget = findViewById(R.id.demo_widget)
    pointsWidget.showMessage()

This function can be used to force the points widget to remove the currently visible message it is displaying. Note that if no message is currently displayed this function has no effect.

In this document