Skip to content

Commit

Permalink
fix(InstantSearch): Restore constructor for single widget
Browse files Browse the repository at this point in the history
  • Loading branch information
PLNech committed Aug 16, 2017
1 parent 8dc2dfc commit 96eb97c
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ public InstantSearch(@NonNull final Activity activity, @NonNull Menu menu, @IdRe
processActivity(activity);
}

public InstantSearch(@NonNull final View widget, @NonNull final Searcher searcher) {
this(searcher);
registerWidget(widget);
}

private InstantSearch(@NonNull final Searcher searcher) {
this.searcher = searcher;
enableProgressBar();
Expand Down Expand Up @@ -290,7 +295,11 @@ private void processActivity(@NonNull final Activity activity) {
}
}

private void processListener(View widget) {
/**
* Links the given widget to InstantSearch according to the interfaces it implements.
* @param widget a widget implementing ({@link AlgoliaResultListener} || {@link AlgoliaErrorListener} || {@link AlgoliaSearcherListener}).
*/
public void registerWidget(View widget) {
if (widget instanceof AlgoliaResultListener) {
AlgoliaResultListener listener = (AlgoliaResultListener) widget;
if (!this.resultListeners.contains(listener)) {
Expand Down

0 comments on commit 96eb97c

Please sign in to comment.