summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorBenson Huang <benson.huang@mediatek.com>2014-12-24 14:58:24 +0800
committerNicholas Sauer <nicksauer@google.com>2014-12-31 19:53:05 +0000
commitec7335ddade6439271656665b3152868f884dfcb (patch)
tree4a827fa7c448d2e66caeddab9cd258b408e3d103 /src/com
parent0dedb6b1c809ebad637021782b3bdd1abc9970be (diff)
downloadandroid_packages_apps_FMRadio-ec7335ddade6439271656665b3152868f884dfcb.tar.gz
android_packages_apps_FMRadio-ec7335ddade6439271656665b3152868f884dfcb.tar.bz2
android_packages_apps_FMRadio-ec7335ddade6439271656665b3152868f884dfcb.zip
[FM] FM recording time will display incorrectly when recording time is beyond 60 minutes
Launch FM from Launcher and power up FM -> Select "Start Recording" in options menu, check the Recording Timer Text ("00m00s" is OK) -> Wait for FM recording more than 60 minutes (e.g. 61 minutes 20 seconds), click power key to unlock screen and check the recording timer text in FM record, the recording timer text will be "00m20s". The fix is to follow SoundRecorder's way to show recording timer. from: https://partner-android-review.googlesource.com/#/c/192375/1 Bug 18842895 Change-Id: Iefb385ab855e2e940d23632502c35bc3e27ad8a5 Signed-off-by: Benson Huang <benson.huang@mediatek.com>
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/fmradio/FmRecordActivity.java19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/com/android/fmradio/FmRecordActivity.java b/src/com/android/fmradio/FmRecordActivity.java
index 95ba8e8..e9ba75a 100644
--- a/src/com/android/fmradio/FmRecordActivity.java
+++ b/src/com/android/fmradio/FmRecordActivity.java
@@ -61,6 +61,7 @@ public class FmRecordActivity extends Activity implements
private static final String FM_ENTER_RECORD_SCREEN = "fmradio.enter.record.screen";
private static final String TAG_SAVE_RECORDINGD = "SaveRecording";
private static final int MSG_UPDATE_NOTIFICATION = 1000;
+ private static final int TIME_BASE = 60;
private Context mContext;
private TextView mMintues;
private TextView mSeconds;
@@ -226,6 +227,7 @@ public class FmRecordActivity extends Activity implements
}
// Trigger to refreshing timer text if still in record
if (!isStopRecording()) {
+ mHandler.removeMessages(FmListener.MSGID_REFRESH);
mHandler.sendEmptyMessage(FmListener.MSGID_REFRESH);
}
// Clear notification, it only need show when in background
@@ -331,6 +333,7 @@ public class FmRecordActivity extends Activity implements
}
mPlayIndicator.startAnimation();
mStopRecordButton.setEnabled(true);
+ mHandler.removeMessages(FmListener.MSGID_REFRESH);
mHandler.sendEmptyMessage(FmListener.MSGID_REFRESH);
};
@@ -340,6 +343,14 @@ public class FmRecordActivity extends Activity implements
};
};
+ private String addPaddingForString(long time) {
+ StringBuilder builder = new StringBuilder();
+ if (time >= 0 && time < 10) {
+ builder.append("0");
+ }
+ return builder.append(time).toString();
+ }
+
private final Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
@@ -347,11 +358,9 @@ public class FmRecordActivity extends Activity implements
case FmListener.MSGID_REFRESH:
if (mService != null) {
long recordTime = mService.getRecordTime();
- Date date = new Date(recordTime);
- SimpleDateFormat format = new SimpleDateFormat("mm:ss");
- String[] timeText = format.format(date).split(":");
- mMintues.setText(timeText[0]);
- mSeconds.setText(timeText[1]);
+ recordTime = recordTime / 1000L;
+ mMintues.setText(addPaddingForString(recordTime / TIME_BASE));
+ mSeconds.setText(addPaddingForString(recordTime % TIME_BASE));
// Check storage free space
String recordingSdcard = FmUtils.getDefaultStoragePath();