Search in sources :

Example 1 with WallpaperBean

use of org.aisen.weibo.sina.support.bean.WallpaperBean in project AisenWeiBo by wangdan.

the class WallpaperCacheUtility method findCacheData.

@Override
public IResult findCacheData(Setting action, Params params) {
    int page = Integer.parseInt(params.getParameter("page"));
    // 只有第一次加载数据的时候才加载缓存
    if (page == 1) {
        // 根据id倒序
        List<WallpaperBean> beanList = SinaDB.getDB().select(null, WallpaperBean.class);
        if (beanList.size() > 0) {
            WallpaperBeans beans = new WallpaperBeans();
            beans.setItem(new WallpaperBeans.Data());
            beans.getItem().setWallpaperList(beanList);
            beans.setFromCache(true);
            beans.setEndPaging(beanList.size() == 0);
            beans.setOutofdate(CacheTimeUtils.isOutofdate("Wallpaper", null));
            return beans;
        }
    }
    return null;
}
Also used : WallpaperBeans(org.aisen.weibo.sina.support.bean.WallpaperBeans) WallpaperBean(org.aisen.weibo.sina.support.bean.WallpaperBean)

Example 2 with WallpaperBean

use of org.aisen.weibo.sina.support.bean.WallpaperBean in project AisenWeiBo by wangdan.

the class WallpaperFragment method onItemClick.

@Override
public void onItemClick(PLAAdapterView<?> parent, View view, int position, long id) {
    super.onItemClick(parent, view, position, id);
    WallpaperBean bean = getAdapterItems().get(position);
    File file = BitmapLoader.getInstance().getCacheFile(bean.getIndexThumbnailUrl());
    if (file != null && file.exists()) {
        WallpaperSettingActivity.launch(getActivity(), file, bean.getNormalUrl());
    }
}
Also used : WallpaperBean(org.aisen.weibo.sina.support.bean.WallpaperBean) File(java.io.File)

Aggregations

WallpaperBean (org.aisen.weibo.sina.support.bean.WallpaperBean)2 File (java.io.File)1 WallpaperBeans (org.aisen.weibo.sina.support.bean.WallpaperBeans)1