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


Java OnDismissCallback类代码示例

本文整理汇总了Java中com.nhaarman.listviewanimations.itemmanipulation.OnDismissCallback的典型用法代码示例。如果您正苦于以下问题:Java OnDismissCallback类的具体用法?Java OnDismissCallback怎么用?Java OnDismissCallback使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: SwipeDismissListViewTouchListener

import com.nhaarman.listviewanimations.itemmanipulation.OnDismissCallback; //导入依赖的package包/类
/**
 * Constructs a new swipe-to-dismiss touch listener for the given list view.
 *
 * @param listView
 *            The list view whose items should be dismissable.
 * @param callback
 *            The callback to trigger when the user has indicated that she
 *            would like to dismiss one or more list items.
 */
public SwipeDismissListViewTouchListener(final AbsListView listView, final OnDismissCallback callback, final SwipeOnScrollListener onScroll) {
    ViewConfiguration vc = ViewConfiguration.get(listView.getContext());
    mSlop = vc.getScaledTouchSlop();
    mMinFlingVelocity = vc.getScaledMinimumFlingVelocity() * MIN_FLING_VELOCITY_FACTOR;
    mMaxFlingVelocity = vc.getScaledMaximumFlingVelocity();
    mAnimationTime = listView.getContext().getResources().getInteger(android.R.integer.config_shortAnimTime);
    mListView = listView;
    mCallback = callback;

    onScroll.setTouchListener(this);
    mListView.setOnScrollListener(onScroll);
}
 
开发者ID:xulailing,项目名称:android-open-project-demo-master,代码行数:22,代码来源:SwipeDismissListViewTouchListener.java

示例2: onNotesLoaded

import com.nhaarman.listviewanimations.itemmanipulation.OnDismissCallback; //导入依赖的package包/类
@Override
public void onNotesLoaded(ArrayList<Note> notes) {
	int layout = prefs.getBoolean(Constants.PREF_EXPANDED_VIEW, true) ? R.layout.note_layout_expanded
			: R.layout.note_layout;
	mAdapter = new NoteAdapter(getActivity(), layout, notes);

	// A specifical behavior is performed basing on navigation
	SwipeDismissAdapter adapter = new SwipeDismissAdapter(mAdapter, new OnDismissCallback() {
		@Override
		public void onDismiss(AbsListView listView, int[] reverseSortedPositions) {

			// Avoids conflicts with action mode
			finishActionMode();

			for (int position : reverseSortedPositions) {
				Note note = mAdapter.getItem(position);
				selectedNotes.add(note);
				// listView.invalidateViews();

				// Depending on settings and note status this action will...
				// ...restore
				if (Navigation.checkNavigation(Navigation.TRASH)) {
					trashSelectedNotes(false);
				}
				// removes category
				else if (Navigation.checkNavigation(Navigation.CATEGORY)) {
					categorizeSelectedNotes2(null);
				} else {
					// ...trash
					if (prefs.getBoolean("settings_swipe_to_trash", false)
							|| Navigation.checkNavigation(Navigation.ARCHIVED)) {
						trashSelectedNotes(true);
						// ...archive
					} else {
						archiveSelectedNotes(true);
					}
				}
			}
		}
	});
	adapter.setAbsListView(listView);
	listView.setAdapter(adapter);

	// Replace listview with Mr. Jingles if it is empty
	if (notes.size() == 0) listView.setEmptyView(((MainActivity) getActivity()).findViewById(R.id.empty_list));

	// Restores listview position when turning back to list
	if (listView != null && notes.size() > 0) {
		if (listView.getCount() > listViewPosition) {
			listView.setSelectionFromTop(listViewPosition, listViewPositionOffset);
		} else {
			listView.setSelectionFromTop(0, 0);
		}
	}

	// Fade in the list view
	animate(listView).setDuration(getResources().getInteger(R.integer.list_view_fade_anim)).alpha(1);
}
 
开发者ID:kanpol,项目名称:omni-note,代码行数:59,代码来源:ListFragment.java

示例3: SwipeDismissAdapter

import com.nhaarman.listviewanimations.itemmanipulation.OnDismissCallback; //导入依赖的package包/类
/**
 * Create a new SwipeDismissAdapter.
 *
 * @param baseAdapter       the {@link android.widget.BaseAdapter to use}
 * @param onDismissCallback the {@link OnDismissCallback} to be notified of dismissed items.
 */
public SwipeDismissAdapter(final BaseAdapter baseAdapter, final OnDismissCallback onDismissCallback) {
    this(baseAdapter, onDismissCallback, new SwipeOnScrollListener());
}
 
开发者ID:xulailing,项目名称:android-open-project-demo-master,代码行数:10,代码来源:SwipeDismissAdapter.java


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