本文整理汇总了Java中de.timroes.android.listview.EnhancedListView类的典型用法代码示例。如果您正苦于以下问题:Java EnhancedListView类的具体用法?Java EnhancedListView怎么用?Java EnhancedListView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EnhancedListView类属于de.timroes.android.listview包,在下文中一共展示了EnhancedListView类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onDismiss
import de.timroes.android.listview.EnhancedListView; //导入依赖的package包/类
@Override
public EnhancedListView.Undoable onDismiss(EnhancedListView enhancedListView, final int pos) {
final FoodItem item = mAdapter.getItem(pos);
mAdapter.remove(pos);
return new EnhancedListView.Undoable() {
@Override
public void undo() {
mAdapter.add(pos, item);
checkShowInventoryLowView();
}
@Override
public String getTitle() {
checkShowInventoryLowView();
return "Deleted " + item.getTitle();
}
};
}
示例2: onCreate
import de.timroes.android.listview.EnhancedListView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
taskList = (EnhancedListView) findViewById(R.id.TaskList);
testingTasks = new ArrayList<Task>();
Intent intent = new Intent(this, Notifier.class);
bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
//Toast.makeText(this, "Service is apparently starting " + mBound, Toast.LENGTH_LONG).show();
inflateTaskListAll();
setUpGestureDetection();
}
示例3: initGUI
import de.timroes.android.listview.EnhancedListView; //导入依赖的package包/类
@AfterViews
protected void initGUI(){
List<Post> posts = Storage.get().getPosts();
if (posts.size() > 0) updateList(posts);
updater.setOnRefreshListener(this);
updater.setColorScheme(android.R.color.holo_blue_bright,
android.R.color.holo_green_light,
android.R.color.holo_orange_light,
android.R.color.holo_red_light);
mListPosts.setUndoStyle(EnhancedListView.UndoStyle.MULTILEVEL_POPUP);
mListPosts.setRequireTouchBeforeDismiss(false);
mListPosts.setUndoHideDelay(3000);
mListPosts.setSwipeDirection(EnhancedListView.SwipeDirection.BOTH);
mListPosts.setDismissCallback(dismissCalback);
mListPosts.enableSwipeToDismiss();
}
示例4: onCreate
import de.timroes.android.listview.EnhancedListView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_contact);
mListView = (EnhancedListView) findViewById(android.R.id.list);
mContactDao = new ContactDao(this);
mListView.setDismissCallback(new EnhancedListView.OnDismissCallback() {
@Override
public EnhancedListView.Undoable onDismiss(EnhancedListView enhancedListView, int i) {
Contact contact = mAdapter.getItem(i);
mContactDao.delete(contact.getId());
mAdapter.remove(i);
return null;
}
});
mListView.enableSwipeToDismiss();
getSupportLoaderManager().initLoader(1, null, this);
}
示例5: setViewItems
import de.timroes.android.listview.EnhancedListView; //导入依赖的package包/类
private void setViewItems(View view) {
mInventoryList = (EnhancedListView) view.findViewById(R.id.inventory_list);
mPantryBareView = (RelativeLayout) view.findViewById(R.id.pantry_bare_view);
setButtonViews(view);
populateInventory();
checkShowInventoryLowView();
}
示例6: onDismiss
import de.timroes.android.listview.EnhancedListView; //导入依赖的package包/类
@Override
public EnhancedListView.Undoable onDismiss(EnhancedListView listView, final int position) {
final PostsAdapter adapter = (PostsAdapter) mListPosts.getAdapter();
final Post post = (Post) adapter.getItem(position);
if (post == null) return null;
adapter.remove(position);
return new EnhancedListView.Undoable() {
@Override
public void undo() {
adapter.insert(position, post);
}
@Override
public String getTitle() {
return "post removed";
}
@Override
public void discard() {
mDeletePostRequest = new DeletePostRequest(post.id);
RequestStatusObject.getInstance().setStarted();
getSpiceManager().execute(mDeletePostRequest, post.id,
DurationInMillis.ALWAYS_EXPIRED, new DeleteRequestListener());
}
};
}
示例7: setUpGestureDetection
import de.timroes.android.listview.EnhancedListView; //导入依赖的package包/类
public void setUpGestureDetection() {
//giving all tasks the ability to open a context menu
//on a long press
//credit to https://github.com/timroes/EnhancedListView/ for the EnhancedListView
//set up the delete and undo functionality
taskList.setDismissCallback(new EnhancedListView.OnDismissCallback() {
@Override
public EnhancedListView.Undoable onDismiss(EnhancedListView listView, final int position) {
// Store the item for later undo
final Task item = (Task) taskAdapter.getItem(position);
// Remove the item from the adapter
taskAdapter.remove(taskAdapter.getItem(position));
// return an Undoable
return new EnhancedListView.Undoable() {
// Reinsert the item to the adapter
@Override
public void undo() {
taskAdapter.insert(item, position);
}
// Return a string for your item
@Override
public String getTitle() {
return "Deleted '" + item.getTitle() + "'"; // Plz, use the resource system :)
}
// Delete item completely from your persistent storage
@Override
public void discard() {
DataAccess.deleteTask(getApplicationContext(), item);
}
};
}
});
//allow for multilevel undoing
taskList.setUndoStyle(EnhancedListView.UndoStyle.MULTILEVEL_POPUP);
//add swipe functionality
taskList.setShouldSwipeCallback(new EnhancedListView.OnShouldSwipeCallback() {
@Override
public boolean onShouldSwipe(EnhancedListView enhancedListView, int i) {
return true;
}
});
//enable the swipe/undo
taskList.enableSwipeToDismiss();
//register list view for context menu
registerForContextMenu(taskList);
taskList.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
openContextMenu(view);
return false;
}
});
}
示例8: initView
import de.timroes.android.listview.EnhancedListView; //导入依赖的package包/类
private void initView() {
listView = (EnhancedListView) getView().findViewById(R.id.cardListView);
}