Skip to content

Commit 7e27755

Browse files
authored
Merge pull request #11 from JDevZone/dev_new
Ripple effect added & version bumped 😎
2 parents 67bbd0b + c330bbb commit 7e27755

File tree

12 files changed

+207
-81
lines changed

12 files changed

+207
-81
lines changed

app/build.gradle

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ apply plugin: 'kotlin-android'
55
apply plugin: 'kotlin-android-extensions'
66

77
android {
8-
compileSdkVersion 29
8+
compileSdkVersion 30
99
defaultConfig {
1010
applicationId "com.devzone.checkabletextview"
1111
minSdkVersion 17
12-
targetSdkVersion 29
12+
targetSdkVersion 30
1313
versionCode 1
1414
versionName "1.0"
1515

@@ -25,8 +25,9 @@ android {
2525
dependencies {
2626
implementation fileTree(dir: 'libs', include: ['*.jar'])
2727
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
28-
implementation 'androidx.appcompat:appcompat:1.0.2'
29-
implementation 'androidx.core:core-ktx:1.0.2'
28+
implementation 'com.google.android.material:material:1.3.0'
29+
implementation 'androidx.appcompat:appcompat:1.2.0'
30+
implementation 'androidx.core:core-ktx:1.3.2'
3031
implementation project(path: ':checkabletextview')
3132

3233
}

app/src/main/java/com/devzone/ctv_sample/MainActivity.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package com.devzone.ctv_sample
22

3+
import android.graphics.Color
34
import android.os.Bundle
45
import android.view.View
56
import android.view.animation.AnticipateOvershootInterpolator
67
import android.view.animation.BounceInterpolator
78
import android.view.animation.LinearInterpolator
89
import androidx.appcompat.app.AppCompatActivity
9-
import com.devzone.checkabletextview.CheckableTextView
1010
import com.devzone.checkabletextview.CheckableTextView.Companion.SCALE
1111
import com.devzone.checkabletextview.CheckableTextView.Companion.TRANSLATE
1212
import com.devzone.checkabletextview.CheckedListener
@@ -18,7 +18,9 @@ class MainActivity : AppCompatActivity(), CheckedListener {
1818
super.onCreate(savedInstanceState)
1919
setContentView(R.layout.activity_main)
2020

21-
checkedTV.setOnCheckChangeListener { view, isChecked -> stateTV.text = if (isChecked) "Checked" else "Unchecked"}
21+
checkedTV.setOnCheckChangeListener { _, isChecked ->
22+
stateTV.text = if (isChecked) "Checked" else "Unchecked"
23+
}
2224
checkedSecondTV.setOnCheckChangeListener(::checkHandler) // function as parameter
2325
checkedThirdTV.setOnCheckChangeListener(this@MainActivity)
2426

@@ -28,6 +30,8 @@ class MainActivity : AppCompatActivity(), CheckedListener {
2830
checkedThirdTV.animInterpolator = BounceInterpolator()
2931

3032
checkedThirdTV.setAnimDuration(1000)
33+
checkedThirdTV.setRippleTint(Color.parseColor("#ff9900"))
34+
checkedSecondTV.setAnimDuration(1000)
3135
}
3236

3337
private fun checkHandler(view: View, isChecked: Boolean) {

app/src/main/res/layout/activity_main.xml

Lines changed: 52 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -10,66 +10,76 @@
1010
tools:context=".MainActivity">
1111

1212
<com.devzone.checkabletextview.CheckableTextView
13-
android:layout_marginTop="20dp"
14-
android:id="@+id/checkedTV"
15-
app:ctv_TextStyle="@style/TextAppearance.General"
16-
app:ctv_IconTint="@color/colorPrimary"
17-
app:ctv_IconChecked="false"
18-
android:background="#e8e8e8"
19-
app:ctv_Text="@string/app_name"
20-
app:ctv_AnimDuration="1250"
21-
app:ctv_AnimType="translate"
22-
android:layout_width="match_parent"
23-
android:layout_height="wrap_content"/>
13+
android:id="@+id/checkedTV"
14+
android:layout_width="match_parent"
15+
android:layout_height="wrap_content"
16+
android:layout_marginTop="20dp"
17+
android:background="#e8e8e8"
18+
app:ctv_AnimDuration="1250"
19+
app:ctv_AnimType="translate"
20+
app:ctv_IconChecked="false"
21+
app:ctv_IconTint="@color/colorPrimary"
22+
app:ctv_RippleFillEnabled="true"
23+
app:ctv_Text="@string/app_name"
24+
app:ctv_TextStyle="@style/TextAppearance.General" />
2425

2526

2627
<androidx.appcompat.widget.AppCompatTextView
27-
android:layout_marginTop="5dp"
28-
android:id="@+id/stateTV"
29-
android:text="Checked"
30-
android:padding="5dp"
31-
android:gravity="center"
32-
android:layout_gravity="center_horizontal"
33-
style="@style/TextAppearance.General"
34-
android:layout_width="wrap_content"
35-
android:layout_height="wrap_content"/>
28+
android:id="@+id/stateTV"
29+
style="@style/TextAppearance.General"
30+
android:layout_width="wrap_content"
31+
android:layout_height="wrap_content"
32+
android:layout_gravity="center_horizontal"
33+
android:layout_marginTop="5dp"
34+
android:gravity="center"
35+
android:padding="5dp"
36+
android:text="Checked" />
3637

37-
<com.devzone.checkabletextview.CheckableTextView
38-
android:layout_marginTop="20dp"
38+
<com.google.android.material.card.MaterialCardView
39+
android:layout_width="match_parent"
40+
android:layout_height="wrap_content"
41+
android:layout_marginTop="20dp"
42+
app:cardCornerRadius="5dp"
43+
app:cardUseCompatPadding="true">
44+
45+
<com.devzone.checkabletextview.CheckableTextView
3946
android:background="#e8e8e8"
47+
android:layout_height="wrap_content"
4048
android:id="@+id/checkedSecondTV"
4149
app:ctv_TextStyle="@style/TextAppearance.General"
4250
app:ctv_IconChecked="false"
4351
app:ctv_AnimType="scale"
4452
app:ctv_Icon="@drawable/ic_cancel_custom_vector"
4553
app:ctv_Text="@string/app_name"
4654
android:layout_width="match_parent"
47-
android:layout_height="wrap_content"/>
55+
app:ctv_RippleFillEnabled="true" />
56+
</com.google.android.material.card.MaterialCardView>
4857

4958

5059
<androidx.appcompat.widget.AppCompatTextView
51-
android:id="@+id/stateSecondTV"
52-
android:text="Checked"
53-
android:padding="5dp"
54-
android:layout_marginTop="5dp"
55-
android:layout_gravity="center_horizontal"
56-
style="@style/TextAppearance.General"
57-
android:gravity="center"
58-
android:layout_width="wrap_content"
59-
android:layout_height="wrap_content"/>
60+
android:id="@+id/stateSecondTV"
61+
style="@style/TextAppearance.General"
62+
android:layout_width="wrap_content"
63+
android:layout_height="wrap_content"
64+
android:layout_gravity="center_horizontal"
65+
android:layout_marginTop="5dp"
66+
android:gravity="center"
67+
android:padding="5dp"
68+
android:text="Checked" />
6069

6170

6271
<com.devzone.checkabletextview.CheckableTextView
63-
android:layout_marginTop="20dp"
64-
android:background="#e8e8e8"
65-
android:id="@+id/checkedThirdTV"
66-
app:ctv_TextStyle="@style/TextAppearance.General"
67-
app:ctv_IconTint="@color/colorOrange"
68-
app:ctv_IconChecked="false"
69-
app:ctv_AnimType="fall_down"
70-
app:ctv_Text="@string/app_name"
71-
android:layout_width="match_parent"
72-
android:layout_height="wrap_content"/>
72+
android:id="@+id/checkedThirdTV"
73+
android:layout_width="match_parent"
74+
android:layout_height="wrap_content"
75+
android:layout_marginTop="20dp"
76+
android:background="#e8e8e8"
77+
app:ctv_AnimType="fall_down"
78+
app:ctv_IconChecked="false"
79+
app:ctv_IconTint="@color/colorOrange"
80+
app:ctv_RippleFillEnabled="true"
81+
app:ctv_Text="@string/app_name"
82+
app:ctv_TextStyle="@style/TextAppearance.General" />
7383

7484

7585
<androidx.appcompat.widget.AppCompatTextView

app/src/main/res/values/styles.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<resources>
22

33
<!-- Base application theme. -->
4-
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
4+
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
55
<!-- Customize your theme here. -->
66
<item name="colorPrimary">@color/colorPrimary</item>
77
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22

33
buildscript {
4-
ext.kotlin_version = '1.3.41'
4+
ext.kotlin_version = '1.4.32'
55
repositories {
66
google()
77
jcenter()
88

99
}
1010
dependencies {
11-
classpath 'com.android.tools.build:gradle:3.4.2'
11+
classpath 'com.android.tools.build:gradle:4.1.3'
1212
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1313
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
1414
// NOTE: Do not place your application dependencies here; they belong

checkabletextview/build.gradle

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ apply plugin: 'com.github.dcendents.android-maven'
66
group='com.github.JDevZone'
77

88
android {
9-
compileSdkVersion 29
9+
compileSdkVersion 30
1010

1111

1212
defaultConfig {
1313
minSdkVersion 17
14-
targetSdkVersion 29
14+
targetSdkVersion 30
1515
versionCode 1
1616
versionName "1.0"
1717
vectorDrawables.useSupportLibrary = true
@@ -29,11 +29,10 @@ android {
2929

3030
dependencies {
3131
implementation fileTree(dir: 'libs', include: ['*.jar'])
32-
33-
implementation 'androidx.appcompat:appcompat:1.0.2'
34-
implementation "androidx.core:core-ktx:1.0.2"
35-
implementation 'androidx.vectordrawable:vectordrawable:1.1.0-rc01'
3632
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
33+
implementation 'androidx.appcompat:appcompat:1.2.0'
34+
implementation "androidx.core:core-ktx:1.3.2"
35+
implementation 'androidx.vectordrawable:vectordrawable:1.2.0-alpha02'
3736

3837
}
3938
repositories {

0 commit comments

Comments
 (0)