本文整理汇总了Java中com.github.florent37.materialviewpager.MaterialViewPagerHelper.registerRecyclerView方法的典型用法代码示例。如果您正苦于以下问题:Java MaterialViewPagerHelper.registerRecyclerView方法的具体用法?Java MaterialViewPagerHelper.registerRecyclerView怎么用?Java MaterialViewPagerHelper.registerRecyclerView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.florent37.materialviewpager.MaterialViewPagerHelper
的用法示例。
在下文中一共展示了MaterialViewPagerHelper.registerRecyclerView方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getItemOffsets
import com.github.florent37.materialviewpager.MaterialViewPagerHelper; //导入方法依赖的package包/类
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView recyclerView, RecyclerView.State state) {
final RecyclerView.ViewHolder holder = recyclerView.getChildViewHolder(view);
final Context context = recyclerView.getContext();
if(!registered) {
MaterialViewPagerHelper.registerRecyclerView(context, recyclerView);
registered = true;
}
int headerCells = 1;
//don't work with stagged
RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();
if(layoutManager instanceof GridLayoutManager){
GridLayoutManager gridLayoutManager = (GridLayoutManager)layoutManager;
headerCells = gridLayoutManager.getSpanCount();
}
MaterialViewPagerAnimator animator = MaterialViewPagerHelper.getAnimator(context);
if (animator != null) {
if (holder.getAdapterPosition() < headerCells) {
outRect.top = Math.round(Utils.dpToPx(animator.getHeaderHeight() + 10, context));
}
}
}
示例2: onViewCreated
import com.github.florent37.materialviewpager.MaterialViewPagerHelper; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mRecyclerView = (RecyclerView) view.findViewById(R.id.recyclerView);
//permet un affichage sous forme liste verticale
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getActivity());
mRecyclerView.setLayoutManager(layoutManager);
mRecyclerView.setHasFixedSize(true);
//100 faux contenu
List<Object> mContentItems = new ArrayList<>();
for (int i = 0; i < 100; ++i)
mContentItems.add(new Object());
//penser à passer notre Adapter (ici : TestRecyclerViewAdapter) à un RecyclerViewMaterialAdapter
mAdapter = new RecyclerViewMaterialAdapter(new TestRecyclerViewAdapter(mContentItems));
mRecyclerView.setAdapter(mAdapter);
//notifier le MaterialViewPager qu'on va utiliser une RecyclerView
MaterialViewPagerHelper.registerRecyclerView(getActivity(), mRecyclerView, null);
}
示例3: onViewCreated
import com.github.florent37.materialviewpager.MaterialViewPagerHelper; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
getPresenter().onResponse();
mRecyclerView = (RecyclerView) view.findViewById(R.id.recyclerView);
mActionButton = (ActionButton) view.findViewById(R.id.actionButton_fragment_ad);
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getActivity());
mRecyclerView.setLayoutManager(layoutManager);
mRecyclerView.setHasFixedSize(true);
mAdapter = new RecyclerViewMaterialAdapter(new AdAdapter(mContentItems, this));
mRecyclerView.setAdapter(mAdapter);
setScrollListener();
MaterialViewPagerHelper.registerRecyclerView(getActivity(), mRecyclerView, null);
}
示例4: onViewCreated
import com.github.florent37.materialviewpager.MaterialViewPagerHelper; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
ButterKnife.bind(this, view);
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
recyclerView.setAdapter(new RecyclerViewMaterialAdapter(adapter));
MaterialViewPagerHelper.registerRecyclerView(getActivity(), recyclerView, null);
betaSeriesAPI.serieInformations(showId)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(betaSerieResponse -> {
adapter.setShow(betaSerieResponse.getShow());
recyclerView.getAdapter().notifyDataSetChanged();
});
}
示例5: onViewCreated
import com.github.florent37.materialviewpager.MaterialViewPagerHelper; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
ButterKnife.bind(this, view);
final LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
mRecyclerView.setLayoutManager(layoutManager);
mRecyclerView.setHasFixedSize(true);
mAdapter = new RecyclerViewMaterialAdapter(new ActionViewAdapter(getActivity(), mContentItems, actions));
mRecyclerView.setAdapter(mAdapter);
mRecyclerView.setOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
int visibleItemCount = layoutManager.getChildCount();
int totalItemCount = layoutManager.getItemCount();
int pastVisiblesItems = layoutManager.findFirstVisibleItemPosition();
if (loading) {
if ((visibleItemCount + pastVisiblesItems) >= totalItemCount) {
// 达到底部加载更多
loading = false;
new LoadActions().execute();
}
}
}
});
MaterialViewPagerHelper.registerRecyclerView(getActivity(), mRecyclerView, null);
new LoadActions().execute();
}
示例6: onViewCreated
import com.github.florent37.materialviewpager.MaterialViewPagerHelper; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mRecyclerView = (RecyclerView) view.findViewById(R.id.recyclerView);
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getActivity());
mRecyclerView.setLayoutManager(layoutManager);
mRecyclerView.setHasFixedSize(true);
mAdapter = new RecyclerViewMaterialAdapter(new TrainListAdapter(mContentItems, this));
mRecyclerView.setAdapter(mAdapter);
MaterialViewPagerHelper.registerRecyclerView(getActivity(), mRecyclerView, null);
}
示例7: onViewCreated
import com.github.florent37.materialviewpager.MaterialViewPagerHelper; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mRecyclerView = (RecyclerView) view.findViewById(R.id.recyclerView);
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getActivity());
mRecyclerView.setLayoutManager(layoutManager);
mRecyclerView.setHasFixedSize(true);
mAdapter = new RecyclerViewMaterialAdapter(new CityAdapter(cities, citiesId, citiesDescription,this));
mRecyclerView.setAdapter(mAdapter);
MaterialViewPagerHelper.registerRecyclerView(getActivity(), mRecyclerView, null);
}
示例8: onViewCreated
import com.github.florent37.materialviewpager.MaterialViewPagerHelper; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mRecyclerView = (RecyclerView) view.findViewById(R.id.recyclerview_offers);
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getActivity());
mRecyclerView.setLayoutManager(layoutManager);
mRecyclerView.setAdapter(new RecyclerViewMaterialAdapter(new LoaderAdapter()));
MaterialViewPagerHelper.registerRecyclerView(getActivity(), mRecyclerView, null);
Api apiHandler = ((App) getActivity().getApplication()).getApiHandler();
apiHandler.getShoppingOffers(
new Callback<List<Offers>>() {
@Override
public void success(List<Offers> offers, Response response) {
offerList = offers;
mRecyclerView.setAdapter(new RecyclerViewMaterialAdapter(new ShoppingAdapter()));
MaterialViewPagerHelper.registerRecyclerView(getActivity(), mRecyclerView, null);
// Log.d(LOG_TAG, offerList.get(0).getUrl() + " " + offerList.get(0).getAvailability() + " " + offerList.get(0).getDescription() + " " + offerList.get(0).getTitle() + " " + offerList.get(0).getImageUrls().get(0).getUrl());
sendParseAnalytics("true");
}
@Override
public void failure(RetrofitError error) {
Log.d(LOG_TAG, "failure" + error.getUrl() + error.getMessage());
mRecyclerView.setAdapter(new RecyclerViewMaterialAdapter(new ErrorAdapter()));
MaterialViewPagerHelper.registerRecyclerView(getActivity(), mRecyclerView, null);
sendParseAnalytics("false");
}
}
);
}
示例9: onViewCreated
import com.github.florent37.materialviewpager.MaterialViewPagerHelper; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mRecyclerView = (RecyclerView) view.findViewById(R.id.recyclerview_food_order);
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getActivity());
mRecyclerView.setLayoutManager(layoutManager);
mRecyclerView.setAdapter(new RecyclerViewMaterialAdapter(new LoaderAdapter()));
MaterialViewPagerHelper.registerRecyclerView(getActivity(), mRecyclerView, null);
Api apiHandler = ((App) getActivity().getApplication()).getApiHandler();
apiHandler.getOrderFood(
String.valueOf(App.currentLatitude),
String.valueOf(App.currentLongitude),
new Callback<Order>() {
@Override
public void success(Order orders, Response response) {
Log.d(LOG_TAG, "success" + response.getUrl() + response.getStatus());
area_id = orders.getArea_id();
restaurantList = orders.getRestaurants();
mRecyclerView.setAdapter(new RecyclerViewMaterialAdapter(new OrderAdapter()));
MaterialViewPagerHelper.registerRecyclerView(getActivity(), mRecyclerView, null);
Log.d(LOG_TAG, restaurantList.get(0).getAddress() + " " + restaurantList.get(0).getCode() + " " + restaurantList.get(0).getDescription() + " " + restaurantList.get(0).getId() + " " + restaurantList.get(0).getLatitude() + " " + restaurantList.get(0).getLogo() + " " + restaurantList.get(0).getLongitude() + " " + restaurantList.get(0).getMetadata() + " " + restaurantList.get(0).getChain().getName());
sendParseAnalytics("true");
}
@Override
public void failure(RetrofitError error) {
Log.d(LOG_TAG, "failure" + error.getUrl() + error.getMessage());
mRecyclerView.setAdapter(new RecyclerViewMaterialAdapter(new ErrorAdapter()));
MaterialViewPagerHelper.registerRecyclerView(getActivity(), mRecyclerView, null);
sendParseAnalytics("false");
}
}
);
}
示例10: onViewCreated
import com.github.florent37.materialviewpager.MaterialViewPagerHelper; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mRecyclerView = (RecyclerView) view.findViewById(
R.id.recyclerview_cab);
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getActivity());
mRecyclerView.setLayoutManager(layoutManager);
mRecyclerView.setAdapter(new RecyclerViewMaterialAdapter(new LoaderAdapter()));
MaterialViewPagerHelper.registerRecyclerView(getActivity(), mRecyclerView, null);
final Api apiHandler = ((App) getActivity().getApplication()).getApiHandler();
apiHandler.getTravelCabs(
String.valueOf(App.currentLatitude),
String.valueOf(App.currentLongitude),
new Callback<List<Cab>>() {
@Override
public void success(List<Cab> cabs, Response response) {
Log.d(LOG_TAG, "success" + response.getUrl() + response.getStatus());
cabList = cabs;
mRecyclerView.setAdapter(new RecyclerViewMaterialAdapter(new CabAdapter()));
MaterialViewPagerHelper.registerRecyclerView(getActivity(), mRecyclerView, null);
sendParseAnalytics("true");
}
@Override
public void failure(RetrofitError error) {
Log.d(LOG_TAG, "failure" + error.getUrl() + error.getMessage());
mRecyclerView.setAdapter(new RecyclerViewMaterialAdapter(new ErrorAdapter()));
MaterialViewPagerHelper.registerRecyclerView(getActivity(), mRecyclerView, null);
sendParseAnalytics("false");
}
}
);
}
示例11: onViewCreated
import com.github.florent37.materialviewpager.MaterialViewPagerHelper; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mRecyclerView = (RecyclerView) view.findViewById(R.id.recyclerview_plays);
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getActivity());
mRecyclerView.setLayoutManager(layoutManager);
mRecyclerView.setAdapter(new RecyclerViewMaterialAdapter(new LoaderAdapter()));
MaterialViewPagerHelper.registerRecyclerView(getActivity(), mRecyclerView, null);
Api apiHandler = ((App) getActivity().getApplication()).getApiHandler();
apiHandler.getEventPlays(
new Callback<List<Plays>>() {
@Override
public void success(List<Plays> plays, Response response) {
Log.d(LOG_TAG, "success" + response.getUrl() + response.getStatus());
playList = plays;
mRecyclerView.setAdapter(new RecyclerViewMaterialAdapter(new PlayAdapter()));
MaterialViewPagerHelper.registerRecyclerView(getActivity(), mRecyclerView, null);
sendParseAnalytics("true");
}
@Override
public void failure(RetrofitError error) {
Log.d(LOG_TAG, "failure" + error.getUrl() + error.getMessage());
mRecyclerView.setAdapter(new RecyclerViewMaterialAdapter(new ErrorAdapter()));
MaterialViewPagerHelper.registerRecyclerView(getActivity(), mRecyclerView, null);
sendParseAnalytics("false");
}
}
);
}
示例12: onViewCreated
import com.github.florent37.materialviewpager.MaterialViewPagerHelper; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mRecyclerView = (RecyclerView) view.findViewById(R.id.recyclerview_movies);
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getActivity());
mRecyclerView.setLayoutManager(layoutManager);
mRecyclerView.setAdapter(new RecyclerViewMaterialAdapter(new LoaderAdapter()));
MaterialViewPagerHelper.registerRecyclerView(getActivity(), mRecyclerView, null);
Api apiHandler = ((App) getActivity().getApplication()).getApiHandler();
apiHandler.getEventMovies(
new Callback<List<Movies>>() {
@Override
public void success(List<Movies> movies, Response response) {
Log.d(LOG_TAG, "success" + response.getUrl() + response.getStatus());
movieList = movies;
mRecyclerView.setAdapter(new RecyclerViewMaterialAdapter(new MoviesAdapter()));
MaterialViewPagerHelper.registerRecyclerView(getActivity(), mRecyclerView, null);
sendParseAnalytics("true");
}
@Override
public void failure(RetrofitError error) {
Log.d(LOG_TAG, "failure" + error.getUrl() + error.getMessage());
mRecyclerView.setAdapter(new RecyclerViewMaterialAdapter(new ErrorAdapter()));
MaterialViewPagerHelper.registerRecyclerView(getActivity(), mRecyclerView, null);
sendParseAnalytics("false");
}
}
);
}
示例13: onViewCreated
import com.github.florent37.materialviewpager.MaterialViewPagerHelper; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mRecyclerView = (RecyclerView) view.findViewById(
R.id.recyclerview_food_bar);
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getActivity());
mRecyclerView.setLayoutManager(layoutManager);
mAdapter = new RecyclerViewMaterialAdapter(new NumberedAdapter(0));
mRecyclerView.setAdapter(mAdapter);
MaterialViewPagerHelper.registerRecyclerView(getActivity(), mRecyclerView, null);
}
示例14: onViewCreated
import com.github.florent37.materialviewpager.MaterialViewPagerHelper; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mRecyclerView = (RecyclerView) view.findViewById(
R.id.recyclerview_food_cafe);
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getActivity());
mRecyclerView.setLayoutManager(layoutManager);
mAdapter = new RecyclerViewMaterialAdapter(new NumberedAdapter(0));
mRecyclerView.setAdapter(mAdapter);
MaterialViewPagerHelper.registerRecyclerView(getActivity(), mRecyclerView, null);
}
示例15: onViewCreated
import com.github.florent37.materialviewpager.MaterialViewPagerHelper; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mRecyclerView = (RecyclerView) view.findViewById(
R.id.recyclerview_food_restaurant);
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getActivity());
mRecyclerView.setLayoutManager(layoutManager);
mAdapter = new RecyclerViewMaterialAdapter(new NumberedAdapter(0));
mRecyclerView.setAdapter(mAdapter);
MaterialViewPagerHelper.registerRecyclerView(getActivity(), mRecyclerView, null);
}