I am developing new app I have implemented dot indicator by using following https://github.com/romandanylyk/PageIndicatorView library but I can't swipe to next page
below my current kotlin implementation code
class IntroductionPages: AppCompatActivity() {
var pager: ViewPager? =null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.introduction_page)
val pageIndicatorView: PageIndicatorView = findViewById(R.id.pageIndicatorView)
pageIndicatorView.count = 3 // specify total count of indicators
pageIndicatorView.selection = 0
pager?.addOnPageChangeListener(object : OnPageChangeListener {
override fun onPageScrolled(
position: Int,
positionOffset: Float,
positionOffsetPixels: Int
) { /*empty*/
}
override fun onPageSelected(position: Int) {
pageIndicatorView.selection = position
when(position){
0-> AnimationType.SLIDE
}
}
override fun onPageScrollStateChanged(state: Int) { /*empty*/
}
})
val textView= findViewById<TextView>(R.id.skip)
textView.setOnClickListener {
val intent = Intent(this, BookAppointment::class.java)
startActivity(intent)
}
}
Layout:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:attrs="http://schemas.android.com/apk/res-auto"
>
<ImageView
android:id="@+id/vector_1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:adjustViewBounds="true"
android:background="@drawable/vectors_1"
app:layout_constraintTop_toTopOf="parent"
tools:layout_editor_absoluteX="0dp" />
<ImageView
android:id="@+id/some_id"
android:layout_width="221dp"
android:layout_height="158dp"
android:background="@drawable/doctor_appointment"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="0.426"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.158" />
<TextView
android:id="@+id/search_doct"
android:layout_width="272dp"
android:layout_height="82dp"
android:gravity="center_horizontal|top"
android:text="@string/search_doct"
android:textAppearance="@style/search_doct"
app:layout_constraintHorizontal_bias="0.496"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/some_id" />
<TextView
android:id="@+id/get_list_of"
android:layout_width="217dp"
android:layout_height="wrap_content"
android:gravity="center_horizontal|top"
android:text="@string/get_list_of"
android:textAppearance="@style/get_list_of"
app:layout_constraintBottom_toBottomOf="@id/search_doct"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/search_doct" />
<com.rd.PageIndicatorView
android:id="@+id/pageIndicatorView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="0.477"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.801"
app:piv_animationType="scale"
app:piv_dynamicCount="true"
app:piv_interactiveAnimation="true"
app:piv_selectedColor="@color/gray_50"
app:piv_unselectedColor="@color/gray_300"
app:piv_viewPager="@id/viewPager"
attrs:piv_padding="12dp"
attrs:piv_radius="8dp" />
<TextView
android:layout_below="@id/pageIndicatorView"
android:id="@+id/skip"
android:layout_width="87dp"
android:layout_height="43dp"
android:gravity="center_horizontal|top"
android:text="Skip"
android:textAppearance="@style/skip"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintVertical_bias="0.93"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
my question is what I have to in order to implement correctly swipe function correctly so that I can swipe to next page
I want to implement this kind of approach

I don't understand your problem fully but I can see that you want a IntroSlider which should slide and dots should move with slide. So I have a IntroSlider which you can use and if you wish you can convert my java code with inbuilt java to kotlin converter in android studio. But I guess there will be no problem with java and kotlin both in your project. so here is the solution.