Skip to content

Commit

Permalink
Merge pull request #34 from FarshidRoohi/master
Browse files Browse the repository at this point in the history
fixed issues and customize pinView method
  • Loading branch information
Vatican-Cameos authored Jun 12, 2019
2 parents d26a742 + 3ce3690 commit 390d71b
Show file tree
Hide file tree
Showing 8 changed files with 187 additions and 55 deletions.
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.4.0'

// 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
15 changes: 7 additions & 8 deletions example/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
compileSdkVersion 28
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 +19,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'
testImplementation 'junit:junit:4.12'
implementation project(':pinview')
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,33 @@
package com.goodiebag.pinview.example;

import android.support.v7.app.AppCompatActivity;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
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);

Pinview pinview1 = findViewById(R.id.pinview1);
pinview1.setPinViewEventListener(new Pinview.PinViewEventListener() {
@Override
public void onDataEntered(Pinview pinview, boolean fromUser) {
Toast.makeText(MainActivity.this, pinview.getValue(), Toast.LENGTH_SHORT).show();
}
});


// pinView Customize
Pinview pinview5 = findViewById(R.id.pinview5);
pinview5.setCursorShape(R.drawable.example_cursor);
// pinview5.setCursorColor(Color.BLUE);
pinview5.setTextSize(12);
pinview5.setTextColor(Color.BLACK);
pinview5.showCursor(true);
}
}
15 changes: 15 additions & 0 deletions example/src/main/res/drawable/example_cursor.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">

<solid android:color="#009688"/>

<size android:width="2dp"/>
<gradient
android:angle="90"
android:endColor="#9C27B0"
android:startColor="#2196F3"/>
<corners android:radius="2dp"/>


</shape>
48 changes: 33 additions & 15 deletions example/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,38 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#e1e1e1"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin">
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#e1e1e1"
android:orientation="vertical"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingBottom="@dimen/activity_vertical_margin">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
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"
app:pinLength="4"
app:pinWidth="40dp" />
app:pinWidth="40dp"/>

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

<com.goodiebag.pinview.Pinview
android:id="@+id/pinview2"
android:layout_width="match_parent"
Expand All @@ -45,12 +47,13 @@
app:pinBackground="@drawable/example_drawable"
app:pinHeight="40dp"
app:pinLength="4"
app:pinWidth="40dp" />
app:pinWidth="40dp"/>

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

<com.goodiebag.pinview.Pinview
android:id="@+id/pinview3"
android:layout_width="match_parent"
Expand All @@ -62,12 +65,13 @@
app:pinBackground="@drawable/example_drawable"
app:pinHeight="40dp"
app:pinLength="4"
app:pinWidth="40dp" />
app:pinWidth="40dp"/>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Text-Password"/>

<com.goodiebag.pinview.Pinview
android:id="@+id/pinview4"
android:layout_width="match_parent"
Expand All @@ -79,6 +83,20 @@
app:pinBackground="@drawable/example_drawable"
app:pinHeight="40dp"
app:pinLength="4"
app:pinWidth="40dp" />
app:pinWidth="40dp"/>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Custom Pin View"/>

<com.goodiebag.pinview.Pinview
android:id="@+id/pinview5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:inputType="text"
app:pinHeight="40dp"
app:pinLength="4"
app:pinWidth="40dp"/>

</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
#Thu May 16 12:53:08 IRDT 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-5.1.1-all.zip
13 changes: 6 additions & 7 deletions pinview/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
compileSdkVersion 28

defaultConfig {
minSdkVersion 15
targetSdkVersion 25
targetSdkVersion 28
versionCode 3
versionName "1.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand All @@ -21,10 +20,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'
}
Loading

0 comments on commit 390d71b

Please sign in to comment.