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
.files
.services
.FileUploader
;
23 import com
.owncloud
.android
.ui
.dialog
.ConflictsResolveDialog
;
24 import com
.owncloud
.android
.ui
.dialog
.ConflictsResolveDialog
.Decision
;
25 import com
.owncloud
.android
.ui
.dialog
.ConflictsResolveDialog
.OnConflictDecisionMadeListener
;
27 import android
.accounts
.Account
;
28 import android
.content
.Intent
;
29 import android
.os
.Bundle
;
30 import android
.util
.Log
;
33 * Wrapper activity which will be launched if keep-in-sync file will be modified by external
36 * @author Bartek Przybylski
39 public class ConflictsResolveActivity
extends SherlockFragmentActivity
implements OnConflictDecisionMadeListener
{
41 private String TAG
= ConflictsResolveActivity
.class.getSimpleName();
43 private String mRemotePath
;
45 private String mLocalPath
;
47 private Account mOCAccount
;
50 protected void onCreate(Bundle savedInstanceState
) {
51 super.onCreate(savedInstanceState
);
52 mRemotePath
= getIntent().getStringExtra("remotepath");
53 mLocalPath
= getIntent().getStringExtra("localpath");
54 mOCAccount
= getIntent().getParcelableExtra("account");
55 ConflictsResolveDialog d
= ConflictsResolveDialog
.newInstance(mRemotePath
, this);
60 public void ConflictDecisionMade(Decision decision
) {
61 Intent i
= new Intent(getApplicationContext(), FileUploader
.class);
67 i
.putExtra(FileUploader
.KEY_FORCE_OVERWRITE
, true
);
68 case KEEP_BOTH
: // fallthrough
71 Log
.wtf(TAG
, "Unhandled conflict decision " + decision
);
74 i
.putExtra(FileUploader
.KEY_ACCOUNT
, mOCAccount
);
75 i
.putExtra(FileUploader
.KEY_REMOTE_FILE
, mRemotePath
);
76 i
.putExtra(FileUploader
.KEY_LOCAL_FILE
, mLocalPath
);
77 i
.putExtra(FileUploader
.KEY_UPLOAD_TYPE
, FileUploader
.UPLOAD_SINGLE_FILE
);