Make assumption that app is non-null explicit

The adapter has a hard coded assumption that mApp is never null.
This documents it as such by making the member variable @NonNull.
This is not perfect, because the consumer of this class doesn't quite
seem to check this constraing properly, however at least within the
class it adds some explicit documentation that is understood by editors
and lint that this is a non-nullable field.
This commit is contained in:
Peter Serwylo 2016-11-30 22:24:00 +11:00
parent 1eb7d389f2
commit 190cf40ff9

@ -6,6 +6,7 @@ import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.support.annotation.NonNull;
import android.support.v4.view.ViewCompat;
import android.support.v4.widget.TextViewCompat;
import android.support.v7.text.AllCapsTransformationMethod;
@ -77,6 +78,7 @@ public class AppDetailsRecyclerViewAdapter
private final int VIEWTYPE_VERSION = 7;
private final Context mContext;
@NonNull
private App mApp;
private final AppDetailsRecyclerViewAdapterCallbacks mCallbacks;
private RecyclerView mRecyclerView;
@ -86,13 +88,14 @@ public class AppDetailsRecyclerViewAdapter
private HeaderViewHolder mHeaderView;
public AppDetailsRecyclerViewAdapter(Context context, App app, AppDetailsRecyclerViewAdapterCallbacks callbacks) {
public AppDetailsRecyclerViewAdapter(Context context, @NonNull App app, AppDetailsRecyclerViewAdapterCallbacks callbacks) {
mContext = context;
mCallbacks = callbacks;
mApp = app;
updateItems(app);
}
public void updateItems(App app) {
public void updateItems(@NonNull App app) {
mApp = app;
// Get versions