Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (img != null && detector.detect(img, width, height)) {
- // The delay is necessary to avoid taking a picture while in
- // the
- // middle of taking another. This problem can causes some
- // phones
- // to reboot.
- long now = System.currentTimeMillis();
- if (now > (mReferenceTime + Preferences.PICTURE_DELAY)) {
- mReferenceTime = now;
- Bitmap previous = null;
- if (Preferences.SAVE_PREVIOUS && pre != null) {
- if (Preferences.USE_RGB) previous = ImageProcessing.rgbToBitmap(pre, width, height);
- else previous = ImageProcessing.lumaToGreyscale(pre, width, height);
- }
- Bitmap original = null;
- if (Preferences.SAVE_ORIGINAL && org != null) {
- if (Preferences.USE_RGB) original = ImageProcessing.rgbToBitmap(org, width, height);
- else original = ImageProcessing.lumaToGreyscale(org, width, height);
- }
- Bitmap bitmap = null;
- if (Preferences.SAVE_CHANGES) {
- if (Preferences.USE_RGB) bitmap = ImageProcessing.rgbToBitmap(img, width, height);
- else bitmap = ImageProcessing.lumaToGreyscale(img, width, height);
- }
- //<----SwitchPreference---->
- SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(MotionDetectionActivity.this);
- boolean enablesmsnotif = sharedPref.getBoolean(ENABLE_SMS_NOTIFICATION, true);
- boolean enablemailnotif=sharedPref.getBoolean(ENABLE_EMAIL_NOTIFICATION,true);
- if (enablesmsnotif) {
- sendSMS(ref);
- }
- if (enablemailnotif) {
- sendEmail(ref);
- }
- Log.i(TAG, "Saving.. previous=" + previous + " original=" + original + " bitmap=" + bitmap);
- Looper.prepare();
- new SavePhotoTask().execute(previous, original, bitmap);
- } else {
- Log.i(TAG, "Not taking picture because not enough time has passed since the creation of the Surface");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement