示例#1
0
 @Override
 public void onItemClicked(
     Presenter.ViewHolder itemViewHolder,
     Object item,
     RowPresenter.ViewHolder rowViewHolder,
     Row row) {
   if (item instanceof Post) {
     if (NetworkUtil.isNetworkConnected(getActivity())) {
       Post post = (Post) item;
       int index = mRowsAdapter.indexOf(row);
       PostAdapter adapter =
           ((PostAdapter) ((ListRow) mRowsAdapter.get(index)).getAdapter());
       ArrayList<Post> postList = (ArrayList<Post>) adapter.getAllItems();
       startActivity(PlaybackActivity.newStartIntent(getActivity(), post, postList));
     } else {
       ToastFactory.createWifiErrorToast(getActivity()).show();
     }
   } else if (item instanceof Option) {
     Option option = (Option) item;
     if (option.title.equals(getString(R.string.title_no_videos))
         || item.equals(getString(R.string.title_oops))) {
       int index = mRowsAdapter.indexOf(row);
       PostAdapter adapter =
           ((PostAdapter) ((ListRow) mRowsAdapter.get(index)).getAdapter());
       adapter.removeReloadCard();
       addPostLoadSubscription(adapter);
     } else {
       startActivity(GuidedStepActivity.getStartIntent(getActivity()));
     }
   }
 }
 private void notifyChanged(Action action) {
   ArrayObjectAdapter adapter = mPrimaryActionsAdapter;
   if (adapter.indexOf(action) >= 0) {
     adapter.notifyArrayItemRangeChanged(adapter.indexOf(action), 1);
     return;
   }
   adapter = mSecondaryActionsAdapter;
   if (adapter.indexOf(action) >= 0) {
     adapter.notifyArrayItemRangeChanged(adapter.indexOf(action), 1);
     return;
   }
 }
示例#3
0
 @Override
 public void onItemSelected(
     Presenter.ViewHolder itemViewHolder,
     Object item,
     RowPresenter.ViewHolder rowViewHolder,
     Row row) {
   if (item instanceof Post) {
     String backgroundUrl = ((Post) item).thumbnailUrl;
     if (backgroundUrl != null) startBackgroundTimer(URI.create(backgroundUrl));
     int index = mRowsAdapter.indexOf(row);
     PostAdapter adapter = ((PostAdapter) ((ListRow) mRowsAdapter.get(index)).getAdapter());
     if (adapter.get(adapter.size() - 1).equals(item) && adapter.shouldLoadNextPage()) {
       addPostLoadSubscription(adapter);
     }
   }
 }