Single sign-on for Nextcloud (Android Library Project)
Перейти к файлу
David Luhmer 8b17d15e37
Delete LICENSE
2018-03-05 10:42:03 -04:00
src/main remove launcher icons 2015-01-10 13:29:04 +01:00
.gitignore initial upload 2014-06-05 23:21:42 +02:00
AccountImporter.iml initial upload 2014-06-05 23:21:42 +02:00
README.md Add small tutorial 2014-06-05 23:36:50 +02:00
build.gradle Update compileSdkVersion / buildToolsVersion 2017-11-07 20:17:32 +01:00
proguard-rules.pro initial upload 2014-06-05 23:21:42 +02:00

README.md

ownCloud-Account-Importer

Account Importer (Android Library Project)

How to use it?

  1. you'll need to extend IAccountImport

That means that you have to implement the following method:

public void accountAccessGranted(OwnCloudAccount account);

As you can see in the following example, it's really easy to get the account data

@Override
public void accountAccessGranted(OwnCloudAccount account) {
    mUsernameView.setText(account.getUsername());
    mPasswordView.setText(account.getPassword());
    mOc_root_path_View.setText(account.getUrl());
}

And then you can call the dialog with the following code:

public static void show(FragmentActivity activity, IAccountImport accountImport)

Here a small example:

view.findViewById(R.id.btn_importAccount).setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View view) {
        ImportAccountsDialogFragment.show(getActivity(), LoginDialogFragment.this);
    }
});

//If no other accounts (from other apps) are available.. hide the button
if(AccountImporter.findAccounts(getActivity()).size() <= 0) {
    view.findViewById(R.id.btn_importAccount).setVisibility(View.GONE);
}