netpromoterscore

NPS android library helps you to get the feedback you need from the users

Gradle Dependency:

implementation ‘com.github.quantumlibs:netpromoterscore:0.1.5’

Adding NPS layout in XML

<lib.quantum.nps.NPSRecyclerView
    android:id="@+id/nps_rv"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/text"
    android:orientation="horizontal"
    android:layout_centerHorizontal="true"
    app:shape="square"
    app:count="10"/>

Set layout attributes

  • for number of boxes

    app:count=”10″

  • set answer from layout

    app:answer=”3″

  • set answer from layout

    app:shape=”square” or app:shape=”circle”

Square type

Circle type

Set Selected Answer

npsRV.setSelectedAnswer(1)

Get Selected Answer

npsRV.getSelectedAnswer()

AnswerSelected Listener

npsRV.OnSelectAnswerListner(object : NPSRecyclerView.NPSAnswerSelectedListener {
        
        override fun onAnswerSelected(npsAnswer: Int) {
            Toast.makeText(context, ""+npsAnswer, Toast.LENGTH_SHORT).show()
        }
    })

GitHub

View Github