diff options
-rw-r--r-- | src/com/android/camera/VideoModule.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java index 92a2e806f..e8ab677bd 100644 --- a/src/com/android/camera/VideoModule.java +++ b/src/com/android/camera/VideoModule.java @@ -80,6 +80,7 @@ import java.util.Iterator; import java.util.List; import java.util.HashMap; import java.lang.reflect.Method; +import java.util.regex.Pattern; public class VideoModule implements CameraModule, VideoController, @@ -2545,10 +2546,9 @@ public class VideoModule implements CameraModule, mActivity.getString(R.string.pref_video_time_lapse_frame_interval_default)); int timeLapseInterval = Integer.parseInt(frameIntervalStr); int rate = 0; - if (!hfr.equals("off")) - rate = Integer.parseInt(hfr); - else - rate = Integer.parseInt(hsr); + if ( isDigit(highFrameRate.substring(3)) ) { + rate = Integer.parseInt(highFrameRate.substring(3)); + } Log.v(TAG, "rate = "+rate); if ( (timeLapseInterval != 0) || (disMode.equals("enable") && (rate > PERSIST_EIS_MAX_FPS)) || @@ -2602,6 +2602,12 @@ public class VideoModule implements CameraModule, } } + private boolean isDigit(String input) { + String ruler = "[1-9][0-9]*"; + Pattern pattern = Pattern.compile(ruler); + return pattern.matcher(input).matches(); + } + @SuppressWarnings("deprecation") private void setCameraParameters(boolean isFlashDelay) { Log.d(TAG,"Preview dimension in App->"+mDesiredPreviewWidth+"X"+mDesiredPreviewHeight); |