Tabnine Logo
FastAdapter.getPreItemCountByOrder
Code IndexAdd Tabnine to your IDE (free)

How to use
getPreItemCountByOrder
method
in
com.mikepenz.fastadapter.FastAdapter

Best Java code snippets using com.mikepenz.fastadapter.FastAdapter.getPreItemCountByOrder (Showing top 13 results out of 315)

origin: mikepenz/FastAdapter

/**
 * returns the global position if the relative position within this adapter was given
 *
 * @param position the relative position
 * @return the global position
 */
public int getGlobalPosition(int position) {
  return position + getFastAdapter().getPreItemCountByOrder(getOrder());
}
origin: mikepenz/FastAdapter

/**
 * removes all items of this adapter
 */
public ModelAdapter<Model, Item> clear() {
  mItems.clear(getFastAdapter().getPreItemCountByOrder(getOrder()));
  return this;
}
origin: mikepenz/FastAdapter

/**
 * helper method to get all selections from the ItemAdapter's original item list
 *
 * @return a Set with the global positions of all selected Items
 */
public Set<Integer> getSelections() {
  if (mOriginalItems != null) {
    Set<Integer> selections = new HashSet<>();
    int adapterOffset = mItemAdapter.getFastAdapter().getPreItemCountByOrder(mItemAdapter.getOrder());
    for (int i = 0, size = mOriginalItems.size(); i < size; i++) {
      Item item = mOriginalItems.get(i);
      if (item.isSelected()) {
        selections.add(i + adapterOffset);
      }
    }
    return selections;
  } else {
    return mItemAdapter.getFastAdapter().getSelections();
  }
}
origin: mikepenz/FastAdapter

  @Override
  public void onChanged(int position, int count, Object payload) {
    adapter.getFastAdapter().notifyAdapterItemRangeChanged(adapter.getFastAdapter().getPreItemCountByOrder(adapter.getOrder()) + position, count, payload);
  }
}
origin: mikepenz/FastAdapter

@Override
public void onRemoved(int position, int count) {
  adapter.getFastAdapter().notifyAdapterItemRangeRemoved(adapter.getFastAdapter().getPreItemCountByOrder(adapter.getOrder()) + position, count);
}
origin: mikepenz/FastAdapter

@Override
public void onMoved(int fromPosition, int toPosition) {
  adapter.getFastAdapter().notifyAdapterItemMoved(adapter.getFastAdapter().getPreItemCountByOrder(adapter.getOrder()) + fromPosition, toPosition);
}
origin: mikepenz/FastAdapter

@Override
public void onInserted(int position, int count) {
  adapter.getFastAdapter().notifyAdapterItemRangeInserted(adapter.getFastAdapter().getPreItemCountByOrder(adapter.getOrder()) + position, count);
}
origin: mikepenz/FastAdapter

public ModelAdapter<Model, Item> addInternal(int position, List<Item> items) {
  if (mUseIdDistributor) {
    getIdDistributor().checkIds(items);
  }
  if (items.size() > 0) {
    mItems.addAll(position, items, getFastAdapter().getPreItemCountByOrder(getOrder()));
    mapPossibleTypes(items);
  }
  return this;
}
origin: mikepenz/FastAdapter

@Test
public void getPreItemCountByOrder() throws Exception {
  List<TestItem> items = TestDataGenerator.genTestItemList(100);
  itemAdapter.set(items);
  assertThat(adapter.getPreItemCountByOrder(itemAdapter.getOrder())).isEqualTo(0);
}
origin: mikepenz/FastAdapter

@Test
public void getPreItemCountByOrder() throws Exception {
  List<TestItem> items = TestDataGenerator.genTestItemList(100);
  itemAdapter.set(items);
  assertThat(adapter.getPreItemCountByOrder(itemAdapter.getOrder())).isEqualTo(0);
}
origin: mikepenz/FastAdapter

public ModelAdapter<Model, Item> addInternal(List<Item> items) {
  if (mUseIdDistributor) {
    getIdDistributor().checkIds(items);
  }
  FastAdapter<Item> fastAdapter = getFastAdapter();
  if (fastAdapter != null) {
    mItems.addAll(items, fastAdapter.getPreItemCountByOrder(getOrder()));
  } else {
    mItems.addAll(items, 0);
  }
  mapPossibleTypes(items);
  return this;
}
origin: mikepenz/FastAdapter

int preItemCount = getFastAdapter().getPreItemCountByOrder(getOrder());
for (int i = 0; i < getAdapterItemCount(); i++) {
  int globalPosition = i + preItemCount;
origin: mikepenz/FastAdapter

/**
 * set a new list of model and apply it to the existing list (clear - add) for this adapter
 * NOTE may consider using setNewList if the items list is a reference to the list which is used inside the adapter
 *
 * @param items           the items to set
 * @param resetFilter     `true` if the filter should get reset
 * @param adapterNotifier a `IAdapterNotifier` allowing to modify the notify logic for the adapter (keep null for default)
 * @return this
 */
public ModelAdapter<Model, Item> setInternal(List<Item> items, boolean resetFilter, @Nullable IAdapterNotifier adapterNotifier) {
  if (mUseIdDistributor) {
    getIdDistributor().checkIds(items);
  }
  //reset the filter
  if (resetFilter && getItemFilter().getConstraint() != null) {
    getItemFilter().performFiltering(null);
  }
  for (IAdapterExtension<Item> ext : getFastAdapter().getExtensions()) {
    ext.set(items, resetFilter);
  }
  //map the types
  mapPossibleTypes(items);
  //forward set
  int itemsBeforeThisAdapter = getFastAdapter().getPreItemCountByOrder(getOrder());
  mItems.set(items, itemsBeforeThisAdapter, adapterNotifier);
  return this;
}
com.mikepenz.fastadapterFastAdaptergetPreItemCountByOrder

Javadoc

calculates the item count up to a given (excluding this) order number

Popular methods of FastAdapter

  • with
    creates a new FastAdapter with the provided adapters if adapters is null, a default ItemAdapter is d
  • getItem
    gets the IItem by a position, from all registered adapters
  • getItemCount
    calculates the total ItemCount over all registered adapters
  • getExtension
  • getAdapter
    Gets the adapter for the given position
  • getPosition
    Searches for the given item and calculates its global position
  • getSelections
  • withSelectable
    Set to true if you want the items to be selectable. By default, no items are selectable
  • addExtension
  • getRelativeInfo
    Internal method to get the Item as ItemHolder which comes with the relative position within its adap
  • notifyItemChanged
  • saveInstanceState
    add the values to the bundle for saveInstanceState
  • notifyItemChanged,
  • saveInstanceState,
  • select,
  • withSavedInstanceState,
  • addAdapter,
  • getItemId,
  • getItemViewType,
  • getPreItemCount,
  • getSelectedItems

Popular in Java

  • Making http post requests using okhttp
  • onRequestPermissionsResult (Fragment)
  • putExtra (Intent)
  • getSupportFragmentManager (FragmentActivity)
  • BufferedReader (java.io)
    Wraps an existing Reader and buffers the input. Expensive interaction with the underlying reader is
  • String (java.lang)
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now