public static ItemSelectionSupport from(RecyclerView recyclerView) {
    if (recyclerView == null) {
      return null;
    }

    return (ItemSelectionSupport) recyclerView.getTag(R.id.recyclerview_item_selection_support);
  }
  public static ItemClickSupport from(RecyclerView recyclerView) {
    if (recyclerView == null) {
      return null;
    }

    return (ItemClickSupport) recyclerView.getTag(R.id.twowayview_item_click_support);
  }
 public static ItemClickSupport removeFrom(RecyclerView view) {
   ItemClickSupport support = (ItemClickSupport) view.getTag(R.id.item_click_support);
   if (support != null) {
     support.detach(view);
   }
   return support;
 }
 public static ItemClickSupport addTo(RecyclerView view) {
   ItemClickSupport support = (ItemClickSupport) view.getTag(R.id.item_click_support);
   if (support == null) {
     support = new ItemClickSupport(view);
   }
   return support;
 }
 private void resetUILoadingState() {
   Object _state = mRecyclerView.getTag();
   // prevent unnecessary traffic
   if (_state != null && (_state instanceof Utils.State)) {
     ((Utils.State) _state).setPendingLoadMore(false);
   } else {
     Utils.State state = new Utils.State();
     state.setPendingLoadMore(false);
     _state = state;
   }
   mRecyclerView.setTag(_state);
   reInitializeScrollListener(mRecyclerView);
 }
Example #6
0
 @Override
 public void getListView(RecyclerView list) {
   int pos = (Integer) list.getTag();
   list.setLayoutManager(new LinearLayoutManager(getContext()));
   switch (pos) {
     case 0:
       list.setAdapter(latestListAdapter);
       break;
     case 1:
       list.setAdapter(popularListAdapter);
       break;
     case 2:
       list.setAdapter(mangaListAdapter);
       break;
     default:
       Utilities.Log(LOG_TAG, "NOPE! No list to be shown boiii");
   }
 }
  private void callForRemotePosts(boolean isPaginating) {
    String tag = getArguments().getString(K.KEY_TAG.name());

    // construct context from preferences if any?
    Bundle iArgs = new Bundle();

    if (isPaginating) {
      Object _state = mRecyclerView.getTag();
      // prevent unnecessary traffic
      if (_state != null && (_state instanceof Utils.State)) {
        if (((Utils.State) _state).isPendingLoadMore()) {
          return;
        }
      }

      Utils.State state = new Utils.State();
      state.setPendingLoadMore(true);
      mRecyclerView.setTag(state);

      //            Utils.PreferencesManager pref = Utils.PreferencesManager.getInstance();
      //            Map<String, String> entries =
      // pref.getValueAsMap(AppConstants.API.PREF_POSTS_LIST_USER.getValue());
      //            for (Map.Entry<String, String> e : entries.entrySet()) {
      //                iArgs.putString(e.getKey(), e.getValue());
      //            }
    }

    // context
    iArgs.putString(KEY_BY.getValue(), KEY_POSTS_SEARCH.getValue());
    iArgs.putString(KEY_KEY.getValue(), tag);

    // call for intent
    Intent mServiceIntent = new Intent(mActivity, PostsPullService.class);
    mServiceIntent.putExtras(iArgs);
    mActivity.startService(mServiceIntent);
  }