Minor style fix in authentication classes

This commit is contained in:
Rodrigo Damazio
2011-06-28 02:38:12 -03:00
parent 0f00e71b5e
commit 565662a8aa
5 changed files with 17 additions and 19 deletions
@@ -44,7 +44,7 @@ public class AccountChooser {
* Handle the account being selected. * Handle the account being selected.
* @param account The selected account or null if none could be found * @param account The selected account or null if none could be found
*/ */
public void handleAccountSelected(Account account); public void onAccountSelected(Account account);
} }
/** /**
@@ -65,13 +65,13 @@ public class AccountChooser {
return; return;
} }
if (accounts.length == 1) { if (accounts.length == 1) {
handler.handleAccountSelected(accounts[0]); handler.onAccountSelected(accounts[0]);
return; return;
} }
// TODO This should be read out of a preference. // TODO This should be read out of a preference.
if (selectedAccount != null) { if (selectedAccount != null) {
handler.handleAccountSelected(selectedAccount); handler.onAccountSelected(selectedAccount);
return; return;
} }
@@ -89,14 +89,14 @@ public class AccountChooser {
selectedAccount = accounts[selectedAccountIndex]; selectedAccount = accounts[selectedAccountIndex];
} }
handler.handleAccountSelected(selectedAccount); handler.onAccountSelected(selectedAccount);
} }
}); });
builder.setNegativeButton(R.string.cancel, builder.setNegativeButton(R.string.cancel,
new DialogInterface.OnClickListener() { new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
dialog.dismiss(); dialog.dismiss();
handler.handleAccountSelected(null); handler.onAccountSelected(null);
} }
}); });
String[] choices = new String[accounts.length]; String[] choices = new String[accounts.length];
@@ -127,7 +127,7 @@ public class AccountChooser {
new DialogInterface.OnClickListener() { new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
dialog.dismiss(); dialog.dismiss();
handler.handleAccountSelected(null); handler.onAccountSelected(null);
} }
}); });
builder.show(); builder.show();
@@ -84,7 +84,7 @@ public class MyMapsList extends Activity implements MapsFacade.MapsListCallback
MyMapsList.this, MyMapsList.this,
new AccountChooser.AccountHandler() { new AccountChooser.AccountHandler() {
@Override @Override
public void handleAccountSelected(Account account) { public void onAccountSelected(Account account) {
// Account selection happens in the UI thread. // Account selection happens in the UI thread.
if (account != null) { if (account != null) {
// The user did not quit and there was a valid google // The user did not quit and there was a valid google
@@ -24,7 +24,6 @@ import android.content.Intent;
* @author Sandor Dornbush * @author Sandor Dornbush
*/ */
public interface AuthManager { public interface AuthManager {
/** /**
* Initializes the login process. The user should be asked to login if they * Initializes the login process. The user should be asked to login if they
* haven't already. The {@link Runnable} provided will be executed when the * haven't already. The {@link Runnable} provided will be executed when the
@@ -34,7 +33,7 @@ public interface AuthManager {
* has been successfully fetched and is available via * has been successfully fetched and is available via
* {@link #getAuthToken()} * {@link #getAuthToken()}
*/ */
public abstract void doLogin(Runnable whenFinished, Object o); void doLogin(Runnable whenFinished, Object o);
/** /**
* The {@link android.app.Activity} owner of this class should call this * The {@link android.app.Activity} owner of this class should call this
@@ -53,7 +52,7 @@ public interface AuthManager {
* the auth token, or False if there was an error or the request was * the auth token, or False if there was an error or the request was
* canceled * canceled
*/ */
public abstract boolean authResult(int resultCode, Intent results); boolean authResult(int resultCode, Intent results);
/** /**
* Returns the current auth token. Response may be null if no valid auth * Returns the current auth token. Response may be null if no valid auth
@@ -62,7 +61,7 @@ public interface AuthManager {
* @return The current auth token or null if no auth token has been * @return The current auth token or null if no auth token has been
* fetched * fetched
*/ */
public abstract String getAuthToken(); String getAuthToken();
/** /**
* Invalidates the existing auth token and request a new one. The * Invalidates the existing auth token and request a new one. The
@@ -72,6 +71,5 @@ public interface AuthManager {
* @param whenFinished A {@link Runnable} to execute when a new auth token * @param whenFinished A {@link Runnable} to execute when a new auth token
* is successfully fetched * is successfully fetched
*/ */
public abstract void invalidateAndRefresh(Runnable whenFinished); void invalidateAndRefresh(Runnable whenFinished);
} }
@@ -187,7 +187,7 @@ public class ModernAuthManager implements AuthManager {
accountChooser.chooseAccount(activity, accountChooser.chooseAccount(activity,
new AccountChooser.AccountHandler() { new AccountChooser.AccountHandler() {
@Override @Override
public void handleAccountSelected(Account account) { public void onAccountSelected(Account account) {
if (account != null) { if (account != null) {
doLogin(whenFinished, account); doLogin(whenFinished, account);
} else { } else {
@@ -533,7 +533,7 @@ public class SendActivity extends Activity implements ProgressIndicator {
accountChooser.chooseAccount(SendActivity.this, accountChooser.chooseAccount(SendActivity.this,
new AccountChooser.AccountHandler() { new AccountChooser.AccountHandler() {
@Override @Override
public void handleAccountSelected(Account account) { public void onAccountSelected(Account account) {
if (account == null) { if (account == null) {
progressDialog.dismiss(); progressDialog.dismiss();
progressDialog = null; progressDialog = null;