Skip to content

Commit

Permalink
Adding reademe
Browse files Browse the repository at this point in the history
Droidhelios committed Mar 22, 2022
1 parent f17db74 commit ee7df0e
Showing 3 changed files with 108 additions and 0 deletions.
1 change: 1 addition & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

101 changes: 101 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# OTP-view

#### Library size is : Kb

## Setup Project

Add this to your project build.gradle
``` gradle
allprojects {
repositories {
maven {
url "https://jitpack.io"
}
}
}
```

Add this to your project build.gradle

#### Dependency
[![](https://jitpack.io/v/appsfeature/otp-view.svg)](https://jitpack.io/#appsfeature/otp-view)
```gradle
dependencies {
implementation 'com.github.appsfeature:otp-view:1.0'
}
```


### Statistics Usage methods

### Activity class setup
```java
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_sample1)

val errorButton = findViewById<Button>(R.id.button)
val successButton = findViewById<Button>(R.id.button2)
val otpTextView = findViewById(R.id.otp_view) as OTPTextView
otpTextView.requestFocusOTP()
otpTextView.otpListener = object : OTPListener {
override fun onInteractionListener() {

}

override fun onOTPComplete(otp: String) {
Toast.makeText(this@SampleActivity1, "The OTP is $otp", Toast.LENGTH_SHORT).show()
}
}
errorButton.setOnClickListener { otpTextView.showError() }
successButton.setOnClickListener { otpTextView.showSuccess() }
}
}
```

### OTP Box implementation changes in layout.xml file
```xml
<com.otpview.OTPTextView
android:id="@+id/otp_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ffffff"
app:otp_box_background="@drawable/bg_otp_box"
app:otp_box_background_active="@drawable/bg_otp_box_active"
app:otp_box_background_inactive="@drawable/bg_otp_box_inactive"
app:otp_box_background_error="@drawable/bg_otp_box_error"
app:otp_box_background_success="@drawable/bg_otp_box_success"
app:box_margin="0dp"
app:height="40dp"
app:hide_otp="false"
app:length="6"
app:otp=""
app:otp_text_size="20dp"
app:width="40dp" />
```

### Dash implementation changes in layout.xml file
```xml
<com.otpview.OTPTextView
android:id="@+id/otp_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ffffff"
app:bar_active_color="@color/white"
app:bar_enabled="true"
app:bar_error_color="@color/red"
app:bar_height="1.5dp"
app:bar_inactive_color="#606060"
app:bar_margin_bottom="0dp"
app:bar_margin_left="2dp"
app:bar_margin_right="2dp"
app:bar_success_color="#33cc33"
app:box_margin="0dp"
app:height="40dp"
app:hide_otp="true"
app:length="6"
app:otp=""
app:otp_text_size="20dp"
app:width="40dp" />
```

0 comments on commit ee7df0e

Please sign in to comment.