2 * ownCloud Android client application
4 * Copyright (C) 2015 ownCloud Inc.
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2,
8 * as published by the Free Software Foundation.
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 android
.accounts
.Account
;
23 import android
.os
.Bundle
;
24 import android
.view
.View
.OnClickListener
;
26 import com
.owncloud
.android
.datamodel
.OCFile
;
27 import com
.owncloud
.android
.ui
.fragment
.FileFragment
;
28 import com
.owncloud
.android
.ui
.fragment
.OCFileListFragment
;
30 public class UploadPathActivity
extends FolderPickerActivity
implements FileFragment
.ContainerActivity
,
31 OnClickListener
, OnEnforceableRefreshListener
{
33 public static final String KEY_INSTANT_UPLOAD_PATH
= "INSTANT_UPLOAD_PATH";
37 protected void onCreate(Bundle savedInstanceState
) {
38 super.onCreate(savedInstanceState
);
40 String instantUploadPath
= getIntent().getStringExtra(KEY_INSTANT_UPLOAD_PATH
);
42 // The caller activity (Preferences) is not a FileActivity, so it has no OCFile, only a path.
43 OCFile folder
= new OCFile(instantUploadPath
);
49 * Called when the ownCloud {@link Account} associated to the Activity was
53 protected void onAccountSet(boolean stateWasRecovered
) {
54 super.onAccountSet(stateWasRecovered
);
55 if (getAccount() != null
) {
59 OCFile folder
= getFile();
60 if (folder
== null
|| !folder
.isFolder()) {
61 // fall back to root folder
62 setFile(getStorageManager().getFileByPath(OCFile
.ROOT_PATH
));
66 onBrowsedDownTo(folder
);
68 if (!stateWasRecovered
) {
69 OCFileListFragment listOfFolders
= getListOfFilesFragment();
70 // TODO Enable when "On Device" is recovered ?
71 listOfFolders
.listDirectory(folder
/*, false*/);
73 startSyncFolderOperation(folder
, false
);
76 updateNavigationElementsInActionBar();