From 7ecad88e40095ee2cfcf1d9dd21135f02bbe20a6 Mon Sep 17 00:00:00 2001 From: Zeeshan rasool Date: Wed, 31 Oct 2018 18:22:33 +0500 Subject: [PATCH 1/2] Pinview Clear Functionality Added. Build tools and Dependencies Updated --- build.gradle | 4 ++- example/build.gradle | 16 ++++++------ .../pinview/example/MainActivity.java | 18 +++++++++++-- example/src/main/res/layout/activity_main.xml | 25 +++++++++++++------ gradle/wrapper/gradle-wrapper.properties | 2 +- pinview/build.gradle | 14 +++++------ .../java/com/goodiebag/pinview/Pinview.java | 6 +++++ 7 files changed, 59 insertions(+), 26 deletions(-) diff --git a/build.gradle b/build.gradle index c2eea8e..ae9fbaf 100644 --- a/build.gradle +++ b/build.gradle @@ -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.2.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -15,6 +16,7 @@ buildscript { allprojects { repositories { jcenter() + google() } } diff --git a/example/build.gradle b/example/build.gradle index 480a3e5..fc6ed71 100644 --- a/example/build.gradle +++ b/example/build.gradle @@ -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" @@ -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' } diff --git a/example/src/main/java/com/goodiebag/pinview/example/MainActivity.java b/example/src/main/java/com/goodiebag/pinview/example/MainActivity.java index 2f2ac1e..1f773e2 100644 --- a/example/src/main/java/com/goodiebag/pinview/example/MainActivity.java +++ b/example/src/main/java/com/goodiebag/pinview/example/MainActivity.java @@ -1,22 +1,36 @@ 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; + private Button btnClear; + @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); + 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(); + } + }); } + + } diff --git a/example/src/main/res/layout/activity_main.xml b/example/src/main/res/layout/activity_main.xml index d525beb..b96e783 100644 --- a/example/src/main/res/layout/activity_main.xml +++ b/example/src/main/res/layout/activity_main.xml @@ -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"> + android:text="Number" /> + + android:text="Text" /> + + android:text="Number-Password" /> + + android:text="Text-Password" /> + +