當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。