Skip to content

Commit

Permalink
Fixed Timer
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Sotelo committed Mar 23, 2018
1 parent 125743b commit 11cb37a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions README.md
Expand Up @@ -12,7 +12,7 @@ A Simple Wav audio recorder dialog

## Releases:

#### Current release: 1.2.0.
#### Current release: 1.2.1.

You can see all the library releases [here](https://github.com/IvanSotelo/RecordDialog/releases).

Expand Down Expand Up @@ -43,7 +43,7 @@ allprojects {
Now add the dependency to your app build.gradle file:

```groovy
compile 'com.github.IvanSotelo:RecordDialog:1.2.0'
compile 'com.github.IvanSotelo:RecordDialog:1.2.1'
```

### Creating the dialog with Java
Expand Down Expand Up @@ -71,15 +71,15 @@ Here is a complete snippet of it usage:
--------
#### Gradle
```groovy
compile 'com.ivansotelo.RecordDialog:1.2.0'
compile 'com.ivansotelo.RecordDialog:1.2.1'
```

##### Maven
```xml
<dependency>
<groupId>com.ivansotelo</groupId>
<artifactId>RecordDialog</artifactId>
<version>1.2.0</version>
<version>1.2.1</version>
<type>aar</type>
</dependency>
```
Expand Down
6 changes: 3 additions & 3 deletions recorddialog/build.gradle
Expand Up @@ -9,8 +9,8 @@ android {
defaultConfig {
minSdkVersion 18
targetSdkVersion 26
versionCode 3
versionName "1.2.0"
versionCode 4
versionName "1.2.1"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

Expand All @@ -27,7 +27,7 @@ android {
}
group = "com.ivansotelo"
archivesBaseName = "RecordDialog"
version = "1.2.0" //customize this for new release
version = "1.2.1" //customize this for new release

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
Expand Down
Expand Up @@ -45,7 +45,7 @@ public class RecordDialog extends DialogFragment {
private String STATE_BUTTON = "INIT";
private String _AudioSavePathInDevice = null;
private TextView _timerView;
private Timer timer;
private Timer _timer;
private int recorderSecondsElapsed;
private int playerSecondsElapsed;

Expand Down Expand Up @@ -89,7 +89,7 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
LayoutInflater inflater = LayoutInflater.from(getActivity());
View rootView = inflater.inflate(R.layout.record_dialog, null);
String strMessage = _strMessage == null ? "Presiona para grabar" : _strMessage;
_timerView = rootView.findViewById(R.id.timer);
_timerView = rootView.findViewById(R.id.txtTimer);
_timerView.setText(strMessage);
_recordButton = rootView.findViewById(R.id.btnRecord);
_recordButton.setOnClickListener(new View.OnClickListener() {
Expand Down Expand Up @@ -264,8 +264,8 @@ private void stopMediaPlayer() {

private void startTimer(){
stopTimer();
timer = new Timer();
timer.scheduleAtFixedRate(new TimerTask() {
_timer = new Timer();
_timer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
updateTimer();
Expand All @@ -274,10 +274,10 @@ public void run() {
}

private void stopTimer(){
if (timer != null) {
timer.cancel();
timer.purge();
timer = null;
if (_timer != null) {
_timer.cancel();
_timer.purge();
_timer = null;
}
}

Expand Down
2 changes: 1 addition & 1 deletion recorddialog/src/main/res/layout/record_dialog.xml
Expand Up @@ -22,7 +22,7 @@
app:rippleColor="@color/colorPrimary" />

<TextView
android:id="@+id/timer"
android:id="@+id/txtTimer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
Expand Down

0 comments on commit 11cb37a

Please sign in to comment.