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


Java SimpleItemAnimator类代码示例

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


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

示例1: setRecyclerView

import android.support.v7.widget.SimpleItemAnimator; //导入依赖的package包/类
@Override
public void setRecyclerView(RecyclerView recyclerView) {
    recyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 3));
    recyclerView.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY);
    ((SimpleItemAnimator)recyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
    int i = getResources().getDisplayMetrics().widthPixels;
    int y = DensityUtil.dp2px(getContext(), 90);
    int p = DensityUtil.dp2px(getContext(), 15);
    int padding = (3 * y + 2 * 3 * p + 2 * p - i) / (2 * 3);

    recyclerView.setPadding(
            padding,
            DensityUtil.dp2px(getContext(), 8),
            padding,
            DensityUtil.dp2px(getContext(), 8)
    );
}
 
开发者ID:z-chu,项目名称:FriendBook,代码行数:18,代码来源:BookcaseFragment.java

示例2: onCreate

import android.support.v7.widget.SimpleItemAnimator; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    // 实例化控件
    final RecyclerView rv = (RecyclerView) findViewById(R.id.rv);

    // 设置启动列表的修改动画效果(默认为关闭状态) 23.0.1以后使用方法,23.0.1之前用setSupportsChangeAnimations方法
    RecyclerView.ItemAnimator animator = rv.getItemAnimator();
    if (animator instanceof SimpleItemAnimator) {
        ((SimpleItemAnimator) animator).setSupportsChangeAnimations(false);
    }
    // 设置动画时长
    rv.getItemAnimator().setChangeDuration(300);
    rv.getItemAnimator().setMoveDuration(300);

    // 实现RecyclerView实现竖向列表展示模式
    final LinearLayoutManager layoutManager = new LinearLayoutManager(this);
    rv.setLayoutManager(layoutManager);

    // 实例化数据适配器并绑定在控件上
    final MainAdapter adapter = new MainAdapter();
    rv.setAdapter(adapter);
}
 
开发者ID:AndroidKiven,项目名称:RecyclerviewExpand,代码行数:25,代码来源:MainActivity.java

示例3: onCreate

import android.support.v7.widget.SimpleItemAnimator; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_notification);
    Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    recyclerView = findViewById(R.id.notification_recycler_view);

    notifications = new LinkedList<>();

    LinearLayoutManager llm = new LinearLayoutManager(this);

    recyclerView.setLayoutManager(llm);

    //To prevent onBindViewHolder to be called twice on onClick
    ((SimpleItemAnimator)recyclerView.getItemAnimator()).setSupportsChangeAnimations(false);

    notifAdapter = new NotificationAdapter(this, notifications);
    recyclerView.setAdapter(notifAdapter);

}
 
开发者ID:CSI-KJSCE,项目名称:CSI-KJSCEOfficial,代码行数:24,代码来源:NotificationActivity.java

示例4: createRecyclerView

import android.support.v7.widget.SimpleItemAnimator; //导入依赖的package包/类
private void createRecyclerView() {
    rvMonths = new SlowdownRecyclerView(getContext());
    rvMonths.setId(View.generateViewId());
    rvMonths.setHasFixedSize(true);
    rvMonths.setNestedScrollingEnabled(false);
    ((SimpleItemAnimator) rvMonths.getItemAnimator()).setSupportsChangeAnimations(false);

    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    params.addRule(RelativeLayout.BELOW, llDaysOfWeekTitles.getId());
    rvMonths.setLayoutParams(params);

    rvMonths.setLayoutManager(new GridLayoutManager(getContext(), 1, settingsManager.getCalendarOrientation(), false));
    monthAdapter = createAdapter();

    changeSnapHelper();

    rvMonths.setAdapter(monthAdapter);
    rvMonths.scrollToPosition(SettingsManager.DEFAULT_MONTH_COUNT / 2);
    rvMonths.addOnScrollListener(pagingScrollListener);
    rvMonths.getRecycledViewPool().setMaxRecycledViews(ItemViewType.MONTH, 10);
    addView(rvMonths);
}
 
开发者ID:ApplikeySolutions,项目名称:CosmoCalendar,代码行数:23,代码来源:CalendarView.java

示例5: setAdapter

import android.support.v7.widget.SimpleItemAnimator; //导入依赖的package包/类
/**
 * Sets adapter for MessagesList
 *
 * @param adapter       Adapter. Must extend MessagesListAdapter
 * @param reverseLayout weather to use reverse layout for layout manager.
 * @param <MESSAGE>     Message model class
 */
public <MESSAGE extends IMessage>
void setAdapter(MessagesListAdapter<MESSAGE> adapter, boolean reverseLayout) {
    SimpleItemAnimator itemAnimator = new DefaultItemAnimator();
    itemAnimator.setSupportsChangeAnimations(false);

    LinearLayoutManager layoutManager = new LinearLayoutManager(getContext(),
            LinearLayoutManager.VERTICAL, reverseLayout);

    setItemAnimator(itemAnimator);
    setLayoutManager(layoutManager);
    adapter.setLayoutManager(layoutManager);
    adapter.setStyle(messagesListStyle);

    addOnScrollListener(new RecyclerScrollMoreListener(layoutManager, adapter));
    super.setAdapter(adapter);
}
 
开发者ID:sciage,项目名称:FinalProject,代码行数:24,代码来源:MessagesList.java

示例6: onCreateView

import android.support.v7.widget.SimpleItemAnimator; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater,
                         @Nullable ViewGroup container,
                         @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_dialogs, container, false);
    mLayoutManager = new LinearLayoutManager(getActivity());
    recyclerView = (RecyclerView) view.findViewById(R.id.dialogs_recycler);
    recyclerView.setLayoutManager(mLayoutManager);
    ((SimpleItemAnimator)recyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
    swipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.dialogs_swipe_refresh_layout);
    swipeRefreshLayout.setOnRefreshListener(this);

    setHasOptionsMenu(true);

    return view;
}
 
开发者ID:ukevgen,项目名称:BizareChat,代码行数:18,代码来源:PrivateDialogsFragment.java

示例7: onCreateView

import android.support.v7.widget.SimpleItemAnimator; //导入依赖的package包/类
/**
 * Returns an inflated image list view.
 * <br>
 * Call {@link #initializeList(ImageListProvider)} to initialize the list view and display the first page of a list.
 */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) throws IllegalStateException {
    View v = inflater.inflate(R.layout.fragment_image_list, container, false);
    ButterKnife.bind(this, v);
    /* disable item change animations for image interactions */
    ((SimpleItemAnimator) recyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
    mSavedInstanceState = savedInstanceState;
    mImageListPresenter = new PaginatedListPresenter<DerpibooruImageThumb>(refreshLayout, recyclerView) {
        @Override
        public RecyclerViewPaginationAdapter<DerpibooruImageThumb, ?> getNewInstanceOfListAdapter(List<DerpibooruImageThumb> initialItems) {
            return getNewInstanceOfImageListAdapter(initialItems);
        }
    };
    return v;
}
 
开发者ID:deliciousblackink,项目名称:Derpibooru,代码行数:22,代码来源:ImageListFragment.java

示例8: setListAdapter

import android.support.v7.widget.SimpleItemAnimator; //导入依赖的package包/类
@UiThread(propagation = UiThread.Propagation.REUSE)
protected void setListAdapter(
	List<InstalledApp> items
) {
	if (mRecyclerView == null || mBus == null) {
		return;
	}

	mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
       if (new UpdaterOptions(getContext()).disableAnimations()) {
           mRecyclerView.setItemAnimator(null);
       } else {
           ((SimpleItemAnimator) mRecyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
       }
	mRecyclerView.setAdapter(new InstalledAppAdapter(getContext(), mRecyclerView, items));
	mBus.post(new InstalledAppTitleChange(getString(R.string.tab_installed) + " (" + items.size() + ")"));
}
 
开发者ID:rumboalla,项目名称:apkupdater,代码行数:18,代码来源:InstalledAppFragment.java

示例9: setListAdapter

import android.support.v7.widget.SimpleItemAnimator; //导入依赖的package包/类
@UiThread(propagation = UiThread.Propagation.REUSE)
protected void setListAdapter(
	@NonNull List<InstalledApp> items
) {
	if (mRecyclerView == null || mBus == null || mProgressBar == null) {
		return;
	}

	mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
       if (new UpdaterOptions(getContext()).disableAnimations()) {
           mRecyclerView.setItemAnimator(null);
       } else {
           ((SimpleItemAnimator) mRecyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
       }
	mAdapter.init(getActivity(), mRecyclerView, items);
	mRecyclerView.setAdapter(mAdapter);
	mBus.post(new SearchTitleChange(getString(R.string.tab_search) + " (" + items.size() + ")"));
	mProgressBar.setVisibility(View.GONE);
}
 
开发者ID:rumboalla,项目名称:apkupdater,代码行数:20,代码来源:SearchFragment.java

示例10: init

import android.support.v7.widget.SimpleItemAnimator; //导入依赖的package包/类
@AfterViews
void init(
) {
       mAdapter.init(mRecyclerView, new ArrayList<Update>());
	mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
	if (new UpdaterOptions(getContext()).disableAnimations()) {
	    mRecyclerView.setItemAnimator(null);
       } else {
           ((SimpleItemAnimator) mRecyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
       }
	mRecyclerView.setAdapter(mAdapter);

	// Load data
	loadData();

	initProgressBar();
}
 
开发者ID:rumboalla,项目名称:apkupdater,代码行数:18,代码来源:UpdaterFragment.java

示例11: setAdapter

import android.support.v7.widget.SimpleItemAnimator; //导入依赖的package包/类
/**
 * Set adapter for MessageList.
 *
 * @param adapter   Adapter, extends MsgListAdapter.
 * @param <MESSAGE> Message model extends IMessage.
 */
public <MESSAGE extends IMessage> void setAdapter(MsgListAdapter<MESSAGE> adapter) {
    mAdapter = adapter;
    SimpleItemAnimator itemAnimator = new DefaultItemAnimator();
    itemAnimator.setSupportsChangeAnimations(false);
    setItemAnimator(itemAnimator);

    LinearLayoutManager layoutManager = new LinearLayoutManager(
            getContext(), LinearLayoutManager.VERTICAL, true);
    layoutManager.setStackFromEnd(true);
    setLayoutManager(layoutManager);
    
    adapter.setLayoutManager(layoutManager);
    adapter.setStyle(mContext, mMsgListStyle);
    mScrollMoreListener = new ScrollMoreListener(layoutManager, adapter);
    addOnScrollListener(mScrollMoreListener);
    super.setAdapter(adapter);
}
 
开发者ID:jpush,项目名称:aurora-imui,代码行数:24,代码来源:MessageList.java

示例12: onCreate

import android.support.v7.widget.SimpleItemAnimator; //导入依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_apple_calendar);
    setTitle("2016");
    rvCalendar = (RecyclerView) findViewById(R.id.rvCalendar);
    rvCalendar.setLayoutManager(new LinearLayoutManager(this));
    ((SimpleItemAnimator) rvCalendar.getItemAnimator()).setSupportsChangeAnimations(false);
    List<SCMonth> months = SCDateUtils.generateMonths(2016, 2016);
    rvCalendar.setAdapter(new CalendarAdpater(months));
    selector = new CalendarSelector(months, SingleMonthSelector.SEGMENT);
    selector.setSegmentSelectListener(new SegmentSelectListener() {
        @Override
        public void onSegmentSelect(FullDay startDay, FullDay endDay) {
            // TODO
        }
    });
}
 
开发者ID:TUBB,项目名称:CalendarSelector,代码行数:19,代码来源:AppleCalendarActivity.java

示例13: setupView

import android.support.v7.widget.SimpleItemAnimator; //导入依赖的package包/类
private void setupView(View view) {
    ImageButton addContribution = (ImageButton) view.findViewById(R.id.addContribution);
    addContribution.setOnClickListener((buttonView) -> this.onAddNewContribution());

    contribution = (EditText) view.findViewById(R.id.contribution);
    contribution.setHint(R.string.poll_comment);
    contribution.setOnEditorActionListener(onDescriptionEditorActionListener);

    RecyclerView contributionList = (RecyclerView) view.findViewById(R.id.contributionList);
    ((SimpleItemAnimator) contributionList.getItemAnimator()).setSupportsChangeAnimations(false);
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext()
            , LinearLayoutManager.VERTICAL, false);
    linearLayoutManager.setAutoMeasureEnabled(true);
    linearLayoutManager.setStackFromEnd(true);
    contributionList.setLayoutManager(linearLayoutManager);

    contributionAdapter = new ContributionAdapter();
    contributionAdapter.setOnContributionRemoveListener(this);
    contributionList.setAdapter(contributionAdapter);

    contribute = (TextView) view.findViewById(R.id.contribute);
    contribute.setText(R.string.title_comment_poll);
}
 
开发者ID:rapidpro,项目名称:ureport-android,代码行数:24,代码来源:PollsResultsContributionsDialog.java

示例14: initRecyclerView

import android.support.v7.widget.SimpleItemAnimator; //导入依赖的package包/类
private void initRecyclerView(Context context) {
        if (mRecyclerView == null) return;
        mRecyclerView.setBackgroundColor(mBackgroundColor);
        mRecyclerView.setHasFixedSize(true);
        mLayoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false);

        mRecyclerView.setLayoutManager(mLayoutManager);
        mRecyclerView.setAdapter(createAdapter());
        mRecyclerView.setNestedScrollingEnabled(isNestedScrollEnable());


//        mRecyclerView.getItemAnimator().setSupportsChangeAnimations(true);
        RecyclerView.ItemAnimator animator = mRecyclerView.getItemAnimator();
        if (animator instanceof SimpleItemAnimator) {
            ((SimpleItemAnimator) animator).setSupportsChangeAnimations(false);
        }
        onRecyclerViewInit(mRecyclerView);
    }
 
开发者ID:TouchBoarder,项目名称:weekdays-buttons-bar,代码行数:19,代码来源:WeekdaysDataSource.java

示例15: onCreateView

import android.support.v7.widget.SimpleItemAnimator; //导入依赖的package包/类
/** Called to create this fragment's view for the first time.  */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_picker, container, false);
    ButterKnife.bind(this, view);
    card_list.setLayoutManager(new LinearLayoutManager(getContext()));
    card_list.addItemDecoration(new ListDivider(getContext()));

    // Disable flicker animation when an item changes
    // (otherwise items will flicker when selection state changes)
    ItemAnimator animator = card_list.getItemAnimator();
    if (animator instanceof SimpleItemAnimator)
        ((SimpleItemAnimator) animator).setSupportsChangeAnimations(false);

    final SharedPreferences pref = Pref.get(getContext());
    adapter = new AdapterCardsFilter(card_list, pref.getString(Pref.FILT_CARD, ""),
                                                pref.getString(Pref.REQ_CARDS, ""));
    card_list.setAdapter(adapter);
    updateView();
    return view;
}
 
开发者ID:Mark-Lauman,项目名称:DominionPicker,代码行数:23,代码来源:FragmentPicker.java


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