Skip to content

Commit

Permalink
Make library available for API level 21 and above
Browse files Browse the repository at this point in the history
  • Loading branch information
hexdecimal16 committed Aug 30, 2020
1 parent 5fc81f0 commit c194470
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ android {

defaultConfig {
applicationId "com.dhairytripathi.edittextpin"
minSdkVersion 23
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0"
Expand All @@ -25,10 +25,10 @@ android {
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
implementation project(path: ':library')
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

}
8 changes: 4 additions & 4 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ android {
buildToolsVersion "30.0.2"

defaultConfig {
minSdkVersion 23
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0"
Expand All @@ -26,8 +26,8 @@ dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.2.0'
testImplementation 'junit:junit:4.13'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

}
2 changes: 0 additions & 2 deletions library/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dhairytripathi.library">

/
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.LayerDrawable;
import android.os.Build;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.AttributeSet;
Expand All @@ -24,6 +25,8 @@ public class EditTextPin extends ConstraintLayout {
private Context context;
private int underlineColor = R.color.underlineColor;
private int background = R.drawable.background;
private static final String TAG = "EditTextPin";

public EditTextPin(Context context, AttributeSet attrs) {
super(context, attrs);
handleAttrs(attrs);
Expand All @@ -44,7 +47,9 @@ protected void onAttachedToWindow() {
LayerDrawable shape = (LayerDrawable) ContextCompat.getDrawable(context,R.drawable.underline);
GradientDrawable bgShape = (GradientDrawable) (shape.findDrawableByLayerId(R.id.underline));
bgShape.setStroke(convertDpToPx(2), ContextCompat.getColor(context, underlineColor));
shape.setDrawable(0, bgShape);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
shape.setDrawable(0, bgShape);
}
view.setBackground(shape);
pin1 = findViewById(R.id.pin1);
pin2 = findViewById(R.id.pin2);
Expand Down

0 comments on commit c194470

Please sign in to comment.