Java 7 migration

This commit is contained in:
TacoTheDank 2020-08-31 19:27:05 -04:00
parent 7df0c1824a
commit 9b0a17ab0a
68 changed files with 109 additions and 107 deletions

View File

@ -19,5 +19,5 @@ package com.google.android.gms.auth;
import org.microg.safeparcel.AutoSafeParcelable;
public class AccountChangeEvent extends AutoSafeParcelable {
public static Creator<AccountChangeEvent> CREATOR = new AutoCreator<AccountChangeEvent>(AccountChangeEvent.class);
public static Creator<AccountChangeEvent> CREATOR = new AutoCreator<>(AccountChangeEvent.class);
}

View File

@ -27,6 +27,6 @@ public class AccountChangeEventsRequest extends AutoSafeParcelable {
@SafeParceled(3)
private String s;
public static Creator<AccountChangeEventsRequest> CREATOR = new AutoCreator<AccountChangeEventsRequest>(AccountChangeEventsRequest.class);
public static Creator<AccountChangeEventsRequest> CREATOR = new AutoCreator<>(AccountChangeEventsRequest.class);
}

View File

@ -29,8 +29,8 @@ public class AccountChangeEventsResponse extends AutoSafeParcelable {
private List<AccountChangeEvent> events;
public AccountChangeEventsResponse() {
events = new ArrayList<AccountChangeEvent>();
events = new ArrayList<>();
}
public static Creator<AccountChangeEventsResponse> CREATOR = new AutoCreator<AccountChangeEventsResponse>(AccountChangeEventsResponse.class);
public static Creator<AccountChangeEventsResponse> CREATOR = new AutoCreator<>(AccountChangeEventsResponse.class);
}

View File

@ -60,5 +60,5 @@ public class TokenData extends AutoSafeParcelable {
this.scopes = null;
}
public static final Creator<TokenData> CREATOR = new AutoCreator<TokenData>(TokenData.class);
public static final Creator<TokenData> CREATOR = new AutoCreator<>(TokenData.class);
}

View File

@ -26,6 +26,7 @@ import org.microg.safeparcel.SafeParceled;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
@PublicApi
public class Credential extends AutoSafeParcelable {
@ -143,15 +144,15 @@ public class Credential extends AutoSafeParcelable {
Credential that = (Credential) o;
if (id != null ? !id.equals(that.id) : that.id != null) return false;
if (name != null ? !name.equals(that.name) : that.name != null) return false;
if (profilePictureUri != null ? !profilePictureUri.equals(that.profilePictureUri) : that.profilePictureUri != null)
if (!Objects.equals(id, that.id)) return false;
if (!Objects.equals(name, that.name)) return false;
if (!Objects.equals(profilePictureUri, that.profilePictureUri))
return false;
if (password != null ? !password.equals(that.password) : that.password != null)
if (!Objects.equals(password, that.password))
return false;
if (accountType != null ? !accountType.equals(that.accountType) : that.accountType != null)
if (!Objects.equals(accountType, that.accountType))
return false;
return generatedPassword != null ? generatedPassword.equals(that.generatedPassword) : that.generatedPassword == null;
return Objects.equals(generatedPassword, that.generatedPassword);
}
@ -245,5 +246,5 @@ public class Credential extends AutoSafeParcelable {
}
}
public static final Creator<Credential> CREATOR = new AutoCreator<Credential>(Credential.class);
public static final Creator<Credential> CREATOR = new AutoCreator<>(Credential.class);
}

View File

@ -88,5 +88,5 @@ public class CredentialPickerConfig extends AutoSafeParcelable {
}
}
public static final Creator<CredentialPickerConfig> CREATOR = new AutoCreator<CredentialPickerConfig>(CredentialPickerConfig.class);
public static final Creator<CredentialPickerConfig> CREATOR = new AutoCreator<>(CredentialPickerConfig.class);
}

View File

@ -71,5 +71,5 @@ public class CredentialRequest extends AutoSafeParcelable {
return passwordLoginSupported;
}
public static final Creator<CredentialRequest> CREATOR = new AutoCreator<CredentialRequest>(CredentialRequest.class);
public static final Creator<CredentialRequest> CREATOR = new AutoCreator<>(CredentialRequest.class);
}

View File

@ -54,5 +54,5 @@ public class IdToken extends AutoSafeParcelable {
return id;
}
public static final Creator<IdToken> CREATOR = new AutoCreator<IdToken>(IdToken.class);
public static final Creator<IdToken> CREATOR = new AutoCreator<>(IdToken.class);
}

View File

@ -19,5 +19,5 @@ package com.google.android.gms.auth.api.credentials.internal;
import org.microg.safeparcel.AutoSafeParcelable;
public class DeleteRequest extends AutoSafeParcelable {
public static final Creator<DeleteRequest> CREATOR = new AutoCreator<DeleteRequest>(DeleteRequest.class);
public static final Creator<DeleteRequest> CREATOR = new AutoCreator<>(DeleteRequest.class);
}

View File

@ -19,5 +19,5 @@ package com.google.android.gms.auth.api.credentials.internal;
import org.microg.safeparcel.AutoSafeParcelable;
public class GeneratePasswordRequest extends AutoSafeParcelable {
public static final Creator<GeneratePasswordRequest> CREATOR = new AutoCreator<GeneratePasswordRequest>(GeneratePasswordRequest.class);
public static final Creator<GeneratePasswordRequest> CREATOR = new AutoCreator<>(GeneratePasswordRequest.class);
}

View File

@ -19,5 +19,5 @@ package com.google.android.gms.auth.api.credentials.internal;
import org.microg.safeparcel.AutoSafeParcelable;
public class SaveRequest extends AutoSafeParcelable {
public static final Creator<SaveRequest> CREATOR = new AutoCreator<SaveRequest>(SaveRequest.class);
public static final Creator<SaveRequest> CREATOR = new AutoCreator<>(SaveRequest.class);
}

View File

@ -42,5 +42,5 @@ public class AccountRecoveryGuidanceRequest extends AutoSafeParcelable {
this.account = account;
}
public static final Creator<AccountRecoveryGuidanceRequest> CREATOR = new AutoCreator<AccountRecoveryGuidanceRequest>(AccountRecoveryGuidanceRequest.class);
public static final Creator<AccountRecoveryGuidanceRequest> CREATOR = new AutoCreator<>(AccountRecoveryGuidanceRequest.class);
}

View File

@ -42,5 +42,5 @@ public class AccountRemovalRequest extends AutoSafeParcelable {
this.account = account;
}
public static final Creator<AccountRemovalRequest> CREATOR = new AutoCreator<AccountRemovalRequest>(AccountRemovalRequest.class);
public static final Creator<AccountRemovalRequest> CREATOR = new AutoCreator<>(AccountRemovalRequest.class);
}

View File

@ -30,5 +30,5 @@ public class ConfirmCredentialsRequest extends AutoSafeParcelable {
@SafeParceled(3)
public CaptchaSolution captchaSolution;
public static final Creator<ConfirmCredentialsRequest> CREATOR = new AutoCreator<ConfirmCredentialsRequest>(ConfirmCredentialsRequest.class);
public static final Creator<ConfirmCredentialsRequest> CREATOR = new AutoCreator<>(ConfirmCredentialsRequest.class);
}

View File

@ -40,5 +40,5 @@ public class TokenRequest extends AutoSafeParcelable{
return new Account(accountName, accountType);
}
public static final Creator<TokenRequest> CREATOR = new AutoCreator<TokenRequest>(TokenRequest.class);
public static final Creator<TokenRequest> CREATOR = new AutoCreator<>(TokenRequest.class);
}

View File

@ -39,5 +39,5 @@ public class ConfirmCredentialsWorkflowRequest extends AutoSafeParcelable {
@SafeParceled(6)
public AccountAuthenticatorResponse accountAuthenticatorResponse;
public static final Creator<ConfirmCredentialsWorkflowRequest> CREATOR = new AutoCreator<ConfirmCredentialsWorkflowRequest>(ConfirmCredentialsWorkflowRequest.class);
public static final Creator<ConfirmCredentialsWorkflowRequest> CREATOR = new AutoCreator<>(ConfirmCredentialsWorkflowRequest.class);
}

View File

@ -34,5 +34,5 @@ public class AccountCredentials extends AutoSafeParcelable {
return new Account(accountName, accountType);
}
public static final Creator<AccountCredentials> CREATOR = new AutoCreator<AccountCredentials>(AccountCredentials.class);
public static final Creator<AccountCredentials> CREATOR = new AutoCreator<>(AccountCredentials.class);
}

View File

@ -31,5 +31,5 @@ public class AppDescription extends AutoSafeParcelable {
@SafeParceled(5)
public String callingPkg;
public static final Creator<AppDescription> CREATOR = new AutoCreator<AppDescription>(AppDescription.class);
public static final Creator<AppDescription> CREATOR = new AutoCreator<>(AppDescription.class);
}

View File

@ -25,5 +25,5 @@ public class CaptchaSolution extends AutoSafeParcelable {
@SafeParceled(1)
private int versionCode = 1;
public static final Creator<CaptchaSolution> CREATOR = new AutoCreator<CaptchaSolution>(CaptchaSolution.class);
public static final Creator<CaptchaSolution> CREATOR = new AutoCreator<>(CaptchaSolution.class);
}

View File

@ -100,5 +100,5 @@ public class LogEventParcelable extends AutoSafeParcelable {
}
}
public static final Creator<LogEventParcelable> CREATOR = new AutoCreator<LogEventParcelable>(LogEventParcelable.class);
public static final Creator<LogEventParcelable> CREATOR = new AutoCreator<>(LogEventParcelable.class);
}

View File

@ -71,5 +71,5 @@ public class GoogleCertificatesQuery extends AutoSafeParcelable {
return certData;
}
public static final Creator<GoogleCertificatesQuery> CREATOR = new AutoCreator<GoogleCertificatesQuery>(GoogleCertificatesQuery.class);
public static final Creator<GoogleCertificatesQuery> CREATOR = new AutoCreator<>(GoogleCertificatesQuery.class);
}

View File

@ -20,5 +20,5 @@ import org.microg.safeparcel.AutoSafeParcelable;
public class FavaDiagnosticsEntity extends AutoSafeParcelable {
public static final Creator<FavaDiagnosticsEntity> CREATOR = new AutoCreator<FavaDiagnosticsEntity>(FavaDiagnosticsEntity.class);
public static final Creator<FavaDiagnosticsEntity> CREATOR = new AutoCreator<>(FavaDiagnosticsEntity.class);
}

View File

@ -32,5 +32,5 @@ public class ParcelableLoadImageOptions extends AutoSafeParcelable {
@SafeParceled(3)
public boolean useLargePictureForCp2Images;
public static final Creator<ParcelableLoadImageOptions> CREATOR = new AutoCreator<ParcelableLoadImageOptions>(ParcelableLoadImageOptions.class);
public static final Creator<ParcelableLoadImageOptions> CREATOR = new AutoCreator<>(ParcelableLoadImageOptions.class);
}

View File

@ -36,5 +36,5 @@ public class AccountMetadata extends AutoSafeParcelable {
@SafeParceled(5)
public boolean hasFeature4 = true;
public static Creator<AccountMetadata> CREATOR = new AutoCreator<AccountMetadata>(AccountMetadata.class);
public static Creator<AccountMetadata> CREATOR = new AutoCreator<>(AccountMetadata.class);
}

View File

@ -30,5 +30,5 @@ public class AvatarReference extends AutoSafeParcelable {
@SafeParceled(2)
public String location;
public static final Creator<AvatarReference> CREATOR = new AutoCreator<AvatarReference>(AvatarReference.class);
public static final Creator<AvatarReference> CREATOR = new AutoCreator<>(AvatarReference.class);
}

View File

@ -50,5 +50,5 @@ public class LogEvent extends AutoSafeParcelable {
'}';
}
public static Creator<LogEvent> CREATOR = new AutoCreator<LogEvent>(LogEvent.class);
public static Creator<LogEvent> CREATOR = new AutoCreator<>(LogEvent.class);
}

View File

@ -97,5 +97,5 @@ public class PlayLoggerContext extends AutoSafeParcelable {
return sb.toString();
}
public static Creator<PlayLoggerContext> CREATOR = new AutoCreator<PlayLoggerContext>(PlayLoggerContext.class);
public static Creator<PlayLoggerContext> CREATOR = new AutoCreator<>(PlayLoggerContext.class);
}

View File

@ -8,5 +8,5 @@ package com.google.android.gms.auth.api.signin;
import org.microg.safeparcel.AutoSafeParcelable;
public class GoogleSignInAccount extends AutoSafeParcelable {
public static final Creator<GoogleSignInAccount> CREATOR = new AutoCreator<GoogleSignInAccount>(GoogleSignInAccount.class);
public static final Creator<GoogleSignInAccount> CREATOR = new AutoCreator<>(GoogleSignInAccount.class);
}

View File

@ -211,7 +211,7 @@ public class DataHolder extends AutoSafeParcelable implements Closeable {
@SuppressWarnings("deprecation")
private static CursorWindow[] createCursorWindows(Builder builder) {
if (builder.columns.length == 0) return new CursorWindow[0];
List<CursorWindow> windows = new ArrayList<CursorWindow>();
List<CursorWindow> windows = new ArrayList<>();
try {
CursorWindow current = null;
for (int rowIndex = 0; rowIndex < builder.rows.size(); rowIndex++) {
@ -261,7 +261,7 @@ public class DataHolder extends AutoSafeParcelable implements Closeable {
private static CursorWindow[] createCursorWindows(Cursor cursor) {
if (cursor.getColumnCount() == 0) return new CursorWindow[0];
List<CursorWindow> windows = new ArrayList<CursorWindow>();
List<CursorWindow> windows = new ArrayList<>();
CursorWindow current = null;
int rowIndex = 0;
while (cursor.moveToNext()) {
@ -436,7 +436,7 @@ public class DataHolder extends AutoSafeParcelable implements Closeable {
}
public void validateContents() {
columnIndices = new HashMap<String, Integer>();
columnIndices = new HashMap<>();
for (int i = 0; i < columns.length; i++) {
columnIndices.put(columns[i], i);
}
@ -455,9 +455,9 @@ public class DataHolder extends AutoSafeParcelable implements Closeable {
private Builder(String[] columns, String uniqueColumn) {
this.columns = columns;
this.rows = new ArrayList<Map<String, Object>>();
this.rows = new ArrayList<>();
this.uniqueColumn = uniqueColumn;
this.uniqueIndizes = new HashMap<Object, Integer>();
this.uniqueIndizes = new HashMap<>();
}
/**
@ -509,7 +509,7 @@ public class DataHolder extends AutoSafeParcelable implements Closeable {
* @return {@link DataHolder.Builder} to continue construction.
*/
public Builder withRow(ContentValues values) {
HashMap<String, Object> row = new HashMap<String, Object>();
HashMap<String, Object> row = new HashMap<>();
for (Map.Entry<String, Object> entry : values.valueSet()) {
row.put(entry.getKey(), entry.getValue());
}

View File

@ -24,7 +24,7 @@ import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class WebImage extends AutoSafeParcelable {
public static final Creator<WebImage> CREATOR = new AutoCreator<WebImage>(WebImage.class);
public static final Creator<WebImage> CREATOR = new AutoCreator<>(WebImage.class);
public WebImage () {
this.uri = null;

View File

@ -20,5 +20,5 @@ import org.microg.safeparcel.AutoSafeParcelable;
@Deprecated
public class AccountInfo extends AutoSafeParcelable {
public static final Creator<AccountInfo> CREATOR = new AutoCreator<AccountInfo>(AccountInfo.class);
public static final Creator<AccountInfo> CREATOR = new AutoCreator<>(AccountInfo.class);
}

View File

@ -241,10 +241,10 @@ public interface GoogleApiClient {
@PublicApi
class Builder {
private final Context context;
private final Map<Api, Api.ApiOptions> apis = new HashMap<Api, Api.ApiOptions>();
private final Set<ConnectionCallbacks> connectionCallbacks = new HashSet<ConnectionCallbacks>();
private final Set<OnConnectionFailedListener> connectionFailedListeners = new HashSet<OnConnectionFailedListener>();
private final Set<String> scopes = new HashSet<String>();
private final Map<Api, Api.ApiOptions> apis = new HashMap<>();
private final Set<ConnectionCallbacks> connectionCallbacks = new HashSet<>();
private final Set<OnConnectionFailedListener> connectionFailedListeners = new HashSet<>();
private final Set<String> scopes = new HashSet<>();
private String accountName;
private int clientId = -1;
private FragmentActivity fragmentActivity;

View File

@ -44,7 +44,7 @@ public class GmsConnector<C extends ApiClient, R extends Result> {
}
public static <C extends ApiClient, R extends Result> PendingResult<R> call(GoogleApiClient client, Api api, GmsConnector.Callback<C, R> callback) {
return new GmsConnector<C, R>(client, api, callback).connect();
return new GmsConnector<>(client, api, callback).connect();
}
public AbstractPendingResult<R> connect() {
@ -52,7 +52,7 @@ public class GmsConnector<C extends ApiClient, R extends Result> {
apiClient.incrementUsageCounter();
apiClient.getApiConnection(api);
Looper looper = apiClient.getLooper();
final AbstractPendingResult<R> result = new AbstractPendingResult<R>(looper);
final AbstractPendingResult<R> result = new AbstractPendingResult<>(looper);
Message msg = new Message();
msg.obj = result;
new Handler(looper).sendMessage(msg);

View File

@ -39,7 +39,7 @@ public class MultiConnectionKeeper {
private static MultiConnectionKeeper INSTANCE;
private final Context context;
private final Map<String, Connection> connections = new HashMap<String, Connection>();
private final Map<String, Connection> connections = new HashMap<>();
public MultiConnectionKeeper(Context context) {
this.context = context;
@ -83,7 +83,7 @@ public class MultiConnectionKeeper {
public class Connection {
private final String actionString;
private final Set<ServiceConnection> connectionForwards = new HashSet<ServiceConnection>();
private final Set<ServiceConnection> connectionForwards = new HashSet<>();
private boolean bound = false;
private boolean connected = false;
private IBinder binder;

View File

@ -34,7 +34,7 @@ public class AbstractPendingResult<R extends Result> implements PendingResult<R>
private ResultCallback<R> resultCallback;
public AbstractPendingResult(Looper looper) {
handler = new ResultCallbackHandler<R>(looper);
handler = new ResultCallbackHandler<>(looper);
}
private R getResult() {

View File

@ -43,10 +43,10 @@ public class GoogleApiClientImpl implements GoogleApiClient {
private final Context context;
private final Looper looper;
private final ApiClientSettings clientSettings;
private final Map<Api, Api.ApiOptions> apis = new HashMap<Api, Api.ApiOptions>();
private final Map<Api, ApiClient> apiConnections = new HashMap<Api, ApiClient>();
private final Set<ConnectionCallbacks> connectionCallbacks = new HashSet<ConnectionCallbacks>();
private final Set<OnConnectionFailedListener> connectionFailedListeners = new HashSet<OnConnectionFailedListener>();
private final Map<Api, Api.ApiOptions> apis = new HashMap<>();
private final Map<Api, ApiClient> apiConnections = new HashMap<>();
private final Set<ConnectionCallbacks> connectionCallbacks = new HashSet<>();
private final Set<OnConnectionFailedListener> connectionFailedListeners = new HashSet<>();
private final int clientId;
private final ConnectionCallbacks baseConnectionCallbacks = new ConnectionCallbacks() {
@Override

View File

@ -17,6 +17,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
public class GoogleApiManager {
private static GoogleApiManager instance;
@ -52,7 +53,7 @@ public class GoogleApiManager {
if (connected) {
apiCall.execute(client, completionSource);
} else {
waitingApiCallMap.get(new ApiInstance(api)).add(new WaitingApiCall<R>((PendingGoogleApiCall<R, ApiClient>) apiCall, completionSource));
waitingApiCallMap.get(new ApiInstance(api)).add(new WaitingApiCall<>((PendingGoogleApiCall<R, ApiClient>) apiCall, completionSource));
if (!connecting) {
client.connect();
}
@ -134,8 +135,8 @@ public class GoogleApiManager {
WaitingApiCall<?> that = (WaitingApiCall<?>) o;
if (apiCall != null ? !apiCall.equals(that.apiCall) : that.apiCall != null) return false;
return completionSource != null ? completionSource.equals(that.completionSource) : that.completionSource == null;
if (!Objects.equals(apiCall, that.apiCall)) return false;
return Objects.equals(completionSource, that.completionSource);
}
@Override
@ -166,8 +167,8 @@ public class GoogleApiManager {
ApiInstance that = (ApiInstance) o;
if (apiClass != null ? !apiClass.equals(that.apiClass) : that.apiClass != null) return false;
return apiOptions != null ? apiOptions.equals(that.apiOptions) : that.apiOptions == null;
if (!Objects.equals(apiClass, that.apiClass)) return false;
return Objects.equals(apiOptions, that.apiOptions);
}
@Override

View File

@ -50,7 +50,7 @@ class ResultCallbackHandler<R extends Result> extends Handler {
public void sendResultCallback(ResultCallback<R> callback, R result) {
Message message = new Message();
message.what = CALLBACK_ON_COMPLETE;
message.obj = new OnCompleteObject<R>(callback, result);
message.obj = new OnCompleteObject<>(callback, result);
sendMessage(message);
}

View File

@ -61,5 +61,5 @@ public class Scope extends AutoSafeParcelable {
return scopeUri;
}
public static final Creator<Scope> CREATOR = new AutoCreator<Scope>(Scope.class);
public static final Creator<Scope> CREATOR = new AutoCreator<>(Scope.class);
}

View File

@ -176,5 +176,5 @@ public final class Status extends AutoSafeParcelable implements Result {
}
}
public static final Creator<Status> CREATOR = new AutoCreator<Status>(Status.class);
public static final Creator<Status> CREATOR = new AutoCreator<>(Status.class);
}

View File

@ -79,5 +79,5 @@ public class GetServiceRequest extends AutoSafeParcelable {
'}';
}
public static Creator<GetServiceRequest> CREATOR = new AutoCreator<GetServiceRequest>(GetServiceRequest.class);
public static Creator<GetServiceRequest> CREATOR = new AutoCreator<>(GetServiceRequest.class);
}

View File

@ -19,5 +19,5 @@ package com.google.android.gms.common.internal;
import org.microg.safeparcel.AutoSafeParcelable;
public class ValidateAccountRequest extends AutoSafeParcelable {
public static Creator<ValidateAccountRequest> CREATOR = new AutoCreator<ValidateAccountRequest>(ValidateAccountRequest.class);
public static Creator<ValidateAccountRequest> CREATOR = new AutoCreator<>(ValidateAccountRequest.class);
}

View File

@ -72,6 +72,6 @@ public class ObjectWrapper<T> extends IObjectWrapper.Stub {
}
public static <T> ObjectWrapper<T> wrap(T t) {
return new ObjectWrapper<T>(t);
return new ObjectWrapper<>(t);
}
}

View File

@ -81,5 +81,5 @@ public class ApplicationMetadata extends AutoSafeParcelable {
return sb.toString();
}
public static final Creator<ApplicationMetadata> CREATOR = new AutoCreator<ApplicationMetadata>(ApplicationMetadata.class);
public static final Creator<ApplicationMetadata> CREATOR = new AutoCreator<>(ApplicationMetadata.class);
}

View File

@ -32,5 +32,5 @@ public class ApplicationStatus extends AutoSafeParcelable {
@SafeParceled(2)
private String applicationStatus;
public static final Creator<ApplicationStatus> CREATOR = new AutoCreator<ApplicationStatus>(ApplicationStatus.class);
public static final Creator<ApplicationStatus> CREATOR = new AutoCreator<>(ApplicationStatus.class);
}

View File

@ -47,7 +47,7 @@ public class CastDevice extends AutoSafeParcelable {
this.servicePort = port;
this.deviceVersion = deviceVersion;
this.friendlyName = friendlyName;
this.icons = new ArrayList<WebImage>();
this.icons = new ArrayList<>();
this.icons.add(new WebImage(Uri.parse(String.format("http://%s:8008%s", this.address, iconPath))));
this.modelName = modelName;
this.capabilities = capabilities;
@ -190,5 +190,5 @@ public class CastDevice extends AutoSafeParcelable {
"}";
}
public static Creator<CastDevice> CREATOR = new AutoCreator<CastDevice>(CastDevice.class);
public static Creator<CastDevice> CREATOR = new AutoCreator<>(CastDevice.class);
}

View File

@ -45,5 +45,5 @@ public class CastDeviceStatus extends AutoSafeParcelable {
@SafeParceled(6)
private int standbyState;
public static final Creator<CastDeviceStatus> CREATOR = new AutoCreator<CastDeviceStatus>(CastDeviceStatus.class);
public static final Creator<CastDeviceStatus> CREATOR = new AutoCreator<>(CastDeviceStatus.class);
}

View File

@ -25,5 +25,5 @@ public class JoinOptions extends AutoSafeParcelable {
@SafeParceled(2)
private int connectionType = 0;
public static Creator<JoinOptions> CREATOR = new AutoCreator<JoinOptions>(JoinOptions.class);
public static Creator<JoinOptions> CREATOR = new AutoCreator<>(JoinOptions.class);
}

View File

@ -43,5 +43,5 @@ public class LaunchOptions extends AutoSafeParcelable {
this.relaunchIfRunning = relaunchIfRunning;
}
public static Creator<LaunchOptions> CREATOR = new AutoCreator<LaunchOptions>(LaunchOptions.class);
public static Creator<LaunchOptions> CREATOR = new AutoCreator<>(LaunchOptions.class);
}

View File

@ -61,5 +61,5 @@ public class CastOptions extends AutoSafeParcelable {
return this.launchOptions;
}
public static Creator<CastOptions> CREATOR = new AutoCreator<CastOptions>(CastOptions.class);
public static Creator<CastOptions> CREATOR = new AutoCreator<>(CastOptions.class);
}

View File

@ -32,5 +32,5 @@ public class CastMediaOptions extends AutoSafeParcelable {
@SafeParceled(5)
public NotificationOptions notificationOptions;
public static Creator<CastMediaOptions> CREATOR = new AutoCreator<CastMediaOptions>(CastMediaOptions.class);
public static Creator<CastMediaOptions> CREATOR = new AutoCreator<>(CastMediaOptions.class);
}

View File

@ -92,5 +92,5 @@ public class NotificationOptions extends AutoSafeParcelable {
@SafeParceled(33)
public INotificationActionsProvider notificationActionsProvider;
public static Creator<NotificationOptions> CREATOR = new AutoCreator<NotificationOptions>(NotificationOptions.class);
public static Creator<NotificationOptions> CREATOR = new AutoCreator<>(NotificationOptions.class);
}

View File

@ -89,7 +89,7 @@ public final class Cast {
/**
* Token to pass to {@link GoogleApiClient.Builder#addApi(Api)} to enable the Cast features.
*/
public static final Api<CastOptions> API = new Api<CastOptions>(new CastApiClientBuilder());
public static final Api<CastOptions> API = new Api<>(new CastApiClientBuilder());
/**
* An implementation of the CastApi interface. The interface is used to interact with a cast device.

View File

@ -32,7 +32,7 @@ public final class CastRemoteDisplay {
/**
* Token to pass to {@link GoogleApiClient.Builder#addApi(Api)} to enable the CastRemoteDisplay features.
*/
public static final Api<CastRemoteDisplayOptions> API = new Api<CastRemoteDisplayOptions>(new CastRemoteDisplayApiClientBuilder());
public static final Api<CastRemoteDisplayOptions> API = new Api<>(new CastRemoteDisplayApiClientBuilder());
/**
* An implementation of the CastRemoteDisplayAPI interface. The interface is used to interact with a cast device.

View File

@ -102,7 +102,7 @@ public abstract class AbstractAboutFragment extends Fragment {
aboutRoot.findViewById(android.R.id.summary).setVisibility(View.VISIBLE);
}
List<Library> libraries = new ArrayList<Library>();
List<Library> libraries = new ArrayList<>();
collectLibraries(libraries);
Collections.sort(libraries);
((ListView) aboutRoot.findViewById(android.R.id.list)).setAdapter(new LibraryAdapter(getContext(), libraries.toArray(new Library[libraries.size()])));

View File

@ -12,7 +12,7 @@ import java.util.List;
public abstract class AbstractDashboardActivity extends AppCompatActivity {
protected int preferencesResource = 0;
private final List<Condition> conditions = new ArrayList<Condition>();
private final List<Condition> conditions = new ArrayList<>();
private ViewGroup conditionContainer;
@Override

View File

@ -58,7 +58,7 @@ public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedC
private String mSummary;
private ArrayList<OnSwitchChangeListener> mSwitchChangeListeners =
new ArrayList<OnSwitchChangeListener>();
new ArrayList<>();
public SwitchBar(Context context) {
this(context, null);

View File

@ -44,7 +44,7 @@ public class SessionManagerImpl extends ISessionManager.Stub {
private Set<ISessionManagerListener> sessionManagerListeners = new HashSet<ISessionManagerListener>();
private Set<ICastStateListener> castStateListeners = new HashSet<ICastStateListener>();
private Map<String, SessionImpl> routeSessions = new HashMap<String, SessionImpl>();
private Map<String, SessionImpl> routeSessions = new HashMap<>();
private SessionImpl currentSession;

View File

@ -137,7 +137,7 @@ public class AuthManagerServiceImpl extends IAuthManagerService.Stub {
private List<Scope> getScopes(String scope) {
if (!scope.startsWith("oauth2:")) return null;
String[] strings = scope.substring(7).split(" ");
List<Scope> res = new ArrayList<Scope>();
List<Scope> res = new ArrayList<>();
for (String string : strings) {
res.add(new Scope(string));
}

View File

@ -107,8 +107,8 @@ public class CastDeviceControllerImpl extends ICastDeviceController.Stub impleme
metadata.name = app.name;
Log.d(TAG, "unimplemented: ApplicationMetadata.images");
Log.d(TAG, "unimplemented: ApplicationMetadata.senderAppLaunchUri");
metadata.images = new ArrayList<WebImage>();
metadata.namespaces = new ArrayList<String>();
metadata.images = new ArrayList<>();
metadata.namespaces = new ArrayList<>();
for(Namespace namespace : app.namespaces) {
metadata.namespaces.add(namespace.name);
}

View File

@ -45,13 +45,13 @@ import java.util.Map;
public class CastMediaRouteProvider extends MediaRouteProvider {
private static final String TAG = CastMediaRouteProvider.class.getSimpleName();
private Map<String, CastDevice> castDevices = new HashMap<String, CastDevice>();
private Map<String, String> serviceCastIds = new HashMap<String, String>();
private Map<String, CastDevice> castDevices = new HashMap<>();
private Map<String, String> serviceCastIds = new HashMap<>();
private NsdManager mNsdManager;
private NsdManager.DiscoveryListener mDiscoveryListener;
private List<String> customCategories = new ArrayList<String>();
private List<String> customCategories = new ArrayList<>();
private enum State {
NOT_DISCOVERING,
@ -61,7 +61,7 @@ public class CastMediaRouteProvider extends MediaRouteProvider {
}
private State state = State.NOT_DISCOVERING;
private static final ArrayList<IntentFilter> BASE_CONTROL_FILTERS = new ArrayList<IntentFilter>();
private static final ArrayList<IntentFilter> BASE_CONTROL_FILTERS = new ArrayList<>();
static {
IntentFilter filter;
@ -318,7 +318,7 @@ public class CastMediaRouteProvider extends MediaRouteProvider {
private void publishRoutes() {
MediaRouteProviderDescriptor.Builder builder = new MediaRouteProviderDescriptor.Builder();
for (CastDevice castDevice : this.castDevices.values()) {
ArrayList<IntentFilter> controlFilters = new ArrayList<IntentFilter>(BASE_CONTROL_FILTERS);
ArrayList<IntentFilter> controlFilters = new ArrayList<>(BASE_CONTROL_FILTERS);
// Include any app-specific control filters that have been requested.
// TODO: Do we need to check with the device?
for (String category : this.customCategories) {

View File

@ -46,7 +46,7 @@ import java.util.zip.GZIPOutputStream;
public class CheckinClient {
private static final String TAG = "GmsCheckinClient";
private static final Object TODO = null; // TODO
private static final List<String> TODO_LIST_STRING = new ArrayList<String>(); // TODO
private static final List<String> TODO_LIST_STRING = new ArrayList<>(); // TODO
private static final List<CheckinRequest.Checkin.Statistic> TODO_LIST_CHECKIN = new ArrayList<CheckinRequest.Checkin.Statistic>(); // TODO
private static final String SERVICE_URL = "https://android.clients.google.com/checkin";

View File

@ -43,7 +43,7 @@ public class CheckinManager {
return null;
if (!CheckinPrefs.get(context).isEnabled())
return null;
List<CheckinClient.Account> accounts = new ArrayList<CheckinClient.Account>();
List<CheckinClient.Account> accounts = new ArrayList<>();
AccountManager accountManager = AccountManager.get(context);
String accountType = AuthConstants.DEFAULT_ACCOUNT_TYPE;
for (Account account : accountManager.getAccountsByType(accountType)) {

View File

@ -69,7 +69,7 @@ public class DeviceConfiguration {
glEsVersion = configurationInfo.reqGlEsVersion;
PackageManager packageManager = context.getPackageManager();
String[] systemSharedLibraryNames = packageManager.getSystemSharedLibraryNames();
sharedLibraries = new ArrayList<String>();
sharedLibraries = new ArrayList<>();
if (systemSharedLibraryNames != null) sharedLibraries.addAll(Arrays.asList(systemSharedLibraryNames));
for (String s : new String[]{"com.google.android.maps", "com.google.android.media.effects", "com.google.widevine.software.drm"}) {
if (!sharedLibraries.contains(s)) {
@ -77,7 +77,7 @@ public class DeviceConfiguration {
}
}
Collections.sort(sharedLibraries);
availableFeatures = new ArrayList<String>();
availableFeatures = new ArrayList<>();
if (packageManager.getSystemAvailableFeatures() != null) {
for (FeatureInfo featureInfo : packageManager.getSystemAvailableFeatures()) {
if (featureInfo != null && featureInfo.name != null) availableFeatures.add(featureInfo.name);
@ -87,14 +87,14 @@ public class DeviceConfiguration {
this.nativePlatforms = getNativePlatforms();
widthPixels = displayMetrics.widthPixels;
heightPixels = displayMetrics.heightPixels;
locales = new ArrayList<String>(Arrays.asList(context.getAssets().getLocales()));
locales = new ArrayList<>(Arrays.asList(context.getAssets().getLocales()));
for (int i = 0; i < locales.size(); i++) {
locales.set(i, locales.get(i).replace("-", "_"));
}
Collections.sort(locales);
Set<String> glExtensions = new HashSet<String>();
Set<String> glExtensions = new HashSet<>();
addEglExtensions(glExtensions);
this.glExtensions = new ArrayList<String>(glExtensions);
this.glExtensions = new ArrayList<>(glExtensions);
Collections.sort(this.glExtensions);
}
@ -104,7 +104,7 @@ public class DeviceConfiguration {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
return Arrays.asList(Build.SUPPORTED_ABIS);
} else {
nativePlatforms = new ArrayList<String>();
nativePlatforms = new ArrayList<>();
nativePlatforms.add(Build.CPU_ABI);
if (Build.CPU_ABI2 != null && !Build.CPU_ABI2.equals("unknown"))
nativePlatforms.add(Build.CPU_ABI2);

View File

@ -33,11 +33,11 @@ public class MultiListenerProxy<T extends IInterface> implements InvocationHandl
private static final String TAG = "GmsMultiListener";
public static <T extends IInterface> T get(Class<T> tClass, final Collection<T> listeners) {
return get(tClass, new CollectionListenerPool<T>(listeners));
return get(tClass, new CollectionListenerPool<>(listeners));
}
public static <T extends IInterface> T get(Class<T> tClass, final ListenerPool<T> listenerPool) {
return (T) Proxy.newProxyInstance(tClass.getClassLoader(), new Class[]{tClass}, new MultiListenerProxy<T>(listenerPool));
return (T) Proxy.newProxyInstance(tClass.getClassLoader(), new Class[]{tClass}, new MultiListenerProxy<>(listenerPool));
}
private final ListenerPool<T> listeners;
@ -48,7 +48,7 @@ public class MultiListenerProxy<T extends IInterface> implements InvocationHandl
@Override
public Object invoke(Object proxy, Method method, Object[] args) {
for (T listener : new HashSet<T>(listeners)) {
for (T listener : new HashSet<>(listeners)) {
try {
method.invoke(listener, args);
} catch (Exception e) {

View File

@ -38,12 +38,12 @@ public class RemoteListenerProxy<T extends IInterface> implements ServiceConnect
private final String bindAction;
private IBinder remote;
private boolean connecting;
private List<Runnable> waiting = new ArrayList<Runnable>();
private List<Runnable> waiting = new ArrayList<>();
private Class<T> tClass;
public static <T extends IInterface> T get(Context context, Intent intent, Class<T> tClass, String bindAction) {
return (T) Proxy.newProxyInstance(tClass.getClassLoader(), new Class[]{tClass},
new RemoteListenerProxy<T>(context, intent, tClass, bindAction));
new RemoteListenerProxy<>(context, intent, tClass, bindAction));
}
private RemoteListenerProxy(Context context, Intent intent, Class<T> tClass, String bindAction) {

View File

@ -75,7 +75,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
}
public Map<String, String> search(String search) {
Map<String, String> map = new HashMap<String, String>();
Map<String, String> map = new HashMap<>();
Cursor cursor = getReadableDatabase().query("overrides", new String[]{"name", "value"},
"name LIKE ?", new String[]{search}, null, null, null, null);
if (cursor != null) {

View File

@ -46,8 +46,8 @@ public class GServicesProvider extends ContentProvider {
private static final String TAG = "GmsServicesProvider";
private DatabaseHelper databaseHelper;
private Map<String, String> cache = new HashMap<String, String>();
private Set<String> cachedPrefixes = new HashSet<String>();
private Map<String, String> cache = new HashMap<>();
private Set<String> cachedPrefixes = new HashSet<>();
@Override
public boolean onCreate() {