本文整理汇总了Java中com.bumptech.glide.util.ViewPreloadSizeProvider类的典型用法代码示例。如果您正苦于以下问题:Java ViewPreloadSizeProvider类的具体用法?Java ViewPreloadSizeProvider怎么用?Java ViewPreloadSizeProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ViewPreloadSizeProvider类属于com.bumptech.glide.util包,在下文中一共展示了ViewPreloadSizeProvider类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.bumptech.glide.util.ViewPreloadSizeProvider; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ImageView giphyLogoView = (ImageView) findViewById(R.id.giphy_logo_view);
Glide.with(this)
.load(R.raw.large_giphy_logo)
.into(giphyLogoView);
RecyclerView gifList = (RecyclerView) findViewById(R.id.gif_list);
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
gifList.setLayoutManager(layoutManager);
RequestBuilder<Drawable> gifItemRequest = Glide.with(this).asDrawable();
ViewPreloadSizeProvider<Api.GifResult> preloadSizeProvider =
new ViewPreloadSizeProvider<>();
adapter = new GifAdapter(this, gifItemRequest, preloadSizeProvider);
gifList.setAdapter(adapter);
RecyclerViewPreloader<Api.GifResult> preloader =
new RecyclerViewPreloader<>(Glide.with(this), adapter, preloadSizeProvider, 4);
gifList.addOnScrollListener(preloader);
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:26,代码来源:MainActivity.java
示例2: setAdapter
import com.bumptech.glide.util.ViewPreloadSizeProvider; //导入依赖的package包/类
@Override
public void setAdapter(Adapter adapter) {
if (adapter instanceof BaseQuickAdapter) {
mReqAdapter = (BaseQuickAdapter) adapter;
removeOnScrollListener(mOnScrollListener);
addOnScrollListener(mOnScrollListener);
}
if (adapter instanceof ListPreloaderQuickAdapter) {
ListPreloaderQuickAdapter tempAdapter = (ListPreloaderQuickAdapter)adapter;
RecyclerViewPreloader preloader =new RecyclerViewPreloader(Glide.with(getContext()), tempAdapter, new ViewPreloadSizeProvider(), tempAdapter.getMaxPreload());
addOnScrollListener(preloader);
}
super.setAdapter(adapter);
if (needInitAddItemDescration && null != mFamiliarDefaultItemDecoration) {
needInitAddItemDescration = false;
super.addItemDecoration(mFamiliarDefaultItemDecoration);
}
}
开发者ID:lujianzhao,项目名称:AndroidBase,代码行数:24,代码来源:FamiliarRecyclerView.java
示例3: onCreate
import com.bumptech.glide.util.ViewPreloadSizeProvider; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ImageView giphyLogoView = (ImageView) findViewById(R.id.giphy_logo_view);
GlideApp.with(this)
.load(R.raw.large_giphy_logo)
.into(giphyLogoView);
RecyclerView gifList = (RecyclerView) findViewById(R.id.gif_list);
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
gifList.setLayoutManager(layoutManager);
RequestBuilder<Drawable> gifItemRequest = GlideApp.with(this)
.asDrawable();
ViewPreloadSizeProvider<Api.GifResult> preloadSizeProvider =
new ViewPreloadSizeProvider<>();
adapter = new GifAdapter(this, gifItemRequest, preloadSizeProvider);
gifList.setAdapter(adapter);
RecyclerViewPreloader<Api.GifResult> preloader =
new RecyclerViewPreloader<>(GlideApp.with(this), adapter, preloadSizeProvider, 4);
gifList.addOnScrollListener(preloader);
gifList.setRecyclerListener(new RecyclerListener() {
@Override
public void onViewRecycled(ViewHolder holder) {
// This is an optimization to reduce the memory usage of RecyclerView's recycled view pool
// and good practice when using Glide with RecyclerView.
GifViewHolder gifViewHolder = (GifViewHolder) holder;
GlideApp.with(MainActivity.this).clear(gifViewHolder.gifView);
}
});
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:36,代码来源:MainActivity.java
示例4: FeedAdapter
import com.bumptech.glide.util.ViewPreloadSizeProvider; //导入依赖的package包/类
FeedAdapter(Activity hostActivity,
@Nullable DataLoadingSubject dataLoading,
int columns,
boolean pocketInstalled, ViewPreloadSizeProvider<Shot> shotPreloadSizeProvider) {
this.host = hostActivity;
this.dataLoading = dataLoading;
if (dataLoading != null) {
dataLoading.registerCallback(this);
}
this.columns = columns;
this.pocketIsInstalled = pocketInstalled;
this.shotPreloadSizeProvider = shotPreloadSizeProvider;
layoutInflater = LayoutInflater.from(host);
comparator = new PlaidItemSorting.PlaidItemComparator();
items = new ArrayList<>();
setHasStableIds(true);
// get the dribbble shot placeholder colors & badge color from the theme
final TypedArray a = host.obtainStyledAttributes(R.styleable.DribbbleFeed);
final int loadingColorArrayId =
a.getResourceId(R.styleable.DribbbleFeed_shotLoadingPlaceholderColors, 0);
if (loadingColorArrayId != 0) {
int[] placeholderColors = host.getResources().getIntArray(loadingColorArrayId);
shotLoadingPlaceholders = new ColorDrawable[placeholderColors.length];
for (int i = 0; i < placeholderColors.length; i++) {
shotLoadingPlaceholders[i] = new ColorDrawable(placeholderColors[i]);
}
} else {
shotLoadingPlaceholders = new ColorDrawable[] { new ColorDrawable(Color.DKGRAY) };
}
final int initialGifBadgeColorId =
a.getResourceId(R.styleable.DribbbleFeed_initialBadgeColor, 0);
initialGifBadgeColor = initialGifBadgeColorId != 0 ?
ContextCompat.getColor(host, initialGifBadgeColorId) : 0x40ffffff;
a.recycle();
}
开发者ID:nickbutcher,项目名称:plaid,代码行数:37,代码来源:FeedAdapter.java
示例5: FuliAdapter
import com.bumptech.glide.util.ViewPreloadSizeProvider; //导入依赖的package包/类
protected FuliAdapter(Response mResponse, Context context,
ViewPreloadSizeProvider<Entry> preloadSizeProvider) {
super(mResponse);
mContext = context;
mPreloadSizeProvider = preloadSizeProvider;
mPool = Glide.get(context).getBitmapPool();
}
开发者ID:pkliang,项目名称:gankmaku,代码行数:8,代码来源:FuliAdapter.java
示例6: AppsAdapter
import com.bumptech.glide.util.ViewPreloadSizeProvider; //导入依赖的package包/类
public AppsAdapter(Context context, ThemedActivity ba, UtilitiesProviderInterface utilsProvider,
AppsAdapterPreloadModel modelProvider, ViewPreloadSizeProvider<String> sizeProvider,
int resourceId, AppsListFragment app) {
super(context, resourceId);
themedActivity = ba;
this.utilsProvider = utilsProvider;
this.modelProvider = modelProvider;
this.sizeProvider = sizeProvider;
this.context = context;
this.app = app;
/*for (int i = 0; i < items.size(); i++) {
myChecked.put(i, false);
}*/
}
开发者ID:TeamAmaze,项目名称:AmazeFileManager,代码行数:16,代码来源:AppsAdapter.java
示例7: GifAdapter
import com.bumptech.glide.util.ViewPreloadSizeProvider; //导入依赖的package包/类
public GifAdapter(Activity activity, RequestBuilder<Drawable> requestBuilder,
ViewPreloadSizeProvider<Api.GifResult> preloadSizeProvider) {
this.activity = activity;
this.requestBuilder = requestBuilder;
this.preloadSizeProvider = preloadSizeProvider;
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:7,代码来源:MainActivity.java
示例8: onCreateView
import com.bumptech.glide.util.ViewPreloadSizeProvider; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
final View result = inflater.inflate(R.layout.flickr_photo_list, container, false);
list = (RecyclerView) result.findViewById(R.id.flickr_photo_list);
layoutManager = new LinearLayoutManager(getActivity());
list.setLayoutManager(layoutManager);
adapter = new FlickrPhotoListAdapter();
list.setAdapter(adapter);
preloadSizeProvider = new ViewPreloadSizeProvider<>();
RecyclerViewPreloader<Photo> preloader =
new RecyclerViewPreloader<>(
GlideApp.with(this), adapter, preloadSizeProvider, PRELOAD_AHEAD_ITEMS);
list.addOnScrollListener(preloader);
list.setItemViewCacheSize(0);
if (currentPhotos != null) {
adapter.setPhotos(currentPhotos);
}
final GlideRequests glideRequests = GlideApp.with(this);
fullRequest = glideRequests
.asDrawable()
.centerCrop()
.placeholder(new ColorDrawable(Color.GRAY));
thumbRequest = glideRequests
.asDrawable()
.diskCacheStrategy(DiskCacheStrategy.DATA)
.override(Api.SQUARE_THUMB_SIZE)
.transition(withCrossFade());
list.setRecyclerListener(new RecyclerView.RecyclerListener() {
@Override
public void onViewRecycled(RecyclerView.ViewHolder holder) {
PhotoTitleViewHolder vh = (PhotoTitleViewHolder) holder;
glideRequests.clear(vh.imageView);
}
});
if (savedInstanceState != null) {
int index = savedInstanceState.getInt(STATE_POSITION_INDEX);
int offset = savedInstanceState.getInt(STATE_POSITION_OFFSET);
layoutManager.scrollToPositionWithOffset(index, offset);
}
return result;
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:51,代码来源:FlickrPhotoList.java
示例9: GifAdapter
import com.bumptech.glide.util.ViewPreloadSizeProvider; //导入依赖的package包/类
GifAdapter(Activity activity, RequestBuilder<Drawable> requestBuilder,
ViewPreloadSizeProvider<Api.GifResult> preloadSizeProvider) {
this.activity = activity;
this.requestBuilder = requestBuilder;
this.preloadSizeProvider = preloadSizeProvider;
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:7,代码来源:MainActivity.java
示例10: onCreateView
import com.bumptech.glide.util.ViewPreloadSizeProvider; //导入依赖的package包/类
@Override
public View onCreateView(
@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View result = inflater.inflate(R.layout.flickr_photo_list, container, false);
list = (RecyclerView) result.findViewById(R.id.flickr_photo_list);
layoutManager = new LinearLayoutManager(getActivity());
list.setLayoutManager(layoutManager);
adapter = new FlickrPhotoListAdapter();
list.setAdapter(adapter);
preloadSizeProvider = new ViewPreloadSizeProvider<>();
RecyclerViewPreloader<Photo> preloader =
new RecyclerViewPreloader<>(
GlideApp.with(this), adapter, preloadSizeProvider, PRELOAD_AHEAD_ITEMS);
list.addOnScrollListener(preloader);
list.setItemViewCacheSize(0);
if (currentPhotos != null) {
adapter.setPhotos(currentPhotos);
}
final GlideRequests glideRequests = GlideApp.with(this);
fullRequest = glideRequests
.asDrawable()
.centerCrop()
.placeholder(new ColorDrawable(Color.GRAY));
thumbRequest = glideRequests
.asDrawable()
.diskCacheStrategy(DiskCacheStrategy.DATA)
.override(Api.SQUARE_THUMB_SIZE)
.transition(withCrossFade());
list.setRecyclerListener(new RecyclerView.RecyclerListener() {
@Override
public void onViewRecycled(RecyclerView.ViewHolder holder) {
PhotoTitleViewHolder vh = (PhotoTitleViewHolder) holder;
glideRequests.clear(vh.imageView);
}
});
if (savedInstanceState != null) {
int index = savedInstanceState.getInt(STATE_POSITION_INDEX);
int offset = savedInstanceState.getInt(STATE_POSITION_OFFSET);
layoutManager.scrollToPositionWithOffset(index, offset);
}
return result;
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:51,代码来源:FlickrPhotoList.java
示例11: bindEvenListener
import com.bumptech.glide.util.ViewPreloadSizeProvider; //导入依赖的package包/类
@Override
public void bindEvenListener(@Nullable Bundle savedInstanceState) {
super.bindEvenListener(savedInstanceState);
allowSwipeBack(false);
unbinder = ButterKnife.bind(this, viewDelegate.getRootView());
mDataManager = new DataManager();
mSwipeRefreshLayout.setOnRefreshListener(this);
mSwipeRefreshLayout.setRefreshing(false);
final GlideRequests glideRequests = GlideApp.with(PixelsApplication.getInstance());
GlideRequest<Drawable> fullRequest = glideRequests
.asDrawable()
.centerCrop()
.placeholder(new ColorDrawable(Color.GRAY));
GlideRequest<Drawable> thumbRequest = glideRequests
.asDrawable()
.diskCacheStrategy(DiskCacheStrategy.DATA)
.transition(withCrossFade());
mAdapter = new UserAdapter(fullRequest, thumbRequest);
mAdapter.setOnLoadMoreListener(this, mRecyclerView);
mLayoutManager = new LinearLayoutManager(getActivity());
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.setAdapter(mAdapter);
ViewPreloadSizeProvider<User> preloadSizeProvider = new ViewPreloadSizeProvider<>();
RecyclerViewPreloader<User> preloader =
new RecyclerViewPreloader<>(
GlideApp.with(this), mAdapter, preloadSizeProvider, PRELOAD_AHEAD_ITEMS);
mRecyclerView.addOnScrollListener(preloader);
mRecyclerView.setItemViewCacheSize(0);
mRecyclerView.setRecyclerListener(new RecyclerView.RecyclerListener() {
@Override
public void onViewRecycled(RecyclerView.ViewHolder holder) {
BaseViewHolder holder1 = (BaseViewHolder) holder;
AppCompatImageView imageView = holder1.getView(R.id.item_image);
if (null != imageView) {
glideRequests.clear(imageView);
}
}
});
if (null != savedInstanceState) {
int index = savedInstanceState.getInt(STATE_POSITION_INDEX);
int offset = savedInstanceState.getInt(STATE_POSITION_OFFSET);
mLayoutManager.scrollToPositionWithOffset(index, offset);
}
RxView.clicks(mRetryBtn).compose(this.bindUntilEvent(FragmentEvent.DESTROY_VIEW)).throttleFirst(1, TimeUnit.SECONDS).subscribe(new Consumer<Object>() {
@Override
public void accept(Object o) throws Exception {
mSwipeRefreshLayout.setVisibility(View.VISIBLE);
mStateView.setVisibility(View.GONE);
startRefresh();
}
});
}
开发者ID:alphater,项目名称:garras,代码行数:61,代码来源:SearchUserFragment.java
示例12: bindEvenListener
import com.bumptech.glide.util.ViewPreloadSizeProvider; //导入依赖的package包/类
@Override
public void bindEvenListener(@Nullable Bundle savedInstanceState) {
super.bindEvenListener(savedInstanceState);
allowSwipeBack(false);
unbinder = ButterKnife.bind(this, viewDelegate.getRootView());
mDataManager = new DataManager();
mSwipeRefreshLayout.setOnRefreshListener(this);
mSwipeRefreshLayout.setRefreshing(false);
mDatas = new ArrayList<>();
final GlideRequests glideRequests = GlideApp.with(PixelsApplication.getInstance());
GlideRequest<Drawable> fullRequest = glideRequests
.asDrawable()
.centerCrop()
.placeholder(new ColorDrawable(Color.GRAY));
GlideRequest<Drawable> thumbRequest = glideRequests
.asDrawable()
.diskCacheStrategy(DiskCacheStrategy.DATA)
.transition(withCrossFade());
mAdapter = new PhotoAdapter(fullRequest, thumbRequest);
mAdapter.setOnLoadMoreListener(this, mRecyclerView);
mLayoutManager = new LinearLayoutManager(getActivity());
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.setAdapter(mAdapter);
ViewPreloadSizeProvider<Photos> preloadSizeProvider = new ViewPreloadSizeProvider<>();
RecyclerViewPreloader<Photos> preloader =
new RecyclerViewPreloader<>(
GlideApp.with(this), mAdapter, preloadSizeProvider, PRELOAD_AHEAD_ITEMS);
mRecyclerView.addOnScrollListener(preloader);
mRecyclerView.setItemViewCacheSize(0);
mRecyclerView.setRecyclerListener(new RecyclerView.RecyclerListener() {
@Override
public void onViewRecycled(RecyclerView.ViewHolder holder) {
BaseViewHolder holder1 = (BaseViewHolder) holder;
AppCompatImageView imageView = holder1.getView(R.id.item_image);
if (null != imageView) {
glideRequests.clear(imageView);
}
}
});
if (null != savedInstanceState) {
int index = savedInstanceState.getInt(STATE_POSITION_INDEX);
int offset = savedInstanceState.getInt(STATE_POSITION_OFFSET);
mLayoutManager.scrollToPositionWithOffset(index, offset);
}
RxView.clicks(mRetryBtn).compose(this.bindUntilEvent(FragmentEvent.DESTROY_VIEW)).throttleFirst(1, TimeUnit.SECONDS).subscribe(new Consumer<Object>() {
@Override
public void accept(Object o) throws Exception {
mSwipeRefreshLayout.setVisibility(View.VISIBLE);
mStateView.setVisibility(View.GONE);
startRefresh();
}
});
}
开发者ID:alphater,项目名称:garras,代码行数:61,代码来源:SearchPhotoFragment.java
示例13: bindEvenListener
import com.bumptech.glide.util.ViewPreloadSizeProvider; //导入依赖的package包/类
@Override
public void bindEvenListener(@Nullable Bundle savedInstanceState) {
super.bindEvenListener(savedInstanceState);
allowSwipeBack(false);
unbinder = ButterKnife.bind(this, viewDelegate.getRootView());
mDataManager = new DataManager();
mSwipeRefreshLayout.setOnRefreshListener(this);
mSwipeRefreshLayout.setRefreshing(false);
mDatas = new ArrayList<>();
final GlideRequests glideRequests = GlideApp.with(PixelsApplication.getInstance());
GlideRequest<Drawable> fullRequest = glideRequests
.asDrawable()
.centerCrop()
.placeholder(new ColorDrawable(Color.GRAY));
GlideRequest<Drawable> thumbRequest = glideRequests
.asDrawable()
.diskCacheStrategy(DiskCacheStrategy.DATA)
.transition(withCrossFade());
mAdapter = new CollectionAdapter(fullRequest, thumbRequest);
mAdapter.setOnLoadMoreListener(this, mRecyclerView);
mLayoutManager = new LinearLayoutManager(getActivity());
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.setAdapter(mAdapter);
ViewPreloadSizeProvider<Collection> preloadSizeProvider = new ViewPreloadSizeProvider<>();
RecyclerViewPreloader<Collection> preloader =
new RecyclerViewPreloader<>(
GlideApp.with(this), mAdapter, preloadSizeProvider, PRELOAD_AHEAD_ITEMS);
mRecyclerView.addOnScrollListener(preloader);
mRecyclerView.setItemViewCacheSize(0);
mRecyclerView.setRecyclerListener(new RecyclerView.RecyclerListener() {
@Override
public void onViewRecycled(RecyclerView.ViewHolder holder) {
BaseViewHolder holder1 = (BaseViewHolder) holder;
AppCompatImageView imageView = holder1.getView(R.id.item_image);
if (null != imageView) {
glideRequests.clear(imageView);
}
}
});
if (null != savedInstanceState) {
int index = savedInstanceState.getInt(STATE_POSITION_INDEX);
int offset = savedInstanceState.getInt(STATE_POSITION_OFFSET);
mLayoutManager.scrollToPositionWithOffset(index, offset);
}
RxView.clicks(mRetryBtn).compose(this.bindUntilEvent(FragmentEvent.DESTROY_VIEW)).throttleFirst(1, TimeUnit.SECONDS).subscribe(new Consumer<Object>() {
@Override
public void accept(Object o) throws Exception {
mSwipeRefreshLayout.setVisibility(View.VISIBLE);
mStateView.setVisibility(View.GONE);
startRefresh();
}
});
}
开发者ID:alphater,项目名称:garras,代码行数:61,代码来源:SearchCollectionFragment.java
示例14: bindEvenListener
import com.bumptech.glide.util.ViewPreloadSizeProvider; //导入依赖的package包/类
@Override
public void bindEvenListener(@Nullable Bundle savedInstanceState) {
super.bindEvenListener(savedInstanceState);
allowSwipeBack(false);
unbinder = ButterKnife.bind(this, viewDelegate.getRootView());
if (null == getActivity()) return;
mLocalBroadcastManager = LocalBroadcastManager.getInstance(getActivity());
mRefreshBroadcastReceiver = new RefreshBroadcastReceiver();
mLocalBroadcastManager.registerReceiver(mRefreshBroadcastReceiver, new IntentFilter("refresh"));
mDataManager = new DataManager();
mSwipeRefreshLayout.setOnRefreshListener(this);
mDatas = new ArrayList<>();
final GlideRequests glideRequests = GlideApp.with(PixelsApplication.getInstance());
GlideRequest<Drawable> fullRequest = glideRequests
.asDrawable()
.centerCrop()
.placeholder(new ColorDrawable(Color.GRAY));
GlideRequest<Drawable> thumbRequest = glideRequests
.asDrawable()
.diskCacheStrategy(DiskCacheStrategy.DATA)
.transition(withCrossFade());
mAdapter = new PhotoAdapter(fullRequest, thumbRequest);
mAdapter.setOnLoadMoreListener(this, mRecyclerView);
mLayoutManager = new LinearLayoutManager(getActivity());
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.setAdapter(mAdapter);
ViewPreloadSizeProvider<Photos> preloadSizeProvider = new ViewPreloadSizeProvider<>();
RecyclerViewPreloader<Photos> preloader =
new RecyclerViewPreloader<>(
GlideApp.with(this), mAdapter, preloadSizeProvider, PRELOAD_AHEAD_ITEMS);
mRecyclerView.addOnScrollListener(preloader);
mRecyclerView.setItemViewCacheSize(0);
mRecyclerView.setRecyclerListener(new RecyclerView.RecyclerListener() {
@Override
public void onViewRecycled(RecyclerView.ViewHolder holder) {
BaseViewHolder holder1 = (BaseViewHolder) holder;
AppCompatImageView imageView = holder1.getView(R.id.item_image);
if (null != imageView) {
glideRequests.clear(imageView);
}
}
});
RxView.clicks(mRetryBtn).compose(this.bindUntilEvent(FragmentEvent.DESTROY_VIEW)).throttleFirst(1, TimeUnit.SECONDS).subscribe(new Consumer<Object>() {
@Override
public void accept(Object o) throws Exception {
mSwipeRefreshLayout.setVisibility(View.VISIBLE);
mStateView.setVisibility(View.GONE);
startRefresh();
}
});
if (null != savedInstanceState) {
int index = savedInstanceState.getInt(STATE_POSITION_INDEX);
int offset = savedInstanceState.getInt(STATE_POSITION_OFFSET);
mLayoutManager.scrollToPositionWithOffset(index, offset);
}
}
开发者ID:alphater,项目名称:garras,代码行数:65,代码来源:FeaturedFragment.java
示例15: bindEvenListener
import com.bumptech.glide.util.ViewPreloadSizeProvider; //导入依赖的package包/类
@Override
public void bindEvenListener(@Nullable Bundle savedInstanceState) {
super.bindEvenListener(savedInstanceState);
unbinder = ButterKnife.bind(this, viewDelegate.getRootView());
mDataManager = new DataManager();
mSwipeRefreshLayout.setOnRefreshListener(this);
mDatas = new ArrayList<>();
final GlideRequests glideRequests = GlideApp.with(PixelsApplication.getInstance());
GlideRequest<Drawable> fullRequest = glideRequests
.asDrawable()
.centerCrop()
.placeholder(new ColorDrawable(Color.GRAY));
GlideRequest<Drawable> thumbRequest = glideRequests
.asDrawable()
.diskCacheStrategy(DiskCacheStrategy.DATA)
.override(320)
.transition(withCrossFade());
mAdapter = new PhotoAdapter(fullRequest, thumbRequest);
mAdapter.setOnLoadMoreListener(this, mRecyclerView);
mLayoutManager = new LinearLayoutManager(getActivity());
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.setAdapter(mAdapter);
ViewPreloadSizeProvider<Photos> preloadSizeProvider = new ViewPreloadSizeProvider<>();
RecyclerViewPreloader<Photos> preloader =
new RecyclerViewPreloader<>(
GlideApp.with(this), mAdapter, preloadSizeProvider, PRELOAD_AHEAD_ITEMS);
mRecyclerView.addOnScrollListener(preloader);
mRecyclerView.setItemViewCacheSize(0);
mRecyclerView.setRecyclerListener(new RecyclerView.RecyclerListener() {
@Override
public void onViewRecycled(RecyclerView.ViewHolder holder) {
BaseViewHolder holder1 = (BaseViewHolder) holder;
AppCompatImageView imageView = holder1.getView(R.id.item_image);
if (null != imageView) {
glideRequests.clear(imageView);
}
}
});
if (null != savedInstanceState) {
int index = savedInstanceState.getInt(STATE_POSITION_INDEX);
int offset = savedInstanceState.getInt(STATE_POSITION_OFFSET);
mLayoutManager.scrollToPositionWithOffset(index, offset);
}
RxView.clicks(mRetryBtn).compose(this.bindUntilEvent(FragmentEvent.DESTROY_VIEW)).throttleFirst(1, TimeUnit.SECONDS).subscribe(new Consumer<Object>() {
@Override
public void accept(Object o) throws Exception {
mSwipeRefreshLayout.setVisibility(View.VISIBLE);
mStateView.setVisibility(View.GONE);
startRefresh();
}
});
}
开发者ID:alphater,项目名称:garras,代码行数:60,代码来源:UserPhotoFragment.java
示例16: bindEvenListener
import com.bumptech.glide.util.ViewPreloadSizeProvider; //导入依赖的package包/类
@Override
public void bindEvenListener(@Nullable Bundle savedInstanceState) {
super.bindEvenListener(savedInstanceState);
allowSwipeBack(false);
unbinder = ButterKnife.bind(this, viewDelegate.getRootView());
mDataManager = new DataManager();
mSwipeRefreshLayout.setOnRefreshListener(this);
mDatas = new ArrayList<>();
final GlideRequests glideRequests = GlideApp.with(PixelsApplication.getInstance());
GlideRequest<Drawable> fullRequest = glideRequests
.asDrawable()
.centerCrop()
.placeholder(new ColorDrawable(Color.GRAY));
GlideRequest<Drawable> thumbRequest = glideRequests
.asDrawable()
.diskCacheStrategy(DiskCacheStrategy.DATA)
.transition(withCrossFade());
mAdapter = new PhotoAdapter(fullRequest, thumbRequest);
mAdapter.setOnLoadMoreListener(this, mRecyclerView);
mLayoutManager = new LinearLayoutManager(getActivity());
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.setAdapter(mAdapter);
ViewPreloadSizeProvider<Photos> preloadSizeProvider = new ViewPreloadSizeProvider<>();
RecyclerViewPreloader<Photos> preloader =
new RecyclerViewPreloader<>(
GlideApp.with(this), mAdapter, preloadSizeProvider, PRELOAD_AHEAD_ITEMS);
mRecyclerView.addOnScrollListener(preloader);
mRecyclerView.setItemViewCacheSize(0);
mRecyclerView.setRecyclerListener(new RecyclerView.RecyclerListener() {
@Override
public void onViewRecycled(RecyclerView.ViewHolder holder) {
BaseViewHolder holder1 = (BaseViewHolder) holder;
AppCompatImageView imageView = holder1.getView(R.id.item_image);
if (null != imageView) {
glideRequests.clear(imageView);
}
}
});
RxView.clicks(mRetryBtn).compose(this.bindUntilEvent(FragmentEvent.DESTROY_VIEW)).throttleFirst(1, TimeUnit.SECONDS).subscribe(new Consumer<Object>() {
@Override
public void accept(Object o) throws Exception {
mSwipeRefreshLayout.setVisibility(View.VISIBLE);
mStateView.setVisibility(View.GONE);
startRefresh();
}
});
if (null != savedInstanceState) {
int index = savedInstanceState.getInt(STATE_POSITION_INDEX);
int offset = savedInstanceState.getInt(STATE_POSITION_OFFSET);
mLayoutManager.scrollToPositionWithOffset(index, offset);
}
}
开发者ID:alphater,项目名称:garras,代码行数:59,代码来源:RandomFragment.java
示例17: bindEvenListener
import com.bumptech.glide.util.ViewPreloadSizeProvider; //导入依赖的package包/类
@Override
public void bindEvenListener(@Nullable Bundle savedInstanceState) {
super.bindEvenListener(savedInstanceState);
unbinder = ButterKnife.bind(this, viewDelegate.getRootView());
mDataManager = new DataManager();
mSwipeRefreshLayout.setOnRefreshListener(this);
mDatas = new ArrayList<>();
final GlideRequests glideRequests = GlideApp.with(PixelsApplication.getInstance());
GlideRequest<Drawable> fullRequest = glideRequests
.asDrawable()
.centerCrop()
.placeholder(new ColorDrawable(Color.GRAY));
GlideRequest<Drawable> thumbRequest = glideRequests
.asDrawable()
.diskCacheStrategy(DiskCacheStrategy.DATA)
.override(320)
.transition(withCrossFade());
mAdapter = new PhotoAdapter(fullRequest, thumbRequest);
mAdapter.setOnLoadMoreListener(this, mRecyclerView);
mLayoutManager = new LinearLayoutManager(getActivity());
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.setAdapter(mAdapter);
ViewPreloadSizeProvider<Photos> preloadSizeProvider = new ViewPreloadSizeProvider<>();
RecyclerViewPreloader<Photos> preloader =
new RecyclerViewPreloader<>(
GlideApp.with(this), mAdapter, preloadSizeProvider, PRELOAD_AHEAD_ITEMS);
mRecyclerView.addOnScrollListener(preloader);
mRecyclerView.setItemViewCacheSize(0);
mRecyclerView.setRecyclerListener(new RecyclerView.RecyclerListener() {
@Override
public void onViewRecycled(RecyclerView.ViewHolder holder) {
BaseViewHolder holder1 = (BaseViewHolder) holder;
AppCompatImageView imageView = holder1.getView(R.id.item_image);
if (null != imageView) {
glideRequests.clear(imageView);
}
}
});
if (null != savedInstanceState) {
int index = savedInstanceState.getInt(STATE_POSITION_INDEX);
int offset = savedInstanceState.getInt(STATE_POSITION_OFFSET);
mLayoutManager.scrollToPositionWithOffset(index, offset);
}
RxView.clicks(mRetryBtn).compose(this.bindUntilEvent(FragmentEvent.DESTROY_VIEW)).throttleFirst(1, TimeUnit.SECONDS).subscribe(new Consumer<Object>() {
@Override
public void accept(Object o) throws Exception {
mSwipeRefreshLayout.setVisibility(View.VISIBLE);
mStateView.setVisibility(View.GONE);
startRefresh();
}
});
}
开发者ID:alphater,项目名称:garras,代码行数:61,代码来源:UserLikesFragment.java
示例18: bindEvenListener
import com.bumptech.glide.util.ViewPreloadSizeProvider; //导入依赖的package包/类
@Override
public void bindEvenListener(@Nullable Bundle savedInstanceState) {
super.bindEvenListener(savedInstanceState);
allowSwipeBack(false);
unbinder = ButterKnife.bind(this, viewDelegate.getRootView());
if (null == getActivity()) return;
mLocalBroadcastManager = LocalBroadcastManager.getInstance(getActivity());
mRefreshBroadcastReceiver = new RefreshBroadcastReceiver();
mLocalBroadcastManager.registerReceiver(mRefreshBroadcastReceiver, new IntentFilter("refresh"));
mDataManager = new DataManager();
mSwipeRefreshLayout.setOnRefreshListener(this);
mDatas = new ArrayList<>();
final GlideRequests glideRequests = GlideApp.with(PixelsApplication.getInstance());
GlideRequest<Drawable> fullRequest = glideRequests
.asDrawable()
.centerCrop()
.placeholder(new ColorDrawable(Color.GRAY));
GlideRequest<Drawable> thumbRequest = glideRequests
.asDrawable()
.diskCacheStrategy(DiskCacheStrategy.DATA)
.transition(withCrossFade());
mAdapter = new PhotoAdapter(fullRequest, thumbRequest);
mAdapter.setOnLoadMoreListener(this, mRecyclerView);
mLayoutManager = new LinearLayoutManager(getActivity());
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.setItemViewCacheSize(10);
mRecyclerView.setDrawingCacheEnabled(true);
mRecyclerView.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH);
mRecyclerView.setAdapter(mAdapter);
ViewPreloadSizeProvider<Photos> preloadSizeProvider = new ViewPreloadSizeProvider<>();
RecyclerViewPreloader<Photos> preloader =
new RecyclerViewPreloader<>(
GlideApp.with(this), mAdapter, preloadSizeProvider, PRELOAD_AHEAD_ITEMS);
mRecyclerView.addOnScrollListener(preloader);
mRecyclerView.setItemViewCacheSize(0);
mRecyclerView.setRecyclerListener(new RecyclerView.RecyclerListener() {
@Override
public void onViewRecycled(RecyclerView.ViewHolder holder) {
BaseViewHolder holder1 = (BaseViewHolder) holder;
AppCompatImageView imageView = holder1.getView(R.id.item_image);
if (null != imageView) {
glideRequests.clear(imageView);
}
}
});
RxView.clicks(mRetryBtn).compose(this.bindUntilEvent(FragmentEvent.DESTROY_VIEW)).throttleFirst(1, TimeUnit.SECONDS).subscribe(new Consumer<Object>() {
@Override
public void accept(Object o) throws Exception {
mSwipeRefreshLayout.setVisibility(View.VISIBLE);
mStateView.setVisibility(View.GONE);
startRefresh();
}
});
if (null != savedInstanceState) {
int index = savedInstanceState.getInt(STATE_POSITION_INDEX);
int offset = savedInstanceState.getInt(STATE_POSITION_OFFSET);
mLayoutManager.scrollToPositionWithOffset(index, offset);
}
}
开发者ID:alphater,项目名称:garras,代码行数:67,代码来源:NewFragment.java
示例19: bindEvenListener
import com.bumptech.glide.util.ViewPreloadSizeProvider; //导入依赖的package包/类
@Override
public void bindEvenListener(@Nullable Bundle savedInstanceState) {
super.bindEvenListener(savedInstanceState);
allowSwipeBack(false);
unbinder = ButterKnife.bind(this, viewDelegate.getRootView());
if (null == getActivity()) return;
mLocalBroadcastManager = LocalBroadcastManager.getInstance(getActivity());
mRefreshBroadcastReceiver = new RefreshBroadcastReceiver();
mLocalBroadcastManager.registerReceiver(mRefreshBroadcastReceiver, new IntentFilter("refresh"));
mDataManager = new DataManager();
mSwipeRefreshLayout.setOnRefreshListener(this);
mDatas = new ArrayList<>();
final GlideRequests glideRequests = GlideApp.with(PixelsApplication.getInstance());
GlideRequest<Drawable> fullRequest = glideRequests
.asDrawable()
.centerCrop()
.placeholder(new ColorDrawable(Color.GRAY));
GlideRequest<Drawable> thumbRequest = glideRequests
.asDrawable()
.diskCacheStrategy(DiskCacheStrategy.DATA)
.transition(withCrossFade());
mAdapter = new CollectionAdapter(fullRequest, thumbRequest);
mAdapter.setOnLoadMoreListener(this, mRecyclerView);
mLayoutManager = new LinearLayoutManager(getActivity());
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.setAdapter(mAdapter);
ViewPreloadSizeProvider<Collection> preloadSizeProvider = new ViewPreloadSizeProvider<>();
RecyclerViewPreloader<Collection> preloader =
new RecyclerViewPreloader<>(
GlideApp.with(this), mAdapter, preloadSizeProvider, PRELOAD_AHEAD_ITEMS);
mRecyclerView.addOnScrollListener(preloader);
mRecyclerView.setItemViewCacheSize(0);
mRecyclerView.setRecyclerListener(new RecyclerView.RecyclerListener() {
@Override
public void onViewRecycled(RecyclerView.ViewHolder holder) {
BaseViewHolder holder1 = (BaseViewHolder) holder;
AppCompatImageView imageView = holder1.getView(R.id.item_image);
if (null != imageView) {
glideRequests.clear(imageView);
}
}
});
RxView.clicks(mRetryBtn).compose(this.bindUntilEvent(FragmentEvent.DESTROY_VIEW)).throttleFirst(1, TimeUnit.SECONDS).subscribe(new Consumer<Object>() {
@Override
public void accept(Object o) throws Exception {
mSwipeRefreshLayout.setVisibility(View.VISIBLE);
mStateView.setVisibility(View.GONE);
startRefresh();
}
});
if (null != savedInstanceState) {
int index = savedInstanceState.getInt(STATE_POSITION_INDEX);
int offset = savedInstanceState.getInt(STATE_POSITION_OFFSET);
mLayoutManager.scrollToPositionWithOffset(index, offset);
}
}
开发者ID:alphater,项目名称:garras,代码行数:66,代码来源:CollectionFragment.java
示例20: bindEvenListener
import com.bumptech.glide.util.ViewPreloadSizeProvider; //导入依赖的package包/类
@Override
public void bindEvenListener(@Nullable Bundle savedInstanceState) {
super.bindEvenListener(savedInstanceState);
allowSwipeBack(false);
unbinder = ButterKnife.bind(this, viewDelegate.getRootView());
mDataManager = new DataManager();
mSwipeRefreshLayout.setOnRefreshListener(this);
mDatas = new ArrayList<>();
final GlideRequests glideRequests = GlideApp.with(PixelsApplication.getInstance());
GlideRequest<Drawable> fullRequest = glideRequests
.asDrawable()
.centerCrop()
.placeholder(new ColorDrawable(Color.GRAY));
GlideRequest<Drawable> thumbRequest = glideRequests
.asDrawable()
.diskCacheStrategy(DiskCacheStrategy.DATA)
.transition(withCrossFade());
mAdapter = new CollectionAdapter(fullRequest, thumbRequest);
mAdapter.setOnLoadMoreListener(this, mRecyclerView);
mLayoutManager = new LinearLayoutManager(getActivity());
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.setAdapter(mAdapter);
ViewPreloadSizeProvider<Collection> preloadSizeProvider = new ViewPreloadSizeProvider<>();
RecyclerViewPreloader<Collection> preloader =
new RecyclerViewPreloader<>(
|
请发表评论