本文整理汇总了Java中com.woxthebox.draglistview.DragListView类的典型用法代码示例。如果您正苦于以下问题:Java DragListView类的具体用法?Java DragListView怎么用?Java DragListView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DragListView类属于com.woxthebox.draglistview包,在下文中一共展示了DragListView类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateView
import com.woxthebox.draglistview.DragListView; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.dictionary_list_fragment, container, false);
dictionaryListView = (DragListView) view.findViewById(R.id.drag_list_view);
dictionaryListView.getRecyclerView().setVerticalScrollBarEnabled(true);
dictionaryListView.setDragEnabled(true);
addButton = (ImageButton) view.findViewById(R.id.dictionary_add_button);
addButton.setOnClickListener(v -> {
addDictionary();
});
dictionaryService = DictionaryServiceImpl.get();
initDictionaryList();
return view;
}
示例2: 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;
}
示例3: 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;
}
示例4: 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);
}