Skip to content

Commit

Permalink
chore: run formatter (#1629)
Browse files Browse the repository at this point in the history
* chore: run formatter

* chore: fix line lengths
  • Loading branch information
chingor13 committed Nov 10, 2020
1 parent 1d8304c commit 91401e9
Show file tree
Hide file tree
Showing 151 changed files with 3,629 additions and 3,782 deletions.
Expand Up @@ -21,7 +21,7 @@
import com.google.api.client.util.Preconditions;

/**
* {@link Beta} <br/>
* {@link Beta} <br>
* Account manager wrapper for Google accounts.
*
* @since 1.11
Expand All @@ -36,16 +36,12 @@ public final class GoogleAccountManager {
/** Account manager. */
private final AccountManager manager;

/**
* @param accountManager account manager
*/
/** @param accountManager account manager */
public GoogleAccountManager(AccountManager accountManager) {
this.manager = Preconditions.checkNotNull(accountManager);
}

/**
* @param context context from which to retrieve the account manager
*/
/** @param context context from which to retrieve the account manager */
public GoogleAccountManager(Context context) {
this(AccountManager.get(context));
}
Expand Down
Expand Up @@ -13,12 +13,11 @@
*/

/**
* {@link com.google.api.client.util.Beta} <br/>
* {@link com.google.api.client.util.Beta} <br>
* Utilities for Account Manager for Google accounts on Android Eclair (SDK 2.1) and later.
*
* @since 1.11
* @author Yaniv Inbar
*/
@com.google.api.client.util.Beta
package com.google.api.client.googleapis.extensions.android.accounts;

Expand Up @@ -37,25 +37,22 @@
import java.util.Collection;

/**
* {@link Beta} <br/>
* {@link Beta} <br>
* Manages authorization and account selection for Google accounts.
*
* <p>
* When fetching a token, any thrown {@link GoogleAuthException} would be wrapped:
* <p>When fetching a token, any thrown {@link GoogleAuthException} would be wrapped:
*
* <ul>
* <li>{@link GooglePlayServicesAvailabilityException} would be wrapped inside of
* {@link GooglePlayServicesAvailabilityIOException}</li>
* <li>{@link UserRecoverableAuthException} would be wrapped inside of
* {@link UserRecoverableAuthIOException}</li>
* <li>{@link GoogleAuthException} when be wrapped inside of {@link GoogleAuthIOException}</li>
* <li>{@link GooglePlayServicesAvailabilityException} would be wrapped inside of {@link
* GooglePlayServicesAvailabilityIOException}
* <li>{@link UserRecoverableAuthException} would be wrapped inside of {@link
* UserRecoverableAuthIOException}
* <li>{@link GoogleAuthException} when be wrapped inside of {@link GoogleAuthIOException}
* </ul>
* </p>
*
* <p>
* Upgrade warning: in prior version 1.14 exponential back-off was enabled by default when I/O
* <p>Upgrade warning: in prior version 1.14 exponential back-off was enabled by default when I/O
* exception was thrown inside {@link #getToken}, but starting with version 1.15 you need to call
* {@link #setBackOff} with {@link ExponentialBackOff} to enable it.
* </p>
*
* @since 1.12
* @author Yaniv Inbar
Expand Down Expand Up @@ -106,7 +103,6 @@ public GoogleAccountCredential(Context context, String scope) {
* @param context context
* @param scopes non empty OAuth 2.0 scope list
* @return new instance
*
* @since 1.15
*/
public static GoogleAccountCredential usingOAuth2(Context context, Collection<String> scopes) {
Expand All @@ -128,8 +124,8 @@ public static GoogleAccountCredential usingAudience(Context context, String audi
}

/**
* Sets the selected Google account name (e-mail address) -- for example
* {@code "johndoe@gmail.com"} -- or {@code null} for none.
* Sets the selected Google account name (e-mail address) -- for example {@code
* "johndoe@gmail.com"} -- or {@code null} for none.
*/
public final GoogleAccountCredential setSelectedAccountName(String accountName) {
selectedAccount = accountManager.getAccountByName(accountName);
Expand All @@ -141,9 +137,7 @@ public final GoogleAccountCredential setSelectedAccountName(String accountName)
/**
* Sets the selected Google {@link Account} or {@code null} for none.
*
* <p>
* Caller must ensure the given Google account exists.
* </p>
* <p>Caller must ensure the given Google account exists.
*/
public final GoogleAccountCredential setSelectedAccount(Account selectedAccount) {
this.selectedAccount = selectedAccount;
Expand Down Expand Up @@ -184,8 +178,8 @@ public final Account getSelectedAccount() {
}

/**
* Returns the back-off policy which is used when an I/O exception is thrown inside
* {@link #getToken} or {@code null} for none.
* Returns the back-off policy which is used when an I/O exception is thrown inside {@link
* #getToken} or {@code null} for none.
*
* @since 1.15
*/
Expand Down Expand Up @@ -224,8 +218,8 @@ public final GoogleAccountCredential setSleeper(Sleeper sleeper) {
}

/**
* Returns the selected Google account name (e-mail address), for example
* {@code "johndoe@gmail.com"}, or {@code null} for none.
* Returns the selected Google account name (e-mail address), for example {@code
* "johndoe@gmail.com"}, or {@code null} for none.
*/
public final String getSelectedAccountName() {
return accountName;
Expand All @@ -235,12 +229,11 @@ public final String getSelectedAccountName() {
* Returns an intent to show the user to select a Google account, or create a new one if there are
* none on the device yet.
*
* <p>
* Must be run from the main UI thread.
* </p>
* <p>Must be run from the main UI thread.
*/
public final Intent newChooseAccountIntent() {
return AccountPicker.newChooseAccountIntent(selectedAccount,
return AccountPicker.newChooseAccountIntent(
selectedAccount,
null,
new String[] {GoogleAccountManager.ACCOUNT_TYPE},
true,
Expand All @@ -253,9 +246,7 @@ public final Intent newChooseAccountIntent() {
/**
* Returns an OAuth 2.0 access token.
*
* <p>
* Must be run from a background thread, not the main UI thread.
* </p>
* <p>Must be run from a background thread, not the main UI thread.
*/
public String getToken() throws IOException, GoogleAuthException {
if (backOff != null) {
Expand All @@ -278,12 +269,12 @@ public String getToken() throws IOException, GoogleAuthException {
}
}


@Beta
class RequestHandler implements HttpExecuteInterceptor, HttpUnsuccessfulResponseHandler {

/** Whether we've received a 401 error code indicating the token is invalid. */
boolean received401;

String token;

@Override
Expand Down
Expand Up @@ -18,12 +18,10 @@
import java.io.IOException;

/**
* {@link Beta} <br/>
* {@link Beta} <br>
* Wraps a {@link GoogleAuthException} into an {@link IOException} so it can be caught directly.
*
* <p>
* Use {@link #getCause()} to get the wrapped {@link GoogleAuthException}.
* </p>
* <p>Use {@link #getCause()} to get the wrapped {@link GoogleAuthException}.
*
* @since 1.12
* @author Yaniv Inbar
Expand Down
Expand Up @@ -19,27 +19,24 @@
import java.io.IOException;

/**
* {@link Beta} <br/>
* {@link Beta} <br>
* Wraps a {@link GooglePlayServicesAvailabilityException} into an {@link IOException} so it can be
* caught directly.
*
* <p>
* Use {@link #getConnectionStatusCode()} to display the error dialog. Alternatively, use
* {@link #getCause()} to get the wrapped {@link GooglePlayServicesAvailabilityException}. Example
* usage:
* </p>
* <p>Use {@link #getConnectionStatusCode()} to display the error dialog. Alternatively, use {@link
* #getCause()} to get the wrapped {@link GooglePlayServicesAvailabilityException}. Example usage:
*
* <pre>
} catch (final GooglePlayServicesAvailabilityIOException availabilityException) {
myActivity.runOnUiThread(new Runnable() {
public void run() {
Dialog dialog = GooglePlayServicesUtil.getErrorDialog(
availabilityException.getConnectionStatusCode(),
myActivity,
MyActivity.REQUEST_GOOGLE_PLAY_SERVICES);
dialog.show();
}
});
* } catch (final GooglePlayServicesAvailabilityIOException availabilityException) {
* myActivity.runOnUiThread(new Runnable() {
* public void run() {
* Dialog dialog = GooglePlayServicesUtil.getErrorDialog(
* availabilityException.getConnectionStatusCode(),
* myActivity,
* MyActivity.REQUEST_GOOGLE_PLAY_SERVICES);
* dialog.show();
* }
* });
* </pre>
*
* @since 1.12
Expand All @@ -50,9 +47,7 @@ public class GooglePlayServicesAvailabilityIOException extends UserRecoverableAu

private static final long serialVersionUID = 1L;

/**
* @since 1.21.0
*/
/** @since 1.21.0 */
public GooglePlayServicesAvailabilityIOException(
GooglePlayServicesAvailabilityException wrapped) {
super(wrapped);
Expand All @@ -64,8 +59,8 @@ public GooglePlayServicesAvailabilityException getCause() {
}

/**
* Returns the error code to use with
* {@link GooglePlayServicesUtil#getErrorDialog(int, Activity, int)}.
* Returns the error code to use with {@link GooglePlayServicesUtil#getErrorDialog(int, Activity,
* int)}.
*/
public final int getConnectionStatusCode() {
return getCause().getConnectionStatusCode();
Expand Down
Expand Up @@ -19,20 +19,18 @@
import java.io.IOException;

/**
* {@link Beta} <br/>
* {@link Beta} <br>
* Wraps a {@link UserRecoverableAuthException} into an {@link IOException} so it can be caught
* directly.
*
* <p>
* Use {@link #getIntent()} to allow user interaction to recover. Alternatively, use
* {@link #getCause()} to get the wrapped {@link UserRecoverableAuthException}. Example usage:
* </p>
* <p>Use {@link #getIntent()} to allow user interaction to recover. Alternatively, use {@link
* #getCause()} to get the wrapped {@link UserRecoverableAuthException}. Example usage:
*
* <pre>
} catch (UserRecoverableAuthIOException userRecoverableException) {
myActivity.startActivityForResult(
userRecoverableException.getIntent(), MyActivity.REQUEST_AUTHORIZATION);
}
* } catch (UserRecoverableAuthIOException userRecoverableException) {
* myActivity.startActivityForResult(
* userRecoverableException.getIntent(), MyActivity.REQUEST_AUTHORIZATION);
* }
* </pre>
*
* @since 1.12
Expand All @@ -43,9 +41,7 @@ public class UserRecoverableAuthIOException extends GoogleAuthIOException {

private static final long serialVersionUID = 1L;

/**
* @since 1.21.0
*/
/** @since 1.21.0 */
public UserRecoverableAuthIOException(UserRecoverableAuthException wrapped) {
super(wrapped);
}
Expand All @@ -56,8 +52,8 @@ public UserRecoverableAuthException getCause() {
}

/**
* Returns the {@link Intent} that when supplied to
* {@link Activity#startActivityForResult(Intent, int)} will allow user intervention.
* Returns the {@link Intent} that when supplied to {@link Activity#startActivityForResult(Intent,
* int)} will allow user intervention.
*/
public final Intent getIntent() {
return getCause().getIntent();
Expand Down
Expand Up @@ -11,7 +11,7 @@
*/

/**
* {@link com.google.api.client.util.Beta} <br/>
* {@link com.google.api.client.util.Beta} <br>
* Utilities based on <a href="https://developers.google.com/android/google-play-services/">Google
* Play services</a>.
*
Expand All @@ -20,4 +20,3 @@
*/
@com.google.api.client.util.Beta
package com.google.api.client.googleapis.extensions.android.gms.auth;

0 comments on commit 91401e9

Please sign in to comment.