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
;
24 import android
.os
.Bundle
;
25 import android
.view
.View
.OnClickListener
;
27 import com
.owncloud
.android
.datamodel
.OCFile
;
28 import com
.owncloud
.android
.ui
.fragment
.FileFragment
;
29 import com
.owncloud
.android
.ui
.fragment
.OCFileListFragment
;
31 public class UploadPathActivity
extends FolderPickerActivity
implements FileFragment
.ContainerActivity
,
32 OnClickListener
, OnEnforceableRefreshListener
{
34 public static final String KEY_INSTANT_UPLOAD_PATH
= "INSTANT_UPLOAD_PATH";
38 protected void onCreate(Bundle savedInstanceState
) {
39 super.onCreate(savedInstanceState
);
41 String instantUploadPath
= getIntent().getStringExtra(KEY_INSTANT_UPLOAD_PATH
);
43 // The caller activity (Preferences) is not a FileActivity, so it has no OCFile, only a path.
44 OCFile folder
= new OCFile(instantUploadPath
);
50 * Called when the ownCloud {@link Account} associated to the Activity was
54 protected void onAccountSet(boolean stateWasRecovered
) {
55 super.onAccountSet(stateWasRecovered
);
56 if (getAccount() != null
) {
60 OCFile folder
= getFile();
61 if (folder
== null
|| !folder
.isFolder()) {
62 // fall back to root folder
63 setFile(getStorageManager().getFileByPath(OCFile
.ROOT_PATH
));
67 onBrowsedDownTo(folder
);
69 if (!stateWasRecovered
) {
70 OCFileListFragment listOfFolders
= getListOfFilesFragment();
71 listOfFolders
.listDirectory(folder
);
73 startSyncFolderOperation(folder
, false
);
76 updateNavigationElementsInActionBar();