blob: 2450881793db761c414e1baca39e43103cf36e58 [file] [log] [blame]
Owen Lina2fba682011-08-17 22:07:43 +08001/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16
17package com.android.gallery3d.ui;
18
Owen Lin73a04ff2012-03-14 17:27:24 +080019import android.os.Bundle;
20import android.widget.Toast;
21
Owen Lina2fba682011-08-17 22:07:43 +080022import com.android.gallery3d.R;
23import com.android.gallery3d.app.AlbumPage;
24import com.android.gallery3d.app.GalleryActivity;
Owen Lina2fba682011-08-17 22:07:43 +080025import com.android.gallery3d.util.MediaSetUtils;
26
Owen Lina2fba682011-08-17 22:07:43 +080027public class ImportCompleteListener implements MenuExecutor.ProgressListener {
28 private GalleryActivity mActivity;
29
30 public ImportCompleteListener(GalleryActivity galleryActivity) {
31 mActivity = galleryActivity;
32 }
33
34 public void onProgressComplete(int result) {
35 int message;
36 if (result == MenuExecutor.EXECUTION_RESULT_SUCCESS) {
37 message = R.string.import_complete;
38 goToImportedAlbum();
39 } else {
40 message = R.string.import_fail;
41 }
42 Toast.makeText(mActivity.getAndroidContext(), message, Toast.LENGTH_LONG).show();
43 }
44
45 public void onProgressUpdate(int index) {
46 }
47
48 private void goToImportedAlbum() {
49 String pathOfImportedAlbum = "/local/all/" + MediaSetUtils.IMPORTED_BUCKET_ID;
50 Bundle data = new Bundle();
51 data.putString(AlbumPage.KEY_MEDIA_PATH, pathOfImportedAlbum);
52 mActivity.getStateManager().startState(AlbumPage.class, data);
53 }
54
55}