Java 类android.support.v7.widget.DefaultItemAnimator 实例源码
项目:thesis-project
文件:AssignmentAddActivityF.java
@Override
public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
try {
List<Assignment> assignmentList = aassignmentService.getAssignmentListByClassId(classId, termId);
AssignmentAdapterF assignmentAdapterF = new AssignmentAdapterF(AssignmentAddActivityF.this, assignmentList);
LinearLayoutManager layoutManager = new LinearLayoutManager(AssignmentAddActivityF.this);
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
recyclerView.setAdapter(assignmentAdapterF);
recyclerView.setLayoutManager(layoutManager);
recyclerView.setItemAnimator(new DefaultItemAnimator());
}catch (GradingFactorException e) {
e.printStackTrace();
}
}
});
}
项目:clb-quic-demo
文件:HttpsFragment.java
private void loadItems() {
numberOfImages = 0;
RecyclerView cronetView = (RecyclerView) view.findViewById(R.id.https_images_view);
GridLayoutManager gridLayoutManager =
new GridLayoutManager(getActivity(), 3);
viewAdapter = new com.tencent.samples.quic_sample.ViewAdapter(getActivity());
// In order to enable Netlog, a Cronet logging system, enable write permissions.
// Find more info about Netlog here:
// https://www.chromium.org/developers/design-documents/network-stack/netlog
enableWritingPermissionForLogging();
cronetView.setLayoutManager(gridLayoutManager);
cronetView.setAdapter(viewAdapter);
cronetView.setItemAnimator(new DefaultItemAnimator());
onItemsLoadComplete();
}
项目:recyclerview-android
文件:MultipleChoiceModeExampleActivity.java
@Override
protected void onCreate(@Nullable final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_multiple_choice_mode_example);
final PersonsViewModel viewModel = ViewModelProviders.of(this).get(PersonsViewModel.class);
final Datasource<Person> datasource = viewModel.getDatasource();
final CheckedPersonsAdapter adapter = new CheckedPersonsAdapter(datasource, true);
mRecyclerView = (RecyclerView) findViewById(android.R.id.list);
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
mRecyclerView.setItemAnimator(new DefaultItemAnimator());
mRecyclerView.setAdapter(adapter);
mChoiceMode = new MultipleChoiceMode(savedInstanceState);
mChoiceMode.setChoiceModeListener(this::onItemCheckedChanged);
mChoiceModeHelper = new ChoiceModeHelper<>(adapter, mChoiceMode);
mChoiceModeHelper.setRecyclerView(mRecyclerView);
findViewById(R.id.action_clear_choices).setOnClickListener(v -> mChoiceMode.clearChoices());
findViewById(R.id.action_get_checked_items).setOnClickListener(v -> showCheckedItems());
}
项目:GitHub
文件:EverydayFragment.java
private void initRecyclerView() {
bindingView.xrvEveryday.setPullRefreshEnabled(false);
bindingView.xrvEveryday.setLoadingMoreEnabled(false);
if (mHeaderView == null) {
mHeaderView = mHeaderBinding.getRoot();
bindingView.xrvEveryday.addHeaderView(mHeaderView);
}
if (mFooterView == null) {
mFooterBinding = DataBindingUtil.inflate(LayoutInflater.from(getContext()), R.layout.footer_item_everyday, null, false);
mFooterView = mFooterBinding.getRoot();
bindingView.xrvEveryday.addFootView(mFooterView, true);
bindingView.xrvEveryday.noMoreLoading();
}
bindingView.xrvEveryday.setLayoutManager(new LinearLayoutManager(getContext()));
// 需加,不然滑动不流畅
bindingView.xrvEveryday.setNestedScrollingEnabled(false);
bindingView.xrvEveryday.setHasFixedSize(false);
bindingView.xrvEveryday.setItemAnimator(new DefaultItemAnimator());
}
项目:JKApp
文件:PullLoadMoreRecyclerView.java
private void initView(Context context) {
mContext = context;
View view = LayoutInflater.from(context).inflate(com.wuxiaolong.pullloadmorerecyclerview.R.layout.pull_loadmore_layout, null);
mSwipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(com.wuxiaolong.pullloadmorerecyclerview.R.id.swipeRefreshLayout);
mSwipeRefreshLayout.setColorSchemeResources(android.R.color.holo_green_dark, android.R.color.holo_blue_dark, android.R.color.holo_orange_dark);
mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayoutOnRefresh(this));
mRecyclerView = (RecyclerView) view.findViewById(com.wuxiaolong.pullloadmorerecyclerview.R.id.recycler_view);
mRecyclerView.setVerticalScrollBarEnabled(true);
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setItemAnimator(new DefaultItemAnimator());
mRecyclerView.setOnTouchListener(new onTouchRecyclerView());
mFooterView = view.findViewById(R.id.footerView);
loadMoreLayout = (LinearLayout) view.findViewById(R.id.loadMoreLayout);
loadMoreText = (TextView) view.findViewById(R.id.loadMoreText);
mprogressBar = (ProgressBar)view.findViewById(R.id.loadMoreProgressBar) ;
mFooterView.setVisibility(View.GONE);
this.addView(view);
}
项目:LueansRead
文件:SoDetailActivity.java
private void initRecyclerView() {
recycleView = (RecyclerView)findViewById(R.id.recyclerView);
recycleView.setItemAnimator(new DefaultItemAnimator());
//设置分割线
SoSpaceItemDecoration decoration = new SoSpaceItemDecoration(1);
recycleView.addItemDecoration(decoration);
//设置布局样式
recycleView.setLayoutManager(new StaggeredGridLayoutManager(2,
StaggeredGridLayoutManager.VERTICAL));
//设置适配器
mDetailAdapter = new SoDetailAdapter(this,null);
recycleView.setAdapter(mDetailAdapter);
soDetailPresenter.getSoDetailDataFromInternet(_id);
}
项目:AndroidGithubIssues
文件:MainActivity.java
private void setupView() {
mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView);
mSearchEditText = (EditText) findViewById(R.id.et_search);
// Setup Progress Dialog to show loading state
mDialog = new ProgressDialog(MainActivity.this);
mDialog.setIndeterminate(true);
mDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
mDialog.setTitle(getString(R.string.progress_title));
mDialog.setMessage(getString(R.string.progress_body));
mDialog.setCancelable(false);
mDialog.setCanceledOnTouchOutside(false);
mRecyclerView.setRecycledViewPool(new RecyclerView.RecycledViewPool());
mRecyclerView.setLayoutManager(new LinearLayoutManager(
this, LinearLayoutManager.VERTICAL, false)
);
mRecyclerView.hasFixedSize();
mRecyclerView.setItemAnimator(new DefaultItemAnimator());
DividerItemDecoration mDividerItemDecoration = new DividerItemDecoration(
mRecyclerView.getContext(), LinearLayoutManager.VERTICAL
);
mRecyclerView.addItemDecoration(mDividerItemDecoration);
mAdapter = new DataAdapter(getLayoutInflater());
mRecyclerView.setAdapter(mAdapter);
}
项目:Odyssey2017
文件:EventActivity.java
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_event_content);
recyclerView= (RecyclerView) findViewById(R.id.recycler_view);
list=new ArrayList<>();
adapter=new EventAdapter(this,list);
toolbar= (Toolbar) findViewById(R.id.Event_toolbar);
toolbar.setNavigationIcon(R.drawable.backbutton);
toolbar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
RecyclerView.LayoutManager layoutManager=new GridLayoutManager(this,2); // 2 is the number of columns in grid view
recyclerView.setLayoutManager(new GridLayoutManager(this,2));
recyclerView.addItemDecoration(new GridSpacingItemDecoration(2,dpToPx(10),true));
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(adapter);
initialize();
}
项目:dhbw-timetable-android
文件:ManageTimetablesActivity.java
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_timetables);
setupActionBar();
recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
tAdapter = new TimetablesAdapter(timetableList, v -> {
Timetable item = timetableList.get(recyclerView.getChildLayoutPosition(v));
Intent i = new Intent(ManageTimetablesActivity.this, EditTimetableActivity.class);
i.putExtra("url", item.getURL());
i.putExtra("name", item.getName());
startActivity(i);
overridePendingTransition(0, 0);
});
RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getApplicationContext());
recyclerView.setLayoutManager(mLayoutManager);
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(tAdapter);
}
项目:Quran
文件:BookmarksFragment.java
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.quran_list, container, false);
final Context context = getActivity();
recyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);
recyclerView.setLayoutManager(new LinearLayoutManager(context));
recyclerView.setItemAnimator(new DefaultItemAnimator());
bookmarksAdapter = new QuranListAdapter(context, recyclerView, new QuranRow[0], true);
bookmarksAdapter.setQuranTouchListener(this);
recyclerView.setAdapter(bookmarksAdapter);
return view;
}
项目:aos-Video
文件:CredentialsManagerPreferencesFragment.java
@Override
public View onCreateView(LayoutInflater inflater,ViewGroup container, Bundle savedInstanceState){
View v = inflater.inflate(R.layout.credentials_manager_fragment, container, false);
mEmptyView = v.findViewById(R.id.empty_view);
mEmptyTextView = (TextView)v.findViewById(R.id.empty_textview);
mList = (RecyclerView)v.findViewById(R.id.recycler_view);
mLayoutManager = new LinearLayoutManager(getActivity());
mList.setLayoutManager(mLayoutManager);
mList.setHasFixedSize(false);
mList.setItemAnimator(new DefaultItemAnimator());
mCredentials = NetworkCredentialsDatabase.getInstance().getAllPersistentCredentials();
mAdapter = new CredentialsManagerAdapter(mCredentials,getActivity(), this);
mList.setAdapter(mAdapter);
refreshCredentialsList();
return v;
}
项目:topnews
文件:KeepOneFragment.java
@Override
public View onSuccessView() {
View view=View.inflate(UIUtils.getContext(), R.layout.user_keep_one,null);
recyclerView = (RecyclerView)view.findViewById(R.id.recycler_view);
mLinearDelete = (LinearLayout) view.findViewById(R.id.keep_one_linear);
mDeleteIcon = (ImageView) view.findViewById(R.id.keep_one_icon);
mDeleteText = (TextView) view.findViewById(R.id.keep_one_delete);
mLinearDelete.setOnClickListener(this);
LinearLayoutManager manager=new LinearLayoutManager(UIUtils.getContext());
recyclerView.setLayoutManager(manager);
adapter = new UserKeepAdapter(mDatas,mDeleteIcon,mDeleteText);
recyclerView.setAdapter(adapter);
recyclerView.setItemAnimator(new DefaultItemAnimator());
return view;
}
项目:FormMaster
文件:FormBuilder.java
/**
* private method for initializing form build helper
* @param context
* @param recyclerView
* @param listener
*/
private void initializeFormBuildHelper(Context context, RecyclerView recyclerView, OnFormElementValueChangedListener listener) {
// initialize form adapter
this.mFormAdapter = new FormAdapter(context, listener);
// set up the recyclerview with adapter
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context);
linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
linearLayoutManager.setStackFromEnd(false);
recyclerView.setLayoutManager(linearLayoutManager);
recyclerView.setAdapter(mFormAdapter);
recyclerView.setItemAnimator(new DefaultItemAnimator());
}
项目:GitHub
文件:MainFragment.java
@Override
protected void initData() {
List<ItemModel> items = new ArrayList<>();
fillData(items);
adapter = new MainAdapter(items);
adapter.openLoadAnimation(BaseQuickAdapter.SCALEIN);
adapter.isFirstOnly(false);
adapter.setOnLoadMoreListener(this);
refreshLayout.setColorSchemeColors(Color.RED, Color.BLUE, Color.GREEN);
refreshLayout.setOnRefreshListener(this);
recyclerView.setLayoutManager(new LinearLayoutManager(context));
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.addItemDecoration(new DividerItemDecoration(context, LinearLayoutManager.VERTICAL));
recyclerView.setAdapter(adapter);
}
项目:civify-app
文件:EventViewFragment.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
mEventViewAdapter = new EventViewAdapter(mEventList, mEventsFragment);
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_event_view, container, false);
RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.event_recyclerView);
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getContext());
recyclerView.setLayoutManager(layoutManager);
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(mEventViewAdapter);
return view;
}
项目:GitHub
文件:NewsTabFragment.java
@Override
protected void initData() {
url = Urls.URL_GANK_BASE + fragmentTitle + "/" + PAGE_SIZE + "/";
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setLayoutManager(new LinearLayoutManager(context));
newsAdapter = new NewsAdapter(null);
newsAdapter.openLoadAnimation(BaseQuickAdapter.SCALEIN);
newsAdapter.isFirstOnly(false);
recyclerView.setAdapter(newsAdapter);
refreshLayout.setColorSchemeColors(Color.RED, Color.BLUE, Color.GREEN);
refreshLayout.setOnRefreshListener(this);
newsAdapter.setOnLoadMoreListener(this);
//开启loading,获取数据
setRefreshing(true);
onRefresh();
}
项目:civify-app
文件:BadgeViewFragment.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
mBadgeViewAdapter = new BadgeViewAdapter(mBadgeList, getContext());
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_badge_view, container, false);
RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.badge_recyclerView);
mProgressBar = (ProgressBar) view.findViewById(R.id.loading_badges);
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getContext());
recyclerView.setLayoutManager(layoutManager);
recyclerView.setItemAnimator(new DefaultItemAnimator());
DividerItemDecoration dividerItemDecoration =
new DividerItemDecoration(recyclerView.getContext(), LinearLayoutManager.VERTICAL);
recyclerView.addItemDecoration(dividerItemDecoration);
recyclerView.setAdapter(mBadgeViewAdapter);
return view;
}
项目:cniao5
文件:GoodsListActivity.java
/**
* 展示数据
*/
private void showData() {
if (datas != null && datas.size() > 0) {
mTxtSummary.setText("共有" + datas.size() + "件商品");
} else {
mLlSummary.setVisibility(View.GONE);
ToastUtils.setGravity(Gravity.CENTER, 0, 0);
ToastUtils.showShortSafe("暂无商品信息");
return;
}
mAdatper = new HotGoodsAdapter(datas, this);
mRecyclerview.setAdapter(mAdatper);
if (actionType == ACTION_LIST) {
mRecyclerview.setLayoutManager(new LinearLayoutManager(this));
} else {
mRecyclerview.setLayoutManager(new GridLayoutManager(this, 2));
}
mRecyclerview.setItemAnimator(new DefaultItemAnimator());
mRecyclerview.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration
.HORIZONTAL));
}
项目:IdealMedia
文件:PlaylistsFragment.java
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
listView = (RecyclerView)view.findViewById(android.R.id.list);
listView.setLayoutManager(new LinearLayoutManager(getActivity()));
listView.setItemAnimator(new DefaultItemAnimator());
listView.setAdapter(adapter);
view.findViewById(R.id.fabNewPlaylist).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
newPlaylist();
}
});
Tracker t = ((NavigationActivity)getActivity()).getTracker(NavigationActivity.TrackerName.APP_TRACKER);
t.setScreenName("List of playlists");
t.send(new HitBuilders.AppViewBuilder().build());
}
项目:GoSCELE
文件:CourseDetailRecyclerViewAdapter.java
@Override
public void initialize(ViewHolder holder, int position) {
CourseDetailModel model = list.get(position);
holder.title.setText(model.title);
if (TextUtils.isEmpty(model.summary)) {
holder.summary.setVisibility(HtmlTextView.GONE);
} else {
holder.summary.setVisibility(HtmlTextView.VISIBLE);
holder.summary.setHtml(model.summary, new HtmlHttpImageGetter(holder.summary));
}
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(holder.itemView.getContext());
holder.content.setLayoutManager(layoutManager);
holder.content.setItemAnimator(new DefaultItemAnimator());
holder.content.setAdapter(new CourseDetailInnerRecyclerViewAdapter(model.courseDetailInnerModels()));
}
项目:MVPArmsTest1
文件:HotsFragment.java
@Override
public void initData() {
swipeToLoadLayout.setOnRefreshListener(this);
swipeToLoadLayout.setOnLoadMoreListener(this);
swipeToLoadLayout.setSwipeStyle(SwipeToLoadLayout.STYLE.ABOVE);
View view1 = getActivity().getLayoutInflater().inflate(R.layout.layout_google_hook_header, swipeToLoadLayout, false);
swipeToLoadLayout.setRefreshHeaderView(view1);
View view2 = getActivity().getLayoutInflater().inflate(R.layout.layout_google_hook_footer, swipeToLoadLayout, false);
swipeToLoadLayout.setLoadMoreFooterView(view2);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
recyclerView.setItemAnimator(new DefaultItemAnimator());
if (getArguments() != null) {
Timber.tag("huzeliang").w("id = " + getArguments().getString("id", "0") + "pageNO:" + pageNo);
mPresenter.requestHots(pageNo, getArguments().getString("id", "0"));
} else {
Timber.tag("huzeliang").w("getArguments() != null");
}
}
项目:GoSCELE
文件:ScheduleDailyFragment.java
@Override
public void initialize(Bundle savedInstanceState) {
super.initialize(savedInstanceState);
recyclerViewDaily.setLayoutManager(new LinearLayoutManager(getActivity().getApplicationContext()));
recyclerViewDaily.setItemAnimator(new DefaultItemAnimator());
recyclerViewDetail.setLayoutManager(new LinearLayoutManager(getActivity().getApplicationContext()));
recyclerViewDetail.setItemAnimator(new DefaultItemAnimator());
buttonRefresh.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
presenter.clearDailySchedule();
progressDialog = ((BaseActivity) getActivity()).showProgress(R.string.loading);
progressDialog.show();
presenter.runProvider();
}
});
if (presenter.isModelEmpty()) {
siakStatusLayout.setVisibility(LinearLayout.VISIBLE);
} else {
presenter.runProvider();
}
}
项目:TestChat
文件:EditShareMessageActivity.java
private void initBottomVisibilityData() {
LogUtil.e("初始化底部数据");
selectedFriend.setLayoutManager(new LinearLayoutManager(this));
selectedFriend.setItemAnimator(new DefaultItemAnimator());
selectedFriend.addItemDecoration(new ListViewDecoration(this));
selectedFriend.setHasFixedSize(true);
selectedFriend.setSwipeMenuCreator(new SwipeMenuCreator() {
@Override
public void onCreateMenu(SwipeMenu swipeLeftMenu, SwipeMenu swipeRightMenu, int viewType) {
SwipeMenuItem deleteItem = new SwipeMenuItem(EditShareMessageActivity.this);
int width = getResources().getDimensionPixelSize(R.dimen.recent_top_height);
deleteItem.setBackgroundDrawable(new ColorDrawable(Color.rgb(0xF9,
0x3F, 0x25))).setText("删除").setTextColor(Color.WHITE).setHeight(ViewGroup.LayoutParams.MATCH_PARENT).setWidth(width);
swipeRightMenu.addMenuItem(deleteItem);
}
});
selectedFriend.setSwipeMenuItemClickListener(this);
mAdapter = new VisibilityAdapter(null, R.layout.edit_share_message_visibility_item_layout);
selectedFriend.setAdapter(mAdapter);
}
项目:FinalProject
文件:MessagesList.java
/**
* 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);
}
项目:thesis-project
文件:SliderScheduleFragment.java
public void init() {
Collections.sort(scheduleList, new Comparator<Schedule>() {
@Override
public int compare(Schedule o1, Schedule o2) {
return (o1.getTime().compareTo(o2.getTime()));
}
});
scheduleRecyclerView = (RecyclerView)
customView.findViewById(R.id.shedule_recyclerview);
scheduleAdapter = new ScheduleAdapter(getContext(), scheduleList);
scheduleRecyclerView.setAdapter(scheduleAdapter);
LinearLayoutManager layoutManager =
new LinearLayoutManager(getContext());
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
scheduleRecyclerView.setLayoutManager(layoutManager);
scheduleRecyclerView.setItemAnimator(new DefaultItemAnimator());
scheduleRecyclerView.setVisibility(View.VISIBLE);
progressBar.setVisibility(View.INVISIBLE);
}
项目:ceji_android
文件:MyBookMarkActvity.java
private void initData() {
mModels = new ArrayList<>();
for (int i = 0; i < 5; i++) {
BookMarkModel mModel = new BookMarkModel();
mModel.setMark(i+"");
mModel.setMarkTime("2017-5-30");
mModel.setMinTitle("AAAAAA");
mModel.setMinTitleContent("AAAAAA");
mModel.setBookMarkeContent("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
mModels.add(mModel);
}
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.addItemDecoration(new DividerItemDecoration(this, LinearLayoutManager.VERTICAL));
adapter = new MarkAdapter(getApplicationContext());
recyclerView.setAdapter(adapter);
}
项目:MovieApp
文件:UserListDialogFragment.java
private void init(View view) {
ButterKnife.bind(this, view);
LinearLayoutManager layoutManager
= new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false);
recyclerView.setLayoutManager(layoutManager);
recyclerView.setHasFixedSize(true);
recyclerView.setMotionEventSplittingEnabled(false);
recyclerView.setNestedScrollingEnabled(false);
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(adapter);
if(listName == null) {
return;
} else {
adapter.addItems(listName);
}
createNewList.setOnClickListener(v -> {
listener.createNewListClick(wrapper);
dismiss();
});
}
项目:MovieApp
文件:MoreImagesFragment.java
private void init(View view) {
unbinder = ButterKnife.bind(this, view);
mActivity = (AppCompatActivity) getActivity();
mActivity.setSupportActionBar(toolbar);
ActionBar actionBar = mActivity.getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowTitleEnabled(false);
}
toolbar.setBackgroundColor(toolbarColor);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
mActivity.getWindow().setStatusBarColor(Utils.getDarkColor(toolbarColor));
}
toolbar.setTitle(title);
boolean isTabLayout = Utils.isScreenW(SCREEN_TABLET_DP_WIDTH);
recyclerView.setLayoutManager(setUpLayoutManager(isTabLayout));
recyclerView.setHasFixedSize(true);
recyclerView.setMotionEventSplittingEnabled(false);
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(adapter);
}
项目:FuelUp
文件:VehicleListFragment.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_vehicle_list, container, false);
recyclerView = rootView.findViewById(R.id.recycler_view);
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(new GridLayoutManager(getContext(), 1));
recyclerView.addItemDecoration(new DividerItemDecoration(recyclerView.getContext(),
((LinearLayoutManager) recyclerView.getLayoutManager()).getOrientation()));
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(adapter);
txtNoVehicle = rootView.findViewById(R.id.txt_noVehicle);
addCarBtn = getActivity().findViewById(R.id.fab_add_vehicle);
addCarBtn.setOnClickListener(this);
getActivity().findViewById(R.id.fab_add_vehicle).setVisibility(View.VISIBLE);
return rootView;
}
项目:MyFire
文件:NewsChannelActivity.java
@Override
public void returnMineNewsChannels(List<NewsChannelTable> newsChannelsMine) {
channelAdapterMine = new ChannelAdapter(mContext,R.layout.item_news_channel);
newsChannelMineRv.setLayoutManager(new GridLayoutManager(this, 4, LinearLayoutManager.VERTICAL, false));
newsChannelMineRv.setItemAnimator(new DefaultItemAnimator());
newsChannelMineRv.setAdapter(channelAdapterMine);
channelAdapterMine.replaceAll(newsChannelsMine);
channelAdapterMine.setOnItemClickListener(new ChannelAdapter.OnItemClickListener() {
@Override
public void onItemClick(View view, int position) {
NewsChannelTable newsChannel = channelAdapterMine.get(position);
channelAdapterMore.add(newsChannel);
channelAdapterMine.removeAt(position);
mPresenter.onItemAddOrRemove((ArrayList<NewsChannelTable>) channelAdapterMine.getAll(), (ArrayList<NewsChannelTable>)channelAdapterMore.getAll());
}
});
ItemDragHelperCallback itemDragHelperCallback = new ItemDragHelperCallback(channelAdapterMine);
ItemTouchHelper itemTouchHelper = new ItemTouchHelper(itemDragHelperCallback);
itemTouchHelper.attachToRecyclerView(newsChannelMineRv);
channelAdapterMine.setItemDragHelperCallback(itemDragHelperCallback);
}
项目:ANNO1404-Warenrechner-App
文件:PopulationFragment.java
@Override
protected void onViewCreated(View parent) {
getGameActivity().component().inject(this);
registerLifecycle(adapter);
populationList.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
populationList.setItemAnimator(new DefaultItemAnimator());
populationList.setAdapter(adapter);
}
项目:ClouldReader
文件:SlideScrollViewActivity.java
private void initRecyclerView() {
rcvGoodsList.setVisibility(View.VISIBLE);
final RCVListAdapter adapter = new RCVListAdapter(this);
View header = new View(this);
header.setLayoutParams(new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
header.getLayoutParams().height = getResources().getDimensionPixelOffset(R.dimen.new_home_header_size) - getStatusBarHeight(this);
adapter.setHeader(header);
rcvGoodsList.setLayoutManager(new LinearLayoutManager(this));
rcvGoodsList.setItemAnimator(new DefaultItemAnimator());
rcvGoodsList.setAdapter(adapter);
adapter.setDataSource(Arrays.asList("", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", ""));
adapter.notifyDataSetChanged();
rcvGoodsList.setOnScrollListener(new RecyclerView.OnScrollListener() {
public int scrolledY = 0;
@Override
public void onScrolled(RecyclerView recyclerView, final int dx, final int dy) {
super.onScrolled(recyclerView, dx, dy);
scrolledY += dy;
scrollChangeHeader(scrolledY);
}
});
}
项目:recyclerview-android
文件:ListDatasourceExampleActivity.java
@Override
protected void onCreate(@Nullable final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list_datasource_example);
mViewModel = ViewModelProviders.of(this).get(ListDatasourceExampleViewModel.class);
final Datasource<Person> datasource = mViewModel.getDatasource();
final PersonsAdapter adapter = new PersonsAdapter(datasource);
mRecyclerView = (RecyclerView) findViewById(android.R.id.list);
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
mRecyclerView.setItemAnimator(new DefaultItemAnimator());
mRecyclerView.setAdapter(adapter);
// Add click support to RecyclerView. Adapter implements ItemClickHelper.Callback
mItemClickHelper = new ItemClickHelper<>(adapter);
mItemClickHelper.setOnItemClickListener(this::onItemClick);
mItemClickHelper.setOnItemLongClickListener(this::onItemLongClick);
mItemClickHelper.setRecyclerView(mRecyclerView);
// Add enable view holder behavior. Adapter implements SimpleEnableBehavior.Callback
mViewHolderTracker = new ViewHolderTracker();
mViewHolderTracker.registerViewHolderObserver(new RecursiveEnableBehavior(adapter));
mViewHolderTracker.setRecyclerView(mRecyclerView);
findViewById(R.id.action_add_item).setOnClickListener(v -> mViewModel.addSingleItem());
findViewById(R.id.action_add_multiple_items).setOnClickListener(v -> mViewModel.addMultipleItems());
}
项目:NewAndroidArchitecture
文件:MainActivity.java
private void setupRecyclerView() {
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
RecyclerView.ItemAnimator itemAnimator = new DefaultItemAnimator();
recyclerView.setLayoutManager(layoutManager);
recyclerView.setItemAnimator(itemAnimator);
adapter = new CountriesAdapter(country -> {
Intent intent = new Intent(MainActivity.this, DetailActivity.class);
intent.putExtra(DetailActivity.EXTRA_COUNTRY, country);
startActivity(intent);
});
recyclerView.setAdapter(adapter);
}
项目:EasyTodo
文件:MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
baseInit(); // 启动页面, 数据库加载, 界面初始化(滑动侧板菜单, 浮动添加事件按钮等)
Collections.sort(eventList); // 按evenList每个元素的pos进行排序, 即为显示的顺序
// 设置RecycleView
SwipeMenuRecyclerView eventNameRecyclerView = (SwipeMenuRecyclerView) findViewById(R.id
.event_name_recycler_view);
LinearLayoutManager layoutManager = new LinearLayoutManager(getApplicationContext());
MyAdapter = new EventsAdapter(eventList, eventNameRecyclerView, visibility);
MyAdapter.setTodoEventSize(eventList.size());
// 设置侧滑菜单和侧滑菜单监听器
eventNameRecyclerView.setSwipeMenuCreator(mSwipeMenuCreator); // 创建滑动菜单
eventNameRecyclerView.setSwipeMenuItemClickListener(mMenuItemClickListener); // 滑动菜单监听器
eventNameRecyclerView.setOnItemMoveListener(onItemMoveListener);// 监听拖拽,更新UI。
eventNameRecyclerView.setLayoutManager(layoutManager); // 设置LayoutManager
eventNameRecyclerView.setItemAnimator(new DefaultItemAnimator());
eventNameRecyclerView.setAdapter(MyAdapter); // 设置adapter
registerForContextMenu(eventNameRecyclerView); // 长按上下文菜单
}
项目:Quran
文件:TranslationView.java
public TranslationView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
translationRecycler = new RecyclerView(context);
translationRecycler.setLayoutManager(new LinearLayoutManager(context));
translationRecycler.setItemAnimator(new DefaultItemAnimator());
translationAdapter = new TranslationAdapter(context, translationRecycler);
translationRecycler.setAdapter(translationAdapter);
addView(translationRecycler, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
}
项目:GitHub
文件:RecyclerGalleryActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.recycler_gallery_layout);
top_bar_linear_back=(LinearLayout)this.findViewById(R.id.top_bar_linear_back);
btn_add=(Button)this.findViewById(R.id.btn_add);
btn_delete=(Button)this.findViewById(R.id.btn_delete);
top_bar_linear_back.setOnClickListener(new CustomOnClickListener());
btn_add.setOnClickListener(new CustomOnClickListener());
btn_delete.setOnClickListener(new CustomOnClickListener());
top_bar_title=(TextView)this.findViewById(R.id.top_bar_title);
top_bar_title.setText("RecyclerView打造Gallery效果");
//初始化RecyclerView控件
gallery_recycler=(RecyclerView)this.findViewById(R.id.gallery_recycler);
//固定高度
gallery_recycler.setHasFixedSize(true);
//创建布局管理器
LinearLayoutManager linearLayoutManager=new CustomLinearLayoutManager(this);
//设置横向
linearLayoutManager.setOrientation(OrientationHelper.HORIZONTAL);
//设置布局管理器
gallery_recycler.setLayoutManager(linearLayoutManager);
//设置分割线
gallery_recycler.addItemDecoration(new TestDecoration(this));
//设置动画
gallery_recycler.setItemAnimator(new DefaultItemAnimator());
//创建适配器
adapter=new GalleryRecyclerAdapter(this);
//绑定适配器
gallery_recycler.setAdapter(adapter);
adapter.setOnRecyclerViewItemClickListener(new GalleryRecyclerAdapter.OnRecyclerViewItemClickListener() {
@Override
public void onItemClick(View view, int position) {
Toast.makeText(RecyclerGalleryActivity.this,"您点击的Item的索引为:"+position,Toast.LENGTH_SHORT).show();
}
});
}
项目:GitHub
文件:SlideScrollViewActivity.java
private void initRecyclerView() {
rcvGoodsList.setVisibility(View.VISIBLE);
final RCVListAdapter adapter = new RCVListAdapter(this);
View header = new View(this);
header.setLayoutParams(new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
header.getLayoutParams().height = getResources().getDimensionPixelOffset(R.dimen.new_home_header_size) - getStatusBarHeight(this);
adapter.setHeader(header);
rcvGoodsList.setLayoutManager(new LinearLayoutManager(this));
rcvGoodsList.setItemAnimator(new DefaultItemAnimator());
rcvGoodsList.setAdapter(adapter);
adapter.setDataSource(Arrays.asList("", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", ""));
adapter.notifyDataSetChanged();
rcvGoodsList.setOnScrollListener(new RecyclerView.OnScrollListener() {
public int scrolledY = 0;
@Override
public void onScrolled(RecyclerView recyclerView, final int dx, final int dy) {
super.onScrolled(recyclerView, dx, dy);
scrolledY += dy;
scrollChangeHeader(scrolledY);
}
});
}
项目:GitHub
文件:BlogFragment.java
@Override
protected void setUp(View view) {
mLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.setItemAnimator(new DefaultItemAnimator());
mRecyclerView.setAdapter(mBlogAdapter);
mPresenter.onViewPrepared();
}
项目:android-mvp-architecture
文件:OpenSourceFragment.java
@Override
protected void setUp(View view) {
mLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.setItemAnimator(new DefaultItemAnimator());
mRecyclerView.setAdapter(mOpenSourceAdapter);
mPresenter.onViewPrepared();
}