diff options
author | ztenghui <ztenghui@google.com> | 2013-09-05 15:47:58 -0700 |
---|---|---|
committer | ztenghui <ztenghui@google.com> | 2013-09-19 11:12:50 -0700 |
commit | 064d6000933354f7bf344a41e0caa7052401c903 (patch) | |
tree | f442349e15a415ad0af271960391175b1f5100d2 /src/com/android/camera/data/LocalMediaObserver.java | |
parent | a5682ab08e1d42fe272ec877929478b4adb769f5 (diff) | |
download | android_packages_apps_Snap-064d6000933354f7bf344a41e0caa7052401c903.tar.gz android_packages_apps_Snap-064d6000933354f7bf344a41e0caa7052401c903.tar.bz2 android_packages_apps_Snap-064d6000933354f7bf344a41e0caa7052401c903.zip |
Use contentObserver to refresh the data when dirty.
Handle another setDataSource exception.
Remove the old work around for refreshing after editing.
bug:10390298
Change-Id: I8777364b96c86eeaf5581a96163aab823cd4b438
Diffstat (limited to 'src/com/android/camera/data/LocalMediaObserver.java')
-rw-r--r-- | src/com/android/camera/data/LocalMediaObserver.java | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/com/android/camera/data/LocalMediaObserver.java b/src/com/android/camera/data/LocalMediaObserver.java new file mode 100644 index 000000000..4dd0f8897 --- /dev/null +++ b/src/com/android/camera/data/LocalMediaObserver.java @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.camera.data; + +import android.database.ContentObserver; +import android.net.Uri; +import android.os.Handler; + +import com.android.camera.CameraActivity; + +/** + * Listening to the changes to the local image and video data. onChange will + * happen on the main thread. + */ +public class LocalMediaObserver extends ContentObserver { + + private final CameraActivity mActivity; + + public LocalMediaObserver(Handler handler, CameraActivity activity) { + super(handler); + mActivity = activity; + } + + @Override + public void onChange(boolean selfChange) { + this.onChange(selfChange, null); + } + + @Override + public void onChange(boolean selfChange, Uri uri) { + mActivity.setDirtyWhenPaused(); + } +} |