MediumClap-Android
The Medium's Clapping Effect developed in Android.
? How-To Article
Coming soon!
✔️ Changelog
Changes exist in the releases tab.
? Installation
Add this in your app's build.gradle file:
dependencies {
implementation 'com.wajahatkarim3.clapfab:clapfab:1.0.0'
}
Or add ClapFab as a new dependency inside your pom.xml
<dependency>
<groupId>com.wajahatkarim3.clapfab</groupId>
<artifactId>clapfab</artifactId>
<version>1.0.0</version>
<type>pom</type>
</dependency>
❔ Usage
<com.wajahatkarim3.clapfab.ClapFAB
android:id="@+id/clapFAB"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
app:cf_count_circle_color="@color/colorAccent"
app:cf_count_text_color="@color/white_color"
app:cf_default_icon="@drawable/ic_star_border_black_24dp"
app:cf_default_icon_color="@color/colorAccent"
app:cf_dots_1_color="@android:color/holo_green_dark"
app:cf_dots_2_color="@color/colorAccent"
app:cf_filled_icon="@drawable/ic_star_black_24dp"
app:cf_filled_icon_color="@color/colorAccent"
app:cf_max_clap_count="20" />
? Customization and Attributes
All customizable attributes for ClapFab
Attribute Name | Default Value | Description |
---|---|---|
app:cf_default_icon | @drawable/ic_clap_hands_outline | The default icon of the ClapFab button |
app:cf_filled_icon | @drawable/ic_clap_hands_filled | The filled icon after clapping of the ClapFab button |
app:cf_default_icon_color | @color/colorClapIcon | The color of default icon of the ClapFab button |
app:cf_filled_icon_color | @color/colorClapIcon | The filled color of icon after clapping of the ClapFab button |
app:cf_max_clap_count | 50 | The maximum count of clapping of the ClapFab button |
app:cf_count_circle_color | @color/colorClapIcon | The color of count's circle background |
app:cf_count_text_color | @android:color/white | The color of count's circle text |
app:cf_dots_1_color | @color/dotsColor1 | The color of particle's dots 1 |
app:cf_dots_2_color | @color/dotsColor2 | The color of particle's dots 2 |
Clap Listener
ClapFAB clapFAB = (ClapFAB) findViewById(R.id.clapFAB);
clapFAB.setClapListener(new ClapFAB.OnClapListener() {
@Override
public void onFabClapped(@NotNull ClapFAB clapFab, int count, boolean isMaxReached) {
// count is the current count of the clapping
// isMaxReached is true when button has already reached the maximum count
// and is not being clapped anymore. Otherwise its false
}
});