Skip to content
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
19 changes: 16 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# PasscodeView
# PasscodeView <img id="badge" src="https://jitpack.io/v/JobGetabu/PasscodeView.svg">

An Passcode view view for Android.

Expand All @@ -9,14 +9,27 @@ An Passcode view view for Android.
<img src="https://github.com/hanks-zyh/PasscodeView/raw/master/screenshot/demo.gif" width="220px" style="margin: 20px;">
</div>

## Usage
## Add

```gradle
dependencies {
compile 'com.hanks:passcodeview:0.1.2'
implementation 'com.github.JobGetabu:PasscodeView:0.1.3'
}
```

Add it in your root build.gradle at the end of repositories:

```
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
```

## Usage

```xml
<com.hanks.passcodeview.PasscodeView
android:id="@+id/passcodeView"
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.novoda:bintray-release:0.7.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
6 changes: 3 additions & 3 deletions passcodeview/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 26
compileSdkVersion 28

defaultConfig {
minSdkVersion 15
targetSdkVersion 26
targetSdkVersion 28
versionCode 2
versionName "0.1.2"
vectorDrawables.useSupportLibrary = true
Expand All @@ -19,7 +19,7 @@ android {
}

dependencies {
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
testImplementation 'junit:junit:4.12'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import android.support.annotation.IntDef;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.content.res.AppCompatResources;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
Expand All @@ -18,6 +19,7 @@
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import java.lang.annotation.Retention;
Expand All @@ -41,6 +43,7 @@ public class PasscodeView extends FrameLayout implements View.OnClickListener {
private TextView number0, number1, number2, number3, number4, number5, number6, number7, number8, number9;
private ImageView numberB, numberOK;
private ImageView iv_lock, iv_ok;
private RelativeLayout relativeLayoutDraw;
private View cursor;

private String firstInputTip = "Enter a passcode of 4 digits";
Expand Down Expand Up @@ -99,6 +102,9 @@ private void init() {
cursor = findViewById(R.id.cursor);
iv_lock = (ImageView) findViewById(R.id.iv_lock);
iv_ok = (ImageView) findViewById(R.id.iv_ok);
relativeLayoutDraw = (RelativeLayout) findViewById(R.id.rv_with_drawable);

relativeLayoutDraw.setBackgroundDrawable(AppCompatResources.getDrawable(getContext(),R.drawable.lock_bg_white));

tv_input_tip.setText(firstInputTip);

Expand Down
4 changes: 2 additions & 2 deletions passcodeview/src/main/res/layout/layout_passcode_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@
android:layout_weight="1"/>

<RelativeLayout
android:id="@+id/rv_with_drawable"
android:layout_width="match_parent"
android:layout_height="312dp"
android:background="@drawable/lock_bg_white"
android:padding="48dp">

<TextView
Expand Down Expand Up @@ -161,4 +161,4 @@

</RelativeLayout>

</LinearLayout>
</LinearLayout>
8 changes: 4 additions & 4 deletions sample/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 26
compileSdkVersion 28
defaultConfig {
applicationId "com.hanks.demo"
minSdkVersion 15
targetSdkVersion 26
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand All @@ -24,8 +24,8 @@ dependencies {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation project(":passcodeview")
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:design:28.0.0'
testImplementation 'junit:junit:4.12'
}
2 changes: 1 addition & 1 deletion sample/src/main/java/com/hanks/demo/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.hanks.demo;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;

public class MainActivity extends AppCompatActivity {
Expand Down