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

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

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

origin: mikepenz/FastAdapter

/**
 * selects an item and remembers its position in the selections list
 *
 * @param position               the global position
 * @param fireEvent              true if the onClick listener should be called
 * @param considerSelectableFlag true if the select method should not select an item if its not selectable
 */
public void select(int position, boolean fireEvent, boolean considerSelectableFlag) {
  FastAdapter.RelativeInfo<Item> relativeInfo = mFastAdapter.getRelativeInfo(position);
  if (relativeInfo == null || relativeInfo.item == null) {
    return;
  }
  select(relativeInfo.adapter, relativeInfo.item, position, fireEvent, considerSelectableFlag);
}
origin: mikepenz/FastAdapter

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

@Test
public void getRelativeInfo() throws Exception {
  List<TestItem> items = TestDataGenerator.genTestItemList(100);
  TestItem item = items.get(40);
  itemAdapter.set(items);
  assertThat(adapter.getRelativeInfo(40).item).isEqualTo(item);
  assertThat(adapter.getRelativeInfo(40).adapter).isEqualTo(itemAdapter);
  assertThat(adapter.getRelativeInfo(40).position).isEqualTo(40);
}
origin: mikepenz/FastAdapter

FastAdapter.RelativeInfo<Item> ri = mFastAdapter.getRelativeInfo(positions.get(i));
if (ri.item != null && ri.item.isSelected()) { //double verify
  if (ri.adapter != null && ri.adapter instanceof IItemAdapter) {
origin: mikepenz/FastAdapter

/**
 * util function which recursively iterates over all items and subItems of the given adapter.
 * It executes the given `predicate` on every item and will either stop if that function returns true, or continue (if stopOnMatch is false)
 *
 * @param predicate           the predicate to run on every item, to check for a match or do some changes (e.g. select)
 * @param globalStartPosition the start position at which we star tto recursively iterate over the items. (This will not stop at the end of a sub hierarchy!)
 * @param stopOnMatch         defines if we should stop iterating after the first match
 * @return Triple&lt;Boolean, IItem, Integer&gt; The first value is true (it is always not null), the second contains the item and the third the position (if the item is visible) if we had a match, (always false and null and null in case of stopOnMatch == false)
 */
@NonNull
public Triple<Boolean, Item, Integer> recursive(AdapterPredicate<Item> predicate, int globalStartPosition, boolean stopOnMatch) {
  for (int i = globalStartPosition; i < getItemCount(); i++) {
    //retrieve the item + it's adapter
    RelativeInfo<Item> relativeInfo = getRelativeInfo(i);
    Item item = relativeInfo.item;
    if (predicate.apply(relativeInfo.adapter, i, item, i) && stopOnMatch) {
      return new Triple<>(true, item, i);
    }
    if (item instanceof IExpandable) {
      Triple<Boolean, Item, Integer> res = FastAdapter.recursiveSub(relativeInfo.adapter, i, (IExpandable) item, predicate, stopOnMatch);
      if (res.first && stopOnMatch) {
        return res;
      }
    }
  }
  return new Triple<>(false, null, null);
}
origin: mikepenz/FastAdapter

history.action = ACTION_REMOVE;
for (int position : positions) {
  history.items.add(mAdapter.getRelativeInfo(position));
origin: mikepenz/FastAdapter

FastAdapter.RelativeInfo<Item> relativeInfo = getFastAdapter().getRelativeInfo(globalPosition);
Item item = relativeInfo.item;
com.mikepenz.fastadapterFastAdaptergetRelativeInfo

Javadoc

Internal method to get the Item as ItemHolder which comes with the relative position within its adapter Finds the responsible adapter for the given position

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
  • getPreItemCountByOrder
    calculates the item count up to a given (excluding this) order number
  • notifyItemChanged
  • saveInstanceState
    add the values to the bundle for saveInstanceState
  • notifyItemChanged,
  • saveInstanceState,
  • select,
  • withSavedInstanceState,
  • addAdapter,
  • getItemId,
  • getItemViewType,
  • getPreItemCount,
  • getSelectedItems

Popular in Java

  • Reactive rest calls using spring rest template
  • findViewById (Activity)
  • setRequestProperty (URLConnection)
  • getExternalFilesDir (Context)
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • Path (java.nio.file)
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • Top plugins for WebStorm
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