Commit b70dd4d1 by sikang

clear litepel

parent 0dbe840e
......@@ -63,8 +63,6 @@ dependencies {
api "com.google.protobuf:protobuf-java:3.5.1"
// stream
api 'com.annimon:stream:1.1.4'
// litepal
api 'org.litepal.android:core:2.0.0'
// api 'me.jessyan:autosize:1.0.6'
......
<?xml version="1.0" encoding="utf-8"?>
<litepal>
<dbname value="collect_info" />
<version value="1" />
<list>
<mapping class="com.common.bean.CollectInfoEntity" />
</list>
</litepal>
\ No newline at end of file
......@@ -167,48 +167,6 @@ public class Collector {
}
/**
* location有可能没有,需要搜集多次才可能搜集到
*/
@SuppressLint("CheckResult")
public static void collectAndSaveLocation(Context context) {
Observable.interval(1, TimeUnit.MINUTES)
.startWith(0L)
.flatMap(new io.reactivex.functions.Function<Long, ObservableSource<InfoType>>() {
@Override
public ObservableSource<InfoType> apply(Long aLong) throws Exception {
return Observable.just(InfoType.LOCATION);
}
})
.map(new io.reactivex.functions.Function<InfoType, Pair<InfoType, Boolean>>() {
@Override
public Pair<InfoType, Boolean> apply(InfoType type) throws Exception {
Pair<InfoType, Boolean> pair = Pair.create(type, DataBaseHelper.permissionGranted(InfoType.toPermission(type), context));
return pair;
}
})
.filter(new Predicate<Pair<InfoType, Boolean>>() {
@Override
public boolean test(Pair<InfoType, Boolean> pair) throws Exception {
return pair.second;
}
})
.map(new io.reactivex.functions.Function<Pair<InfoType, Boolean>, CollectInfoEntity>() {
@Override
public CollectInfoEntity apply(Pair<InfoType, Boolean> pair) throws Exception {
return Collector.getStoreEntity(pair.first, context, null);
}
})
.subscribe(new Consumer<CollectInfoEntity>() {
@Override
public void accept(CollectInfoEntity collect) throws Exception {
if (collect != null) {
collect.saveOrUpdate("type=?", collect.getType());
}
}
});
}
/**
* 查询指定类型的数据
*/
public static CollectInfoEntity getStoreEntity(InfoType type, Context context, List<ContactEntity> contactList) {
......
package com.common.bean;
import org.litepal.crud.LitePalSupport;
public class CollectInfoEntity extends LitePalSupport {
public class CollectInfoEntity {
private String type;
private String body;
private long update_time;
......@@ -39,11 +38,6 @@ public class CollectInfoEntity extends LitePalSupport {
&& entity instanceof CollectInfoEntity
&& ((CollectInfoEntity)entity).getType() != null && type.equals(((CollectInfoEntity)entity).getType());
}
@Override
public int hashCode(){
return type.hashCode();
}
@Override
public String toString() {
......
......@@ -15,10 +15,8 @@ import com.scwang.smartrefresh.layout.api.RefreshFooter;
import com.scwang.smartrefresh.layout.api.RefreshHeader;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.footer.ClassicsFooter;
import com.scwang.smartrefresh.layout.header.ClassicsHeader;
import org.litepal.LitePal;
//SDK-TD-START
import cn.fraudmetrix.octopus.aspirit.main.OctopusManager;
......@@ -124,8 +122,6 @@ public class LibConfig {
//屏幕适配(360dp宽度限定)
ScreenAutoSize.resizeDensity(CONTEXT, 360f);
LitePal.initialize(CONTEXT);
SQLiteDatabase db = LitePal.getDatabase();
//上传工具
UploadManager.init(CONTEXT);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment