/ Video

Instagram video button having the same animation

Instagram video button having the same animation

InstagramVideoButton

This library is inspired by the instagram video button having the same animation, look and feel.

USAGE

To add instagramVideoButton in your project, just add the below code in your dependencies section inside the app module gradle file:

Gradle

dependencies {
    ...
    implementation 'com.jackandphantom.android:instagramvideobutton:1.0.0'
}

NOTE

In order to enable video and photo animation you have to add enableVideoRecording and enablePhotoTaking true either in kotlin or in xml as
an attribute.

XML

<!-- <a> instagram video button xml</a> -->
    <com.jackandphantom.instagramvideobutton.InstagramVideoButton
            android:layout_width="130dp"
            android:layout_height="130dp"
            android:id="@+id/component"
            app:enableVideoRecording="true"
            android:layout_marginBottom="30dp"
            app:enablePhotoTaking="true"
            app:progressColor="#FF5722"
            android:layout_centerHorizontal="true"
            android:layout_alignParentBottom="true"/>

xml attributes

Xml attribute Description
app:innerCircleColor represents the inner circle inside the button
app:outerCircleColor represents the outer circle in the button
app:progressColor represents a color of circular progress bar
app:outerCircleWidth outer circle width
app:enableVideoRecording for enable the video on long press
app:enablePhotoTaking for enabling the photo on single tap

Kotlin

val instagramVideoButton = findViewById<InstagramVideoButton>(R.id.instagram_video_button)
instagramVideoButton.enablePhotoTaking(true)
instagramVideoButton.enableVideoRecording(true)
instagramVideoButton.setVideoDuration(10000)

Observe !!

instagramVideoButton.actionListener =  object : InstagramVideoButton.ActionListener {
           override fun onStartRecord() {
               Log.e("MY TAG", "CALL the on start record ")
            
           }
           override fun onEndRecord() {
               Log.e("MY TAG", "CALL the on end record ")
           }

           override fun onSingleTap() {
               Log.e("MY TAG", "CALL the on single tap record ")
           }

           override fun onDurationTooShortError() {
               Log.e("MY TAG", "CALL the on on duration record ")

           }

           override fun onCancelled() {
               Log.e("MY TAG", "CALL the on on cancel record ")
           }

       
      }
      

Public Methods

Method Description
void fun enableVideoRecording(boolean enable) In order to perform video animation you have to make it true.
void fun enablePhotoTaking(boolean enable) In order to perform single tap photo click animation you have to make it true.
void fun setVideoDuration(long duration) set the video duration.
void fun setMinimumVideoDuration(long duration) set the minimum video duration.
void fun cancelRecording() Cancel the video recording.
void fun setInnerCircleColor(int color) set the color of inner circle.
void fun setOuterCircleColor(int color) set the color of outer circle.
void fun setOuterCircleWidth(int color) set the width of outer circle.
void fun setProgressColor(int color) set the color of circular progressbar.

Contribution

If you want to add feature and find a bug feel free to contribute , you can create issue related to bug , feature and send a pull.

GitHub