use warning suggestions for .addAll() method and null guard

This commit is contained in:
Hans-Christoph Steiner 2018-03-07 16:45:44 +01:00
parent 5547f12527
commit 215db81802

View File

@ -63,7 +63,6 @@ import java.util.Set;
* TODO: If a user downloads an old version of an app (resulting in a new update being available * TODO: If a user downloads an old version of an app (resulting in a new update being available
* instantly), then we need to refresh the list of apps to update. * instantly), then we need to refresh the list of apps to update.
*/ */
@SuppressWarnings("LineLength")
public class UpdatesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> public class UpdatesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
implements LoaderManager.LoaderCallbacks<Cursor> { implements LoaderManager.LoaderCallbacks<Cursor> {
@ -170,9 +169,7 @@ public class UpdatesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
} }
} }
for (KnownVulnApp app : knownVulnApps) { items.addAll(knownVulnApps);
items.add(app);
}
} }
@Override @Override
@ -329,6 +326,9 @@ public class UpdatesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
private final BroadcastReceiver receiverAppStatusChanges = new BroadcastReceiver() { private final BroadcastReceiver receiverAppStatusChanges = new BroadcastReceiver() {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
if (intent == null) {
return;
}
switch (intent.getAction()) { switch (intent.getAction()) {
case AppUpdateStatusManager.BROADCAST_APPSTATUS_LIST_CHANGED: case AppUpdateStatusManager.BROADCAST_APPSTATUS_LIST_CHANGED:
onManyAppStatusesChanged(intent.getStringExtra(AppUpdateStatusManager.EXTRA_REASON_FOR_CHANGE)); onManyAppStatusesChanged(intent.getStringExtra(AppUpdateStatusManager.EXTRA_REASON_FOR_CHANGE));