Change signature of RecyclerViewFragment#onCreateAdapter() to not require Bundle param

This commit is contained in:
Phillip Hsu 2016-09-03 15:33:03 -07:00
parent ca2da0ad66
commit 8171a663bc
4 changed files with 6 additions and 10 deletions

View File

@ -48,15 +48,11 @@ public abstract class RecyclerViewFragment<
/** /**
* @return the adapter to set on the RecyclerView. Called in onCreateView(). * @return the adapter to set on the RecyclerView. Called in onCreateView().
* @param savedInstanceState the same Bundle used to save out and restore state for this Fragment
* when the configuration is changed. Implementors may find this useful
* if their ViewHolder type(s) require saving and restoring state across
* configurations.
*/ */
protected abstract A onCreateAdapter(Bundle savedInstanceState); protected abstract A onCreateAdapter();
/** /**
* @return the adapter instance created from {@link #onCreateAdapter(Bundle)} * @return the adapter instance created from {@link #onCreateAdapter()}
*/ */
protected final A getAdapter() { protected final A getAdapter() {
return mAdapter; return mAdapter;
@ -76,7 +72,7 @@ public abstract class RecyclerViewFragment<
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = super.onCreateView(inflater, container, savedInstanceState); View view = super.onCreateView(inflater, container, savedInstanceState);
mList.setLayoutManager(getLayoutManager()); mList.setLayoutManager(getLayoutManager());
mList.setAdapter(mAdapter = onCreateAdapter(savedInstanceState)); mList.setAdapter(mAdapter = onCreateAdapter());
return view; return view;
} }

View File

@ -136,7 +136,7 @@ public class AlarmsFragment extends RecyclerViewFragment<
} }
@Override @Override
protected AlarmsCursorAdapter onCreateAdapter(Bundle savedInstanceState) { protected AlarmsCursorAdapter onCreateAdapter() {
// Create a new adapter. This is called before we can initialize mAlarmController, // Create a new adapter. This is called before we can initialize mAlarmController,
// so right now it is null. However, after super.onCreate() returns, it is initialized, and // so right now it is null. However, after super.onCreate() returns, it is initialized, and
// the reference variable will be pointing to an actual object. This assignment "propagates" // the reference variable will be pointing to an actual object. This assignment "propagates"

View File

@ -260,7 +260,7 @@ public class StopwatchFragment extends RecyclerViewFragment<
} }
@Override @Override
protected LapsAdapter onCreateAdapter(Bundle savedInstanceState) { protected LapsAdapter onCreateAdapter() {
return new LapsAdapter(); return new LapsAdapter();
} }

View File

@ -84,7 +84,7 @@ public class TimersFragment extends RecyclerViewFragment<
} }
@Override @Override
protected TimersCursorAdapter onCreateAdapter(Bundle savedInstanceState) { protected TimersCursorAdapter onCreateAdapter() {
// Create a new adapter. This is called before we can initialize mAsyncTimersTableUpdateHandler, // Create a new adapter. This is called before we can initialize mAsyncTimersTableUpdateHandler,
// so right now it is null. However, after super.onCreate() returns, it is initialized, and // so right now it is null. However, after super.onCreate() returns, it is initialized, and
// the reference variable will be pointing to an actual object. This assignment "propagates" // the reference variable will be pointing to an actual object. This assignment "propagates"