Skip to content

Commit

Permalink
Remove unnecessary Context
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Lapadula committed May 13, 2015
1 parent da92883 commit cb90a67
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -26,7 +26,7 @@ View anotherHeader = LayoutInflater.from(getContext()).inflate(R.layout.another_
View myFooter = LayoutInflater.from(getContext()).inflate(R.layout.my_footer, null);

// Add them as headers / footers
Bookends<MyAdapter> adapter = new Bookends<MyAdapter>(myAdapter, getContext());
Bookends<MyAdapter> adapter = new Bookends<MyAdapter>(myAdapter);
adapter.addHeader(myHeader);
adapter.addHeader(anotherHeader);
adapter.addFooter(myFooter);
Expand Down
8 changes: 1 addition & 7 deletions bookends/src/main/java/com/tumblr/bookends/Bookends.java
@@ -1,6 +1,5 @@
package com.tumblr.bookends;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.View;
Expand Down Expand Up @@ -29,8 +28,6 @@ public class Bookends<T extends RecyclerView.Adapter> extends RecyclerView.Adapt

private final T mBase;

private final Context mContext;

/**
* Defines available view type integers for headers and footers.
*
Expand All @@ -53,13 +50,10 @@ public class Bookends<T extends RecyclerView.Adapter> extends RecyclerView.Adapt
*
* @param base
* the adapter to wrap
* @param context
* the context to use
*/
public Bookends(T base, Context context) {
public Bookends(T base) {
super();
mBase = base;
mContext = context;
}

/**
Expand Down
Expand Up @@ -29,7 +29,7 @@ protected void onCreate(Bundle savedInstanceState) {

// Make Bookends
SampleAdapter sampleAdapter = new SampleAdapter();
mBookends = new Bookends<>(sampleAdapter, getBaseContext());
mBookends = new Bookends<>(sampleAdapter);

// Inflate header and footer views
LayoutInflater inflater = LayoutInflater.from(getBaseContext());
Expand Down

0 comments on commit cb90a67

Please sign in to comment.