1 /* ownCloud Android client application
2 * Copyright (C) 2012 Bartek Przybylski
3 * Copyright (C) 2012-2013 ownCloud Inc.
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 package com
.owncloud
.android
.ui
.activity
;
22 import com
.actionbarsherlock
.app
.SherlockFragmentActivity
;
23 import com
.owncloud
.android
.Log_OC
;
24 import com
.owncloud
.android
.datamodel
.OCFile
;
25 import com
.owncloud
.android
.files
.services
.FileUploader
;
26 import com
.owncloud
.android
.ui
.dialog
.ConflictsResolveDialog
;
27 import com
.owncloud
.android
.ui
.dialog
.ConflictsResolveDialog
.Decision
;
28 import com
.owncloud
.android
.ui
.dialog
.ConflictsResolveDialog
.OnConflictDecisionMadeListener
;
30 import android
.accounts
.Account
;
31 import android
.content
.Intent
;
32 import android
.os
.Bundle
;
33 import android
.util
.Log
;
36 * Wrapper activity which will be launched if keep-in-sync file will be modified by external
39 * @author Bartek Przybylski
42 public class ConflictsResolveActivity
extends SherlockFragmentActivity
implements OnConflictDecisionMadeListener
{
44 public static final String EXTRA_FILE
= "FILE";
45 public static final String EXTRA_ACCOUNT
= "ACCOUNT";
47 private String TAG
= ConflictsResolveActivity
.class.getSimpleName();
49 //private String mRemotePath;
51 //private String mLocalPath;
54 private Account mOCAccount
;
57 protected void onCreate(Bundle savedInstanceState
) {
58 super.onCreate(savedInstanceState
);
60 //mRemotePath = getIntent().getStringExtra("remotepath");
61 //mLocalPath = getIntent().getStringExtra("localpath");
62 mFile
= getIntent().getParcelableExtra(EXTRA_FILE
);
63 mOCAccount
= getIntent().getParcelableExtra(EXTRA_ACCOUNT
);
64 ConflictsResolveDialog d
= ConflictsResolveDialog
.newInstance(mFile
.getRemotePath(), this);
69 public void ConflictDecisionMade(Decision decision
) {
70 Intent i
= new Intent(getApplicationContext(), FileUploader
.class);
77 i
.putExtra(FileUploader
.KEY_FORCE_OVERWRITE
, true
);
80 i
.putExtra(FileUploader
.KEY_LOCAL_BEHAVIOUR
, FileUploader
.LOCAL_BEHAVIOUR_MOVE
);
83 Log_OC
.wtf(TAG
, "Unhandled conflict decision " + decision
);
86 i
.putExtra(FileUploader
.KEY_ACCOUNT
, mOCAccount
);
87 i
.putExtra(FileUploader
.KEY_FILE
, mFile
);
88 i
.putExtra(FileUploader
.KEY_UPLOAD_TYPE
, FileUploader
.UPLOAD_SINGLE_FILE
);