Skip to content

Commit

Permalink
- fixed incorrect calculation of recording length, changed int dataty…
Browse files Browse the repository at this point in the history
…pe to long in RecordingService.java to properly calculate System.CurrentTimeMillis()
  • Loading branch information
dkim0419 committed Jan 15, 2015
1 parent 622c1ad commit 1ffa89a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "com.danielkim.soundrecorder"
minSdkVersion 16
targetSdkVersion 21
versionCode 4
versionName "1.2.1"
versionCode 5
versionName "1.2.2"
}
buildTypes {
release {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class RecordingService extends Service {
private DBHelper mDatabase;

private long mStartingTimeMillis = 0;
private int mElapsedMillis = 0;
private long mElapsedMillis = 0;
private int mElapsedSeconds = 0;
private OnTimerChangedListener onTimerChangedListener = null;
private static final SimpleDateFormat mTimerFormat = new SimpleDateFormat("mm:ss", Locale.getDefault());
Expand Down Expand Up @@ -116,7 +116,7 @@ public void setFileNameAndPath(){

public void stopRecording() {
mRecorder.stop();
mElapsedMillis = (int) (System.currentTimeMillis() - mStartingTimeMillis);
mElapsedMillis = (System.currentTimeMillis() - mStartingTimeMillis);
mRecorder.release();
Toast.makeText(this, getString(R.string.toast_recording_finish) + " " + mFilePath, Toast.LENGTH_LONG).show();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void onBindViewHolder(final RecordingsViewHolder holder, int position) {
- TimeUnit.MINUTES.toSeconds(minutes);

holder.vName.setText(item.getName());
holder.vLength.setText(String.format("%02d:%02d", minutes,seconds));
holder.vLength.setText(String.format("%02d:%02d", minutes, seconds));
holder.vDateAdded.setText(mDateAddedFormatter.format(item.getTime()));

// define an on click listener to open PlaybackFragment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ public void run() {
long minutes = TimeUnit.MILLISECONDS.toMinutes(mCurrentPosition);
long seconds = TimeUnit.MILLISECONDS.toSeconds(mCurrentPosition)
- TimeUnit.MINUTES.toSeconds(minutes);
mCurrentProgressTextView.setText(String.format("%02d:%02d", minutes,seconds));
mCurrentProgressTextView.setText(String.format("%02d:%02d", minutes, seconds));

updateSeekBar();
}
Expand Down

0 comments on commit 1ffa89a

Please sign in to comment.