本文整理汇总了Java中com.github.florent37.materialviewpager.MaterialViewPagerHelper类的典型用法代码示例。如果您正苦于以下问题:Java MaterialViewPagerHelper类的具体用法?Java MaterialViewPagerHelper怎么用?Java MaterialViewPagerHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MaterialViewPagerHelper类属于com.github.florent37.materialviewpager包,在下文中一共展示了MaterialViewPagerHelper类的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);
MaterialViewPagerHelper.registerScrollView(getActivity(), mScrollView);
}
示例6: 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();
}
示例7: onViewCreated
import com.github.florent37.materialviewpager.MaterialViewPagerHelper; //导入依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mScrollView = (ObservableScrollView) view.findViewById(R.id.scrollView);
fans = (TextView) view.findViewById(R.id.fans);
agree = (TextView) view.findViewById(R.id.agree);
thanks = (TextView) view.findViewById(R.id.thanks);
signature = (TextView) view.findViewById(R.id.signature);
city = (TextView) view.findViewById(R.id.city);
MaterialViewPagerHelper.registerScrollView(getActivity(), mScrollView, null);
new LoadUserInfo().execute();
}
示例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);
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);
}
示例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);
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);
}
示例10: onViewCreated
import com.github.florent37.materialviewpager.MaterialViewPagerHelper; //导入依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mScrollView = (ObservableScrollView) view.findViewById(R.id.scrollView);
mButton= (Button) view.findViewById(R.id.button);
mTextView= (TextView) view.findViewById(R.id.text);
mTextView.setText("五星级酒店扫盲:");
textPayue= (TextView) view.findViewById(R.id.text_payue);
textPayue.setText("简介:\n 凯悦旗下拥有五星级的凯悦(Hyatt Regency)、超五星级的君悦(Grand Hyatt)和奢华品牌柏悦(Park Hyatt)。\n" +
" 其中Park Hyatt为档次最高的极至尊贵精品型酒店,全都位居最繁华城市的一流房产的位置,如芝加哥、北京,上海,洛杉矶、东京、首尔、巴黎和米兰。\n" +
" 而Grand Hyatt以则体现了气势华贵(Grand)这个字眼:位于文化氛围浓厚的地点,吸引着休闲和公务旅行的客人,同时也是各种大型国际会议和宴会的理想场所。其以周全的会议和宴会设施及专业而富有创意的服务而闻名.");
textLisikaerdun= (TextView) view.findViewById(R.id.text_lisikaerdun);
textLisikaerdun.setText("简介:\n 酒店位于北京国贸CBD外围的华贸中心,紧邻新光天地、万达广场、新世界百货等,交通便利。\n 酒店客房延续英伦庄园风格,色调混合以奶油黄和苹果绿。品质一流的古典式家具完美的融合在最先进的科技设备中,包括配备iPod接口的高科技平面电视和无线上网等。房间的艺术风格同时吸取了西方和东方元素精华,和谐统一。北京丽思卡尔顿酒店还设有行政楼层,配有独立的电梯通道。舒适的行政楼层酒廊提供全天多次精美茶点服务。掌握多种语言的礼宾处为客人提供打印登机牌服务预定服务,以及解答与中国相关的商业常规等服务。");
lisikaerdu= (ImageView) view.findViewById(R.id.image_lisikaerdun);
payue= (ImageView) view.findViewById(R.id.image_payue);
ChangeBitmap(view,R.drawable.ic_payue);
ChangeBitmap(view,R.drawable.ic_lisikaerdun);
mButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(HotelFragment.this.getActivity(), ADWebActivity.class);
Bundle bundle = new Bundle();
bundle.putString("url","http://www.booking.com/index.zh.html?aid=383420;label=baidu-index-Hotels-73Cp7e3e2UY1wW0A_2uTcQ-6164420407&utm_source=baidu&utm_medium=cpc&utm_term=73Cp7e3e2UY1wW0A_2uTcQ&utm_campaign=Chinese_ZH-XX_Phrase_Core");
intent.putExtras(bundle);
HotelFragment.this.startActivity(intent);
}
});
MaterialViewPagerHelper.registerScrollView(getActivity(), mScrollView, null);
}
示例11: 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");
}
}
);
}
示例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_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");
}
}
);
}
示例13: fetchFlights
import com.github.florent37.materialviewpager.MaterialViewPagerHelper; //导入依赖的package包/类
private void fetchFlights() {
Api apiHandler = ((App) getActivity().getApplication()).getApiHandler();
apiHandler.getTravelFlights(
departureLocation,
arrivalLocation,
travelDate,
Integer.valueOf(numOfAdults),
new Callback<List<Flight>>() {
@Override
public void success(List<Flight> flights, Response response) {
Log.d(LOG_TAG, "success" + response.getUrl() + response.getStatus());
flightList = flights;
mRecyclerView.setAdapter(new RecyclerViewMaterialAdapter(new FlightAdapter()));
MaterialViewPagerHelper.registerRecyclerView(getActivity(), mRecyclerView, null);
((SubCategoryFragment) getParentFragment()).getSearchFab().attachToRecyclerView(mRecyclerView);
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");
}
}
);
}
示例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_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");
}
}
);
}
示例15: fetchBus
import com.github.florent37.materialviewpager.MaterialViewPagerHelper; //导入依赖的package包/类
private void fetchBus() {
Api apiHandler = ((App) getActivity().getApplication()).getApiHandler();
apiHandler.getTravelBus(
departureLocation,
arrivalLocation,
travelDate,
new Callback<List<Bus>>() {
@Override
public void success(List<Bus> buses, Response response) {
Log.d(LOG_TAG, "success" + response.getUrl() + response.getStatus());
busList = buses;
mRecyclerView.setAdapter(new RecyclerViewMaterialAdapter(new BusAdapter()));
MaterialViewPagerHelper.registerRecyclerView(getActivity(), mRecyclerView, null);
((SubCategoryFragment) getParentFragment()).getSearchFab().attachToRecyclerView(mRecyclerView);
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");
}
}
);
}