add legacy accounts support
This commit is contained in:
@@ -25,6 +25,9 @@
|
|||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<ListView android:id="@+id/accounts_tester_authenticators_list"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="fill_parent"/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
@@ -40,13 +43,14 @@
|
|||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<ListView android:id="@+id/accounts_tester_authenticators_list"
|
|
||||||
android:layout_width="fill_parent" android:layout_height="fill_parent"/>
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/accounts_tester_get_accounts_by_type"
|
android:id="@+id/accounts_tester_get_accounts_by_type"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@@ -58,16 +62,45 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/accounts_tester_get_all_accounts"/>
|
android:text="@string/accounts_tester_get_all_accounts"/>
|
||||||
|
<Button android:id="@+id/accounts_tester_add_account"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/accounts_tester_add_account"/>
|
||||||
|
|
||||||
<Button android:id="@+id/accounts_tester_add_account"
|
<Button android:id="@+id/accounts_tester_edit_properties"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/accounts_tester_add_account"/>
|
android:text="@string/accounts_tester_edit_properties"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<Button android:id="@+id/accounts_tester_edit_properties"
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:orientation="horizontal"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="fill_parent"
|
||||||
android:text="@string/accounts_tester_edit_properties"/>
|
android:layout_height="wrap_content">
|
||||||
|
<TextView android:id="@+id/accounts_tester_desiredFeatures"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/accounts_tester_desired_features_label"/>
|
||||||
|
|
||||||
|
<EditText android:id="@+id/accounts_tester_desired_features"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minEms="15"/>
|
||||||
|
</LinearLayout>
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<TextView android:id="@+id/accounts_tester_desiredFeatures"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/accounts_tester_desired_authtokentype_label"/>
|
||||||
|
|
||||||
|
<EditText android:id="@+id/accounts_tester_desired_authtokentype"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minEms="15"/>
|
||||||
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -136,9 +136,9 @@
|
|||||||
|
|
||||||
<!-- AccountsTester -->
|
<!-- AccountsTester -->
|
||||||
<string name="accounts_tester_app_name">Accounts Tester</string>
|
<string name="accounts_tester_app_name">Accounts Tester</string>
|
||||||
<string name="accounts_tester_get_accounts_by_type">Get Accounts By Type</string>
|
<string name="accounts_tester_get_accounts_by_type">Get By Type</string>
|
||||||
<string name="accounts_tester_get_all_accounts">Get All Accounts</string>
|
<string name="accounts_tester_get_all_accounts">Get All</string>
|
||||||
<string name="accounts_tester_add_account">Add Account</string>
|
<string name="accounts_tester_add_account">Add</string>
|
||||||
<string name="accounts_tester_select_account_type">Select Account Type</string>
|
<string name="accounts_tester_select_account_type">Select Account Type</string>
|
||||||
<string name="accounts_tester_process_name_header">Process Name:</string>
|
<string name="accounts_tester_process_name_header">Process Name:</string>
|
||||||
<string name="accounts_tester_remove_account">remove</string>
|
<string name="accounts_tester_remove_account">remove</string>
|
||||||
@@ -149,5 +149,7 @@
|
|||||||
<string name="accounts_tester_enter_auth_token_type">Enter the authtoken type:</string>
|
<string name="accounts_tester_enter_auth_token_type">Enter the authtoken type:</string>
|
||||||
<string name="accounts_tester_update_credentials">Update Credentials</string>
|
<string name="accounts_tester_update_credentials">Update Credentials</string>
|
||||||
<string name="accounts_tester_confirm_credentials">Confirm Credentials</string>
|
<string name="accounts_tester_confirm_credentials">Confirm Credentials</string>
|
||||||
<string name="accounts_tester_edit_properties">Edit Properties</string>
|
<string name="accounts_tester_edit_properties">Properties</string>
|
||||||
|
<string name="accounts_tester_desired_authtokentype_label">authtoken type:</string>
|
||||||
|
<string name="accounts_tester_desired_features_label">features:</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ public class AccountsTester extends Activity implements OnAccountsUpdatedListene
|
|||||||
private static final int GET_AUTH_TOKEN_DIALOG_ID = 1;
|
private static final int GET_AUTH_TOKEN_DIALOG_ID = 1;
|
||||||
private static final int UPDATE_CREDENTIALS_DIALOG_ID = 2;
|
private static final int UPDATE_CREDENTIALS_DIALOG_ID = 2;
|
||||||
private static final int INVALIDATE_AUTH_TOKEN_DIALOG_ID = 3;
|
private static final int INVALIDATE_AUTH_TOKEN_DIALOG_ID = 3;
|
||||||
|
private EditText mDesiredAuthTokenTypeEditText;
|
||||||
|
private EditText mDesiredFeaturesEditText;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -77,6 +79,9 @@ public class AccountsTester extends Activity implements OnAccountsUpdatedListene
|
|||||||
buttonClickListener);
|
buttonClickListener);
|
||||||
findViewById(R.id.accounts_tester_add_account).setOnClickListener(buttonClickListener);
|
findViewById(R.id.accounts_tester_add_account).setOnClickListener(buttonClickListener);
|
||||||
findViewById(R.id.accounts_tester_edit_properties).setOnClickListener(buttonClickListener);
|
findViewById(R.id.accounts_tester_edit_properties).setOnClickListener(buttonClickListener);
|
||||||
|
mDesiredAuthTokenTypeEditText =
|
||||||
|
(EditText) findViewById(R.id.accounts_tester_desired_authtokentype);
|
||||||
|
mDesiredFeaturesEditText = (EditText) findViewById(R.id.accounts_tester_desired_features);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class AuthenticatorsArrayAdapter extends ArrayAdapter<AuthenticatorDescription> {
|
private static class AuthenticatorsArrayAdapter extends ArrayAdapter<AuthenticatorDescription> {
|
||||||
@@ -190,9 +195,17 @@ public class AccountsTester extends Activity implements OnAccountsUpdatedListene
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
String authTokenType = mDesiredAuthTokenTypeEditText.getText().toString();
|
||||||
|
if (TextUtils.isEmpty(authTokenType)) {
|
||||||
|
authTokenType = null;
|
||||||
|
}
|
||||||
|
String featureString = mDesiredFeaturesEditText.getText().toString();
|
||||||
|
String[] requiredFeatures = TextUtils.split(featureString, " ");
|
||||||
|
if (requiredFeatures.length == 0) {
|
||||||
|
requiredFeatures = null;
|
||||||
|
}
|
||||||
mAccountManager.addAccount(getSelectedAuthenticator().type,
|
mAccountManager.addAccount(getSelectedAuthenticator().type,
|
||||||
null /* authTokenType */,
|
authTokenType, requiredFeatures, null /* options */,
|
||||||
null /* requiredFeatures */, null /* options */,
|
|
||||||
AccountsTester.this, callback, null /* handler */);
|
AccountsTester.this, callback, null /* handler */);
|
||||||
} else if (R.id.accounts_tester_edit_properties == v.getId()) {
|
} else if (R.id.accounts_tester_edit_properties == v.getId()) {
|
||||||
mAccountManager.editProperties(getSelectedAuthenticator().type,
|
mAccountManager.editProperties(getSelectedAuthenticator().type,
|
||||||
|
|||||||
Reference in New Issue
Block a user