当前位置: 首页>>代码示例>>Java>>正文


Java WrapperAdapterUtils.findWrappedAdapter方法代码示例

本文整理汇总了Java中com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils.findWrappedAdapter方法的典型用法代码示例。如果您正苦于以下问题:Java WrapperAdapterUtils.findWrappedAdapter方法的具体用法?Java WrapperAdapterUtils.findWrappedAdapter怎么用?Java WrapperAdapterUtils.findWrappedAdapter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils的用法示例。


在下文中一共展示了WrapperAdapterUtils.findWrappedAdapter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onDragItemFinished

import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils; //导入方法依赖的package包/类
void onDragItemFinished(boolean result) {
    if (LOCAL_LOGD) {
        Log.d(TAG, "onDragItemFinished(result = " + result + ")");
    }

    if (DEBUG_BYPASS_MOVE_OPERATION_MODE) {
        return;
    }

    if (result && (mDraggingItemCurrentPosition != mDraggingItemInitialPosition)) {
        // apply to wrapped adapter
        DraggableItemAdapter adapter = WrapperAdapterUtils.findWrappedAdapter(
                getWrappedAdapter(), DraggableItemAdapter.class);
        adapter.onMoveItem(mDraggingItemInitialPosition, mDraggingItemCurrentPosition);
    }

    mDraggingItemInitialPosition = RecyclerView.NO_POSITION;
    mDraggingItemCurrentPosition = RecyclerView.NO_POSITION;
    mDraggableRange = null;
    mDraggingItemInfo = null;
    mDraggingItemViewHolder = null;

    notifyDataSetChanged();
}
 
开发者ID:fabricethilaw,项目名称:expandable-recyclerview-with-gridlayout,代码行数:25,代码来源:DraggableItemWrapperAdapter.java

示例2: onPrepareActionMode

import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils; //导入方法依赖的package包/类
@Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
    RecyclerView list = listView.get();
    ListableFragment fragment = listFragment.get();
    if (list == null || fragment == null)
        return false;

    MenuItem edit = menu.findItem(R.id.option_edit);

    ListableItemAdapter adapter = WrapperAdapterUtils.findWrappedAdapter(list.getAdapter(), ListableItemAdapter.class);
    for (int index : getManager().getSelectedPositions()) {
        Object obj = adapter.getItem(index);

        if (obj instanceof CustomModificator) {
            return ViewUtils.menuIconState(edit, true);
        } else {
            return ViewUtils.menuIconState(edit, false);
        }
    }

    return false;
}
 
开发者ID:gandulf,项目名称:DsaTab,代码行数:23,代码来源:ListableFragment.java

示例3: onDragItemFinished

import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils; //导入方法依赖的package包/类
void onDragItemFinished(RecyclerView.ViewHolder holder, boolean result) {
    if (LOCAL_LOGD) {
        Log.d(TAG, "onDragItemFinished(holder = " + holder + ", result = " + result + ")");
    }

    if (holder != null && holder != mDraggingItem) {
        throw new IllegalStateException("onDragItemFinished() - may be a bug (mDraggingItem != holder)");
    }

    if (DEBUG_BYPASS_MOVE_OPERATION_MODE) {
        return;
    }

    if (result && (mDraggingItemCurrentPosition != mDraggingItemInitialPosition)) {
        // apply to wrapped adapter
        DraggableItemAdapter adapter = WrapperAdapterUtils.findWrappedAdapter(
                getWrappedAdapter(), DraggableItemAdapter.class);
        adapter.onMoveItem(mDraggingItemInitialPosition, mDraggingItemCurrentPosition);
    }

    mDraggingItemInitialPosition = RecyclerView.NO_POSITION;
    mDraggingItemCurrentPosition = RecyclerView.NO_POSITION;
    mDraggableRange = null;
    mDraggingItemId = RecyclerView.NO_ID;
    mDraggingItem = null;

    notifyDataSetChanged();
}
 
开发者ID:WriterOfAlicrow,项目名称:OpenCVTour,代码行数:29,代码来源:DraggableItemWrapperAdapter.java

示例4: onActionItemClicked

import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils; //导入方法依赖的package包/类
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem menuItem) {
    RecyclerView list = listView.get();
    final ItemListFragment fragment = listFragment.get();
    if (list == null || fragment == null)
        return false;

    boolean notifyChanged = false;

    ItemCursorRecyclerAdapter adapter = WrapperAdapterUtils.findWrappedAdapter(list.getAdapter(), ItemCursorRecyclerAdapter.class);
    for (int index : getManager().getSelectedPositions()) {
        final Object obj = adapter.getItem(index);
        if (obj instanceof Cursor) {

            final Item item = DataManager.getItemByCursor((Cursor) obj);

            switch (menuItem.getItemId()) {
                case R.id.option_delete: {
                    DataManager.deleteItem(item);
                    notifyChanged = true;
                    break;
                }
            }

        }
    }
    if (notifyChanged) {
        fragment.refresh();
    }

    mode.finish();
    return true;
}
 
开发者ID:gandulf,项目名称:DsaTab,代码行数:34,代码来源:ItemListFragment.java

示例5: onPrepareActionMode

import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils; //导入方法依赖的package包/类
@Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
    int selected = 0;
    boolean online = false;
    boolean deletable = false;
    RecyclerView list = listView.get();
    final HeroChooserFragment fragment = listFragment.get();
    if (list == null || fragment == null)
        return false;

    HeroAdapter adapter = WrapperAdapterUtils.findWrappedAdapter(list.getAdapter(), HeroAdapter.class);
    for (int index : getManager().getSelectedPositions()) {
        HeroFileInfo heroInfo = adapter.getItem(index);
        selected++;

        online |= heroInfo.isOnline();
        deletable |= heroInfo.isDeletable();
    }

    mode.setSubtitle(fragment.getString(R.string.count_selected, String.valueOf(selected)));

    boolean changed = false;

    MenuItem download = menu.findItem(R.id.option_download);
    if (download != null && online != download.isVisible()) {
        download.setVisible(online);
        changed = true;
    }

    MenuItem upload = menu.findItem(R.id.option_upload);
    if (upload != null && online != upload.isVisible()) {
        upload.setVisible(online);
        changed |= true;
    }

    MenuItem delete = menu.findItem(R.id.option_delete);
    changed |= ViewUtils.menuIconState(delete, deletable);

    return changed;
}
 
开发者ID:gandulf,项目名称:DsaTab,代码行数:41,代码来源:HeroChooserFragment.java

示例6: onActionItemClicked

import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils; //导入方法依赖的package包/类
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
    RecyclerView list = listView.get();
    ListableFragment fragment = listFragment.get();
    if (list == null || fragment == null)
        return false;

    ListableItemAdapter adapter = WrapperAdapterUtils.findWrappedAdapter(list.getAdapter(), ListableItemAdapter.class);
    for (int index : getManager().getSelectedPositions()) {

        Object obj = adapter.getItem(index);

        if (obj instanceof CustomModificator) {
            CustomModificator modificator = (CustomModificator) obj;

            switch (item.getItemId()) {
                case R.id.option_edit:
                    ModificatorEditFragment.edit(fragment, modificator,
                            DsaTabActivity.ACTION_EDIT_MODIFICATOR);
                    mode.finish();
                    return true;
                case R.id.option_delete:
                    DsaTabApplication.getInstance().getHero().removeModificator(modificator);
                    break;
            }
        }
    }

    mode.finish();
    return true;
}
 
开发者ID:gandulf,项目名称:DsaTab,代码行数:32,代码来源:ListableFragment.java

示例7: onCreateActionMode

import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils; //导入方法依赖的package包/类
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
    RecyclerView list = listView.get();
    ListableFragment fragment = listFragment.get();
    if (list == null || fragment == null)
        return false;

    boolean hasItems = false;
    boolean hasModifiers = false;

    ListableItemAdapter adapter = WrapperAdapterUtils.findWrappedAdapter(list.getAdapter(), ListableItemAdapter.class);
    for (int index : getManager().getSelectedPositions()) {
        Object obj = adapter.getItem(index);
        if (obj instanceof CustomModificator) {
            hasModifiers = true;
        }
        if (obj instanceof EquippedItem) {
            hasItems = true;
        }
    }

    if (hasModifiers && !hasItems) {
        mode.getMenuInflater().inflate(R.menu.menuitem_edit, menu);
        mode.getMenuInflater().inflate(R.menu.menuitem_delete, menu);
    } else if (hasItems && !hasModifiers) {
        mode.getMenuInflater().inflate(R.menu.equipped_item_popupmenu, menu);
    }

    return super.onCreateActionMode(mode, menu);
}
 
开发者ID:gandulf,项目名称:DsaTab,代码行数:31,代码来源:ListableFragment.java

示例8: getSwipeableItemAdapter

import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils; //导入方法依赖的package包/类
private static BaseSwipeableItemAdapter getSwipeableItemAdapter(RecyclerView.Adapter adapter) {
    return WrapperAdapterUtils.findWrappedAdapter(adapter, BaseSwipeableItemAdapter.class);
}
 
开发者ID:fabricethilaw,项目名称:expandable-recyclerview-with-gridlayout,代码行数:4,代码来源:SwipeableItemWrapperAdapter.java

示例9: getSwipeableItemWrapperAdapter

import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils; //导入方法依赖的package包/类
private static SwipeableItemWrapperAdapter getSwipeableItemWrapperAdapter(RecyclerView rv) {
    return WrapperAdapterUtils.findWrappedAdapter(rv.getAdapter(), SwipeableItemWrapperAdapter.class);
}
 
开发者ID:fabricethilaw,项目名称:expandable-recyclerview-with-gridlayout,代码行数:4,代码来源:RecyclerViewSwipeManager.java

示例10: getDraggableItemWrapperAdapter

import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils; //导入方法依赖的package包/类
private static DraggableItemWrapperAdapter getDraggableItemWrapperAdapter(RecyclerView rv) {
    return WrapperAdapterUtils.findWrappedAdapter(rv.getAdapter(), DraggableItemWrapperAdapter.class);
}
 
开发者ID:fabricethilaw,项目名称:expandable-recyclerview-with-gridlayout,代码行数:4,代码来源:RecyclerViewDragDropManager.java

示例11: getDraggableItemAdapter

import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils; //导入方法依赖的package包/类
private static DraggableItemAdapter getDraggableItemAdapter(RecyclerView.Adapter adapter) {
    return WrapperAdapterUtils.findWrappedAdapter(adapter, DraggableItemAdapter.class);
}
 
开发者ID:fabricethilaw,项目名称:expandable-recyclerview-with-gridlayout,代码行数:4,代码来源:DraggableItemWrapperAdapter.java

示例12: getExpandableItemAdapter

import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils; //导入方法依赖的package包/类
private static ExpandableItemAdapter getExpandableItemAdapter(RecyclerView.Adapter adapter) {
    return WrapperAdapterUtils.findWrappedAdapter(adapter, ExpandableItemAdapter.class);
}
 
开发者ID:fabricethilaw,项目名称:expandable-recyclerview-with-gridlayout,代码行数:4,代码来源:ExpandableRecyclerViewWrapperAdapter.java

示例13: getSwipeableItemAdapter

import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils; //导入方法依赖的package包/类
private static SwipeableItemAdapter getSwipeableItemAdapter(RecyclerView.Adapter adapter) {
    return WrapperAdapterUtils.findWrappedAdapter(adapter, SwipeableItemAdapter.class);
}
 
开发者ID:WriterOfAlicrow,项目名称:OpenCVTour,代码行数:4,代码来源:SwipeableItemWrapperAdapter.java

示例14: onActionItemClicked

import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils; //导入方法依赖的package包/类
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
    RecyclerView list = listView.get();
    final ItemsFragment fragment = listFragment.get();
    if (list == null || fragment == null)
        return false;

    EquippedItemRecyclerAdapter adapter = WrapperAdapterUtils.findWrappedAdapter(list.getAdapter(), EquippedItemRecyclerAdapter.class);
    for (int index : getManager().getSelectedPositions()) {
        final Object obj = adapter.getItem(index);
        if (obj instanceof ItemCard) {
            ItemCard itemCard = (ItemCard) obj;

            Item selectedItem = itemCard.getItem();

            if (item.getGroupId() == MENU_MOVE_GROUP) {
                int newScreen = item.getItemId();
                if (newScreen != selectedItem.getContainerId()) {
                    fragment.getHero().moveItem(selectedItem, newScreen);
                }
            } else {
                switch (item.getItemId()) {
                    case R.id.option_delete:
                        fragment.getHero().removeItem(selectedItem);
                        break;
                    case R.id.option_edit:
                        ItemsActivity.edit(fragment, fragment.getHero(), selectedItem, ACTION_EDIT);
                        mode.finish();
                        return true;
                    case R.id.option_equipped:
                        return false;
                    case R.id.option_move:
                        return false;
                    case R.id.option_equipped_set1:
                        fragment.getHero().addEquippedItem(fragment.getActivity(), selectedItem, null,
                                null, 0);
                        break;
                    case R.id.option_equipped_set2:
                        fragment.getHero().addEquippedItem(fragment.getActivity(), selectedItem, null,
                                null, 1);
                        break;
                    case R.id.option_equipped_set3:
                        fragment.getHero().addEquippedItem(fragment.getActivity(), selectedItem, null,
                                null, 2);
                        break;
                }
            }
        }
    }

    mode.finish();
    return true;
}
 
开发者ID:gandulf,项目名称:DsaTab,代码行数:54,代码来源:ItemsFragment.java

示例15: onPrepareActionMode

import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {

    RecyclerView list = listView.get();
    final ItemsFragment fragment = listFragment.get();
    if (list == null || fragment == null)
        return false;

    int selected = 0;
    boolean isEquippable = true;
    boolean changed = false;
    // only moveable if we are not on a set
    boolean isMoveable = !isSetIndex(fragment.getCurrentContainerId());

    MenuItem move = menu.findItem(R.id.option_move);
    MenuItem equipped = menu.findItem(R.id.option_equipped);
    EquippedItemRecyclerAdapter adapter = WrapperAdapterUtils.findWrappedAdapter(list.getAdapter(), EquippedItemRecyclerAdapter.class);
    for (int index : getManager().getSelectedPositions()) {
        final Object obj = adapter.getItem(index);

        if (obj instanceof ItemCard) {
            ItemCard itemCard = (ItemCard) obj;

            Item selectedItem = itemCard.getItem();
            selected++;

            isEquippable &= selectedItem.isEquipable();

        }
    }

    mode.setSubtitle(selected + " ausgewählt");

    changed |= ViewUtils.menuIconState(equipped, isEquippable);
    changed |= ViewUtils.menuIconState(move, isMoveable);
    if (move != null)
        move.setVisible(isMoveable);

    return changed;
}
 
开发者ID:gandulf,项目名称:DsaTab,代码行数:42,代码来源:ItemsFragment.java


注:本文中的com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils.findWrappedAdapter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。