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
.datamodel
.OCFile
;
24 import com
.owncloud
.android
.files
.services
.FileUploader
;
25 import com
.owncloud
.android
.ui
.dialog
.ConflictsResolveDialog
;
26 import com
.owncloud
.android
.ui
.dialog
.ConflictsResolveDialog
.Decision
;
27 import com
.owncloud
.android
.ui
.dialog
.ConflictsResolveDialog
.OnConflictDecisionMadeListener
;
29 import android
.accounts
.Account
;
30 import android
.content
.Intent
;
31 import android
.os
.Bundle
;
32 import android
.util
.Log
;
35 * Wrapper activity which will be launched if keep-in-sync file will be modified by external
38 * @author Bartek Przybylski
41 public class ConflictsResolveActivity
extends SherlockFragmentActivity
implements OnConflictDecisionMadeListener
{
43 public static final String EXTRA_FILE
= "FILE";
44 public static final String EXTRA_ACCOUNT
= "ACCOUNT";
46 private String TAG
= ConflictsResolveActivity
.class.getSimpleName();
48 //private String mRemotePath;
50 //private String mLocalPath;
53 private Account mOCAccount
;
56 protected void onCreate(Bundle savedInstanceState
) {
57 super.onCreate(savedInstanceState
);
59 //mRemotePath = getIntent().getStringExtra("remotepath");
60 //mLocalPath = getIntent().getStringExtra("localpath");
61 mFile
= getIntent().getParcelableExtra(EXTRA_FILE
);
62 mOCAccount
= getIntent().getParcelableExtra(EXTRA_ACCOUNT
);
63 ConflictsResolveDialog d
= ConflictsResolveDialog
.newInstance(mFile
.getRemotePath(), this);
68 public void ConflictDecisionMade(Decision decision
) {
69 Intent i
= new Intent(getApplicationContext(), FileUploader
.class);
76 i
.putExtra(FileUploader
.KEY_FORCE_OVERWRITE
, true
);
79 i
.putExtra(FileUploader
.KEY_LOCAL_BEHAVIOUR
, FileUploader
.LOCAL_BEHAVIOUR_MOVE
);
82 Log
.wtf(TAG
, "Unhandled conflict decision " + decision
);
85 i
.putExtra(FileUploader
.KEY_ACCOUNT
, mOCAccount
);
86 i
.putExtra(FileUploader
.KEY_FILE
, mFile
);
87 i
.putExtra(FileUploader
.KEY_UPLOAD_TYPE
, FileUploader
.UPLOAD_SINGLE_FILE
);