d4043df504003bf856a0bcc526bbdd694300d154
[pub/Android/ownCloud.git] / src / com / owncloud / android / ui / activity / MoveActivity.java
1 /* ownCloud Android client application
2 * Copyright (C) 2012-2014 ownCloud Inc.
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 */
17
18 package com.owncloud.android.ui.activity;
19
20 import android.content.Intent;
21
22 import android.view.View;
23 import android.view.View.OnClickListener;
24
25
26
27 import com.owncloud.android.datamodel.OCFile;
28 import com.owncloud.android.ui.fragment.FileFragment;
29
30
31 public class MoveActivity extends FolderPickerActivity implements FileFragment.ContainerActivity,
32 OnClickListener, OnEnforceableRefreshListener {
33
34 public static final int RESULT_OK_AND_MOVE = 1;
35
36
37 @Override
38 public void onClick(View v) {
39 if (v == mCancelBtn) {
40 finish();
41 } else if (v == mChooseBtn) {
42 Intent i = getIntent();
43 OCFile targetFile = (OCFile) i.getParcelableExtra(MoveActivity.EXTRA_TARGET_FILE);
44
45 Intent data = new Intent();
46 data.putExtra(EXTRA_CURRENT_FOLDER, getCurrentFolder());
47 data.putExtra(EXTRA_TARGET_FILE, targetFile);
48 setResult(RESULT_OK_AND_MOVE, data);
49 finish();
50 }
51 }
52 }