mirror of
https://github.com/nerzhul/ownCloud-SMS-App.git
synced 2025-06-24 08:16:23 +00:00
Prepare the ListView loading for loading contacts from owncloud instance
This commit is contained in:
parent
a8b3eed9c8
commit
f120a92489
@ -13,15 +13,11 @@ public class AccountListActivity extends ListActivity {
|
|||||||
ArrayList<Account> listItems = new ArrayList<Account>();
|
ArrayList<Account> listItems = new ArrayList<Account>();
|
||||||
AndroidAccountAdapter adapter;
|
AndroidAccountAdapter adapter;
|
||||||
|
|
||||||
private static String _accountType;
|
|
||||||
private static AccountManager _accountMgr;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(final Bundle icicle) {
|
public void onCreate(final Bundle icicle) {
|
||||||
super.onCreate(icicle);
|
super.onCreate(icicle);
|
||||||
|
|
||||||
_accountType = getString(R.string.account_type);
|
final AccountManager _accountMgr = AccountManager.get(getBaseContext());
|
||||||
_accountMgr = AccountManager.get(getBaseContext());
|
|
||||||
|
|
||||||
setContentView(R.layout.restore_activity_accountlist);
|
setContentView(R.layout.restore_activity_accountlist);
|
||||||
adapter = new AndroidAccountAdapter(this,
|
adapter = new AndroidAccountAdapter(this,
|
||||||
@ -31,8 +27,9 @@ public class AccountListActivity extends ListActivity {
|
|||||||
R.id.accountname, ContactListActivity.class);
|
R.id.accountname, ContactListActivity.class);
|
||||||
setListAdapter(adapter);
|
setListAdapter(adapter);
|
||||||
|
|
||||||
final Account[] myAccountList = _accountMgr.getAccountsByType(_accountType);
|
final Account[] accountList =
|
||||||
for (final Account element : myAccountList) {
|
_accountMgr.getAccountsByType(getString(R.string.account_type));
|
||||||
|
for (final Account element : accountList) {
|
||||||
listItems.add(element);
|
listItems.add(element);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
package fr.unix_experience.owncloud_sms.activities.restore_sms;
|
package fr.unix_experience.owncloud_sms.activities.restore_sms;
|
||||||
|
|
||||||
|
import android.accounts.Account;
|
||||||
|
import android.accounts.AccountManager;
|
||||||
import android.app.ListActivity;
|
import android.app.ListActivity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import fr.unix_experience.owncloud_sms.R;
|
||||||
|
|
||||||
public class ContactListActivity extends ListActivity {
|
public class ContactListActivity extends ListActivity {
|
||||||
|
|
||||||
@ -9,5 +12,25 @@ public class ContactListActivity extends ListActivity {
|
|||||||
protected void onCreate(final Bundle savedInstanceState) {
|
protected void onCreate(final Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
final String accountName = savedInstanceState.getString("account");
|
||||||
|
// Impossible... need to handle this later, in case of
|
||||||
|
if (accountName == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final AccountManager _accountMgr = AccountManager.get(getBaseContext());
|
||||||
|
final Account[] myAccountList =
|
||||||
|
_accountMgr.getAccountsByType(getString(R.string.account_type));
|
||||||
|
for (final Account element : myAccountList) {
|
||||||
|
if (element.name.equals(accountName)) {
|
||||||
|
loadContacts(element);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// This function fetch contacts from the ownCloud instance and generate the list activity
|
||||||
|
private void loadContacts(final Account account) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user