当前位置: 首页>>代码示例>>Java>>正文


Java Constants类代码示例

本文整理汇总了Java中com.example.jingbin.cloudreader.app.Constants的典型用法代码示例。如果您正苦于以下问题:Java Constants类的具体用法?Java Constants怎么用?Java Constants使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Constants类属于com.example.jingbin.cloudreader.app包,在下文中一共展示了Constants类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getACacheData

import com.example.jingbin.cloudreader.app.Constants; //导入依赖的package包/类
/**
 * 取缓存
 */
private void getACacheData() {
    if (!mIsFirst) {
        return;
    }

    if (mBannerImages != null && mBannerImages.size() > 0) {
        mHeaderBinding.banner.setImages(mBannerImages).setImageLoader(new GlideImageLoader()).start();
    } else {
        loadBannerPicture();
    }
    mLists = (ArrayList<List<AndroidBean>>) maCache.getAsObject(Constants.EVERYDAY_CONTENT);
    if (mLists != null && mLists.size() > 0) {
        setAdapter(mLists);
    } else {
        showRotaLoading(true);
        showContentData();
    }
}
 
开发者ID:joelan,项目名称:ClouldReader,代码行数:22,代码来源:EverydayFragment.java

示例2: handleCache

import com.example.jingbin.cloudreader.app.Constants; //导入依赖的package包/类
public void handleCache() {
    ArrayList<FrontpageBean.ResultBeanXXXXXXXXXXXXXX.FocusBean.ResultBeanX> result = null;
    try {
        mBannerImages = (ArrayList<String>) ACache.get(CloudReaderApplication.getInstance()).getAsObject(Constants.BANNER_PIC);
        result = (ArrayList<FrontpageBean.ResultBeanXXXXXXXXXXXXXX.FocusBean.ResultBeanX>) ACache.get(CloudReaderApplication.getInstance()).getAsObject(Constants.BANNER_PIC_DATA);
    } catch (Exception ignored) {
    }
    if (mBannerImages != null && mBannerImages.size() > 0) {
        // 加上缓存使其可以点击
        everydayNavigator.showBannerView(mBannerImages, result);
    } else {
        showBanncerPage();
    }
    mLists = (ArrayList<List<AndroidBean>>) ACache.get(CloudReaderApplication.getInstance()).getAsObject(Constants.EVERYDAY_CONTENT);
    if (mLists != null && mLists.size() > 0) {
        everydayNavigator.showListView(mLists);
    } else {
        everydayNavigator.showRotaLoading();
        showRecyclerViewData();
    }
}
 
开发者ID:youlookwhat,项目名称:CloudReader,代码行数:22,代码来源:EverydayViewModel.java

示例3: loadHotMovie

import com.example.jingbin.cloudreader.app.Constants; //导入依赖的package包/类
private void loadHotMovie() {
    oneViewModel.getHotMovie().observe(this, hotMovieBean -> {
        showContentView();
        if (hotMovieBean != null && hotMovieBean.getSubjects() != null) {
            setAdapter(hotMovieBean);

            aCache.remove(Constants.ONE_HOT_MOVIE);
            aCache.put(Constants.ONE_HOT_MOVIE, hotMovieBean);
            // 保存请求的日期
            SPUtils.putString("one_data", TimeUtil.getData());
            // 刷新结束
            mIsLoading = false;
        } else {
            if (mHotMovieBean != null) {
                setAdapter(mHotMovieBean);
            } else {
                if (oneAdapter.getItemCount() == 0) {
                    showError();
                }
            }
        }
    });
}
 
开发者ID:youlookwhat,项目名称:CloudReader,代码行数:24,代码来源:OneFragment.java

示例4: onActivityCreated

import com.example.jingbin.cloudreader.app.Constants; //导入依赖的package包/类
@Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

//        showLoading();
        showContentView();
        bindingView.llLoading.setVisibility(View.VISIBLE);
        animation = new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
        animation.setDuration(3000);//设置动画持续时间
        animation.setInterpolator(new LinearInterpolator());//不停顿
        animation.setRepeatCount(10);
        bindingView.ivLoading.setAnimation(animation);
        animation.startNow();

        maCache = ACache.get(getContext());
        mEverydayModel = new EverydayModel();
        mBannerImages = (ArrayList<String>) maCache.getAsObject(Constants.BANNER_PIC);
        DebugUtil.error("----mBannerImages: " + (mBannerImages == null));
        DebugUtil.error("----mLists: " + (mLists == null));

        mHeaderBinding = DataBindingUtil.inflate(LayoutInflater.from(getContext()), R.layout.header_item_everyday, null, false);
        // 设置本地数据点击事件等
        initLocalSetting();
        initRecyclerView();

        mIsPrepared = true;
        /**
         * 因为启动时先走loadData()再走onActivityCreated,
         * 所以此处要额外调用load(),不然最初不会加载内容
         */
        loadData();
    }
 
开发者ID:joelan,项目名称:ClouldReader,代码行数:33,代码来源:EverydayFragment.java

示例5: requestBeforeData

import com.example.jingbin.cloudreader.app.Constants; //导入依赖的package包/类
/**
 * 没请求到数据就取缓存,没缓存一直请求前一天数据
 */
private void requestBeforeData() {
    mLists = (ArrayList<List<AndroidBean>>) maCache.getAsObject(Constants.EVERYDAY_CONTENT);
    if (mLists != null && mLists.size() > 0) {
        setAdapter(mLists);
    } else {
        // 一直请求,知道请求到数据为止
        ArrayList<String> lastTime = TimeUtil.getLastTime(year, month, day);
        mEverydayModel.setData(lastTime.get(0), lastTime.get(1), lastTime.get(2));
        year = lastTime.get(0);
        month = lastTime.get(1);
        day = lastTime.get(2);
        showContentData();
    }
}
 
开发者ID:joelan,项目名称:ClouldReader,代码行数:18,代码来源:EverydayFragment.java

示例6: onActivityCreated

import com.example.jingbin.cloudreader.app.Constants; //导入依赖的package包/类
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    showContentView();
    aCache = ACache.get(getActivity());
    oneAdapter = new OneAdapter(activity);
    mHotMovieBean = (HotMovieBean) aCache.getAsObject(Constants.ONE_HOT_MOVIE);
    isPrepared = true;
    DebugUtil.error("---OneFragment   --onActivityCreated");
}
 
开发者ID:joelan,项目名称:ClouldReader,代码行数:11,代码来源:OneFragment.java

示例7: loadHotMovie

import com.example.jingbin.cloudreader.app.Constants; //导入依赖的package包/类
private void loadHotMovie() {
        Subscription subscription = HttpClient.Builder.getDouBanService().getHotMovie().subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<HotMovieBean>() {
                    @Override
                    public void onCompleted() {
                        showContentView();
                    }

                    @Override
                    public void onError(Throwable e) {
                        showContentView();
                        if (oneAdapter != null && oneAdapter.getItemCount() == 0) {
                            showError();
                        }
                    }

                    @Override
                    public void onNext(HotMovieBean hotMovieBean) {
                        if (hotMovieBean != null) {
                            aCache.remove(Constants.ONE_HOT_MOVIE);
                            // 保存12个小时
                            aCache.put(Constants.ONE_HOT_MOVIE, hotMovieBean, 43200);
                            setAdapter(hotMovieBean);
                            // 保存请求的日期
                            SPUtils.putString("one_data", TimeUtil.getData());
                            // 刷新结束
                            mIsLoading = false;
                        }

                        //构造器中,第一个参数表示列数或者行数,第二个参数表示滑动方向,瀑布流
//                        bindingContentView.listOne.setLayoutManager(new StaggeredGridLayoutManager(4,StaggeredGridLayoutManager.VERTICAL));
                        // GridView
//                        bindingContentView.listOne.setLayoutManager(new GridLayoutManager(getActivity(), 2));
                    }
                });
        addSubscription(subscription);
    }
 
开发者ID:joelan,项目名称:ClouldReader,代码行数:38,代码来源:OneFragment.java

示例8: showRecyclerViewData

import com.example.jingbin.cloudreader.app.Constants; //导入依赖的package包/类
private void showRecyclerViewData() {
    mEverydayModel.showRecyclerViewData(new RequestImpl() {
        @Override
        public void loadSuccess(Object object) {
            if (mLists != null) {
                mLists.clear();
            }
            mLists = (ArrayList<List<AndroidBean>>) object;
            if (mLists.size() > 0 && mLists.get(0).size() > 0) {
                everydayNavigator.showListView(mLists);
            } else {
                mLists = (ArrayList<List<AndroidBean>>) ACache.get(activity.getContext()).getAsObject(Constants.EVERYDAY_CONTENT);
                if (mLists != null && mLists.size() > 0) {
                    everydayNavigator.showListView(mLists);
                } else {
                    // 一直请求,知道请求到数据为止
                    ArrayList<String> lastTime = TimeUtil.getLastTime(year, month, day);
                    mEverydayModel.setData(lastTime.get(0), lastTime.get(1), lastTime.get(2));
                    year = lastTime.get(0);
                    month = lastTime.get(1);
                    day = lastTime.get(2);
                    showRecyclerViewData();
                }
            }
        }

        @Override
        public void loadFailed() {
            if (mLists != null && mLists.size() > 0) {
                return;
            }
            everydayNavigator.showErrorView();
        }

        @Override
        public void addSubscription(Subscription subscription) {
            activity.addSubscription(subscription);
        }
    });
}
 
开发者ID:youlookwhat,项目名称:CloudReader,代码行数:41,代码来源:EverydayViewModel.java

示例9: showBanncerPage

import com.example.jingbin.cloudreader.app.Constants; //导入依赖的package包/类
private void showBanncerPage() {
    mEverydayModel.showBanncerPage(new RequestImpl() {
        @Override
        public void loadSuccess(Object object) {
            if (mBannerImages == null) {
                mBannerImages = new ArrayList<String>();
            } else {
                mBannerImages.clear();
            }
            FrontpageBean bean = (FrontpageBean) object;
            if (bean != null && bean.getResult() != null && bean.getResult().getFocus() != null && bean.getResult().getFocus().getResult() != null) {
                final ArrayList<FrontpageBean.ResultBeanXXXXXXXXXXXXXX.FocusBean.ResultBeanX> result = (ArrayList<FrontpageBean.ResultBeanXXXXXXXXXXXXXX.FocusBean.ResultBeanX>) bean.getResult().getFocus().getResult();
                if (result != null && result.size() > 0) {
                    for (int i = 0; i < result.size(); i++) {
                        //获取所有图片
                        mBannerImages.add(result.get(i).getRandpic());
                    }
                    everydayNavigator.showBannerView(mBannerImages, result);
                    ACache.get(CloudReaderApplication.getInstance()).remove(Constants.BANNER_PIC);
                    ACache.get(CloudReaderApplication.getInstance()).put(Constants.BANNER_PIC, mBannerImages);
                    ACache.get(CloudReaderApplication.getInstance()).remove(Constants.BANNER_PIC_DATA);
                    ACache.get(CloudReaderApplication.getInstance()).put(Constants.BANNER_PIC_DATA, result);
                }
            }
        }

        @Override
        public void loadFailed() {

        }

        @Override
        public void addSubscription(Subscription subscription) {
            activity.addSubscription(subscription);
        }
    });
}
 
开发者ID:youlookwhat,项目名称:CloudReader,代码行数:38,代码来源:EverydayViewModel.java

示例10: handlerFailed

import com.example.jingbin.cloudreader.app.Constants; //导入依赖的package包/类
/**
 * 处理请求失败后的情况
 */
private void handlerFailed() {
    GankIoDataBean mAndroidBean = (GankIoDataBean) mACache.getAsObject(Constants.GANK_MEIZI);
    if (mAndroidBean != null
            && mAndroidBean.getResults() != null
            && mAndroidBean.getResults().size() > 0) {
        navigator.showLoadSuccessView();
        navigator.showAdapterView(mAndroidBean);
    } else {
        navigator.showLoadFailedView();
    }
}
 
开发者ID:youlookwhat,项目名称:CloudReader,代码行数:15,代码来源:WelfareViewModel.java

示例11: loadAndroidData

import com.example.jingbin.cloudreader.app.Constants; //导入依赖的package包/类
public void loadAndroidData() {
    mModel.setData(mType, mPage, HttpUtils.per_page_more);
    mModel.getGankIoData(new RequestImpl() {
        @Override
        public void loadSuccess(Object object) {
            navigator.showLoadSuccessView();
            GankIoDataBean gankIoDataBean = (GankIoDataBean) object;
            if (mPage == 1) {
                if (gankIoDataBean != null && gankIoDataBean.getResults() != null && gankIoDataBean.getResults().size() > 0) {
                    navigator.showAdapterView(gankIoDataBean);

                    mACache.remove(Constants.GANK_ANDROID);
                    mACache.put(Constants.GANK_ANDROID, gankIoDataBean);
                } else {
                    handlerFailed();
                }
            } else {
                if (gankIoDataBean != null && gankIoDataBean.getResults() != null && gankIoDataBean.getResults().size() > 0) {
                    navigator.refreshAdapter(gankIoDataBean);
                } else {
                    navigator.showListNoMoreLoading();
                }
            }
        }

        @Override
        public void loadFailed() {
            handlerFailed();
            if (mPage > 1) {
                mPage--;
            }
        }

        @Override
        public void addSubscription(Subscription subscription) {
            activity.addSubscription(subscription);
        }
    });
}
 
开发者ID:youlookwhat,项目名称:CloudReader,代码行数:40,代码来源:BigAndroidViewModel.java

示例12: handlerFailed

import com.example.jingbin.cloudreader.app.Constants; //导入依赖的package包/类
/**
 * 处理请求失败后的情况
 */
private void handlerFailed() {
    GankIoDataBean mAndroidBean = (GankIoDataBean) mACache.getAsObject(Constants.GANK_ANDROID);
    if (mAndroidBean != null
            && mAndroidBean.getResults() != null
            && mAndroidBean.getResults().size() > 0) {
        navigator.showLoadSuccessView();
        navigator.showAdapterView(mAndroidBean);
    } else {
        navigator.showLoadFailedView();
    }
}
 
开发者ID:youlookwhat,项目名称:CloudReader,代码行数:15,代码来源:BigAndroidViewModel.java

示例13: onActivityCreated

import com.example.jingbin.cloudreader.app.Constants; //导入依赖的package包/类
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    showContentView();
    initRecyclerView();
    aCache = ACache.get(getActivity());
    mHotMovieBean = (HotMovieBean) aCache.getAsObject(Constants.ONE_HOT_MOVIE);
    oneViewModel = ViewModelProviders.of(this).get(OneViewModel.class);
    isPrepared = true;
}
 
开发者ID:youlookwhat,项目名称:CloudReader,代码行数:11,代码来源:OneFragment.java

示例14: getNightMode

import com.example.jingbin.cloudreader.app.Constants; //导入依赖的package包/类
public static boolean getNightMode() {
    return SPUtils.getBoolean(Constants.KEY_MODE_NIGHT, false);
}
 
开发者ID:joelan,项目名称:ClouldReader,代码行数:4,代码来源:SPUtils.java

示例15: setNightMode

import com.example.jingbin.cloudreader.app.Constants; //导入依赖的package包/类
public static void setNightMode(boolean nightMode) {
    SPUtils.putBoolean(Constants.KEY_MODE_NIGHT, nightMode);
}
 
开发者ID:joelan,项目名称:ClouldReader,代码行数:4,代码来源:SPUtils.java


注:本文中的com.example.jingbin.cloudreader.app.Constants类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。