本文整理汇总了Java中com.h6ah4i.android.widget.advrecyclerview.animator.GeneralItemAnimator类的典型用法代码示例。如果您正苦于以下问题:Java GeneralItemAnimator类的具体用法?Java GeneralItemAnimator怎么用?Java GeneralItemAnimator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GeneralItemAnimator类属于com.h6ah4i.android.widget.advrecyclerview.animator包,在下文中一共展示了GeneralItemAnimator类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setUpRecyclerView
import com.h6ah4i.android.widget.advrecyclerview.animator.GeneralItemAnimator; //导入依赖的package包/类
private void setUpRecyclerView() {
recyclerViewDragDropManager = new RecyclerViewDragDropManager();
final GeneralItemAnimator animator = new RefactoredDefaultItemAnimator();
playingQueueAdapter = new PlayingQueueAdapter(
((AppCompatActivity) getActivity()),
MusicPlayerRemote.getPlayingQueue(),
MusicPlayerRemote.getPosition(),
R.layout.item_list,
false,
null);
wrappedAdapter = recyclerViewDragDropManager.createWrappedAdapter(playingQueueAdapter);
layoutManager = new LinearLayoutManager(getActivity());
recyclerView.setLayoutManager(layoutManager);
recyclerView.setAdapter(wrappedAdapter);
recyclerView.setItemAnimator(animator);
recyclerViewDragDropManager.attachRecyclerView(recyclerView);
layoutManager.scrollToPositionWithOffset(MusicPlayerRemote.getPosition() + 1, 0);
}
开发者ID:aliumujib,项目名称:Orin,代码行数:24,代码来源:FlatPlayerFragment.java
示例2: initRecyclerView
import com.h6ah4i.android.widget.advrecyclerview.animator.GeneralItemAnimator; //导入依赖的package包/类
private void initRecyclerView(Bundle savedInstanceState) {
mLayoutManager = new LinearLayoutManager(getActivity());
final Parcelable eimSavedState = (savedInstanceState != null) ?
savedInstanceState.getParcelable(SAVED_STATE_EXPANDABLE_ITEM_MANAGER) : null;
mRecyclerViewExpandableItemManager = new RecyclerViewExpandableItemManager(eimSavedState);
mExpandableItemAdapter = new ExpandableItemAdapter(getActivity(), this, new ArrayList<Day>());
mAdapter = mExpandableItemAdapter;
mWrappedAdapter = mRecyclerViewExpandableItemManager.createWrappedAdapter(mExpandableItemAdapter);
final GeneralItemAnimator animator = new RefactoredDefaultItemAnimator();
animator.setSupportsChangeAnimations(false);
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.setAdapter(mWrappedAdapter);
mRecyclerView.setItemAnimator(animator);
mRecyclerView.setHasFixedSize(false);
mRecyclerViewExpandableItemManager.attachRecyclerView(mRecyclerView);
}
开发者ID:andreshj87,项目名称:CleanFit,代码行数:23,代码来源:DiaryFragment.java
示例3: setUpRecyclerView
import com.h6ah4i.android.widget.advrecyclerview.animator.GeneralItemAnimator; //导入依赖的package包/类
private void setUpRecyclerView() {
ViewUtil.setUpFastScrollRecyclerViewColor(this, ((FastScrollRecyclerView) recyclerView), ThemeStore.accentColor(this));
recyclerView.setLayoutManager(new LinearLayoutManager(this));
if (playlist instanceof AbsCustomPlaylist) {
adapter = new CustomPlaylistSongAdapter(this, new ArrayList<Song>(), R.layout.item_list, false, this);
recyclerView.setAdapter(adapter);
} else {
recyclerViewDragDropManager = new RecyclerViewDragDropManager();
final GeneralItemAnimator animator = new RefactoredDefaultItemAnimator();
adapter = new PlaylistSongAdapter(this, new ArrayList<PlaylistSong>(), R.layout.item_list, false, this, new PlaylistSongAdapter.OnMoveItemListener() {
@Override
public void onMoveItem(int fromPosition, int toPosition) {
if (PlaylistsUtil.moveItem(PlaylistDetailActivity.this, playlist.id, fromPosition, toPosition)) {
Song song = adapter.getDataSet().remove(fromPosition);
adapter.getDataSet().add(toPosition, song);
adapter.notifyItemMoved(fromPosition, toPosition);
}
}
});
wrappedAdapter = recyclerViewDragDropManager.createWrappedAdapter(adapter);
recyclerView.setAdapter(wrappedAdapter);
recyclerView.setItemAnimator(animator);
recyclerViewDragDropManager.attachRecyclerView(recyclerView);
}
adapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() {
@Override
public void onChanged() {
super.onChanged();
checkIsEmpty();
}
});
}
开发者ID:aliumujib,项目名称:Orin,代码行数:36,代码来源:PlaylistDetailActivity.java
示例4: setUpRecyclerView
import com.h6ah4i.android.widget.advrecyclerview.animator.GeneralItemAnimator; //导入依赖的package包/类
private void setUpRecyclerView() {
mRecyclerViewDragDropManager = new RecyclerViewDragDropManager();
final GeneralItemAnimator animator = new RefactoredDefaultItemAnimator();
mPlayingQueueAdapter = new PlayingQueueAdapter(
(AppCompatActivity) getActivity(),
MusicPlayerRemote.getPlayingQueue(),
MusicPlayerRemote.getPosition(),
R.layout.item_list,
false,
null);
mWrappedAdapter = mRecyclerViewDragDropManager.createWrappedAdapter(mPlayingQueueAdapter);
mLayoutManager = new LinearLayoutManager(getContext());
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.setAdapter(mWrappedAdapter);
mRecyclerView.setItemAnimator(animator);
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
/* if (recyclerView.canScrollVertically(RecyclerView.NO_POSITION)) {
mAppBarLayout.setElevation(5f);
} else {
mAppBarLayout.setElevation(0f);
}*/
}
}
});
mRecyclerViewDragDropManager.attachRecyclerView(mRecyclerView);
mLayoutManager.scrollToPositionWithOffset(MusicPlayerRemote.getPosition() + 1, 0);
}
开发者ID:h4h13,项目名称:RetroMusicPlayer,代码行数:37,代码来源:PlayingQueueFragment.java
示例5: setUpRecyclerView
import com.h6ah4i.android.widget.advrecyclerview.animator.GeneralItemAnimator; //导入依赖的package包/类
private void setUpRecyclerView() {
ViewUtil.setUpFastScrollRecyclerViewColor(this,
((FastScrollRecyclerView) recyclerView),
ThemeStore.accentColor(this));
recyclerView.setLayoutManager(new LinearLayoutManager(this));
if (playlist instanceof AbsCustomPlaylist) {
adapter = new PlaylistSongAdapter(this, new ArrayList<Song>(), R.layout.item_list, false, this);
recyclerView.setAdapter(adapter);
} else {
recyclerViewDragDropManager = new RecyclerViewDragDropManager();
final GeneralItemAnimator animator = new RefactoredDefaultItemAnimator();
adapter = new OrderablePlaylistSongAdapter(this, new ArrayList<PlaylistSong>(), R.layout.item_list, false, this, (fromPosition, toPosition) -> {
if (PlaylistsUtil.moveItem(PlaylistDetailActivity.this, playlist.id, fromPosition, toPosition)) {
Song song = adapter.getDataSet().remove(fromPosition);
adapter.getDataSet().add(toPosition, song);
adapter.notifyItemMoved(fromPosition, toPosition);
}
});
wrappedAdapter = recyclerViewDragDropManager.createWrappedAdapter(adapter);
recyclerView.setAdapter(wrappedAdapter);
recyclerView.setItemAnimator(animator);
recyclerViewDragDropManager.attachRecyclerView(recyclerView);
}
adapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() {
@Override
public void onChanged() {
super.onChanged();
checkIsEmpty();
}
});
}
开发者ID:h4h13,项目名称:RetroMusicPlayer,代码行数:34,代码来源:PlaylistDetailActivity.java
示例6: setUpRecyclerView
import com.h6ah4i.android.widget.advrecyclerview.animator.GeneralItemAnimator; //导入依赖的package包/类
private void setUpRecyclerView() {
ViewUtil.setUpFastScrollRecyclerViewColor(this, ((FastScrollRecyclerView) recyclerView), ThemeStore.accentColor(this));
recyclerView.setLayoutManager(new LinearLayoutManager(this));
if (playlist instanceof AbsCustomPlaylist) {
adapter = new PlaylistSongAdapter(this, new ArrayList<Song>(), R.layout.item_list, false, this);
recyclerView.setAdapter(adapter);
} else {
recyclerViewDragDropManager = new RecyclerViewDragDropManager();
final GeneralItemAnimator animator = new RefactoredDefaultItemAnimator();
adapter = new OrderablePlaylistSongAdapter(this, new ArrayList<PlaylistSong>(), R.layout.item_list, false, this, (fromPosition, toPosition) -> {
if (PlaylistsUtil.moveItem(PlaylistDetailActivity.this, playlist.id, fromPosition, toPosition)) {
Song song = adapter.getDataSet().remove(fromPosition);
adapter.getDataSet().add(toPosition, song);
adapter.notifyItemMoved(fromPosition, toPosition);
}
});
wrappedAdapter = recyclerViewDragDropManager.createWrappedAdapter(adapter);
recyclerView.setAdapter(wrappedAdapter);
recyclerView.setItemAnimator(animator);
recyclerViewDragDropManager.attachRecyclerView(recyclerView);
}
adapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() {
@Override
public void onChanged() {
super.onChanged();
checkIsEmpty();
}
});
}
开发者ID:kabouzeid,项目名称:Phonograph,代码行数:33,代码来源:PlaylistDetailActivity.java
示例7: initRecyclerView
import com.h6ah4i.android.widget.advrecyclerview.animator.GeneralItemAnimator; //导入依赖的package包/类
/**
* Initialize the recycler view and set the adapter.
*/
private void initRecyclerView(Bundle savedInstanceState) {
// restore state if necessary
final Parcelable eimSavedState = (savedInstanceState != null) ? savedInstanceState.getParcelable(SAVED_STATE_EXPANDABLE_ITEM_MANAGER) : null;
recyclerViewExpandableItemManager = new RecyclerViewExpandableItemManager(eimSavedState);
// create data provider
dataProvider = new UniversitiesDataProvider();
// create adapter
universitiesAdapter = new UniversitiesAdapter(this, dataProvider, recyclerViewExpandableItemManager);
wrappedAdapter = recyclerViewExpandableItemManager.createWrappedAdapter(universitiesAdapter);
// set animation stuff
final GeneralItemAnimator animator = new RefactoredDefaultItemAnimator();
animator.setSupportsChangeAnimations(false);
// init recycler view
layoutManager = new LinearLayoutManager(this);
rvUniversities = (RecyclerView) findViewById(R.id.rv_universities);
rvUniversities.setLayoutManager(layoutManager);
rvUniversities.setAdapter(wrappedAdapter);
rvUniversities.setItemAnimator(animator);
rvUniversities.setHasFixedSize(false);
// attach recycler view to item manager, necessary for touch listeners
recyclerViewExpandableItemManager.attachRecyclerView(rvUniversities);
}
开发者ID:MyGrades,项目名称:mygrades-app,代码行数:31,代码来源:SelectUniversityActivity.java
示例8: onViewCreated
import com.h6ah4i.android.widget.advrecyclerview.animator.GeneralItemAnimator; //导入依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
//noinspection ConstantConditions
mRecyclerView = (RecyclerView) getView().findViewById(R.id.recycler_view);
mLayoutManager = new LinearLayoutManager(getActivity());
// drag & drop manager
mRecyclerViewDragDropManager = new RecyclerViewDragDropManager();
mRecyclerViewDragDropManager.setDraggingItemShadowDrawable(
(NinePatchDrawable) getResources().getDrawable(R.drawable.material_shadow_z3));
//adapter
final MyDraggableItemAdapter myItemAdapter = new MyDraggableItemAdapter(getDataProvider());
mAdapter = myItemAdapter;
mWrappedAdapter = mRecyclerViewDragDropManager.createWrappedAdapter(myItemAdapter); // wrap for dragging
final GeneralItemAnimator animator = new RefactoredDefaultItemAnimator();
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.setAdapter(mWrappedAdapter); // requires *wrapped* adapter
mRecyclerView.setItemAnimator(animator);
// additional decorations
//noinspection StatementWithEmptyBody
if (supportsViewElevation()) {
// Lollipop or later has native drop shadow feature. ItemShadowDecorator is not required.
} else {
mRecyclerView.addItemDecoration(new ItemShadowDecorator((NinePatchDrawable) getResources().getDrawable(R.drawable.material_shadow_z1)));
}
mRecyclerView.addItemDecoration(new SimpleListDividerDecorator(getResources().getDrawable(R.drawable.list_divider), true));
mRecyclerViewDragDropManager.attachRecyclerView(mRecyclerView);
// for debugging
// animator.setDebug(true);
// animator.setMoveDuration(2000);
}
开发者ID:pczhu,项目名称:android-advancedrecyclerview-master,代码行数:41,代码来源:RecyclerListViewFragment.java
示例9: onViewCreated
import com.h6ah4i.android.widget.advrecyclerview.animator.GeneralItemAnimator; //导入依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
//noinspection ConstantConditions
mRecyclerView = (RecyclerView) getView().findViewById(R.id.recycler_view);
mLayoutManager = new LinearLayoutManager(getActivity());
// drag & drop manager
mRecyclerViewDragDropManager = new RecyclerViewDragDropManager();
mRecyclerViewDragDropManager.setDraggingItemShadowDrawable(
(NinePatchDrawable) getResources().getDrawable(R.drawable.material_shadow_z3));
//adapter
final MyDraggableWithSectionItemAdapter myItemAdapter = new MyDraggableWithSectionItemAdapter(getDataProvider());
mAdapter = myItemAdapter;
mWrappedAdapter = mRecyclerViewDragDropManager.createWrappedAdapter(myItemAdapter); // wrap for dragging
final GeneralItemAnimator animator = new RefactoredDefaultItemAnimator();
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.setAdapter(mWrappedAdapter); // requires *wrapped* adapter
mRecyclerView.setItemAnimator(animator);
// additional decorations
//noinspection StatementWithEmptyBody
if (supportsViewElevation()) {
// Lollipop or later has native drop shadow feature. ItemShadowDecorator is not required.
} else {
mRecyclerView.addItemDecoration(new ItemShadowDecorator((NinePatchDrawable) getResources().getDrawable(R.drawable.material_shadow_z1)));
}
mRecyclerView.addItemDecoration(new SimpleListDividerDecorator(getResources().getDrawable(R.drawable.list_divider), true));
mRecyclerViewDragDropManager.attachRecyclerView(mRecyclerView);
// for debugging
// animator.setDebug(true);
// animator.setMoveDuration(2000);
}
开发者ID:pczhu,项目名称:android-advancedrecyclerview-master,代码行数:41,代码来源:RecyclerListViewFragment.java
示例10: onViewCreated
import com.h6ah4i.android.widget.advrecyclerview.animator.GeneralItemAnimator; //导入依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
//noinspection ConstantConditions
mRecyclerView = (RecyclerView) getView().findViewById(R.id.recycler_view);
mLayoutManager = new LinearLayoutManager(getActivity());
final Parcelable eimSavedState = (savedInstanceState != null) ? savedInstanceState.getParcelable(SAVED_STATE_EXPANDABLE_ITEM_MANAGER) : null;
mRecyclerViewExpandableItemManager = new RecyclerViewExpandableItemManager(eimSavedState);
//adapter
final MyAddRemoveExpandableItemAdapter myItemAdapter = new MyAddRemoveExpandableItemAdapter(mRecyclerViewExpandableItemManager, getDataProvider());
mAdapter = myItemAdapter;
mWrappedAdapter = mRecyclerViewExpandableItemManager.createWrappedAdapter(myItemAdapter); // wrap for expanding
final GeneralItemAnimator animator = new RefactoredDefaultItemAnimator();
// Change animations are enabled by default since support-v7-recyclerview v22.
// Need to disable them when using animation indicator.
animator.setSupportsChangeAnimations(false);
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.setAdapter(mWrappedAdapter); // requires *wrapped* adapter
mRecyclerView.setItemAnimator(animator);
mRecyclerView.setHasFixedSize(false);
// additional decorations
//noinspection StatementWithEmptyBody
if (supportsViewElevation()) {
// Lollipop or later has native drop shadow feature. ItemShadowDecorator is not required.
} else {
mRecyclerView.addItemDecoration(new ItemShadowDecorator((NinePatchDrawable) getResources().getDrawable(R.drawable.material_shadow_z1)));
}
mRecyclerView.addItemDecoration(new SimpleListDividerDecorator(getResources().getDrawable(R.drawable.list_divider), true));
mRecyclerViewExpandableItemManager.attachRecyclerView(mRecyclerView);
}
开发者ID:pczhu,项目名称:android-advancedrecyclerview-master,代码行数:41,代码来源:RecyclerListViewFragment.java
示例11: onCreateView
import com.h6ah4i.android.widget.advrecyclerview.animator.GeneralItemAnimator; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View layout = inflater.inflate(R.layout.properties_fragment, container, false);
final RecyclerView recyclerView = (RecyclerView) layout.findViewById(R.id.properties_list);
final Parcelable savedState = (savedInstanceState != null) ?
savedInstanceState.getParcelable(SAVED_STATE_EXPANDABLE_ITEM_MANAGER) : null;
mRecyclerViewExpandableItemManager = new RecyclerViewExpandableItemManager(savedState);
ElementProperties properties = (ElementProperties) getArguments().get(
PropertiesActivity.ARGUMENT_PROPERTIES);
IsotopesAdapter adapter = new IsotopesAdapter(getActivity(), properties.getIsotopes());
mWrappedAdapter = mRecyclerViewExpandableItemManager.createWrappedAdapter(adapter);
GeneralItemAnimator animator = new RefactoredDefaultItemAnimator();
animator.setSupportsChangeAnimations(false);
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
recyclerView.setAdapter(mWrappedAdapter);
recyclerView.addItemDecoration(new DividerDecoration(getActivity()));
recyclerView.setItemAnimator(animator);
mRecyclerViewExpandableItemManager.attachRecyclerView(recyclerView);
getActivity().registerForContextMenu(recyclerView);
return layout;
}
开发者ID:Frozen-Developers,项目名称:android-periodic-table,代码行数:33,代码来源:IsotopesFragment.java
示例12: onCreateTestTargetItemAnimator
import com.h6ah4i.android.widget.advrecyclerview.animator.GeneralItemAnimator; //导入依赖的package包/类
@Override
protected GeneralItemAnimator onCreateTestTargetItemAnimator() {
return new RefactoredDefaultItemAnimator();
}
开发者ID:fabricethilaw,项目名称:expandable-recyclerview-with-gridlayout,代码行数:5,代码来源:RefactoredDefaultItemAnimatorTest.java
示例13: onCreateTestTargetItemAnimator
import com.h6ah4i.android.widget.advrecyclerview.animator.GeneralItemAnimator; //导入依赖的package包/类
@Override
protected GeneralItemAnimator onCreateTestTargetItemAnimator() {
return new SwipeDismissItemAnimator();
}
开发者ID:fabricethilaw,项目名称:expandable-recyclerview-with-gridlayout,代码行数:5,代码来源:SwipeDismissItemAnimatorTest.java
示例14: onCreate
import com.h6ah4i.android.widget.advrecyclerview.animator.GeneralItemAnimator; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setStatusBarColor(ResourcesUtils.getAttrColor(this, R.attr.colorPrimaryDark));
ToolbarActivityHelper.setContentView(this, R.layout.activity_record);
setActionBarUpIndicator(DrawableManager.getDrawable(this, R.drawable.v_arrow_left_dark_x24));
View tip = findViewById(R.id.tip);
mRecyclerView = (EasyRecyclerView) findViewById(R.id.recycler_view);
mViewTransition = new ViewTransition(tip, mRecyclerView);
// Layout Manager
int interval = getResources().getDimensionPixelOffset(R.dimen.card_interval);
if (getResources().getBoolean(R.bool.two_way)) {
mRecyclerView.setLayoutManager(new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL));
MarginItemDecoration decoration = new MarginItemDecoration(interval, interval, interval, interval, interval);
mRecyclerView.addItemDecoration(decoration);
decoration.applyPaddings(mRecyclerView);
mRecyclerView.setItemAnimator(new SlideInUpAnimator());
} else {
int halfInterval = interval / 2;
mRecyclerView.addItemDecoration(new RawMarginItemDecoration(0, halfInterval, 0, halfInterval));
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
mRecyclerView.setPadding(0, halfInterval, 0, halfInterval);
}
// touch guard manager (this class is required to suppress scrolling while swipe-dismiss animation is running)
mRecyclerViewTouchActionGuardManager = new RecyclerViewTouchActionGuardManager();
mRecyclerViewTouchActionGuardManager.setInterceptVerticalScrollingWhileAnimationRunning(true);
mRecyclerViewTouchActionGuardManager.setEnabled(true);
// swipe manager
mRecyclerViewSwipeManager = new RecyclerViewSwipeManager();
mAdapter = new RecordAdapter();
mAdapter.setHasStableIds(true);
mWrappedAdapter = mRecyclerViewSwipeManager.createWrappedAdapter(mAdapter); // wrap for swiping
final GeneralItemAnimator animator = new SwipeDismissItemAnimator();
// Change animations are enabled by default since support-v7-recyclerview v22.
// Disable the change animation in order to make turning back animation of swiped item works properly.
animator.setSupportsChangeAnimations(false);
mRecyclerView.hasFixedSize();
mRecyclerView.setAdapter(mWrappedAdapter); // requires *wrapped* adapter
mRecyclerView.setItemAnimator(animator);
mRecyclerView.setOnItemClickListener(this);
mRecyclerView.setSelector(Ripple.generateRippleDrawable(this, ResourcesUtils.getAttrBoolean(this, R.attr.dark)));
mRecyclerView.setDrawSelectorOnTop(true);
mRecyclerView.setClipToPadding(false);
mRecyclerView.setClipChildren(false);
// NOTE:
// The initialization order is very important! This order determines the priority of touch event handling.
//
// priority: TouchActionGuard > Swipe > DragAndDrop
mRecyclerViewTouchActionGuardManager.attachRecyclerView(mRecyclerView);
mRecyclerViewSwipeManager.attachRecyclerView(mRecyclerView);
updateLazyList();
checkEmpty(false);
Messenger.getInstance().register(Constants.MESSENGER_ID_UPDATE_RECORD, this);
}
开发者ID:seven332,项目名称:Nimingban,代码行数:68,代码来源:RecordActivity.java
示例15: onCreate
import com.h6ah4i.android.widget.advrecyclerview.animator.GeneralItemAnimator; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setStatusBarColor(ResourcesUtils.getAttrColor(this, R.attr.colorPrimaryDark));
ToolbarActivityHelper.setContentView(this, R.layout.activity_draft);
setActionBarUpIndicator(DrawableManager.getDrawable(this, R.drawable.v_arrow_left_dark_x24));
mTip = findViewById(R.id.tip);
mRecyclerView = (EasyRecyclerView) findViewById(R.id.recycler_view);
mViewTransition = new ViewTransition(mTip, mRecyclerView);
// Layout Manager
mLayoutManager = new LinearLayoutManager(this);
// touch guard manager (this class is required to suppress scrolling while swipe-dismiss animation is running)
mRecyclerViewTouchActionGuardManager = new RecyclerViewTouchActionGuardManager();
mRecyclerViewTouchActionGuardManager.setInterceptVerticalScrollingWhileAnimationRunning(true);
mRecyclerViewTouchActionGuardManager.setEnabled(true);
// swipe manager
mRecyclerViewSwipeManager = new RecyclerViewSwipeManager();
mAdapter = new DraftAdapter();
mAdapter.setHasStableIds(true);
mWrappedAdapter = mRecyclerViewSwipeManager.createWrappedAdapter(mAdapter); // wrap for swiping
final GeneralItemAnimator animator = new SwipeDismissItemAnimator();
// Change animations are enabled by default since support-v7-recyclerview v22.
// Disable the change animation in order to make turning back animation of swiped item works properly.
animator.setSupportsChangeAnimations(false);
mRecyclerView.hasFixedSize();
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.setAdapter(mWrappedAdapter); // requires *wrapped* adapter
mRecyclerView.setItemAnimator(animator);
mRecyclerView.setOnItemClickListener(this);
// NOTE:
// The initialization order is very important! This order determines the priority of touch event handling.
//
// priority: TouchActionGuard > Swipe > DragAndDrop
mRecyclerViewTouchActionGuardManager.attachRecyclerView(mRecyclerView);
mRecyclerViewSwipeManager.attachRecyclerView(mRecyclerView);
updateLazyList();
checkEmpty(false);
}
开发者ID:seven332,项目名称:Nimingban,代码行数:50,代码来源:DraftActivity.java
示例16: onCreate
import com.h6ah4i.android.widget.advrecyclerview.animator.GeneralItemAnimator; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (!handlerIntent(getIntent())) {
finish();
return;
}
setStatusBarColor(ResourcesUtils.getAttrColor(this, R.attr.colorPrimaryDark));
ToolbarActivityHelper.setContentView(this, R.layout.activity_forum_sort);
setActionBarUpIndicator(DrawableManager.getDrawable(this, R.drawable.v_arrow_left_dark_x24));
mTip = findViewById(R.id.tip);
mRecyclerView = (EasyRecyclerView) findViewById(R.id.recycler_view);
mViewTransition = new ViewTransition(mTip, mRecyclerView);
// Layout Manager
mLayoutManager = new LinearLayoutManager(this);
// touch guard manager (this class is required to suppress scrolling while swipe-dismiss animation is running)
mRecyclerViewTouchActionGuardManager = new RecyclerViewTouchActionGuardManager();
mRecyclerViewTouchActionGuardManager.setInterceptVerticalScrollingWhileAnimationRunning(true);
mRecyclerViewTouchActionGuardManager.setEnabled(true);
// drag & drop manager
mRecyclerViewDragDropManager = new RecyclerViewDragDropManager();
mRecyclerViewDragDropManager.setDraggingItemShadowDrawable(
(NinePatchDrawable) getResources().getDrawable(R.drawable.shadow_8dp));
// swipe manager
mRecyclerViewSwipeManager = new RecyclerViewSwipeManager();
mAdapter = new ForumAdapter();
mAdapter.setHasStableIds(true);
mWrappedAdapter = mRecyclerViewDragDropManager.createWrappedAdapter(mAdapter); // wrap for dragging
mWrappedAdapter = mRecyclerViewSwipeManager.createWrappedAdapter(mWrappedAdapter); // wrap for swiping
final GeneralItemAnimator animator = new SwipeDismissItemAnimator();
// Change animations are enabled by default since support-v7-recyclerview v22.
// Disable the change animation in order to make turning back animation of swiped item works properly.
animator.setSupportsChangeAnimations(false);
mRecyclerView.hasFixedSize();
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.setAdapter(mWrappedAdapter); // requires *wrapped* adapter
mRecyclerView.setItemAnimator(animator);
// NOTE:
// The initialization order is very important! This order determines the priority of touch event handling.
//
// priority: TouchActionGuard > Swipe > DragAndDrop
mRecyclerViewTouchActionGuardManager.attachRecyclerView(mRecyclerView);
mRecyclerViewSwipeManager.attachRecyclerView(mRecyclerView);
mRecyclerViewDragDropManager.attachRecyclerView(mRecyclerView);
updateLazyList(false);
if (Settings.getGuideSortForumsActivity()) {
showEyeGuide();
}
}
开发者ID:seven332,项目名称:Nimingban,代码行数:64,代码来源:SortForumsActivity.java
示例17: onCreate
import com.h6ah4i.android.widget.advrecyclerview.animator.GeneralItemAnimator; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//获取RecycleView,创建LayoutManager
mRecyclerView = (RecyclerView) findViewById(R.id.recycler_view);
mLayoutManager = new LinearLayoutManager(this);
// touch guard manager 阻止当Swipe时列表滚动
mRecyclerViewTouchActionGuardManager = new RecyclerViewTouchActionGuardManager();
mRecyclerViewTouchActionGuardManager.setInterceptVerticalScrollingWhileAnimationRunning(true);
mRecyclerViewTouchActionGuardManager.setEnabled(true);
// drag & drop manager
mRecyclerViewDragDropManager = new RecyclerViewDragDropManager();
mRecyclerViewDragDropManager.setDraggingItemShadowDrawable(
(NinePatchDrawable) getResources().getDrawable(R.drawable.material_shadow_z3_xxhdpi));
// swipe manager
mRecyclerViewSwipeManager = new RecyclerViewSwipeManager();
//adapter
for(int i=0;i<100;i++){
dataList.add(new MyItem(i,"测试数据"+i));
}
mAdapter = new MyAdapter(dataList);
mWrappedAdapter = mRecyclerViewDragDropManager.createWrappedAdapter(mAdapter); //处理一下mAdapter可以拖拽
mWrappedAdapter = mRecyclerViewSwipeManager.createWrappedAdapter(mWrappedAdapter); //处理一下mAdapter可以滑动删除
final GeneralItemAnimator animator = new SwipeDismissItemAnimator();
// Change animations are enabled by default since support-v7-recyclerview v22.
// Disable the change animation in order to make turning back animation of swiped item works properly.
animator.setSupportsChangeAnimations(false);
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.setAdapter(mWrappedAdapter); // 注意设置的是mWrappedAdapter
mRecyclerView.setItemAnimator(animator);
//additional decorations
//noinspection StatementWithEmptyBody
if (supportsViewElevation()) {
// Lollipop or later has native drop shadow feature. ItemShadowDecorator is not required.
} else {
mRecyclerView.addItemDecoration(new ItemShadowDecorator((NinePatchDrawable) getResources().getDrawable(R.drawable.material_shadow_z3_xxhdpi)));
}
mRecyclerView.addItemDecoration(new SimpleListDividerDecorator(getResources().getDrawable(R.drawable.list_divider), true));
// NOTE:
// 初始化的顺序十分重要,这决定了处理Touch事件的优先级
// 优先级: TouchActionGuard > Swipe > DragAndDrop
mRecyclerViewTouchActionGuardManager.attachRecyclerView(mRecyclerView);
mRecyclerViewSwipeManager.attachRecyclerView(mRecyclerView);
mRecyclerViewDragDropManager.attachRecyclerView(mRecyclerView);
}
开发者ID:hanks-zyh,项目名称:RecylerView,代码行数:61,代码来源:MainActivity.java
示例18: initRecyclerView
import com.h6ah4i.android.widget.advrecyclerview.animator.GeneralItemAnimator; //导入依赖的package包/类
private void initRecyclerView() {
mRecyclerView = (RecyclerView) getView().findViewById(R.id.recylerView);
mLayoutManager = new LinearLayoutManager(getActivity());
// touch guard manager (this class is required to suppress scrolling while swipe-dismiss animation is running)
mRecyclerViewTouchActionGuardManager = new RecyclerViewTouchActionGuardManager();
mRecyclerViewTouchActionGuardManager.setInterceptVerticalScrollingWhileAnimationRunning(true);
mRecyclerViewTouchActionGuardManager.setEnabled(true);
// drag & drop manager 拖拽排序的manager
mRecyclerViewDragDropManager = new RecyclerViewDragDropManager();
mRecyclerViewDragDropManager.setDraggingItemShadowDrawable(
(NinePatchDrawable) getResources().getDrawable(R.drawable.material_shadow_z3_xxhdpi));
// swipe manager 滑动item的manager
mRecyclerViewSwipeManager = new RecyclerViewSwipeManager();
//adapter
mAdapter = new MyTaskAdapter(context, list);
mWrappedAdapter = mRecyclerViewDragDropManager.createWrappedAdapter(mAdapter); // wrap for swiping
mWrappedAdapter = mRecyclerViewSwipeManager.createWrappedAdapter(mWrappedAdapter); // wrap for swiping
final GeneralItemAnimator animator = new SwipeDismissItemAnimator();
// Change animations are enabled by default since support-v7-recyclerview v22.
// Disable the change animation in order to make turning back animation of swiped item works properly.
animator.setSupportsChangeAnimations(false);
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.setAdapter(mWrappedAdapter); // requires *wrapped* adapter
mRecyclerView.setItemAnimator(animator);
if (supportsViewElevation()) {
// Lollipop or later has native drop shadow feature. ItemShadowDecorator is not required.
} else {
mRecyclerView.addItemDecoration(new ItemShadowDecorator((NinePatchDrawable) getResources().getDrawable(R.drawable.material_shadow_z1_xxhdpi)));
}
mRecyclerView.addItemDecoration(new SimpleListDividerDecorator(getResources().getDrawable(R.drawable.list_divider), true));
// NOTE:
// The initialization order is very important! This order determines the priority of touch event handling.
// priority: TouchActionGuard > Swipe > DragAndDrop
mRecyclerViewTouchActionGuardManager.attachRecyclerView(mRecyclerView);
mRecyclerViewSwipeManager.attachRecyclerView(mRecyclerView);
mRecyclerViewDragDropManager.attachRecyclerView(mRecyclerView);
}
开发者ID:hanks-zyh,项目名称:Conquer,代码行数:47,代码来源:MyTaskFragment.java
示例19: init
import com.h6ah4i.android.widget.advrecyclerview.animator.GeneralItemAnimator; //导入依赖的package包/类
/**
* 初始化
*/
private void init() {
listTask = new ArrayList<Task>();
listDay = new ArrayList<Day>();
adapterDay = new DayAdapter(context, listDay);
mRecyclerView = (RecyclerView) findViewById(R.id.lv_all_zixi);
lv_day = (ListView) findViewById(R.id.lv_day);
tv_day = (TextView) findViewById(R.id.tv_day);
// touch guard manager (this class is required to suppress scrolling while swipe-dismiss animation is running)
mRecyclerViewTouchActionGuardManager = new RecyclerViewTouchActionGuardManager();
mRecyclerViewTouchActionGuardManager.setInterceptVerticalScrollingWhileAnimationRunning(true);
mRecyclerViewTouchActionGuardManager.setEnabled(true);
// drag & drop manager 拖拽排序的manager
mRecyclerViewDragDropManager = new RecyclerViewDragDropManager();
mRecyclerViewDragDropManager.setDraggingItemShadowDrawable(
(NinePatchDrawable) getResources().getDrawable(R.drawable.material_shadow_z3_xxhdpi));
// swipe manager 滑动item的manager
mRecyclerViewSwipeManager = new RecyclerViewSwipeManager();
//adapter
mAdapter = new MyTaskAdapter(context, listTask);
mWrappedAdapter = mRecyclerViewDragDropManager.createWrappedAdapter(mAdapter); // wrap for swiping
mWrappedAdapter = mRecyclerViewSwipeManager.createWrappedAdapter(mWrappedAdapter); // wrap for swiping
final GeneralItemAnimator animator = new SwipeDismissItemAnimator();
// Change animations are enabled by default since support-v7-recyclerview v22.
// Disable the change animation in order to make turning back animation of swiped item works properly.
animator.setSupportsChangeAnimations(false);
mRecyclerView.setLayoutManager(new LinearLayoutManager(context));
mRecyclerView.setAdapter(mWrappedAdapter); // requires *wrapped* adapter
mRecyclerView.setItemAnimator(animator);
if (supportsViewElevation()) {
// Lollipop or later has native drop shadow feature. ItemShadowDecorator is not required.
} else {
mRecyclerView.addItemDecoration(new ItemShadowDecorator((NinePatchDrawable) getResources().getDrawable(R.drawable.material_shadow_z1_xxhdpi)));
}
mRecyclerView.addItemDecoration(new SimpleListDividerDecorator(getResources().getDrawable(R.drawable.list_divider), true));
// NOTE:
// The initialization order is very important! This order determines the priority of touch event handling.
// priority: TouchActionGuard > Swipe > DragAndDrop
mRecyclerViewTouchActionGuardManager.attachRecyclerView(mRecyclerView);
mRecyclerViewSwipeManager.attachRecyclerView(mRecyclerView);
mRecyclerViewDragDropManager.attachRecyclerView(mRecyclerView);
lv_day.setAdapter(adapterDay);
// // 允许加载更多
// lv_day.setPullLoadEnable(true);
// // 允许下拉
// lv_day.setPullRefreshEnable(true);
// // 设置监听器
// lv_day.setXListViewListener(this);
// lv_day.pullRefreshing();
lv_day.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Day d = listDay.get(position);
Calendar tmp = Calendar.getInstance();
tmp.set(d.getYear(), d.getMonth(), d.getDay(), 0, 0, 1);
tv_day.setText(TaskUtil.getZixiDateS(tmp.getTimeInMillis()));
getZixiByDay(tmp);
}
});
// 加载数据
initData();
}
开发者ID:hanks-zyh,项目名称:Conquer,代码行数:80,代码来源:AllMyTaskActivity.java
示例20: onViewCreated
import com.h6ah4i.android.widget.
|
请发表评论