1
1
package com .fly .tour .me .mvvm .model ;
2
2
3
3
import android .app .Application ;
4
- import android .content .Context ;
5
4
import android .support .annotation .NonNull ;
6
5
7
6
import com .fly .tour .api .dto .RespDTO ;
8
7
import com .fly .tour .api .http .ExceptionHandler ;
9
- import com .fly .tour .api .news .entity . NewsDetail ;
10
- import com .fly .tour .api .newstype . entity .NewsType ;
8
+ import com .fly .tour .api .news .NewsDetail ;
9
+ import com .fly .tour .api .news .NewsType ;
11
10
import com .fly .tour .common .event .SingleLiveEvent ;
12
11
import com .fly .tour .common .event .me .NewsDetailCurdEvent ;
13
12
import com .fly .tour .common .mvvm .viewmodel .BaseViewModel ;
16
15
import org .greenrobot .eventbus .EventBus ;
17
16
18
17
import java .util .List ;
19
- import java .util .Map ;
20
-
21
- import javax .inject .Inject ;
22
18
23
19
import io .reactivex .Observer ;
24
20
import io .reactivex .disposables .Disposable ;
@@ -41,15 +37,15 @@ public void addNewsDetail(final int type, final String title, final String conte
41
37
mModel .addNewsDetail (type , title , content ).subscribe (new Observer <RespDTO <NewsDetail >>() {
42
38
@ Override
43
39
public void onSubscribe (Disposable d ) {
44
- showTransLoadingView (true );
40
+ postShowTransLoadingViewEvent (true );
45
41
}
46
42
47
43
@ Override
48
44
public void onNext (RespDTO <NewsDetail > newsDetailRespDTO ) {
49
45
if (newsDetailRespDTO .code == ExceptionHandler .APP_ERROR .SUCC ) {
50
46
ToastUtil .showToast ("添加成功" );
51
- showTransLoadingView (false );
52
- finishActivity ();
47
+ postShowTransLoadingViewEvent (false );
48
+ postFinishActivityEvent ();
53
49
EventBus .getDefault ().post (new NewsDetailCurdEvent (type ));
54
50
} else {
55
51
ToastUtil .showToast ("添加失败" );
@@ -58,12 +54,12 @@ public void onNext(RespDTO<NewsDetail> newsDetailRespDTO) {
58
54
59
55
@ Override
60
56
public void onError (Throwable e ) {
61
- showTransLoadingView (false );
57
+ postShowTransLoadingViewEvent (false );
62
58
}
63
59
64
60
@ Override
65
61
public void onComplete () {
66
- showTransLoadingView (false );
62
+ postShowTransLoadingViewEvent (false );
67
63
}
68
64
});
69
65
}
0 commit comments