Skip to content

DanishAmjad12/PlayButton-Android

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

15 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

PlayButton-Android

๐Ÿ‘ The Zedge Android App Play Button Effect developed in Android using Kotlin.

Demo

Installation ๐Ÿ’ป

Add this in your app's build.gradle file:

dependencies {
	        implementation 'com.github.DanishAmjad12:PlayButton-Android:1.0'
	}

Usage ๐Ÿงพ

  <com.danish.playbutton.PlayButton
        android:layout_width="wrap_content"
        android:id="@+id/playButton"
        app:play_button_icon="@drawable/ic_play_arrow"
        app:pause_button_icon="@drawable/ic_pause"
        app:play_button_default_background="@color/fab_background"
        app:card_background_color="@drawable/background"
        app:progress_color="@color/progress_background"
        android:layout_height="wrap_content"/>

Customization and Attributes ๐ŸŽจ

All customizable attributes for Play Button

Attribute Name Default Value Description
app:play_button_icon @drawable/ic_play_arrow The default icon of the Play button
app:pause_button_icon @drawable/ic_pause The default icon of the Pause button
app:play_button_default_background @color/fab_background The background color of the fab button
app:card_background_color @drawable/background The default background image of the frame view
app:progress_color @color/progress_background The default audio progress color

Play Button Listener

override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        playButton.playButtonListener=listener

    }

    private val listener = object : PlayButton.OnButtonListener{
        override fun onPlayButtonClicked(playButton: PlayButton) {
                playButton.setAudioFileName("audio")
        }
    }
    
     override fun onDestroy() {
        super.onDestroy()
        playButton.stopAudio()
    }

    override fun onPause() {
        super.onPause()
        playButton.pauseAudio()
    }
    

Developed By

DANISH AMJAD follow me ๐Ÿ‘‡

License

Copyright 2021 Danish Amjad

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.