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


Java DragListView.setAdapter方法代码示例

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


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

示例1: onCreateView

import com.woxthebox.draglistview.DragListView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View rootView = inflater.inflate(R.layout.activity_appmanager, container, false);

    appListView = (DragListView) (rootView.findViewById(R.id.appListView));
    appListView.setLayoutManager(new LinearLayoutManager(getActivity()));
    mGBDeviceAppAdapter = new GBDeviceAppAdapter(appList, R.layout.item_with_details, R.id.item_image, this.getContext(), this);
    appListView.setAdapter(mGBDeviceAppAdapter, false);
    appListView.setCanDragHorizontally(false);
    appListView.setDragListListener(new DragListView.DragListListener() {
        @Override
        public void onItemDragStarted(int position) {
        }

        @Override
        public void onItemDragging(int itemPosition, float x, float y) {
        }

        @Override
        public void onItemDragEnded(int fromPosition, int toPosition) {
            onChangedAppOrder();
        }
    });
    return rootView;
}
 
开发者ID:scifiswapnil,项目名称:gadgetbridge_artikcloud,代码行数:27,代码来源:AbstractAppManagerFragment.java

示例2: onCreateView

import com.woxthebox.draglistview.DragListView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View rootView;
    boolean darkTheme = getArguments().getBoolean("darkTheme", false);

    // NO PROJECT
    if (DataEntry.TABLE_NAME.equals("[]")) {
        rootView = inflater.inflate(R.layout.no_project_layout, container, false);
        LinearLayout lin = (LinearLayout) rootView.findViewById(R.id.noProject);
        lin.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (host != null)
                    host.openProjectDialog();
            }
        });
        return rootView;
    }

    if (isSearchModeEnabled()) {
        rootView = inflater.inflate(R.layout.search_view, container, false);
        ListView list = (ListView) rootView.findViewById(R.id.search_list);

        SearchListAdapter adapter = SearchListAdapter.getInstance(getContext(), darkTheme);
        list.setAdapter(adapter);
        return rootView;
    }

    //Inflate the list view
    rootView = inflater.inflate(R.layout.fragment_list_view, container, false);
    DragListView mDragListView = (DragListView) rootView.findViewById(R.id.list);
    mDragListView.setLayoutManager(new LinearLayoutManager(getActivity()));

    //Determine tab number
    int tabNumber = 0;

    if (getTabName().equals(getString(R.string.first_tab))) { //IDEAS
        tabNumber = 1;
    } else if (getTabName().equals(getString(R.string.second_tab))) {
        tabNumber = 2;
    } else if (getTabName().equals(getString(R.string.third_tab))) {
        tabNumber = 3;
    }

    //Set reorder listener
    final int finalTabNumber = tabNumber;
    mDragListView.setDragListListener(new DragListView.DragListListener() {

        @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
        @Override
        public void onItemDragStarted(int position) {
        }

        @Override
        public void onItemDragEnded(int fromPosition, int toPosition) {
            if (fromPosition != toPosition) {
                DatabaseHelper.getInstance(getContext()).resetEntriesOrderAt(finalTabNumber);
            }
        }

        @Override
        public void onItemDragging(int itemPosition, float x, float y) {
        }
    });

    //Set adapter
    ItemAdapter itemAdapter = new ItemAdapter(getContext(), tabNumber, R.layout.recycler_view_item, R.id.horizontal_recycler_view, darkTheme);
    mDragListView.setAdapter(itemAdapter, false);
    mDragListView.setCanDragHorizontally(false);

    DatabaseHelper.setAdapterAtTab(tabNumber, itemAdapter);
    DatabaseHelper.notifyAllLists();

    return rootView;
}
 
开发者ID:IdeaTrackerPlus,项目名称:IdeaTrackerPlus,代码行数:77,代码来源:ListFragment.java

示例3: onCreate

import com.woxthebox.draglistview.DragListView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_order_hostlist);

    Toolbar toolbar = (Toolbar)findViewById(R.id.toolbar_actionbar);
    setSupportActionBar(toolbar);
    if(getSupportActionBar() != null) {
        getSupportActionBar().setHomeButtonEnabled(true);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    }

    DragListView mDragListView = (DragListView) findViewById(R.id.drag_list_view);
    mDragListView.getRecyclerView().setVerticalScrollBarEnabled(true);

    mItemArray = new ArrayList<>();
    for (Class<?> h: Host.HOSTER_LIST) {
        try {
            Host host = (Host) h.getConstructor().newInstance();
            if(host.isEnabled()) {
                mItemArray.add(new Item(host.getId(), host.getName(), R.drawable.ic_drag_handle_black_48dp));
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    sortedList = Utils.getWeightedHostList(getApplicationContext());
    if(sortedList != null) {
        Collections.sort(mItemArray, new Comparator<Item>() {
            @Override
            public int compare(Item o1, Item o2) {
                int x = sortedList.get(o1.getId(), o1.getId());
                int y = sortedList.get(o2.getId(), o1.getId());
                return (x < y) ? -1 : ((x == y) ? 0 : 1);
            }
        });
    }

    mDragListView.setLayoutManager(new LinearLayoutManager(this));
    ItemAdapter listAdapter = new ItemAdapter(mItemArray, R.layout.order_hostlist_item, R.id.image, false);
    mDragListView.setAdapter(listAdapter, true);
    mDragListView.setCanDragHorizontally(false);
}
 
开发者ID:ov3rk1ll,项目名称:KinoCast,代码行数:45,代码来源:OrderHostlistActivity.java


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