本文整理匯總了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();
}
}
示例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();
}
}
示例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();
}
}
}
});
}
示例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();
}
示例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();
}
}
示例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");
}
示例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);
}
示例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);
}
});
}
示例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);
}
});
}
示例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();
}
}
示例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);
}
});
}
示例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();
}
}
示例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;
}
示例14: getNightMode
import com.example.jingbin.cloudreader.app.Constants; //導入依賴的package包/類
public static boolean getNightMode() {
return SPUtils.getBoolean(Constants.KEY_MODE_NIGHT, false);
}
示例15: setNightMode
import com.example.jingbin.cloudreader.app.Constants; //導入依賴的package包/類
public static void setNightMode(boolean nightMode) {
SPUtils.putBoolean(Constants.KEY_MODE_NIGHT, nightMode);
}