Kotlin(Android) Typing Indicator or Wait Progress Animation – Coding Shiksha

Kotlin(Android) Typing Indicator or Wait Progress Animation – Coding Shiksha

Welcome folks I am back with another block post this blog post I will be talking about a very special Kotlin library which allows you to embed typing wait animation for typing progress progress animation in your Android applications so you have seen these typing progress animations in modern chatting application such as WhatsApp Facebook Messenger Instagram etc so all the starting applications integrate these modern typing progress animation so whenever a user type a message typing indicator is shown to other user which is receiving a message saying that way better User experience is there in in the Android application so if you want to integrate this effect into your own chatting application then you can use this library all the source code of this application is given in this tutorial so just copy paste the source code and at it for extend this application accordingly to your needs

 

Demo

 

 

How to use:

Just put it in your xml layout. It can’t get any easier than that.

 <com.udevel.widgetlab.TypingIndicatorView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"/>

 

Gradle:

Add to your project level build.gradle’s allprojects

allprojects {
  repositories {
    ...
    maven { url 'https://jitpack.io' }
  }
}

 

Next add to your module level (app) build.gradle’s dependencies block like this

dependencies {
          compile 'com.github.uDevel:widgetlab:0.9.7'
}

 

 

Real World Example Code

 

activity_main.xml

 

<android.support.v4.view.ViewPager
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/view_pager"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.v4.view.PagerTabStrip
        android:id="@+id/pager_tab_strip"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="top"
        android:background="?attr/colorPrimary"
        android:paddingBottom="12dp"
        android:paddingTop="12dp"
        android:textColor="#fff"/>
</android.support.v4.view.ViewPager>

 

fragment_demo_atrribute.xml

 

<?xml version="1.0" encoding="utf-8"?>
<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:orientation="vertical"
        tools:context=".MainActivity">

        <android.support.v4.widget.Space
            android:layout_width="0dp"
            android:layout_height="20dp"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="8dp"
            android:text="Animation order: sequence, circular, last one first"/>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

            <com.udevel.widgetlab.TypingIndicatorView
                android:id="@+id/typing_indicator_view_11"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_margin="8dp"
                app:animationOrder="sequence"/>

            <com.udevel.widgetlab.TypingIndicatorView
                android:id="@+id/typing_indicator_view_12"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_margin="8dp"
                app:animationOrder="circular"/>

            <com.udevel.widgetlab.TypingIndicatorView
                android:id="@+id/typing_indicator_view_13"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_margin="8dp"
                app:animationOrder="lastOneFirst"/>
        </LinearLayout>

        <android.support.v4.widget.Space
            android:layout_width="0dp"
            android:layout_height="20dp"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="8dp"
            android:gravity="center"
            android:text="Animation type: \ndefault(grow), wink,\ndisappear, sliding\nbouncing sliding"/>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

            <com.udevel.widgetlab.TypingIndicatorView
                android:id="@+id/typing_indicator_view_61"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_margin="8dp"
                android:padding="4dp"
                app:animationOrder="sequence"
                app:backgroundColor="#eaeaea"
                app:backgroundType="rounded"
                app:dotColor="#a4a4a4"
                app:showBackground="true"/>

            <com.udevel.widgetlab.TypingIndicatorView
                android:id="@+id/typing_indicator_view_62"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_margin="8dp"
                android:padding="4dp"
                app:animationOrder="sequence"
                app:backgroundColor="#eaeaea"
                app:backgroundType="rounded"
                app:dotAnimationType="Wink"
                app:dotColor="#a4a4a4"
                app:showBackground="true"/>
        </LinearLayout>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

            <com.udevel.widgetlab.TypingIndicatorView
                android:id="@+id/typing_indicator_view_63"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_margin="8dp"
                android:padding="4dp"
                app:animationOrder="sequence"
                app:backgroundColor="#eaeaea"
                app:backgroundType="rounded"
                app:dotAnimationType="Disappear"
                app:dotColor="#a4a4a4"
                app:showBackground="true"/>

            <com.udevel.widgetlab.TypingIndicatorView
                android:id="@+id/typing_indicator_view_64"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_margin="8dp"
                android:padding="4dp"
                app:animationOrder="sequence"
                app:backgroundColor="#eaeaea"
                app:backgroundType="rounded"
                app:dotAnimationType="Sliding"
                app:dotColor="#a4a4a4"
                app:showBackground="true"/>
        </LinearLayout>

        <com.udevel.widgetlab.TypingIndicatorView
            android:id="@+id/typing_indicator_view_bounce"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_margin="8dp"
            android:padding="4dp"
            app:animateFrequency="800"
            app:animationOrder="sequence"
            app:backgroundColor="#eaeaea"
            app:backgroundType="rounded"
            app:dotAnimationDuration="2000"
            app:dotAnimationType="BouncingSliding"
            app:dotColor="#a4a4a4"
            app:showBackground="true"/>

        <android.support.v4.widget.Space
            android:layout_width="0dp"
            android:layout_height="20dp"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="8dp"
            android:text="Dot Animation duration: default, 200, 2000 "/>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

            <com.udevel.widgetlab.TypingIndicatorView
                android:id="@+id/typing_indicator_view_71"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_margin="8dp"
                android:padding="4dp"
                app:animationOrder="sequence"
                app:backgroundColor="#eaeaea"
                app:backgroundType="rounded"
                app:dotAnimationType="Sliding"
                app:dotColor="#a4a4a4"
                app:showBackground="true"/>

            <com.udevel.widgetlab.TypingIndicatorView
                android:id="@+id/typing_indicator_view_72"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_margin="8dp"
                android:padding="4dp"
                app:animationOrder="sequence"
                app:backgroundColor="#eaeaea"
                app:backgroundType="rounded"
                app:dotAnimationDuration="200"
                app:dotAnimationType="Sliding"
                app:dotColor="#a4a4a4"
                app:showBackground="true"/>

            <com.udevel.widgetlab.TypingIndicatorView
                android:id="@+id/typing_indicator_view_73"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_margin="8dp"
                android:padding="4dp"
                app:animationOrder="sequence"
                app:backgroundColor="#eaeaea"
                app:backgroundType="rounded"
                app:dotAnimationDuration="2000"
                app:dotAnimationType="Sliding"
                app:dotColor="#a4a4a4"
                app:showBackground="true"/>
        </LinearLayout>

        <android.support.v4.widget.Space
            android:layout_width="0dp"
            android:layout_height="20dp"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="8dp"
            android:text="Animate Frequency: default, 200, 2000 "/>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

            <com.udevel.widgetlab.TypingIndicatorView
                android:id="@+id/typing_indicator_view_81"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_margin="8dp"
                android:padding="4dp"
                app:animationOrder="sequence"
                app:backgroundColor="#eaeaea"
                app:backgroundType="rounded"
                app:dotAnimationType="Sliding"
                app:dotColor="#a4a4a4"
                app:showBackground="true"/>

            <com.udevel.widgetlab.TypingIndicatorView
                android:id="@+id/typing_indicator_view_82"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_margin="8dp"
                android:padding="4dp"
                app:animateFrequency="200"
                app:animationOrder="sequence"
                app:backgroundColor="#eaeaea"
                app:backgroundType="rounded"
                app:dotAnimationType="Sliding"
                app:dotColor="#a4a4a4"
                app:showBackground="true"/>

            <com.udevel.widgetlab.TypingIndicatorView
                android:id="@+id/typing_indicator_view_83"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_margin="8dp"
                android:padding="4dp"
                app:animateFrequency="2000"
                app:animationOrder="sequence"
                app:backgroundColor="#eaeaea"
                app:backgroundType="rounded"
                app:dotAnimationType="Sliding"
                app:dotColor="#a4a4a4"
                app:showBackground="true"/>
        </LinearLayout>
    </LinearLayout>
</ScrollView>

 

READ  Kotlin (Android) Send SMTP Email with Awesome MailDroid Library [NEW] - Coding Shiksha

fragment_demo_attribute2.xml

 

<?xml version="1.0" encoding="utf-8"?>
<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:orientation="vertical"
        tools:context=".MainActivity">

        <android.support.v4.widget.Space
            android:layout_width="0dp"
            android:layout_height="20dp"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="8dp"
            android:text="Background: none - background - rounded background "/>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

            <com.udevel.widgetlab.TypingIndicatorView
                android:id="@+id/typing_indicator_view_1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_margin="8dp"
                android:padding="4dp"/>

            <com.udevel.widgetlab.TypingIndicatorView
                android:id="@+id/typing_indicator_view_2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_margin="8dp"
                android:padding="4dp"
                app:backgroundColor="#eaeaea"
                app:dotColor="#a4a4a4"
                app:showBackground="true"/>

            <com.udevel.widgetlab.TypingIndicatorView
                android:id="@+id/typing_indicator_view_3"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_margin="8dp"
                android:padding="4dp"
                app:backgroundColor="#eaeaea"
                app:backgroundType="rounded"
                app:dotColor="#a4a4a4"
                app:showBackground="true"/>
        </LinearLayout>

        <android.support.v4.widget.Space
            android:layout_width="0dp"
            android:layout_height="20dp"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="8dp"
            android:text="Dot color: default, custom color, 2 custom colors "/>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

            <com.udevel.widgetlab.TypingIndicatorView
                android:id="@+id/typing_indicator_view_21"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_margin="8dp"
                android:padding="4dp"
                app:animationOrder="sequence"
                app:backgroundColor="#eaeaea"
                app:backgroundType="rounded"
                app:showBackground="true"/>

            <com.udevel.widgetlab.TypingIndicatorView
                android:id="@+id/typing_indicator_view_22"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_margin="8dp"
                android:padding="4dp"
                app:animationOrder="sequence"
                app:backgroundColor="#eaeaea"
                app:backgroundType="rounded"
                app:dotColor="#a4a4a4"
                app:showBackground="true"/>

            <com.udevel.widgetlab.TypingIndicatorView
                android:id="@+id/typing_indicator_view_23"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_margin="8dp"
                android:padding="4dp"
                app:animationOrder="sequence"
                app:backgroundColor="#eaeaea"
                app:backgroundType="rounded"
                app:dotColor="#a4a4a4"
                app:dotSecondColor="#445794"
                app:showBackground="true"/>
        </LinearLayout>

        <android.support.v4.widget.Space
            android:layout_width="0dp"
            android:layout_height="20dp"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="8dp"
            android:text="Dot count: default, 5"/>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

            <com.udevel.widgetlab.TypingIndicatorView
                android:id="@+id/typing_indicator_view_31"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_margin="8dp"
                android:padding="4dp"
                app:animationOrder="sequence"
                app:backgroundColor="#eaeaea"
                app:backgroundType="rounded"
                app:dotColor="#a4a4a4"
                app:dotSecondColor="#445794"
                app:showBackground="true"/>

            <com.udevel.widgetlab.TypingIndicatorView
                android:id="@+id/typing_indicator_view_32"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_margin="8dp"
                android:padding="4dp"
                app:animationOrder="sequence"
                app:backgroundColor="#eaeaea"
                app:backgroundType="rounded"
                app:dotColor="#a4a4a4"
                app:dotCount="5"
                app:dotSecondColor="#445794"
                app:showBackground="true"/>
        </LinearLayout>

        <android.support.v4.widget.Space
            android:layout_width="0dp"
            android:layout_height="20dp"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="8dp"
            android:text="Dot compress ratio: default, 70%, 30%"/>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

            <com.udevel.widgetlab.TypingIndicatorView
                android:id="@+id/typing_indicator_view_41"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_margin="8dp"
                android:padding="4dp"
                app:animationOrder="sequence"
                app:backgroundColor="#eaeaea"
                app:backgroundType="rounded"
                app:dotColor="#a4a4a4"
                app:dotSecondColor="#445794"
                app:showBackground="true"/>

            <com.udevel.widgetlab.TypingIndicatorView
                android:id="@+id/typing_indicator_view_42"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_margin="8dp"
                android:padding="4dp"
                app:animationOrder="sequence"
                app:backgroundColor="#eaeaea"
                app:backgroundType="rounded"
                app:dotColor="#a4a4a4"
                app:dotMaxCompressRatio="70%"
                app:dotSecondColor="#445794"
                app:showBackground="true"/>

            <com.udevel.widgetlab.TypingIndicatorView
                android:id="@+id/typing_indicator_view_43"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_margin="8dp"
                android:padding="4dp"
                app:animationOrder="sequence"
                app:backgroundColor="#eaeaea"
                app:backgroundType="rounded"
                app:dotColor="#a4a4a4"
                app:dotMaxCompressRatio="30%"
                app:dotSecondColor="#445794"
                app:showBackground="true"/>
        </LinearLayout>

        <android.support.v4.widget.Space
            android:layout_width="0dp"
            android:layout_height="20dp"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="8dp"
            android:text="Dot horizontal space: default, 20dp"/>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

            <com.udevel.widgetlab.TypingIndicatorView
                android:id="@+id/typing_indicator_view_51"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_margin="8dp"
                android:padding="4dp"
                app:animationOrder="sequence"
                app:backgroundColor="#eaeaea"
                app:backgroundType="rounded"
                app:dotColor="#a4a4a4"
                app:showBackground="true"/>

            <com.udevel.widgetlab.TypingIndicatorView
                android:id="@+id/typing_indicator_view_52"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_margin="8dp"
                android:padding="4dp"
                app:animationOrder="sequence"
                app:backgroundColor="#eaeaea"
                app:backgroundType="rounded"
                app:dotColor="#a4a4a4"
                app:dotHorizontalSpacing="20dp"
                app:showBackground="true"/>
        </LinearLayout>
    </LinearLayout>
</ScrollView>

 

READ  Kotlin Google Maps AutocompleteTextView Location Example - Coding Shiksha

Fragment_show_case.xml

 

<?xml version="1.0" encoding="utf-8"?>
<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:scrollbars="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:orientation="vertical"
        tools:context=".MainActivity">

        <android.support.v4.widget.Space
            android:layout_width="0dp"
            android:layout_height="20dp"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Default - random order, grow animation"/>

        <com.udevel.widgetlab.TypingIndicatorView
            android:id="@+id/typing_indicator_view2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_margin="8dp"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Sliding animation - With rounded background"/>

        <com.udevel.widgetlab.TypingIndicatorView
            android:id="@+id/typing_indicator_view01"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_margin="8dp"
            android:padding="8dp"
            app:animateFrequency="700"
            app:animationOrder="sequence"
            app:backgroundColor="#eaeaea"
            app:backgroundType="rounded"
            app:dotAnimationDuration="600"
            app:dotAnimationType="Sliding"
            app:dotColor="#a4a4a4"
            app:dotCount="3"
            app:dotHorizontalSpacing="4dp"
            app:dotMaxCompressRatio="70%"
            app:dotSecondColor="#6ba4a4a4"
            app:dotSize="8dp"
            app:showBackground="true"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Sliding with lastOneFirst animation order"/>

        <com.udevel.widgetlab.TypingIndicatorView
            android:id="@+id/typing_indicator_view02"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_margin="8dp"
            android:padding="8dp"
            app:animateFrequency="700"
            app:animationOrder="lastOneFirst"
            app:backgroundColor="#eaeaea"
            app:backgroundType="rounded"
            app:dotAnimationDuration="600"
            app:dotAnimationType="Sliding"
            app:dotColor="#a4a4a4"
            app:dotCount="3"
            app:dotHorizontalSpacing="4dp"
            app:dotMaxCompressRatio="70%"
            app:dotSecondColor="#6ba4a4a4"
            app:dotSize="8dp"
            app:showBackground="true"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Sliding with lastOneFirst animation order again"/>

        <com.udevel.widgetlab.TypingIndicatorView
            android:id="@+id/typing_indicator_view03"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_margin="8dp"
            android:padding="8dp"
            app:animateFrequency="500"
            app:animationOrder="lastOneFirst"
            app:backgroundColor="#eaeaea"
            app:backgroundType="rounded"
            app:dotAnimationDuration="800"
            app:dotAnimationType="Sliding"
            app:dotColor="#a4a4a4"
            app:dotCount="6"
            app:dotHorizontalSpacing="4dp"
            app:dotMaxCompressRatio="70%"
            app:dotSecondColor="#6ba4a4a4"
            app:dotSize="8dp"
            app:showBackground="true"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:text="Bouncing Sliding, lastOneFirst, 2 dot colors,\nfrequency 800, duration 2000"/>

        <com.udevel.widgetlab.TypingIndicatorView
            android:id="@+id/typing_indicator_view_bounce"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_margin="8dp"
            android:padding="10dp"
            app:animateFrequency="800"
            app:animationOrder="lastOneFirst"
            app:backgroundColor="#eaeaea"
            app:backgroundType="rounded"
            app:dotAnimationDuration="2000"
            app:dotAnimationType="BouncingSliding"
            app:dotColor="#d50000"
            app:dotSecondColor="#1565c0"
            app:showBackground="true"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Grow, random, 2 dot colors, frequency/duration 3000"/>

        <com.udevel.widgetlab.TypingIndicatorView
            android:id="@+id/typing_indicator_view_grow"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_margin="8dp"
            android:padding="8dp"
            app:animateFrequency="3000"
            app:backgroundColor="?attr/colorAccent"
            app:backgroundType="rounded"
            app:dotAnimationDuration="3000"
            app:dotColor="?attr/colorPrimary"
            app:dotCount="5"
            app:dotSecondColor="?attr/colorPrimaryDark"
            app:showBackground="true"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Grow, random, 20 dp horizontal spacing"/>

        <com.udevel.widgetlab.TypingIndicatorView
            android:id="@+id/typing_indicator_view4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_margin="8dp"
            android:paddingBottom="8dp"
            android:paddingEnd="16dp"
            android:paddingStart="16dp"
            android:paddingTop="8dp"
            app:backgroundColor="#eaeaea"
            app:backgroundType="rounded"
            app:dotColor="#a4a4a4"
            app:dotCount="3"
            app:dotHorizontalSpacing="20dp"
            app:dotSize="8dp"
            app:showBackground="true"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Grow, random, 1 dp horizontal spacing, 15% compression"/>

        <com.udevel.widgetlab.TypingIndicatorView
            android:id="@+id/typing_indicator_view5"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_margin="8dp"
            android:padding="8dp"
            app:backgroundColor="#eaeaea"
            app:backgroundType="rounded"
            app:dotColor="#a4a4a4"
            app:dotCount="3"
            app:dotHorizontalSpacing="1dp"
            app:dotMaxCompressRatio="15%"
            app:dotSize="8dp"
            app:showBackground="true"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Wink, sequence, freq. 1500, dur. 700, 2 colors"/>

        <com.udevel.widgetlab.TypingIndicatorView
            android:id="@+id/typing_indicator_view7"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_margin="8dp"
            android:padding="4dp"
            app:animateFrequency="1500"
            app:animationOrder="sequence"
            app:backgroundColor="#eaeaea"
            app:backgroundType="rounded"
            app:dotAnimationDuration="700"
            app:dotAnimationType="Wink"
            app:dotColor="#b9b9b9"
            app:dotCount="3"
            app:dotHorizontalSpacing="4dp"
            app:dotMaxCompressRatio="70%"
            app:dotSecondColor="#5e648e"
            app:dotSize="8dp"
            app:showBackground="true"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Grow, 2 colors but with 1 color same as bg color"/>

        <com.udevel.widgetlab.TypingIndicatorView
            android:id="@+id/typing_indicator_view8"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_margin="8dp"
            android:padding="4dp"
            app:animateFrequency="1000"
            app:animationOrder="sequence"
            app:backgroundColor="#eaeaea"
            app:backgroundType="rounded"
            app:dotColor="#eaeaea"
            app:dotCount="3"
            app:dotHorizontalSpacing="4dp"
            app:dotMaxCompressRatio="70%"
            app:dotSecondColor="#a4a4a4"
            app:dotSize="8dp"
            app:showBackground="true"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Disappear, sequence, freq. 1000, dur. 800"/>

        <com.udevel.widgetlab.TypingIndicatorView
            android:id="@+id/typing_indicator_view10"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_margin="8dp"
            android:padding="8dp"
            app:animateFrequency="1000"
            app:animationOrder="sequence"
            app:backgroundColor="#eaeaea"
            app:backgroundType="rounded"
            app:dotAnimationDuration="800"
            app:dotAnimationType="Disappear"
            app:dotColor="#a4a4a4"
            app:dotCount="3"
            app:dotHorizontalSpacing="4dp"
            app:dotMaxCompressRatio="70%"
            app:dotSecondColor="#eaeaea"
            app:dotSize="12dp"
            app:showBackground="true"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Grow, sequence, freq. 600, dur. 3000"/>

        <com.udevel.widgetlab.TypingIndicatorView
            android:id="@+id/typing_indicator_view11"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_margin="8dp"
            android:padding="4dp"
            app:animateFrequency="500"
            app:animationOrder="sequence"
            app:backgroundColor="#eaeaea"
            app:backgroundType="rounded"
            app:dotAnimationDuration="3000"
            app:dotAnimationType="Grow"
            app:dotColor="#eaeaea"
            app:dotCount="6"
            app:dotHorizontalSpacing="4dp"
            app:dotMaxCompressRatio="70%"
            app:dotSecondColor="#a4a4a4"
            app:dotSize="8dp"
            app:showBackground="true"/>
    </LinearLayout>
</ScrollView>

 

READ  How to make Smart Custom Alert Dialog in Kotlin - Coding Shiksha

MainActivity.kt

 

package com.sadwyn.statepb

import android.os.Bundle
import android.util.Log
import androidx.appcompat.app.AppCompatActivity
import com.sadwyn.resultprogressbar.ResultProgressBar
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity(), ResultProgressBar.AnimationListener {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        startBtn.setOnClickListener { pb.reset(); pb2.reset();pb3.reset() }
        successBtn.setOnClickListener { pb.success(); pb2.success(); pb3.success() }
        failureBtn.setOnClickListener { pb.failure(); pb2.failure(); pb3.failure() }
        pb.listener = this
    }

    override fun onAnimationResult(success: Boolean) {
        Log.i("TAG", "Animation success status is : $success")
    }
}
© 2019 GitHub, Inc.

Leave a Reply

Close Menu