fix: 修改app频繁在已提交界面调用数据统计接口的问题
This commit is contained in:
parent
2126781230
commit
3e6f8997fb
@ -236,10 +236,11 @@ public class HomeActivity extends BaseActivity {
|
||||
obtain.obj = true;
|
||||
EventBus.getDefault().post(obtain);
|
||||
|
||||
Message obtain1 = Message.obtain();
|
||||
obtain1.what = Constant.HAS_SUBMIT_ITEM;
|
||||
obtain1.obj = true;
|
||||
EventBus.getDefault().post(obtain1);
|
||||
// 待提交页面暂时不需要获取,当用户在记录tab下点击已提交后,再去请求 #2023-0216
|
||||
// Message obtain1 = Message.obtain();
|
||||
// obtain1.what = Constant.HAS_SUBMIT_ITEM;
|
||||
// obtain1.obj = true;
|
||||
// EventBus.getDefault().post(obtain1);
|
||||
} else if (tab.getPosition() == 3) {
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.HOME_MINE;
|
||||
|
@ -23,11 +23,14 @@ import com.kongzue.dialog.util.DialogSettings;
|
||||
import com.kongzue.dialog.v3.MessageDialog;
|
||||
import com.lzy.okgo.OkGo;
|
||||
import com.lzy.okgo.model.HttpParams;
|
||||
import com.lzy.okrx2.adapter.FlowableBody;
|
||||
import com.lzy.okrx2.adapter.FlowableResponse;
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.activity.FragmentManagement;
|
||||
import com.navinfo.outdoor.activity.HomeActivity;
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
import com.navinfo.outdoor.base.BaseFragment;
|
||||
import com.navinfo.outdoor.bean.CommonResponse;
|
||||
import com.navinfo.outdoor.bean.HasSubmitBean;
|
||||
import com.navinfo.outdoor.http.Callback;
|
||||
import com.navinfo.outdoor.http.HttpInterface;
|
||||
@ -46,6 +49,8 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
|
||||
|
||||
/**
|
||||
* 记录-已提交
|
||||
*/
|
||||
@ -106,9 +111,9 @@ public class HasSubmitFragment extends BaseFragment implements View.OnClickListe
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if (((HomeActivity)getActivity()).getCurrentTabSelected() == 1) {
|
||||
initRequest();
|
||||
}
|
||||
// if (((HomeActivity)getActivity()).getCurrentTabSelected() == 1) {
|
||||
// initRequest();
|
||||
// }
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@ -133,6 +138,7 @@ public class HasSubmitFragment extends BaseFragment implements View.OnClickListe
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void initOtherSubMitWork() {
|
||||
HttpParams httpParams = new HttpParams();
|
||||
httpParams.put("type", 5);
|
||||
|
@ -2,8 +2,8 @@ package com.navinfo.outdoor.http;
|
||||
|
||||
public class HttpInterface {
|
||||
// public static final String IP = "http://172.23.138.133:9999/m4";//测试接口-IP
|
||||
public static final String IP2 = "http://dtxbmaps.navinfo.com/dtxb/dev/m4";//开发接口-外网
|
||||
public static final String IP = "http://dtxbmaps.navinfo.com/dtxb/test/m4";//测试接口-外网
|
||||
public static final String IP = "http://dtxbmaps.navinfo.com/dtxb/dev/m4";//开发接口-外网
|
||||
public static final String IP2 = "http://dtxbmaps.navinfo.com/dtxb/test/m4";//测试接口-外网
|
||||
public static final String IP1 = "http://dtxbmaps.navinfo.com/dtxb/m4";//正式接口
|
||||
public static final String USER_PATH = "/user/";//我的
|
||||
public static final String MSG_LIST_PATH = "/msgList/";//发现
|
||||
|
79
app/src/test/java/com/navinfo/outdoor/RxAndroidTest.java
Normal file
79
app/src/test/java/com/navinfo/outdoor/RxAndroidTest.java
Normal file
@ -0,0 +1,79 @@
|
||||
package com.navinfo.outdoor;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.ObservableEmitter;
|
||||
import io.reactivex.ObservableOnSubscribe;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.functions.Function;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
public class RxAndroidTest {
|
||||
List<String> sourceList = new ArrayList<>();
|
||||
@Before
|
||||
public void initData() {
|
||||
for (int i = 0; i < 100; i++) {
|
||||
sourceList.add(i+"");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void simpleRxAndroid() {
|
||||
Observable.create(new ObservableOnSubscribe<String>() {
|
||||
@Override
|
||||
public void subscribe(ObservableEmitter<String> emitter) throws Exception {
|
||||
for (String s: sourceList) {
|
||||
emitter.onNext(s);
|
||||
}
|
||||
emitter.onComplete();
|
||||
}
|
||||
}).subscribeOn(Schedulers.io())
|
||||
.observeOn(Schedulers.computation(), true)
|
||||
.timeout(3000, TimeUnit.MILLISECONDS)
|
||||
.doOnNext(new Consumer<String>() {
|
||||
@Override
|
||||
public void accept(String s) throws Exception {
|
||||
System.out.println("接收到的消息Str:"+s+",当前线程是:"+Thread.currentThread().getName());
|
||||
}
|
||||
})
|
||||
.observeOn(Schedulers.single(), true)
|
||||
.map(new Function<String, Integer>() {
|
||||
@Override
|
||||
public Integer apply(String s) throws Exception {
|
||||
System.out.println("接收到的消息Int:"+s+",当前线程是:"+Thread.currentThread().getName());
|
||||
return Integer.valueOf(s);
|
||||
}
|
||||
})
|
||||
.observeOn(Schedulers.trampoline())
|
||||
.subscribe(new Observer<Integer>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
System.out.println("开始订阅!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(Integer integer) {
|
||||
System.out.println("接收到的消息:"+integer+",当前线程是:"+Thread.currentThread().getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
System.out.println("出现错误:"+e.getMessage()+",当前线程是:"+Thread.currentThread().getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
System.out.println("结束!");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user