Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PinView Clear Functionality Added. #26

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.android.tools.build:gradle:3.3.2'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -15,6 +16,7 @@ buildscript {
allprojects {
repositories {
jcenter()
google()
}
}

Expand Down
16 changes: 8 additions & 8 deletions example/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "com.goodiebag.pinview.example"
minSdkVersion 15
targetSdkVersion 25
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand All @@ -20,11 +20,11 @@ android {
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.1.0'
testCompile 'junit:junit:4.12'
compile project(':pinview')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation project(':pinview')
testImplementation 'junit:junit:4.12'
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,35 @@
package com.goodiebag.pinview.example;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import com.goodiebag.pinview.Pinview;

public class MainActivity extends AppCompatActivity {
private Pinview pinview1;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
pinview1= (Pinview) findViewById(R.id.pinview1);
pinview1 = (Pinview) findViewById(R.id.pinview1);
Button btnClear = (Button) findViewById(R.id.btnClear);
pinview1.setPinViewEventListener(new Pinview.PinViewEventListener() {
@Override
public void onDataEntered(Pinview pinview, boolean fromUser) {
Toast.makeText(MainActivity.this, pinview.getValue(), Toast.LENGTH_SHORT).show();
}
});
btnClear.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
pinview1.clearEditText();
}
});
}


}
25 changes: 18 additions & 7 deletions example/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,24 @@
android:layout_height="match_parent"
android:background="#e1e1e1"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin">
android:paddingBottom="@dimen/activity_vertical_margin">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Number"/>
android:text="Number" />

<com.goodiebag.pinview.Pinview
android:id="@+id/pinview1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cursorVisible="false"
app:forceKeyboard="true"
app:hint=""
app:inputType="number"
app:forceKeyboard="true"
app:password="false"
app:pinBackground="@drawable/example_drawable_with_grey_disabled"
app:pinHeight="40dp"
Expand All @@ -32,7 +33,8 @@
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Text"/>
android:text="Text" />

<com.goodiebag.pinview.Pinview
android:id="@+id/pinview2"
android:layout_width="match_parent"
Expand All @@ -50,7 +52,8 @@
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Number-Password"/>
android:text="Number-Password" />

<com.goodiebag.pinview.Pinview
android:id="@+id/pinview3"
android:layout_width="match_parent"
Expand All @@ -67,7 +70,8 @@
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Text-Password"/>
android:text="Text-Password" />

<com.goodiebag.pinview.Pinview
android:id="@+id/pinview4"
android:layout_width="match_parent"
Expand All @@ -81,4 +85,11 @@
app:pinLength="4"
app:pinWidth="40dp" />

<Button
android:id="@+id/btnClear"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Clear Pinview"
/>

</LinearLayout>
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Fri May 04 13:07:43 IST 2018
#Tue Mar 12 10:01:55 GST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
14 changes: 7 additions & 7 deletions pinview/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
compileSdkVersion 28
buildToolsVersion "28.0.3"

defaultConfig {
minSdkVersion 15
targetSdkVersion 25
targetSdkVersion 28
versionCode 3
versionName "1.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand All @@ -21,10 +21,10 @@ android {
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.1.0'
testCompile 'junit:junit:4.12'
implementation 'com.android.support:appcompat-v7:28.0.0'
testImplementation 'junit:junit:4.12'
}
6 changes: 6 additions & 0 deletions pinview/src/main/java/com/goodiebag/pinview/Pinview.java
Original file line number Diff line number Diff line change
Expand Up @@ -652,4 +652,10 @@ public void setInputType(InputType inputType) {
public void setPinViewEventListener(PinViewEventListener listener) {
this.mListener = listener;
}

public void clearEditText() {
for (EditText editText : editTextList) {
editText.getText().clear();
}
}
}