xakdpnr.zip

  • P0GGt6
    了解作者
  • Visual C++
    开发工具
  • 4KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 1
    下载次数
  • 2018-10-14 00:25
    上传日期
本系统主要是针对用户和学生的,用户的信息是直接在注册的时候保存到数据库中的。
xakdpnr.zip
  • HomePresentModule.java
    814B
  • ApplicationModule.java
    453B
  • AppStoreUtil.java
    827B
  • MentionSelectActivity.java
    986B
  • FriendStatusPresentImp.java
    8.9KB
内容介绍
package com.caij.emore.present.imp; import com.caij.emore.Analysis; import com.caij.emore.EMApplication; import com.caij.emore.Key; import com.caij.emore.api.ex.ResponseSubscriber; import com.caij.emore.bean.response.QueryStatusResponse; import com.caij.emore.bean.wrap.StatusWrap; import com.caij.emore.data.local.NotifyManager; import com.caij.emore.data.local.StatusManager; import com.caij.emore.database.bean.Status; import com.caij.emore.database.bean.UnReadMessage; import com.caij.emore.event.EventTag; import com.caij.emore.present.FriendStatusPresent; import com.caij.emore.data.remote.AttitudeApi; import com.caij.emore.data.remote.StatusApi; import com.caij.emore.ui.view.FriendStatusView; import com.caij.lib.util.LogUtil; import com.caij.lib.util.SPBuilder; import com.caij.emore.utils.rxbus.RxBus; import com.caij.emore.api.ex.ErrorCheckerTransformer; import com.caij.emore.api.ex.SchedulerTransformer; import com.caij.emore.utils.rxjava.RxUtil; import com.caij.emore.utils.rxjava.SubscriberAdapter; import com.caij.emore.utils.weibo.MessageUtil; import java.util.List; import rx.Observable; import rx.Subscription; import rx.functions.Action0; import rx.functions.Action1; import rx.functions.Func1; /** * Created by Caij on 2016/5/31. */ public class FriendStatusPresentImp extends AbsListTimeLinePresent<FriendStatusView> implements FriendStatusPresent { private final static int PAGE_COUNT = 20; private final static long STATUS_REFRESH_INTERVAL = 60 * 60 * 1000; private NotifyManager mNotifyManager; private Observable<Status> mPublishStatusObservable; private long mUid; private long mNextCursor; public FriendStatusPresentImp(long uid, FriendStatusView view, StatusApi statusApi, StatusManager statusManager, AttitudeApi attitudeApi, NotifyManager notifyManager) { super(view, statusApi, statusManager, attitudeApi); mNotifyManager = notifyManager; mUid = uid; } @Override public void onCreate() { super.onCreate(); registerEvent(); getLocalFriendStatus(); } private void registerEvent() { mPublishStatusObservable = RxBus.get().register(EventTag.EVENT_PUBLISH_WEIBO_SUCCESS); mPublishStatusObservable.compose(StatusWrapTransformer.create(false)) .compose(SchedulerTransformer.<StatusWrap>create()) .subscribe(new Action1<StatusWrap>() { @Override public void call(StatusWrap statusWrap) { mView.onStatusPublishSuccess(statusWrap); } }); } private void getLocalFriendStatus() { Subscription subscription = RxUtil.createDataObservable(new RxUtil.Provider<List<Status>>() { @Override public List<Status> getData() { return mStatusManager.getFriendStatuses(mUid, 0, 0, PAGE_COUNT, 1); } }).flatMap(new Func1<List<Status>, Observable<Status>>() { @Override public Observable<Status> call(List<Status> statuses) { return Observable.from(statuses); } }) .compose(StatusWrapTransformer.create(false)) .toList() .compose(SchedulerTransformer.<List<StatusWrap>>create()) .subscribe(new SubscriberAdapter<List<StatusWrap>>() { @Override public void onError(Throwable e) { mView.toRefresh(); } @Override public void onNext(List<StatusWrap> statusWraps) { onGetLocalStatusSuccess(statusWraps); } }); addSubscription(subscription); } private void onGetLocalStatusSuccess(List<StatusWrap> statuses) { mStatuses.addAll(statuses); mView.notifyItemChanged(mStatuses); mNextCursor = new SPBuilder(EMApplication.getInstance()) .openDefault() .getLong(Key.FRIEND_STATUS_LOCAL_NEXT_CURSOR, 0); LogUtil.d(this, "local next cursor %s", mNextCursor); long preRefreshTime = new SPBuilder(EMApplication.getInstance()) .openDefault() .getLong(Key.FRIEND_STATUS_UPDATE_TIME, -1); mView.onLoadComplete(mNextCursor > 0); if (System.currentTimeMillis() - preRefreshTime > STATUS_REFRESH_INTERVAL || statuses.size() <= 0) { mView.toRefresh(); } } @Override public void refresh() { Analysis.logRefreshStatus(); Subscription subscription = getFriendStatusesObservable(0, true) .doOnNext(new Action1<List<StatusWrap>>() { @Override public void call(List<StatusWrap> statuses) { cacheAboutData(); } }) .doOnTerminate(new Action0() { @Override public void call() { mView.onRefreshComplete(); } }) .subscribe(new ResponseSubscriber<List<StatusWrap>>(mView) { @Override protected void onFail(Throwable e) { } @Override public void onNext(List<StatusWrap> statuses) { mStatuses.clear(); mStatuses.addAll(statuses); mView.notifyItemChanged(mStatuses); mView.onLoadComplete(mNextCursor > 0); MessageUtil.resetLocalUnReadMessage(UnReadMessage.TYPE_STATUS, 0, mUid, mNotifyManager); } }); addSubscription(subscription); } private void cacheAboutData() { new SPBuilder(EMApplication.getInstance()) .openDefault().edit() .putLong(Key.FRIEND_STATUS_UPDATE_TIME, System.currentTimeMillis()) .putLong(Key.FRIEND_STATUS_LOCAL_NEXT_CURSOR, mNextCursor) .apply(); } @Override public void userFirstVisible() { } @Override public void loadMore() { Subscription subscription = getFriendStatusesObservable(mNextCursor, false) .subscribe(new ResponseSubscriber<List<StatusWrap>>(mView) { @Override protected void onFail(Throwable e) { mView.onLoadComplete(true); } @Override public void onNext(List<StatusWrap> statuses) { mStatuses.addAll(statuses); mView.notifyItemRangeInserted(mStatuses, mStatuses.size() - statuses.size(), statuses.size()); mView.onLoadComplete(mNextCursor > 0); } }); addSubscription(subscription); } private Observable<List<StatusWrap>> getFriendStatusesObservable(long maxId, final boolean isRefresh) { return mStatusApi.getFriendStatus(mUid, 0, maxId, PAGE_COUNT, 1) .compose(ErrorCheckerTransformer.<QueryStatusResponse>create()) .flatMap(new Func1<QueryStatusResponse, Observable<Status>>() { @Override public Observable<Status> call(QueryStatusResponse response) { mNextCursor = response.getNext_cursor(); processAds(response); return Observable.from(response.getStatuses()); } }) .doOnNext(new Action1<Status>() { @Override public void call(Status status) { mStatusManager.insertOrReplace(status); } }) .compose(StatusWrapTransformer.create(false)) .filter(new Func1<StatusWrap, Boolean>() { @Override
评论
    相关推荐
    • MATLAB编译器
      基于MATLAB 2018b版本介绍MATLAB编译器。介绍如何利用编译器将MATLAB代码编译为独立应用程序或组件,并在没有安装MATLAB的计算机上进行部署。
    • matlab入门
      matlab的入门教程,很值得仔细看看,对提高matlab能力有帮助
    • matlab 教程
      matlab 信号处理资料,里面包含信号处理pdf文档,一些杂乱的程序和命令等
    • MATLAB教程
      MATLAB教程MATLAB教程MATLAB教程MATLAB教程MATLAB教程MATLAB教程
    • MATLAB 论文
      基于MATLAB的论文撰写!可以为你指明一条写作MATLAB论文的道路!
    • Matlab教程
      Matlab讲义教程第一章节资源共享。用于学习Matlab的应用。
    • matlab教程
      matlab教程,PPT格式,包含 matlab基本知识、matlab入门、matlab作图、线性规划、无约束优化、非线性规划、统计工具箱、差值、微分方程等多项知识点,并且每个知识点独立成为PPT,内还含有matlab信号处理详解等文档...
    • MATLAB
      MATLAB 该项目是在matlab上完成的,涉及创建和移动宇宙飞船和机器人。 太空飞船和机器人是使用Matlab中的简单几何形状创建的,并通过连续变换矩阵进行移动。 这个项目教我如何使用变换矩阵(旋转,平移等)的概念...
    • Matlab合集
      冈萨雷斯数字图像处理MATLAB版.中文版+数字图像处理第二版中文版(冈萨雷斯)+MATLAB-R2014a完全自学一本通+MATLAB R2016a完全自学一本通 素材文件+[模式识别与智能计算:MATLAB技术实现(第2版)].杨淑莹.扫描版
    • matlab简介
      1.MATLAB 开发环境 1.1 MATLAB 的视窗环境 进入MATLAB之后,会看到一个视窗MATLAB Command Window称为指令视窗,它是你键入指令的地方同时 MATLAB也将计算结果显示在此。 1.2 简易计算 我们先从MATLAB的...