mirror of
https://github.com/nextcloud/android.git
synced 2024-11-25 22:55:46 +03:00
Make these classes use the account selection from the preferences screen
This commit is contained in:
parent
a6e98cc7dc
commit
385211893f
2 changed files with 8 additions and 14 deletions
|
@ -38,6 +38,7 @@ import android.widget.ArrayAdapter;
|
|||
import android.widget.EditText;
|
||||
import eu.alefzero.owncloud.R;
|
||||
import eu.alefzero.owncloud.authenticator.AccountAuthenticator;
|
||||
import eu.alefzero.owncloud.authenticator.AuthUtils;
|
||||
import eu.alefzero.owncloud.datamodel.OCFile;
|
||||
import eu.alefzero.owncloud.ui.fragment.FileList;
|
||||
import eu.alefzero.webdav.WebdavClient;
|
||||
|
@ -66,6 +67,7 @@ public class FileDisplayActivity extends android.support.v4.app.FragmentActivity
|
|||
protected Dialog onCreateDialog(int id, Bundle args) {
|
||||
final AlertDialog.Builder builder = new Builder(this);
|
||||
final EditText dirName = new EditText(getBaseContext());
|
||||
final Account a = AuthUtils.getCurrentOwnCloudAccount(this);
|
||||
builder.setView(dirName);
|
||||
builder.setTitle(R.string.uploader_info_dirname);
|
||||
|
||||
|
@ -76,10 +78,6 @@ public class FileDisplayActivity extends android.support.v4.app.FragmentActivity
|
|||
dialog.cancel();
|
||||
return;
|
||||
}
|
||||
AccountManager am = (AccountManager) getSystemService(ACCOUNT_SERVICE);
|
||||
// following account choosing is incorrect and needs to be replaced
|
||||
// with some sort of session mechanism
|
||||
Account a = am.getAccountsByType(AccountAuthenticator.ACCOUNT_TYPE)[0];
|
||||
|
||||
String path = "";
|
||||
for (int i = mDirectories.getCount()-2; i >= 0; --i) {
|
||||
|
@ -87,7 +85,7 @@ public class FileDisplayActivity extends android.support.v4.app.FragmentActivity
|
|||
}
|
||||
OCFile parent = new OCFile(getContentResolver(), a, path+"/");
|
||||
path += "/" + s + "/";
|
||||
Thread thread = new Thread(new DirectoryCreator(path, a, am));
|
||||
Thread thread = new Thread(new DirectoryCreator(path, a));
|
||||
thread.start();
|
||||
OCFile.createNewFile(getContentResolver(), a, path, 0, 0, 0, "DIR", parent.getFileId()).save();
|
||||
|
||||
|
@ -200,10 +198,10 @@ public class FileDisplayActivity extends android.support.v4.app.FragmentActivity
|
|||
private Account mAccount;
|
||||
private AccountManager mAm;
|
||||
|
||||
public DirectoryCreator(String targetPath, Account account, AccountManager am) {
|
||||
public DirectoryCreator(String targetPath, Account account) {
|
||||
mTargetPath = targetPath;
|
||||
mAccount = account;
|
||||
mAm = am;
|
||||
mAm = (AccountManager) getSystemService(ACCOUNT_SERVICE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -22,8 +22,6 @@ import java.util.Stack;
|
|||
import java.util.Vector;
|
||||
|
||||
import android.accounts.Account;
|
||||
import android.accounts.AccountManager;
|
||||
import android.app.Service;
|
||||
import android.content.ContentProviderOperation;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
@ -33,7 +31,7 @@ import android.util.Log;
|
|||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import eu.alefzero.owncloud.R;
|
||||
import eu.alefzero.owncloud.authenticator.AccountAuthenticator;
|
||||
import eu.alefzero.owncloud.authenticator.AuthUtils;
|
||||
import eu.alefzero.owncloud.datamodel.OCFile;
|
||||
import eu.alefzero.owncloud.ui.FragmentListView;
|
||||
import eu.alefzero.owncloud.ui.activity.FileDetailActivity;
|
||||
|
@ -47,7 +45,6 @@ import eu.alefzero.owncloud.ui.adapter.FileListListAdapter;
|
|||
*/
|
||||
public class FileList extends FragmentListView {
|
||||
private Account mAccount;
|
||||
private AccountManager mAccountManager;
|
||||
private Stack<String> mDirNames;
|
||||
private Vector<OCFile> mFiles;
|
||||
|
||||
|
@ -59,8 +56,7 @@ public class FileList extends FragmentListView {
|
|||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
mAccountManager = (AccountManager)getActivity().getSystemService(Service.ACCOUNT_SERVICE);
|
||||
mAccount = mAccountManager.getAccountsByType(AccountAuthenticator.ACCOUNT_TYPE)[0];
|
||||
mAccount = AuthUtils.getCurrentOwnCloudAccount(getActivity());
|
||||
populateFileList();
|
||||
//addContact(mAccount, "Bartek Przybylski", "czlowiek");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue