Skip to content

Commit

Permalink
Add missing click listener to text search fragment
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsvanvelzen committed Jan 3, 2020
1 parent bf33dc6 commit 5049e7d
Showing 1 changed file with 11 additions and 0 deletions.
Expand Up @@ -12,9 +12,13 @@
import android.widget.TextView;

import org.jellyfin.androidtv.R;
import org.jellyfin.androidtv.itemhandling.BaseRowItem;
import org.jellyfin.androidtv.itemhandling.ItemLauncher;
import org.jellyfin.androidtv.itemhandling.ItemRowAdapter;

import androidx.fragment.app.Fragment;
import androidx.leanback.app.RowsSupportFragment;
import androidx.leanback.widget.ListRow;

public class TextSearchFragment extends Fragment implements TextWatcher, TextView.OnEditorActionListener {
private SearchProvider searchProvider;
Expand Down Expand Up @@ -43,6 +47,13 @@ public void onActivityCreated(Bundle savedInstanceState) {
// Set up result fragment
RowsSupportFragment rowsSupportFragment = (RowsSupportFragment) getChildFragmentManager().findFragmentById(R.id.results_frame);
rowsSupportFragment.setAdapter(searchProvider.getResultsAdapter());

// Create click listener
rowsSupportFragment.setOnItemViewClickedListener((itemViewHolder, item, rowViewHolder, row) -> {
if (!(item instanceof BaseRowItem)) return;

ItemLauncher.launch((BaseRowItem) item, (ItemRowAdapter) ((ListRow) row).getAdapter(), ((BaseRowItem) item).getIndex(), getActivity());
});
}

@Override
Expand Down

0 comments on commit 5049e7d

Please sign in to comment.