2 * Copyright (C) 2012 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package com.android.gallery3d.ui;
19 import android.app.Activity;
20 import android.content.Context;
21 import android.os.PowerManager;
23 import com.android.gallery3d.app.AbstractGalleryActivity;
25 public class WakeLockHoldingProgressListener implements MenuExecutor.ProgressListener {
26 static private final String DEFAULT_WAKE_LOCK_LABEL = "Gallery Progress Listener";
27 private AbstractGalleryActivity mActivity;
28 private PowerManager.WakeLock mWakeLock;
30 public WakeLockHoldingProgressListener(AbstractGalleryActivity galleryActivity) {
31 this(galleryActivity, DEFAULT_WAKE_LOCK_LABEL);
34 public WakeLockHoldingProgressListener(AbstractGalleryActivity galleryActivity, String label) {
35 mActivity = galleryActivity;
37 (PowerManager) ((Activity) mActivity).getSystemService(Context.POWER_SERVICE);
38 mWakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, label);
42 public void onProgressComplete(int result) {
47 public void onProgressStart() {
51 protected AbstractGalleryActivity getActivity() {
56 public void onProgressUpdate(int index) {
60 public void onConfirmDialogDismissed(boolean confirmed) {
64 public void onConfirmDialogShown() {