Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
dononcharles authored Aug 23, 2021
1 parent 0cba19e commit f4a1a57
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Timer converter dialog converts time (HH:MM:SS) into seconds.

# How to use
* Add dependency
```
```gradle
allprojects {
repositories {
maven { url 'https://jitpack.io' }
Expand All @@ -17,38 +17,38 @@ allprojects {
implementation 'com.github.dononcharles:TimerConverterDialog:Tag@aar'
```
* Add TextInputEditText in your layout file
```
```xml
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/secondTimerTil"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
android:layout_width="250dp"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_margin="16dp"
android:layout_weight="1">
android:id="@+id/secondTimerTil"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
android:layout_width="250dp"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_margin="16dp"
android:layout_weight="1">

<com.google.android.material.textfield.TextInputEditText
android:id="@+id/secondTimerTiet"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="false"
android:hint="@string/timer_in_second"
android:imeOptions="actionNext"
android:inputType="number" />
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/secondTimerTiet"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="false"
android:hint="@string/timer_in_second"
android:imeOptions="actionNext"
android:inputType="number" />

</com.google.android.material.textfield.TextInputLayout>
</com.google.android.material.textfield.TextInputLayout>
```
* In your activity class
```
```kotlin
val secondField = findViewById<TextInputEditText>(R.id.secondTimerTiet)
secondField.apply {
setOnClickListener {
STimerDialog(this@MainActivity).customTimerSet(presetInputValue = this.text.toString().toIntOrZero()) { hInSecond, mInSecond, second ->
this.setText((hInSecond + mInSecond + second).toString())
}
secondField.apply {
setOnClickListener {
STimerDialog(this@MainActivity).customTimerSet(presetInputValue = this.text.toString().toIntOrZero()) { hInSecond, mInSecond, second ->
this.setText((hInSecond + mInSecond + second).toString())
}
}
}
```

### See "app" folder for usage
Expand Down

0 comments on commit f4a1a57

Please sign in to comment.