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