Skip to content

Commit

Permalink
yoyiyi
Browse files Browse the repository at this point in the history
  • Loading branch information
yoyiyi committed Sep 13, 2017
1 parent 5634be6 commit ee127c1
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

import com.annimon.stream.Stream;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;
import java.util.ArrayList;

import static org.junit.Assert.assertEquals;

/**
* Instrumentation test, which will execute on an Android device.
Expand All @@ -23,4 +27,16 @@ public void useAppContext() throws Exception {

assertEquals("com.yoyiyi.soleil", appContext.getPackageName());
}

@Test
public void user() throws Exception {
ArrayList<Integer> list = new ArrayList<>();
list.add(1);
list.add(1);
list.add(2);
list.add(2);
System.out.print(2222);
Stream.of(list).distinct().forEach(System.out::println);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,48 @@ public LivePresenter(RetrofitHelper retrofitHelper) {
this.mRetrofitHelper = retrofitHelper;
}

/* @Inject
public LivePresenter() {
this.mRetrofitHelper = BiliSoleilApplication.getInstance().getRetrofitHelper();
}*/

@Override
public void getLiveData() {
BaseObjectSubscriber<LiveRecommend> subscriber = mRetrofitHelper.getLivePartition()
/*addSubscribe(mRetrofitHelper.getLivePartition()
.compose(RxUtils.handleResult())
.flatMap(new Function<LivePartition, Publisher<HttpResponse<LiveRecommend>>>() {
@Override
public Publisher<HttpResponse<LiveRecommend>> apply(LivePartition livePartition) throws Exception {
mView.showLivePartition(livePartition);
return mRetrofitHelper.getLiveRecommend();
}
})
.compose(RxUtils.rxSchedulerHelper())
.subscribeWith(new BaseObjectSubscriber<LiveRecommend>(mView) {
@Override
public void onSuccess(LiveRecommend liveRecommend) {
mView.showLiveRecommend(liveRecommend);
}
}));
addSubscribe(mRetrofitHelper.getLivePartition()
.compose(RxUtils.handleResult())
.flatMap(new Function<LivePartition, Publisher<HttpResponse<LiveRecommend>>>() {
@Override
public Publisher<HttpResponse<LiveRecommend>> apply(LivePartition livePartition) throws Exception {
mView.showLivePartition(livePartition);
return mRetrofitHelper.getLiveRecommend();
}
})
.compose(RxUtils.rxSchedulerHelper())
.subscribeWith(new BaseObjectSubscriber<LiveRecommend>(mView) {
@Override
public void onSuccess(LiveRecommend liveRecommend) {
mView.showLiveRecommend(liveRecommend);
}
}));*/

addSubscribe(mRetrofitHelper.getLivePartition()
.compose(RxUtils.handleResult())
.flatMap(livePartition -> {
mView.showLivePartition(livePartition);
Expand All @@ -36,8 +75,7 @@ public void getLiveData() {
public void onSuccess(LiveRecommend liveRecommend) {
mView.showLiveRecommend(liveRecommend);
}
});
addSubscribe(subscriber);
}));
}

}
2 changes: 1 addition & 1 deletion bilisoleil.iml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1' //2.3使用
// classpath 'com.android.tools.build:gradle:3.0.0-alpha3'
// classpath 'com.android.tools.build:gradle:2.3.1' //2.3使用
classpath 'com.android.tools.build:gradle:3.0.0-alpha4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand Down

0 comments on commit ee127c1

Please sign in to comment.