taxiapp-kotlon-yzd
This commit is contained in:
commit
ad6a3ec2b7
|
@ -0,0 +1 @@
|
||||||
|
/build
|
|
@ -0,0 +1,184 @@
|
||||||
|
apply plugin: 'com.android.application'
|
||||||
|
apply plugin: 'kotlin-android'
|
||||||
|
apply plugin: 'kotlin-android-extensions'
|
||||||
|
apply plugin: 'kotlin-kapt'
|
||||||
|
apply plugin: 'org.greenrobot.greendao' // 添加应用依赖插件
|
||||||
|
|
||||||
|
android {
|
||||||
|
signingConfigs {
|
||||||
|
releaseSoft {
|
||||||
|
storeFile file("../taxiApp.jks")
|
||||||
|
storePassword '123456'
|
||||||
|
keyAlias 'taxi'
|
||||||
|
keyPassword '123456'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
compileSdkVersion 29
|
||||||
|
buildToolsVersion "29.0.2"
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
applicationId "net.sysolution.taxiapp"
|
||||||
|
minSdkVersion 21
|
||||||
|
targetSdkVersion 29
|
||||||
|
versionCode 146
|
||||||
|
versionName "3.3.3-beta23-release"
|
||||||
|
|
||||||
|
//alphaxx - 预览版本,不会对外发布,由测试人员测试,会有很多bug
|
||||||
|
//Betaxx - 公开测试版本,会发给其他工作人员,会有较多版本
|
||||||
|
//rcxx - 最终测试版本,基本稳定,如果没发现其他bug就转正式
|
||||||
|
|
||||||
|
//3.1.0第一次启动会删除之前的广告
|
||||||
|
//3.1.1关闭第一次启动会删除之前的广告
|
||||||
|
//3.1.10 发送异常并写入日志
|
||||||
|
//3.2.0开机直接播放广告
|
||||||
|
|
||||||
|
|
||||||
|
//333-10 去掉crashHandler
|
||||||
|
//333-11 去掉KuroLog日志
|
||||||
|
|
||||||
|
//333-20 转凭证conn没被改到问题
|
||||||
|
//333-21 下载素材时去掉isdownloading的判断
|
||||||
|
|
||||||
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|
||||||
|
// Enabling multidex support.
|
||||||
|
multiDexEnabled true
|
||||||
|
|
||||||
|
signingConfig signingConfigs.releaseSoft
|
||||||
|
|
||||||
|
ndk {
|
||||||
|
abiFilters "armeabi", "armeabi-v7a", "x86", "mips"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
|
signingConfig signingConfigs.releaseSoft
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
debug {
|
||||||
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
|
signingConfig signingConfigs.releaseSoft
|
||||||
|
// resValue("string", "DB_PASSWORD_APP_SHARED_PREFERENCES", "66399266")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlinOptions {
|
||||||
|
jvmTarget = "1.8"
|
||||||
|
}
|
||||||
|
|
||||||
|
android.applicationVariants.all { variant ->
|
||||||
|
variant.outputs.all { output ->
|
||||||
|
def outputFile = output.outputFile
|
||||||
|
if (outputFile != null && outputFile.name.endsWith('.apk')) {
|
||||||
|
outputFileName = "TaxiApp_v${defaultConfig.versionName}{${defaultConfig.versionCode}}.apk"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//每升级一次数据库加一
|
||||||
|
greendao {
|
||||||
|
schemaVersion 35
|
||||||
|
daoPackage 'cn.trans88.taxiappkotlin.logic.dao'
|
||||||
|
targetGenDir 'src/main/java'
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation fileTree(dir: 'libs', include: ['*.jar','*.aar'])
|
||||||
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||||
|
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||||
|
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||||
|
implementation "androidx.core:core-ktx:$core_ktx"
|
||||||
|
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
||||||
|
testImplementation 'junit:junit:4.12'
|
||||||
|
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||||
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||||
|
//xixun
|
||||||
|
implementation files('libs/xixun_card_settings_1.2.4.jar')
|
||||||
|
//
|
||||||
|
// implementation 'com.trs.kuroTool:kuroTool:1.0.4'
|
||||||
|
implementation project(':kurotool')
|
||||||
|
|
||||||
|
//kotlin协程
|
||||||
|
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.3'
|
||||||
|
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3'
|
||||||
|
|
||||||
|
//stetho调试
|
||||||
|
implementation 'com.facebook.stetho:stetho:1.5.1'
|
||||||
|
//网络调试数据库
|
||||||
|
implementation 'com.amitshekhar.android:debug-db:1.0.6'
|
||||||
|
|
||||||
|
//logger
|
||||||
|
implementation 'com.orhanobut:logger:2.2.0'
|
||||||
|
|
||||||
|
//json解析
|
||||||
|
implementation 'com.squareup.retrofit2:converter-gson:2.7.1'
|
||||||
|
implementation 'com.alibaba:fastjson:1.2.46'
|
||||||
|
implementation 'com.alibaba:fastjson:1.2.46.android'
|
||||||
|
|
||||||
|
//Glide
|
||||||
|
implementation 'com.github.bumptech.glide:glide:4.10.0'
|
||||||
|
kapt 'com.github.bumptech.glide:compiler:4.10.0'
|
||||||
|
// annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0'
|
||||||
|
|
||||||
|
//xy
|
||||||
|
implementation 'com.github.xy02:ARxLib:0.1.5'
|
||||||
|
|
||||||
|
//Greendao数据库
|
||||||
|
//implementation 'org.greenrobot:greendao:3.2.2'
|
||||||
|
implementation 'org.greenrobot:greendao:3.3.0'
|
||||||
|
implementation 'com.github.yuweiguocn:GreenDaoUpgradeHelper:v2.2.1'
|
||||||
|
|
||||||
|
//下载
|
||||||
|
implementation 'com.liulishuo.filedownloader:library:1.7.5'
|
||||||
|
|
||||||
|
//jetpack
|
||||||
|
// implementation 'androidx.lifecycle:lifecycle-viewmodel:2.2.0'
|
||||||
|
//room
|
||||||
|
implementation 'androidx.room:room-runtime:2.2.5'//room
|
||||||
|
kapt "androidx.room:room-compiler:2.2.5"
|
||||||
|
|
||||||
|
|
||||||
|
//lifecycle协程
|
||||||
|
implementation "androidx.lifecycle:lifecycle-livedata-core-ktx:$livedata"
|
||||||
|
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$livedata"
|
||||||
|
implementation "androidx.lifecycle:lifecycle-reactivestreams-ktx:$livedata"
|
||||||
|
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$livedata"
|
||||||
|
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$livedata"
|
||||||
|
|
||||||
|
//权限申请
|
||||||
|
implementation 'com.permissionx.guolindev:permissionx:1.1.1'
|
||||||
|
|
||||||
|
//timber
|
||||||
|
implementation 'com.jakewharton.timber:timber:4.7.1'
|
||||||
|
|
||||||
|
//他人库
|
||||||
|
implementation 'com.github.joeyupdo:YJTools:v1.0.5'
|
||||||
|
//jwt解析
|
||||||
|
implementation 'io.jsonwebtoken:jjwt:0.9.1'
|
||||||
|
|
||||||
|
|
||||||
|
implementation 'net.zetetic:android-database-sqlcipher:3.5.7@aar'
|
||||||
|
|
||||||
|
//ljkPlayer
|
||||||
|
// implementation 'tv.danmaku.ijk.media:ijkplayer-java:0.8.8'
|
||||||
|
// implementation 'tv.danmaku.ijk.media:ijkplayer-armv7a:0.8.8'
|
||||||
|
// implementation 'tv.danmaku.ijk.media:ijkplayer-exo:0.8.8'
|
||||||
|
|
||||||
|
// //exo
|
||||||
|
// implementation 'com.google.android.exoplayer:exoplayer:2.8.1'
|
||||||
|
|
||||||
|
implementation 'com.github.Trans88:KuroLibrary:0.1.3'
|
||||||
|
}
|
Binary file not shown.
|
@ -0,0 +1,264 @@
|
||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# You can control the set of applied configuration files using the
|
||||||
|
# proguardFiles setting in build.gradle.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# If your project uses WebView with JS, uncomment the following
|
||||||
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
|
# class:
|
||||||
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
|
# public *;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Uncomment this to preserve the line number information for
|
||||||
|
# debugging stack traces.
|
||||||
|
#-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
||||||
|
# If you keep the line number information, uncomment this to
|
||||||
|
# hide the original source file name.
|
||||||
|
#-renamesourcefileattribute SourceFile
|
||||||
|
|
||||||
|
-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
|
public *;
|
||||||
|
}
|
||||||
|
#webView js调用不混淆,否则取不到数据
|
||||||
|
-keepclassmembers class com.zyp.ui.WebActivity$* {
|
||||||
|
<methods>;
|
||||||
|
}
|
||||||
|
|
||||||
|
#shrink,测试后发现会将一些无效代码给移除,即没有被显示调用的代码,该选项 表示 不启用 shrink。
|
||||||
|
#-dontshrink
|
||||||
|
#指定重新打包,所有包重命名,这个选项会进一步模糊包名,将包里的类混淆成n个再重新打包到一个个的package中
|
||||||
|
#-flattenpackagehierarchy
|
||||||
|
#优化时允许访问并修改有修饰符的类和类的成员
|
||||||
|
-allowaccessmodification
|
||||||
|
#不跳过(混淆) jars中的 非public classes 默认选项
|
||||||
|
-dontskipnonpubliclibraryclassmembers
|
||||||
|
#忽略警告
|
||||||
|
-ignorewarnings
|
||||||
|
#指定代码的压缩级别
|
||||||
|
-optimizationpasses 5
|
||||||
|
#不使用大小写混合类名
|
||||||
|
-dontusemixedcaseclassnames
|
||||||
|
#不去忽略非公共的库类
|
||||||
|
-dontskipnonpubliclibraryclasses
|
||||||
|
#不启用优化 不优化输入的类文件
|
||||||
|
-dontoptimize
|
||||||
|
#不预校验
|
||||||
|
-dontpreverify
|
||||||
|
#混淆时是否记录日志
|
||||||
|
-verbose
|
||||||
|
#混淆时所采用的算法
|
||||||
|
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
|
||||||
|
#保护注解
|
||||||
|
-renamesourcefileattribute SourceFile
|
||||||
|
#保持源文件和行号的信息,用于混淆后定位错误位置
|
||||||
|
-keepattributes SourceFile,LineNumberTable
|
||||||
|
#保持含有Annotation字符串的 attributes
|
||||||
|
-keepattributes *Annotation*
|
||||||
|
#过滤泛型
|
||||||
|
-keepattributes Signature
|
||||||
|
-keepattributes Exceptions,InnerClasses
|
||||||
|
|
||||||
|
-dontwarn org.apache.**
|
||||||
|
-dontwarn android.support.**
|
||||||
|
|
||||||
|
#基础配置
|
||||||
|
# 保持哪些类不被混淆
|
||||||
|
# 系统组件
|
||||||
|
-keep public class * extends android.app.Fragment
|
||||||
|
-keep public class * extends android.app.Activity
|
||||||
|
-keep public class * extends android.app.Application
|
||||||
|
-keep public class * extends android.app.Service
|
||||||
|
-keep public class * extends android.content.BroadcastReceiver
|
||||||
|
-keep public class * extends android.content.ContentProvider
|
||||||
|
-keep public class * extends android.app.backup.BackupAgentHelper
|
||||||
|
-keep public class * extends android.preference.Preference
|
||||||
|
-keep public class com.android.vending.licensing.ILicensingService
|
||||||
|
#如果有引用v4包可以添加下面这行
|
||||||
|
#-keep public class * extends android.support.v4.app.Fragment
|
||||||
|
#自定义View
|
||||||
|
-keep public class * extends android.view.View
|
||||||
|
# V4,V7
|
||||||
|
-keep class android.support.constraint.**{ *; }
|
||||||
|
#-keep class android.support.v4.**{ *; }
|
||||||
|
-keep class android.support.v7.**{ *; }
|
||||||
|
-keep class android.webkit.**{*;}
|
||||||
|
-keep interface android.support.v4.app.** { *; }
|
||||||
|
#保持 本化方法及其类声明
|
||||||
|
-keepclasseswithmembers class * {
|
||||||
|
native <methods>;
|
||||||
|
}
|
||||||
|
#保持view的子类成员: getter setter
|
||||||
|
-keepclassmembers public class * extends android.view.View {
|
||||||
|
void set*(***);
|
||||||
|
*** get*();
|
||||||
|
}
|
||||||
|
#保持Activity的子类成员:参数为一个View类型的方法 如setContentView(View v)
|
||||||
|
-keepclassmembers class * extends android.app.Activity {
|
||||||
|
public void *(android.view.View);
|
||||||
|
}
|
||||||
|
#保持枚举类的成员:values方法和valueOf (每个enum 类都默认有这两个方法)
|
||||||
|
-keepclassmembers enum * {
|
||||||
|
public static **[] values();
|
||||||
|
public static ** valueOf(java.lang.String);
|
||||||
|
}
|
||||||
|
#保持Parcelable的实现类和它的成员:类型为android.os.Parcelable$Creator 名字任意的 属性
|
||||||
|
-keep class * implements android.os.Parcelable {
|
||||||
|
public static final android.os.Parcelable$Creator *;
|
||||||
|
}
|
||||||
|
#保持 任意包名.R类的类成员属性。 即保护R文件中的属性名不变
|
||||||
|
-keepclassmembers class **.R$* {
|
||||||
|
public static <fields>;
|
||||||
|
}
|
||||||
|
|
||||||
|
# 记录生成的日志数据,在 proguard 目录下
|
||||||
|
|
||||||
|
-dump class_files.txt
|
||||||
|
|
||||||
|
-printseeds seeds.txt
|
||||||
|
|
||||||
|
-printusage unused.txt
|
||||||
|
|
||||||
|
-printmapping mapping.txt
|
||||||
|
|
||||||
|
|
||||||
|
-keepclasseswithmembernames class * {
|
||||||
|
native <methods>;
|
||||||
|
}
|
||||||
|
|
||||||
|
-keepclasseswithmembers class * {
|
||||||
|
public <init>(android.content.Context, android.util.AttributeSet);
|
||||||
|
}
|
||||||
|
|
||||||
|
-keepclasseswithmembers class * {
|
||||||
|
public <init>(android.content.Context, android.util.AttributeSet, int);
|
||||||
|
}
|
||||||
|
|
||||||
|
-keepclassmembers class * extends android.app.Activity {
|
||||||
|
public void *(android.view.View);
|
||||||
|
}
|
||||||
|
|
||||||
|
-keepclassmembers enum * {
|
||||||
|
public static **[] values();
|
||||||
|
public static ** valueOf(java.lang.String);
|
||||||
|
}
|
||||||
|
|
||||||
|
-keep class * implements android.os.Parcelable {
|
||||||
|
public static final android.os.Parcelable$Creator *;
|
||||||
|
}
|
||||||
|
-keepnames class * implements android.os.Parcelable {
|
||||||
|
public static final ** CREATOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
-dontwarn java.util.**
|
||||||
|
-keep class java.util.** {*; }
|
||||||
|
|
||||||
|
-dontwarn org.apache.http.**
|
||||||
|
-keep class org.apache.http.** {*; }
|
||||||
|
|
||||||
|
-keepclassmembers class * implements java.io.Serializable {
|
||||||
|
static final long serialVersionUID;
|
||||||
|
private static final java.io.ObjectStreamField[] serialPersistentFields;
|
||||||
|
private void writeObject(java.io.ObjectOutputStream);
|
||||||
|
private void readObject(java.io.ObjectInputStream);
|
||||||
|
java.lang.Object writeReplace();
|
||||||
|
java.lang.Object readResolve();
|
||||||
|
}
|
||||||
|
|
||||||
|
-keep public class * implements java.io.Serializable {*;}
|
||||||
|
|
||||||
|
-keepclassmembers class **.R$* {
|
||||||
|
public static <fields>;
|
||||||
|
}
|
||||||
|
|
||||||
|
# GreenDao
|
||||||
|
-keepclassmembers class * extends org.greenrobot.greendao.AbstractDao {
|
||||||
|
public static java.lang.String TABLENAME;
|
||||||
|
}
|
||||||
|
-keep class **$Properties
|
||||||
|
|
||||||
|
# If you do not use SQLCipher:
|
||||||
|
-dontwarn org.greenrobot.greendao.database.**
|
||||||
|
# If you do not use Rx:
|
||||||
|
-dontwarn rx.**
|
||||||
|
|
||||||
|
# Picasso
|
||||||
|
-dontwarn com.squareup.okhttp.**
|
||||||
|
|
||||||
|
# okHttp
|
||||||
|
-dontwarn okhttp3.**
|
||||||
|
-dontwarn okio.**
|
||||||
|
-dontwarn javax.annotation.**
|
||||||
|
|
||||||
|
# A resource is loaded with a relative path so the package of this class must be preserved.
|
||||||
|
-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase
|
||||||
|
|
||||||
|
# Glide
|
||||||
|
-keep public class * implements com.bumptech.glide.module.GlideModule
|
||||||
|
#-keep public class * extends com.bumptech.glide.module.AppGlideModule
|
||||||
|
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
|
||||||
|
**[] $VALUES;
|
||||||
|
public *;
|
||||||
|
}
|
||||||
|
|
||||||
|
# ======================= activation.jar =============================
|
||||||
|
-dontwarn javax.activation.**
|
||||||
|
-keep class javax.activation.**{*;}
|
||||||
|
-dontwarn com.sun.activation.registries.**
|
||||||
|
-keep class com.sun.activation.registries.**{*;}
|
||||||
|
|
||||||
|
# ======================= additionnal.jar ============================
|
||||||
|
-dontwarn myjava.awt.datatransfer.**
|
||||||
|
-keep class myjava.awt.datatransfer.**{*;}
|
||||||
|
-dontwarn org.apache.harmony.**
|
||||||
|
-keep class org.apache.harmony.**{*;}
|
||||||
|
|
||||||
|
# ======================= RxAndroid,RxJava ===========================
|
||||||
|
-dontwarn sun.misc.**
|
||||||
|
-keepclassmembers class rx.internal.util.unsafe.*ArrayQueue*Field* {
|
||||||
|
long producerIndex;
|
||||||
|
long consumerIndex;
|
||||||
|
}
|
||||||
|
-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef {
|
||||||
|
rx.internal.util.atomic.LinkedQueueNode producerNode;
|
||||||
|
}
|
||||||
|
-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueConsumerNodeRef {
|
||||||
|
rx.internal.util.atomic.LinkedQueueNode consumerNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
# ======================= arxlib =====================================
|
||||||
|
-dontwarn com.github.xy02.arxlib.**
|
||||||
|
-keep class com.github.xy02.arxlib.**{*;}
|
||||||
|
|
||||||
|
# ======================= mail.jar ===================================
|
||||||
|
-keep class com.sun.mail.**{*;}
|
||||||
|
-keep class javax.mail.**{*;}
|
||||||
|
|
||||||
|
# ======================= TaxiApp Keep ================================
|
||||||
|
-keep class net.sysolution.taxiapp.localserver.**{*;}
|
||||||
|
|
||||||
|
-keepclassmembers class * extends org.greenrobot.greendao.AbstractDao {
|
||||||
|
public static void dropTable(org.greenrobot.greendao.database.Database, boolean);
|
||||||
|
public static void createTable(org.greenrobot.greendao.database.Database, boolean);
|
||||||
|
}
|
||||||
|
|
||||||
|
# ======================= GSYVideoPlayer ================================
|
||||||
|
-keep class com.shuyu.gsyvideoplayer.video.** { *; }
|
||||||
|
-dontwarn com.shuyu.gsyvideoplayer.video.**
|
||||||
|
-keep class com.shuyu.gsyvideoplayer.video.base.** { *; }
|
||||||
|
-dontwarn com.shuyu.gsyvideoplayer.video.base.**
|
||||||
|
-keep class com.shuyu.gsyvideoplayer.utils.** { *; }
|
||||||
|
-dontwarn com.shuyu.gsyvideoplayer.utils.**
|
||||||
|
-keep class tv.danmaku.ijk.** { *; }
|
||||||
|
-dontwarn tv.danmaku.ijk.**
|
||||||
|
|
||||||
|
-keep public class * extends android.view.View{
|
||||||
|
*** get*();
|
||||||
|
void set*(***);
|
||||||
|
public <init>(android.content.Context);
|
||||||
|
public <init>(android.content.Context, android.util.AttributeSet);
|
||||||
|
public <init>(android.content.Context, android.util.AttributeSet, int);
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,24 @@
|
||||||
|
package cn.trans88.taxiappkotlin
|
||||||
|
|
||||||
|
import androidx.test.platform.app.InstrumentationRegistry
|
||||||
|
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||||
|
|
||||||
|
import org.junit.Test
|
||||||
|
import org.junit.runner.RunWith
|
||||||
|
|
||||||
|
import org.junit.Assert.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instrumented test, which will execute on an Android device.
|
||||||
|
*
|
||||||
|
* See [testing documentation](http://d.android.com/tools/testing).
|
||||||
|
*/
|
||||||
|
@RunWith(AndroidJUnit4::class)
|
||||||
|
class ExampleInstrumentedTest {
|
||||||
|
@Test
|
||||||
|
fun useAppContext() {
|
||||||
|
// Context of the app under test.
|
||||||
|
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||||
|
assertEquals("cn.trans88.taxiappkotlin", appContext.packageName)
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,74 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="cn.trans88.taxiappkotlin">
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <!-- gps定位权限 -->
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <!-- 允许读取电话状态SIM的权限 -->
|
||||||
|
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:name=".TaxiApp"
|
||||||
|
android:allowBackup="true"
|
||||||
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:largeHeap="true"
|
||||||
|
android:networkSecurityConfig="@xml/network_security_config"
|
||||||
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
|
android:supportsRtl="true"
|
||||||
|
android:theme="@style/AppStartLoadTranslucent">
|
||||||
|
<receiver
|
||||||
|
android:name=".logic.gps.GpsReceiver"
|
||||||
|
android:enabled="true"
|
||||||
|
android:exported="true"></receiver>
|
||||||
|
|
||||||
|
<service
|
||||||
|
android:name=".service.RebootService"
|
||||||
|
android:enabled="true"
|
||||||
|
android:exported="true" />
|
||||||
|
<service
|
||||||
|
android:name=".aidl.localserver.TaxiServiceAIDL"
|
||||||
|
android:enabled="true"
|
||||||
|
android:exported="true">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="net.sysolution.taxiapp.TAXI_SERVICE_AIDL" />
|
||||||
|
</intent-filter>
|
||||||
|
</service>
|
||||||
|
<service android:name=".ui.play.PlayServer" />
|
||||||
|
|
||||||
|
<receiver
|
||||||
|
android:name=".BootBroadcast"
|
||||||
|
android:enabled="true"
|
||||||
|
android:exported="true">
|
||||||
|
<intent-filter android:priority="2147483647">
|
||||||
|
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||||
|
<action android:name="com.xixun.joey.cardsystem.ENTRY" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.HOME" />
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
<receiver android:name=".logic.network.NetworkReceiver">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".ui.play.PlayActivity"
|
||||||
|
android:configChanges="mcc|mnc|locale|layoutDirection|keyboard|keyboardHidden|orientation|screenSize"
|
||||||
|
android:launchMode="singleTask">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<!-- <category android:name="android.intent.category.HOME"/> -->
|
||||||
|
<!-- <category android:name="android.intent.category.DEFAULT"/> -->
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
</application>
|
||||||
|
|
||||||
|
</manifest>
|
|
@ -0,0 +1,8 @@
|
||||||
|
// IAlotServicr.aidl
|
||||||
|
package com.trs88.asproj.alotservice;
|
||||||
|
|
||||||
|
// Declare any non-default types here with import statements
|
||||||
|
|
||||||
|
interface IAlotServicr {
|
||||||
|
void setAlotInfo(String alotInfo);
|
||||||
|
}
|
|
@ -0,0 +1,2 @@
|
||||||
|
package com.xixun.contract.model;
|
||||||
|
parcelable TaskToKeepScreenOn;
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.xixun.lay.safe;
|
||||||
|
|
||||||
|
// Declare any non-default types here with import statements
|
||||||
|
|
||||||
|
interface Safe {
|
||||||
|
/**
|
||||||
|
* safe加密定制aidl
|
||||||
|
*/
|
||||||
|
//安全SDK接口初始化
|
||||||
|
int init();
|
||||||
|
//设置日志打印等级
|
||||||
|
void setLogLevel(int logLevel);
|
||||||
|
//获取当前安全SDK的版本信息
|
||||||
|
int getSdkVersion();
|
||||||
|
//获取当前安全通信连接状态
|
||||||
|
int getSafeConnectState();
|
||||||
|
//与网关服务器建立安全通道
|
||||||
|
int createSafeConnect(String url);
|
||||||
|
//关闭与网关服务器建立的安全通道
|
||||||
|
int destroySafeConnect();
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
package com.xixun.xy.conn.aidl;
|
||||||
|
|
||||||
|
interface ConnService {
|
||||||
|
String getServerURL();
|
||||||
|
boolean setServerURL(String value);
|
||||||
|
String getCompanyId();
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,2 @@
|
||||||
|
package com.xixun.xy.conn.aidl;
|
||||||
|
parcelable FpgaInfo;
|
|
@ -0,0 +1,9 @@
|
||||||
|
//ITaxiListener.aidl
|
||||||
|
package net.sysolution.taxiapp;
|
||||||
|
|
||||||
|
interface ITaxiListener {
|
||||||
|
// Returns the JSON string of the response result
|
||||||
|
void onSuccess(String successJson);
|
||||||
|
// Return error string
|
||||||
|
void onError(String errorMessage);
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
// ITaxiService.aidl
|
||||||
|
package net.sysolution.taxiapp;
|
||||||
|
|
||||||
|
import net.sysolution.taxiapp.ITaxiListener;
|
||||||
|
|
||||||
|
// Declare any non-default types here with import statements
|
||||||
|
interface ITaxiService {
|
||||||
|
void excute(String jsonCommand, ITaxiListener listener);
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package cn.trans88.taxiappkotlin
|
||||||
|
|
||||||
|
import android.content.BroadcastReceiver
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import cn.trans88.taxiappkotlin.ui.play.PlayActivity
|
||||||
|
import cn.trans88.taxiappkotlin.util.YoungUtil
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统启动广告唤醒activity
|
||||||
|
*/
|
||||||
|
class BootBroadcast : BroadcastReceiver() {
|
||||||
|
|
||||||
|
override fun onReceive(context: Context, intent: Intent) {
|
||||||
|
val action = intent.action
|
||||||
|
YoungUtil.YoungLog("BootBroadcast收到开机广播")
|
||||||
|
if (null != action && action == Intent.ACTION_BOOT_COMPLETED) {
|
||||||
|
/*
|
||||||
|
val startActivity = Intent(context, PlayActivity::class.java)
|
||||||
|
startActivity.setPackage(context.packageName)
|
||||||
|
startActivity.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
|
context.startActivity(startActivity)
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,326 @@
|
||||||
|
package cn.trans88.taxiappkotlin;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import cn.trans88.taxiappkotlin.util.YoungUtil;
|
||||||
|
|
||||||
|
public class Configurations {
|
||||||
|
private Context context;
|
||||||
|
|
||||||
|
private static Configurations cfg;
|
||||||
|
private Configurations(Context c){
|
||||||
|
context = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Configurations config(Context c){
|
||||||
|
if(cfg == null)
|
||||||
|
cfg = new Configurations(c);
|
||||||
|
return cfg;
|
||||||
|
}
|
||||||
|
|
||||||
|
//将老的cn.trans88.taxiappkotlin.logic.Settings
|
||||||
|
public void init(){
|
||||||
|
boolean init = context.getSharedPreferences("config", Context.MODE_PRIVATE).getBoolean("init", false);
|
||||||
|
if(init) return;
|
||||||
|
|
||||||
|
boolean firstReg = context.getSharedPreferences("cn.trans88.taxiappkotlin.logic.Settings", Context.MODE_PRIVATE).getBoolean("isFirstRegister", true);
|
||||||
|
if(firstReg){
|
||||||
|
YoungUtil.YoungLog("first register");
|
||||||
|
YoungUtil.YoungLog("cannot read file :cn.trans88.taxiappkotlin.logic.Settings");
|
||||||
|
registerTokenSave("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50X2lkIjoiNWY4OTNiODE1NzIzMDk0YWQzZmM5MTI0IiwiZ3JvdXBfaWQiOiI1Zjg5M2I4MTU3MjMwOTRhZDNmYzkxMjYiLCJ1c2VyX2lkIjoiNWY4OTNiODE1NzIzMDk0YWQzZmM5MTI1In0.o2M6CE2yFi7dvjILb485sQF436eMDdKwzTryK4rw3W0");
|
||||||
|
appTokenSave("");
|
||||||
|
companySave(TaxiApp.Companion.getSANLE());
|
||||||
|
syncSave(true);
|
||||||
|
logServiceUrlSave("http://taxihub.cn:2348/");
|
||||||
|
connServiceUrlSave("");
|
||||||
|
screenSizeXSave(160);
|
||||||
|
screenSizeYSave(64);
|
||||||
|
taxiInfoSave("");
|
||||||
|
cardIdSave( "");
|
||||||
|
taxiServiceUrlSave( "");
|
||||||
|
downloadUrlSave( "");
|
||||||
|
accountIdSave( "");
|
||||||
|
taxiBaseUrlSave("http://taxihub.cn:2346/");
|
||||||
|
isDeleteOldAdvitiseSave( false);
|
||||||
|
isFirstRegisterSave(true);
|
||||||
|
enableWriteLogSave( false);
|
||||||
|
advertiseOrderSave( "");
|
||||||
|
loggerSwitchSave(true);
|
||||||
|
gpsSwitchSave(true);
|
||||||
|
upload_debug_file_urlSave("http://taxihub.cn:2345/postDebugFile");
|
||||||
|
}else{
|
||||||
|
YoungUtil.YoungLog("copy configurations");
|
||||||
|
YoungUtil.YoungLog("read file :cn.trans88.taxiappkotlin.logic.Settings OK");
|
||||||
|
String registerToken = context.getSharedPreferences("cn.trans88.taxiappkotlin.logic.Settings", Context.MODE_PRIVATE).getString("registerToken", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50X2lkIjoiNWY4OTNiODE1NzIzMDk0YWQzZmM5MTI0IiwiZ3JvdXBfaWQiOiI1Zjg5M2I4MTU3MjMwOTRhZDNmYzkxMjYiLCJ1c2VyX2lkIjoiNWY4OTNiODE1NzIzMDk0YWQzZmM5MTI1In0.o2M6CE2yFi7dvjILb485sQF436eMDdKwzTryK4rw3W0");
|
||||||
|
String appToken = context.getSharedPreferences("cn.trans88.taxiappkotlin.logic.Settings", Context.MODE_PRIVATE).getString("appToken", "");
|
||||||
|
String company = context.getSharedPreferences("cn.trans88.taxiappkotlin.logic.Settings", Context.MODE_PRIVATE).getString("company", TaxiApp.Companion.getSANLE());
|
||||||
|
boolean sync = context.getSharedPreferences("cn.trans88.taxiappkotlin.logic.Settings", Context.MODE_PRIVATE).getBoolean("sync", true);
|
||||||
|
String logServiceUrl = context.getSharedPreferences("cn.trans88.taxiappkotlin.logic.Settings", Context.MODE_PRIVATE).getString("logServiceUrl", "http://taxihub.cn:2348/");
|
||||||
|
String connServiceUrl = context.getSharedPreferences("cn.trans88.taxiappkotlin.logic.Settings", Context.MODE_PRIVATE).getString("connServiceUrl", "");
|
||||||
|
int x = context.getSharedPreferences("cn.trans88.taxiappkotlin.logic.Settings", Context.MODE_PRIVATE).getInt("screenSizeX", 160);
|
||||||
|
int y = context.getSharedPreferences("cn.trans88.taxiappkotlin.logic.Settings", Context.MODE_PRIVATE).getInt("screenSizeY", 64);
|
||||||
|
String taxiInfo = context.getSharedPreferences("cn.trans88.taxiappkotlin.logic.Settings", Context.MODE_PRIVATE).getString("taxiInfo", "");
|
||||||
|
String cardId = context.getSharedPreferences("cn.trans88.taxiappkotlin.logic.Settings", Context.MODE_PRIVATE).getString("cardId", "");
|
||||||
|
String taxiServiceUrl = context.getSharedPreferences("cn.trans88.taxiappkotlin.logic.Settings", Context.MODE_PRIVATE).getString("taxiServiceUrl", "");
|
||||||
|
String downloadUrl = context.getSharedPreferences("cn.trans88.taxiappkotlin.logic.Settings", Context.MODE_PRIVATE).getString("downloadUrl", "");
|
||||||
|
String accountId = context.getSharedPreferences("cn.trans88.taxiappkotlin.logic.Settings", Context.MODE_PRIVATE).getString("accountId", "");
|
||||||
|
String taxiBaseUrl = context.getSharedPreferences("cn.trans88.taxiappkotlin.logic.Settings", Context.MODE_PRIVATE).getString("taxiBaseUrl", "http://taxihub.cn:2346/");
|
||||||
|
boolean isDeleteOldAdvitise = context.getSharedPreferences("cn.trans88.taxiappkotlin.logic.Settings", Context.MODE_PRIVATE).getBoolean("isDeleteOldAdvitise", false);
|
||||||
|
boolean isFirstRegister = context.getSharedPreferences("cn.trans88.taxiappkotlin.logic.Settings", Context.MODE_PRIVATE).getBoolean("isFirstRegister", true);
|
||||||
|
boolean enableWriteLog = context.getSharedPreferences("cn.trans88.taxiappkotlin.logic.Settings", Context.MODE_PRIVATE).getBoolean("enableWriteLog", false);
|
||||||
|
boolean loggerSwitch = context.getSharedPreferences("cn.trans88.taxiappkotlin.logic.Settings", Context.MODE_PRIVATE).getBoolean("loggerSwitch", true);
|
||||||
|
boolean gpsSwitch = context.getSharedPreferences("cn.trans88.taxiappkotlin.logic.Settings", Context.MODE_PRIVATE).getBoolean("gpsSwitch", true);
|
||||||
|
String upload_debug_file_url = context.getSharedPreferences("cn.trans88.taxiappkotlin.logic.Settings", Context.MODE_PRIVATE).getString("upload_debug_file_url", "http://taxihub.cn:2345/postDebugFile");
|
||||||
|
String advertiseOrder = context.getSharedPreferences("cn.trans88.taxiappkotlin.logic.Settings", Context.MODE_PRIVATE).getString("advertiseOrder", "");
|
||||||
|
|
||||||
|
/*YoungUtil.YoungLog("yzd", registerToken);
|
||||||
|
YoungUtil.YoungLog("yzd", appToken);
|
||||||
|
YoungUtil.YoungLog("yzd", company);
|
||||||
|
YoungUtil.YoungLog("yzd", "" +sync);
|
||||||
|
YoungUtil.YoungLog("yzd", logServiceUrl);
|
||||||
|
YoungUtil.YoungLog("yzd", connServiceUrl);
|
||||||
|
YoungUtil.YoungLog("yzd", "" +x);
|
||||||
|
YoungUtil.YoungLog("yzd", "" + y);
|
||||||
|
YoungUtil.YoungLog("yzd", taxiInfo);
|
||||||
|
YoungUtil.YoungLog("yzd", cardId);
|
||||||
|
YoungUtil.YoungLog("yzd", taxiServiceUrl);
|
||||||
|
YoungUtil.YoungLog("yzd", downloadUrl);
|
||||||
|
YoungUtil.YoungLog("yzd", accountId);
|
||||||
|
YoungUtil.YoungLog("yzd", taxiBaseUrl);
|
||||||
|
YoungUtil.YoungLog("yzd", "" + isDeleteOldAdvitise);
|
||||||
|
YoungUtil.YoungLog("yzd", "" + isFirstRegister);
|
||||||
|
YoungUtil.YoungLog("yzd", "" + enableWriteLog);
|
||||||
|
YoungUtil.YoungLog("yzd", advertiseOrder);
|
||||||
|
YoungUtil.YoungLog("yzd", "" + loggerSwitch);
|
||||||
|
YoungUtil.YoungLog("yzd", "" + gpsSwitch);
|
||||||
|
YoungUtil.YoungLog("yzd", "" + upload_debug_file_url);
|
||||||
|
*/
|
||||||
|
|
||||||
|
registerTokenSave(registerToken);
|
||||||
|
appTokenSave(appToken);
|
||||||
|
companySave(company);
|
||||||
|
syncSave(sync);
|
||||||
|
logServiceUrlSave(logServiceUrl);
|
||||||
|
connServiceUrlSave(connServiceUrl);
|
||||||
|
screenSizeXSave(x);
|
||||||
|
screenSizeYSave(y);
|
||||||
|
taxiInfoSave(taxiInfo);
|
||||||
|
cardIdSave(cardId);
|
||||||
|
taxiServiceUrlSave(taxiServiceUrl);
|
||||||
|
downloadUrlSave(downloadUrl);
|
||||||
|
accountIdSave(accountId);
|
||||||
|
taxiBaseUrlSave(taxiBaseUrl);
|
||||||
|
isDeleteOldAdvitiseSave(isDeleteOldAdvitise);
|
||||||
|
isFirstRegisterSave(isFirstRegister);
|
||||||
|
enableWriteLogSave(enableWriteLog);
|
||||||
|
advertiseOrderSave(advertiseOrder);
|
||||||
|
loggerSwitchSave(loggerSwitch);
|
||||||
|
gpsSwitchSave(gpsSwitch);
|
||||||
|
upload_debug_file_urlSave(upload_debug_file_url);
|
||||||
|
}
|
||||||
|
context.getSharedPreferences("config", Context.MODE_PRIVATE).edit().putBoolean("init", true).apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String registerToken(){
|
||||||
|
return context.getSharedPreferences("config", Context.MODE_PRIVATE).getString("registerToken", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50X2lkIjoiNWY4OTNiODE1NzIzMDk0YWQzZmM5MTI0IiwiZ3JvdXBfaWQiOiI1Zjg5M2I4MTU3MjMwOTRhZDNmYzkxMjYiLCJ1c2VyX2lkIjoiNWY4OTNiODE1NzIzMDk0YWQzZmM5MTI1In0.o2M6CE2yFi7dvjILb485sQF436eMDdKwzTryK4rw3W0");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void registerTokenSave(String s){
|
||||||
|
context.getSharedPreferences("config", Context.MODE_PRIVATE).edit().putString("registerToken", s).apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String appToken(){
|
||||||
|
return context.getSharedPreferences("config", Context.MODE_PRIVATE).getString("appToken", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void appTokenSave(String s){
|
||||||
|
context.getSharedPreferences("config", Context.MODE_PRIVATE).edit().putString("appToken", s).apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String company(){
|
||||||
|
return context.getSharedPreferences("config", Context.MODE_PRIVATE).getString("company", TaxiApp.Companion.getSANLE());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void companySave(String s){
|
||||||
|
context.getSharedPreferences("config", Context.MODE_PRIVATE).edit().putString("company", s).apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean sync(){
|
||||||
|
return context.getSharedPreferences("config", Context.MODE_PRIVATE).getBoolean("sync", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void syncSave(Boolean b){
|
||||||
|
context.getSharedPreferences("config", Context.MODE_PRIVATE).edit().putBoolean("sync", b).apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String logServiceUrl(){
|
||||||
|
return context.getSharedPreferences("config", Context.MODE_PRIVATE).getString("logServiceUrl", "http://taxihub.cn:2348/");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void logServiceUrlSave(String s){
|
||||||
|
context.getSharedPreferences("config", Context.MODE_PRIVATE).edit().putString("logServiceUrl", s).apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String connServiceUrl(){
|
||||||
|
return context.getSharedPreferences("config", Context.MODE_PRIVATE).getString("connServiceUrl", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void connServiceUrlSave(String s){
|
||||||
|
context.getSharedPreferences("config", Context.MODE_PRIVATE).edit().putString("connServiceUrl", s).apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int screenSizeX(){
|
||||||
|
return context.getSharedPreferences("config", Context.MODE_PRIVATE).getInt("screenSizeX", 160);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void screenSizeXSave(int x){
|
||||||
|
context.getSharedPreferences("config", Context.MODE_PRIVATE).edit().putInt("screenSizeX", x).apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int screenSizeY(){
|
||||||
|
return context.getSharedPreferences("config", Context.MODE_PRIVATE).getInt("screenSizeY", 64);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void screenSizeYSave(int y){
|
||||||
|
context.getSharedPreferences("config", Context.MODE_PRIVATE).edit().putInt("screenSizeY", y).apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String taxiInfo(){
|
||||||
|
return context.getSharedPreferences("config", Context.MODE_PRIVATE).getString("taxiInfo", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void taxiInfoSave(String s){
|
||||||
|
context.getSharedPreferences("config", Context.MODE_PRIVATE).edit().putString("taxiInfo", s).apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String cardId(){
|
||||||
|
return context.getSharedPreferences("config", Context.MODE_PRIVATE).getString("cardId", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void cardIdSave(String s){
|
||||||
|
context.getSharedPreferences("config", Context.MODE_PRIVATE).edit().putString("cardId", s).apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String taxiServiceUrl(){
|
||||||
|
return context.getSharedPreferences("config", Context.MODE_PRIVATE).getString("taxiServiceUrl", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void taxiServiceUrlSave(String s){
|
||||||
|
context.getSharedPreferences("config", Context.MODE_PRIVATE).edit().putString("taxiServiceUrl", s).apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String downloadUrl(){
|
||||||
|
return context.getSharedPreferences("config", Context.MODE_PRIVATE).getString("downloadUrl", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void downloadUrlSave(String s){
|
||||||
|
context.getSharedPreferences("config", Context.MODE_PRIVATE).edit().putString("downloadUrl", s).apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String accountId(){
|
||||||
|
return context.getSharedPreferences("config", Context.MODE_PRIVATE).getString("accountId", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void accountIdSave(String s){
|
||||||
|
context.getSharedPreferences("config", Context.MODE_PRIVATE).edit().putString("accountId", s).apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String taxiBaseUrl(){
|
||||||
|
return context.getSharedPreferences("config", Context.MODE_PRIVATE).getString("taxiBaseUrl", "http://taxihub.cn:2346/");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void taxiBaseUrlSave(String s){
|
||||||
|
context.getSharedPreferences("config", Context.MODE_PRIVATE).edit().putString("taxiBaseUrl", s).apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDeleteOldAdvitise(){
|
||||||
|
return context.getSharedPreferences("config", Context.MODE_PRIVATE).getBoolean("isDeleteOldAdvitise", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void isDeleteOldAdvitiseSave(boolean b){
|
||||||
|
context.getSharedPreferences("config", Context.MODE_PRIVATE).edit().putBoolean("isDeleteOldAdvitise", b).apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isFirstRegister(){
|
||||||
|
return context.getSharedPreferences("config", Context.MODE_PRIVATE).getBoolean("isFirstRegister", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void isFirstRegisterSave(boolean b){
|
||||||
|
context.getSharedPreferences("config", Context.MODE_PRIVATE).edit().putBoolean("isFirstRegister", b).apply();
|
||||||
|
}
|
||||||
|
public boolean enableWriteLog(){
|
||||||
|
return context.getSharedPreferences("config", Context.MODE_PRIVATE).getBoolean("enableWriteLog", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void enableWriteLogSave(boolean b){
|
||||||
|
context.getSharedPreferences("config", Context.MODE_PRIVATE).edit().putBoolean("enableWriteLog", b).apply();
|
||||||
|
}
|
||||||
|
public boolean loggerSwitch(){
|
||||||
|
return context.getSharedPreferences("config", Context.MODE_PRIVATE).getBoolean("loggerSwitch", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loggerSwitchSave(boolean b){
|
||||||
|
context.getSharedPreferences("config", Context.MODE_PRIVATE).edit().putBoolean("loggerSwitch", b).apply();
|
||||||
|
}
|
||||||
|
public boolean gpsSwitch(){
|
||||||
|
return context.getSharedPreferences("config", Context.MODE_PRIVATE).getBoolean("gpsSwitch", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void gpsSwitchSave(boolean b){
|
||||||
|
context.getSharedPreferences("config", Context.MODE_PRIVATE).edit().putBoolean("gpsSwitch", b).apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String advertiseOrder(){
|
||||||
|
return context.getSharedPreferences("config", Context.MODE_PRIVATE).getString("advertiseOrder", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void advertiseOrderSave(String s){
|
||||||
|
context.getSharedPreferences("config", Context.MODE_PRIVATE).edit().putString("advertiseOrder", s).apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String upload_debug_file_url(){
|
||||||
|
return context.getSharedPreferences("config", Context.MODE_PRIVATE).getString("upload_debug_file_url", "http://lichenplatform:2345/postDebugFile");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void upload_debug_file_urlSave(String s){
|
||||||
|
context.getSharedPreferences("config", Context.MODE_PRIVATE).edit().putString("upload_debug_file_url", s).apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
package cn.trans88.taxiappkotlin
|
||||||
|
|
||||||
|
import java.lang.Exception
|
||||||
|
|
||||||
|
sealed class Result
|
||||||
|
class Success(val msg:String):Result()
|
||||||
|
class Failure(val error:Exception):Result()
|
||||||
|
fun getResultMsg(result: Result) =when(result){
|
||||||
|
is Success ->result.msg
|
||||||
|
is Failure ->result.error.message
|
||||||
|
}
|
|
@ -0,0 +1,164 @@
|
||||||
|
package cn.trans88.taxiappkotlin
|
||||||
|
|
||||||
|
import android.app.Application
|
||||||
|
import android.content.Intent
|
||||||
|
import android.os.Build
|
||||||
|
import cn.trans88.kurotool.util.LogLevel
|
||||||
|
import cn.trans88.kurotool.util.LogUtil
|
||||||
|
import cn.trans88.taxiappkotlin.logic.exception.CrashHandler
|
||||||
|
import cn.trans88.taxiappkotlin.logic.network.JoeyDownloadManager
|
||||||
|
import cn.trans88.taxiappkotlin.net.BizInterceptor
|
||||||
|
import cn.trans88.taxiappkotlin.net.RetrofitCallFactory
|
||||||
|
import cn.trans88.taxiappkotlin.ui.play.PlayActivity
|
||||||
|
import cn.trans88.taxiappkotlin.ui.play.PlayServer
|
||||||
|
import cn.trans88.taxiappkotlin.util.YoungUtil
|
||||||
|
import com.facebook.stetho.Stetho
|
||||||
|
import com.trs88.kurolibrary.log.*
|
||||||
|
import com.trs88.kurolibrary.restful.KuroRestful
|
||||||
|
import com.trs88.kurolibrary.restful.retrofit.KuroApiFactory
|
||||||
|
import io.reactivex.plugins.RxJavaPlugins
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
|
||||||
|
class TaxiApp:Application() {
|
||||||
|
val TAG ="TaxiApp"
|
||||||
|
val poolSize =Runtime.getRuntime().availableProcessors()*2+1
|
||||||
|
|
||||||
|
companion object{
|
||||||
|
private var instance:Application? =null
|
||||||
|
fun instance() = instance!!
|
||||||
|
val XIXUN = "XIXUN";
|
||||||
|
val SANLE = "SANLE";
|
||||||
|
val HAOSHENG = "HAOSHENG";
|
||||||
|
val MAIDIER = "MAIDIER";
|
||||||
|
val isTest = false
|
||||||
|
val testCardid:String ="y60-a20-40919"
|
||||||
|
var isActive = false
|
||||||
|
var startSyncMode = false
|
||||||
|
// var isFirstRegister = true
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreate() {
|
||||||
|
super.onCreate()
|
||||||
|
instance =this
|
||||||
|
|
||||||
|
//add by yzd @20211130 用config替换原有的配置文件
|
||||||
|
Configurations.config(this).init();
|
||||||
|
//初始化异常捕捉 //yzd 注释于20211110
|
||||||
|
CrashHandler.getInstance(this).setInfo("熙讯ID", Configurations.config(TaxiApp.instance()).cardId()).setPost("").setDep(5).init()
|
||||||
|
|
||||||
|
//初始化ApiClient
|
||||||
|
// ApiClient.init("http://taxihub.cn:2346/v1/cms/taxi/",true)
|
||||||
|
|
||||||
|
// //初始化Logger
|
||||||
|
// val formatStrategy: FormatStrategy = PrettyFormatStrategy.newBuilder()
|
||||||
|
// .showThreadInfo(false) // (Optional) Whether to show thread info or not. Default true
|
||||||
|
// .methodCount(0) // (Optional) How many method line to show. Default 2
|
||||||
|
// .methodOffset(7) // (Optional) Hides internal method calls up to offset. Default 5
|
||||||
|
// .tag(TAG) // (Optional) Global tag for every log. Default PRETTY_LOGGER
|
||||||
|
// .showThreadInfo(true)
|
||||||
|
// .build()
|
||||||
|
// val adapter = AndroidLogAdapter(formatStrategy)
|
||||||
|
// Logger.addLogAdapter(adapter)
|
||||||
|
|
||||||
|
KuroApiFactory.initRetrofit("http://taxihub.cn:2346/v1/cms/taxi/").setInterceptor(BizInterceptor())
|
||||||
|
|
||||||
|
setLogUtil()
|
||||||
|
|
||||||
|
//初始化下载
|
||||||
|
JoeyDownloadManager.init(this, 30 * 1000, 30 * 1000)
|
||||||
|
|
||||||
|
// KuroDownManager.init(this, 30 * 1000, 30 * 1000)
|
||||||
|
|
||||||
|
//初始化Stetho
|
||||||
|
Stetho.initialize(
|
||||||
|
Stetho.newInitializerBuilder(this)
|
||||||
|
.enableDumpapp(Stetho.defaultDumperPluginsProvider(this))
|
||||||
|
.enableWebKitInspector(Stetho.defaultInspectorModulesProvider(this))
|
||||||
|
.build()
|
||||||
|
)
|
||||||
|
|
||||||
|
setRxJavaErrorHandler()
|
||||||
|
|
||||||
|
initKuroLog()
|
||||||
|
//edit by yzd
|
||||||
|
//安卓8以上不允许后台启动服务
|
||||||
|
if(!TaxiApp.isActive) {
|
||||||
|
val startActivity = Intent(this, PlayActivity::class.java)
|
||||||
|
startActivity.setPackage(this.packageName)
|
||||||
|
startActivity.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
|
this.startActivity(startActivity)
|
||||||
|
}
|
||||||
|
// val serverIntent = Intent(this, PlayServer::class.java)
|
||||||
|
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
|
// startForegroundService(serverIntent);
|
||||||
|
// }else{
|
||||||
|
// startService(serverIntent)
|
||||||
|
// }
|
||||||
|
|
||||||
|
Thread(Runnable {
|
||||||
|
Thread.sleep(10*1000)
|
||||||
|
val file = File(filesDir, "/log")
|
||||||
|
YoungUtil.RecursionDeleteFile(file)
|
||||||
|
}).start()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initKuroLog() {
|
||||||
|
|
||||||
|
val file = File(filesDir, "/log")
|
||||||
|
if (!file.exists()){
|
||||||
|
file.mkdirs()
|
||||||
|
}
|
||||||
|
|
||||||
|
KuroLogManager.init(object : KuroLogConfig(){
|
||||||
|
// override fun injectJsonParser(): JsonParser {
|
||||||
|
// return JsonParser {
|
||||||
|
// Gson().toJson(it)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
override fun includeTread(): Boolean {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getGlobalTag(): String {
|
||||||
|
return "MyApplication"
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun enable(): Boolean {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun stackTraceDepth(): Int {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun printLogLevel(): Int {
|
||||||
|
return KuroLogType.V
|
||||||
|
}
|
||||||
|
}, KuroConsolePrinter(), KuroFileLogPrinter.getInstance(file.path, 3*24*60*60*1000))
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setRxJavaErrorHandler() {
|
||||||
|
RxJavaPlugins.setErrorHandler { throwable: Throwable ->
|
||||||
|
throwable.printStackTrace()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setLogUtil(){
|
||||||
|
val file = File(filesDir, "/log")
|
||||||
|
if (!file.exists()){
|
||||||
|
file.mkdirs()
|
||||||
|
}
|
||||||
|
|
||||||
|
val dest =File(file,"/log.txt")
|
||||||
|
if(!dest.exists()){
|
||||||
|
dest.createNewFile()
|
||||||
|
}
|
||||||
|
|
||||||
|
LogUtil.setShowLevel(LogLevel.V).setLogWriteFile(dest).setLogWriteEnable(Configurations.config(TaxiApp.instance()).enableWriteLog())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//object AppContext: ContextWrapper(TaxiApp.instance())
|
|
@ -0,0 +1,20 @@
|
||||||
|
package cn.trans88.taxiappkotlin.aidl.localserver;
|
||||||
|
|
||||||
|
import android.os.RemoteException;
|
||||||
|
|
||||||
|
import net.sysolution.taxiapp.ITaxiListener;
|
||||||
|
|
||||||
|
import cn.trans88.taxiappkotlin.util.YoungUtil;
|
||||||
|
|
||||||
|
public class BindAccount extends PipeBase {
|
||||||
|
private String accountIdToken;
|
||||||
|
@Override
|
||||||
|
public void execute(ITaxiListener listener) {
|
||||||
|
try {
|
||||||
|
YoungUtil.YoungLog("BindAccount:"+accountIdToken);
|
||||||
|
listener.onSuccess("");
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package cn.trans88.taxiappkotlin.aidl.localserver;
|
||||||
|
|
||||||
|
import net.sysolution.taxiapp.ITaxiListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by joey on 18-1-22.
|
||||||
|
*/
|
||||||
|
public abstract class PipeBase {
|
||||||
|
public String type;
|
||||||
|
|
||||||
|
public abstract void execute(ITaxiListener listener);
|
||||||
|
}
|
|
@ -0,0 +1,173 @@
|
||||||
|
package cn.trans88.taxiappkotlin.aidl.localserver
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
import android.app.Service
|
||||||
|
import android.content.Intent
|
||||||
|
import android.os.IBinder
|
||||||
|
import android.os.RemoteException
|
||||||
|
import cn.trans88.taxiappkotlin.Configurations
|
||||||
|
import cn.trans88.taxiappkotlin.TaxiApp
|
||||||
|
import cn.trans88.taxiappkotlin.logic.model.BindModel
|
||||||
|
import cn.trans88.taxiappkotlin.logic.model.TaxiInfo
|
||||||
|
import cn.trans88.taxiappkotlin.logic.network.ConnManger
|
||||||
|
import cn.trans88.taxiappkotlin.util.YoungUtil
|
||||||
|
import com.alibaba.fastjson.JSON
|
||||||
|
import com.alibaba.fastjson.JSONObject
|
||||||
|
import com.google.gson.Gson
|
||||||
|
import com.orhanobut.logger.Logger
|
||||||
|
import io.reactivex.Single
|
||||||
|
import io.reactivex.SingleObserver
|
||||||
|
import io.reactivex.disposables.Disposable
|
||||||
|
import net.sysolution.taxiapp.ITaxiListener
|
||||||
|
import net.sysolution.taxiapp.ITaxiService
|
||||||
|
|
||||||
|
class TaxiServiceAIDL:Service() {
|
||||||
|
private val TAG = "TaxiServiceAIDL"
|
||||||
|
private val gson = Gson()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户端与服务端绑定时回调,返回TaxiLocal
|
||||||
|
* @param intent null
|
||||||
|
* @return TaxiLocal
|
||||||
|
*/
|
||||||
|
override fun onBind(intent: Intent?): IBinder? {
|
||||||
|
return TaxiLocal()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实现AIDL制定的方法
|
||||||
|
*/
|
||||||
|
inner class TaxiLocal : ITaxiService.Stub() {
|
||||||
|
@SuppressLint("CheckResult")
|
||||||
|
override fun excute(jsonCommand: String, listener: ITaxiListener) {
|
||||||
|
/**
|
||||||
|
* JSON数据中属性名不可为 action
|
||||||
|
*/
|
||||||
|
Single.create<JSONObject> { emitter ->
|
||||||
|
if (null == listener) {
|
||||||
|
emitter.onError(Throwable("Input listener is null"))
|
||||||
|
} else {
|
||||||
|
Logger.json(jsonCommand)
|
||||||
|
emitter.onSuccess(JSON.parseObject(jsonCommand))
|
||||||
|
}
|
||||||
|
}.map { json: JSONObject ->
|
||||||
|
YoungUtil.YoungLog("TaxiService map json: $json")
|
||||||
|
val jsonString = json.getString("jsonCommand")
|
||||||
|
val jsonObject = JSON.parseObject(jsonString)
|
||||||
|
jsonObject.getString("action")
|
||||||
|
}.subscribe(object : SingleObserver<String> {
|
||||||
|
override fun onSubscribe(d: Disposable) {}
|
||||||
|
override fun onSuccess(type: String) {
|
||||||
|
val jsonObject = JSON.parseObject(jsonCommand)
|
||||||
|
val jsonString = jsonObject.getString("jsonCommand")
|
||||||
|
when (type) {
|
||||||
|
"BindAccount" -> {
|
||||||
|
val bindModel = Gson().fromJson(jsonString, BindModel::class.java)
|
||||||
|
if (bindModel.server!=null && bindModel.server!=""){
|
||||||
|
bindModel.server =bindModel.server+"/"
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bindModel.server!=null && bindModel.server!=""){
|
||||||
|
bindModel.tlsServer =bindModel.tlsServer+"/"
|
||||||
|
}
|
||||||
|
|
||||||
|
ConnManger.bindAccount(bindModel, listener)
|
||||||
|
}
|
||||||
|
"SetTaxiInfo" -> {
|
||||||
|
setTaxiInfo(jsonString,listener)
|
||||||
|
}
|
||||||
|
"GetTaxiInfo" -> {
|
||||||
|
getTaxiInfo(jsonString, listener)
|
||||||
|
}
|
||||||
|
"SetURL" ->{
|
||||||
|
// val taxiServerModel:TaxiServerModel = Gson().fromJson(jsonString, TaxiServerModel::class.java)
|
||||||
|
//
|
||||||
|
// if (taxiServerModel.server.isNotEmpty()){
|
||||||
|
// Settings.taxiBaseUrl =taxiServerModel.server
|
||||||
|
// }
|
||||||
|
listener.onSuccess("")
|
||||||
|
}
|
||||||
|
"GetAccountID"->{
|
||||||
|
// if (Settings.appToken.isNotEmpty()){
|
||||||
|
if (Configurations.config(TaxiApp.instance()).registerToken().isNotEmpty()){
|
||||||
|
YoungUtil.YoungLog("GetAccountID")
|
||||||
|
listener.onSuccess(Configurations.config(TaxiApp.instance()).registerToken())
|
||||||
|
}else{
|
||||||
|
listener.onError("Token为空")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
"SetTaxiServer"->{
|
||||||
|
// val taxiServerModel = Gson().fromJson(jsonString, TaxiServerModel::class.java)
|
||||||
|
//
|
||||||
|
// if (taxiServerModel!=null){
|
||||||
|
// Settings.taxiBaseUrl =taxiServerModel.server
|
||||||
|
// }
|
||||||
|
|
||||||
|
listener.onSuccess("")
|
||||||
|
}
|
||||||
|
else -> YoungUtil.YoungLog("无效的远程json命令")
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onError(e: Throwable) {
|
||||||
|
if (null != listener) {
|
||||||
|
try {
|
||||||
|
YoungUtil.YoungLog("远程命令出现异常${e.message}")
|
||||||
|
listener.onError(e.message)
|
||||||
|
} catch (e1: RemoteException) {
|
||||||
|
e1.printStackTrace()
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置车辆信息
|
||||||
|
*/
|
||||||
|
fun setTaxiInfo(jsonString: String, listener: ITaxiListener){
|
||||||
|
val taxiInfo =gson.fromJson(jsonString, TaxiInfo::class.java)
|
||||||
|
val toJson = gson.toJson(taxiInfo)
|
||||||
|
//Settings.taxiInfo =toJson
|
||||||
|
Configurations.config(TaxiApp.instance()).taxiInfoSave(toJson)
|
||||||
|
// SaveSimpleData.setTaxiInfo(jsonString)
|
||||||
|
sendByTaxiListener(listener,jsonString,true)
|
||||||
|
ConnManger.sendTaxiInfo(taxiInfo)
|
||||||
|
YoungUtil.YoungLog("setTaxiInfo${taxiInfo}")
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取车辆信息
|
||||||
|
*/
|
||||||
|
fun getTaxiInfo(jsonString: String, listener: ITaxiListener) {
|
||||||
|
YoungUtil.YoungLog("获取车辆信息")
|
||||||
|
val taxiInfo = Configurations.config(TaxiApp.instance()).taxiInfo()
|
||||||
|
val taxiInfoEntity =gson.fromJson(taxiInfo, TaxiInfo::class.java)
|
||||||
|
if (taxiInfoEntity!=null){
|
||||||
|
taxiInfoEntity.action ="GetTaxiInfo"
|
||||||
|
val json = gson.toJson(taxiInfoEntity)
|
||||||
|
sendByTaxiListener(listener,json,true)
|
||||||
|
YoungUtil.YoungLog("getTaxiInfo${json}")
|
||||||
|
}else{
|
||||||
|
listener.onSuccess("")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun sendByTaxiListener(listener: ITaxiListener?, msg: String, success: Boolean) {
|
||||||
|
try {
|
||||||
|
if (null != listener) {
|
||||||
|
if (success) {
|
||||||
|
listener.onSuccess(msg)
|
||||||
|
} else {
|
||||||
|
listener.onError(msg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e: RemoteException) {
|
||||||
|
YoungUtil.YoungLog("sendByTaxiListener: " + e.message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
package cn.trans88.taxiappkotlin.ext
|
||||||
|
|
||||||
|
import com.google.gson.Gson
|
||||||
|
|
||||||
|
inline fun<reified T> Gson.fromJson(json:String) =fromJson(json,T::class.java)
|
|
@ -0,0 +1,7 @@
|
||||||
|
package cn.trans88.taxiappkotlin.ext
|
||||||
|
|
||||||
|
//import cn.trans88.taxiappkotlin.TaxiApp
|
||||||
|
//import com.trs88.asproj.alotservice.ext.Preference
|
||||||
|
//import kotlin.reflect.jvm.jvmName
|
||||||
|
|
||||||
|
//inline fun <reified R, T> R.pref(default: T) = Preference(TaxiApp.instance(), "", default, R::class.jvmName)
|
|
@ -0,0 +1,7 @@
|
||||||
|
package cn.trans88.taxiappkotlin.ext
|
||||||
|
|
||||||
|
import android.os.Looper
|
||||||
|
|
||||||
|
fun Thread.isMainThread():Boolean{
|
||||||
|
return Thread.currentThread() ==Looper.getMainLooper().thread
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
package cn.trans88.taxiappkotlin.jetpack
|
||||||
|
|
||||||
|
import androidx.lifecycle.Lifecycle
|
||||||
|
import androidx.lifecycle.LifecycleObserver
|
||||||
|
import androidx.lifecycle.OnLifecycleEvent
|
||||||
|
import cn.trans88.taxiappkotlin.util.YoungUtil
|
||||||
|
|
||||||
|
//todo 这个类目前毫无作用
|
||||||
|
class MyObserver(val lifecycle: Lifecycle):LifecycleObserver {
|
||||||
|
|
||||||
|
@OnLifecycleEvent(Lifecycle.Event.ON_CREATE)
|
||||||
|
fun activityCreate(){
|
||||||
|
YoungUtil.YoungLog("activity ON_CREATE")
|
||||||
|
}
|
||||||
|
|
||||||
|
@OnLifecycleEvent(Lifecycle.Event.ON_START)
|
||||||
|
fun activityStart(){
|
||||||
|
YoungUtil.YoungLog("activity ON_STARTt")
|
||||||
|
}
|
||||||
|
|
||||||
|
@OnLifecycleEvent(Lifecycle.Event.ON_RESUME)
|
||||||
|
fun activityResume(){
|
||||||
|
YoungUtil.YoungLog("activity ON_RESUME")
|
||||||
|
}
|
||||||
|
|
||||||
|
@OnLifecycleEvent(Lifecycle.Event.ON_PAUSE)
|
||||||
|
fun activityPause(){
|
||||||
|
YoungUtil.YoungLog("activityPause")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@OnLifecycleEvent(Lifecycle.Event.ON_STOP)
|
||||||
|
fun activityStop(){
|
||||||
|
YoungUtil.YoungLog("activity ON_STOP")
|
||||||
|
}
|
||||||
|
|
||||||
|
@OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)
|
||||||
|
fun activityDestroy(){
|
||||||
|
YoungUtil.YoungLog("activity ON_DESTROY")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package cn.trans88.taxiappkotlin.jetpack
|
||||||
|
|
||||||
|
import android.widget.FrameLayout
|
||||||
|
import android.widget.ImageView
|
||||||
|
import androidx.lifecycle.Lifecycle
|
||||||
|
import androidx.lifecycle.ViewModel
|
||||||
|
import androidx.lifecycle.ViewModelProvider
|
||||||
|
import cn.trans88.taxiappkotlin.ui.custom.AnimFrameLayout
|
||||||
|
import cn.trans88.taxiappkotlin.ui.play.PlayViewModel
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 需要向playViewModel传递参数的时候可以写在PlayViewModelFactory的构造方法里
|
||||||
|
*/
|
||||||
|
class PlayViewModelFactory(private val lifecycle: Lifecycle,private val fl_play:FrameLayout,private val imageView: ImageView):ViewModelProvider.Factory {
|
||||||
|
override fun <T : ViewModel?> create(modelClass: Class<T>): T {
|
||||||
|
return PlayViewModel(lifecycle,fl_play,imageView) as T
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,408 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic
|
||||||
|
|
||||||
|
import android.os.Handler
|
||||||
|
import android.os.Looper
|
||||||
|
import androidx.lifecycle.liveData
|
||||||
|
import cn.trans88.kurotool.datastructure.CircularList
|
||||||
|
import cn.trans88.taxiappkotlin.Configurations
|
||||||
|
import cn.trans88.taxiappkotlin.TaxiApp
|
||||||
|
import cn.trans88.taxiappkotlin.ext.fromJson
|
||||||
|
import cn.trans88.taxiappkotlin.ext.isMainThread
|
||||||
|
import cn.trans88.taxiappkotlin.logic.dao.AdvertiseDao
|
||||||
|
import cn.trans88.taxiappkotlin.logic.dao.DaoUtil
|
||||||
|
import cn.trans88.taxiappkotlin.logic.model.Advertise
|
||||||
|
import cn.trans88.taxiappkotlin.logic.model.AdvertiseOrder
|
||||||
|
import cn.trans88.taxiappkotlin.logic.model.Order
|
||||||
|
import cn.trans88.taxiappkotlin.logic.task.BlockQueueTask
|
||||||
|
import cn.trans88.taxiappkotlin.logic.task.SyncTimerTask
|
||||||
|
import cn.trans88.taxiappkotlin.play.ChangeStatus
|
||||||
|
import cn.trans88.taxiappkotlin.play.PlayerStatus
|
||||||
|
import cn.trans88.taxiappkotlin.play.RefreshPlayer
|
||||||
|
import cn.trans88.taxiappkotlin.ui.advertise.AdvertiseType
|
||||||
|
import cn.trans88.taxiappkotlin.ui.play.PlayViewModel
|
||||||
|
import cn.trans88.taxiappkotlin.ui.play.isAllowPlay
|
||||||
|
import cn.trans88.taxiappkotlin.util.KuroTimer
|
||||||
|
import cn.trans88.taxiappkotlin.util.LastThread
|
||||||
|
import cn.trans88.taxiappkotlin.util.LastThreadListener
|
||||||
|
import cn.trans88.taxiappkotlin.util.SyncUtil.getSyncSingleTime
|
||||||
|
import cn.trans88.taxiappkotlin.util.YoungUtil
|
||||||
|
import com.google.gson.Gson
|
||||||
|
import com.trs88.kurolibrary.execute.KuroExecutor
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import java.util.*
|
||||||
|
import java.util.concurrent.LinkedBlockingQueue
|
||||||
|
import kotlin.collections.ArrayList
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仓库层:判断调用的数据是从本地获取还是网络获取的
|
||||||
|
*/
|
||||||
|
object Repository {
|
||||||
|
// private val circularListMap = mapOf(AdvertiseType.NORMAL.ordinal to CircularList<Advertise>(),AdvertiseType.AREA.ordinal to CircularList<Advertise>())
|
||||||
|
private val circularListMap = mutableMapOf<Int, CircularList<Advertise>>()
|
||||||
|
private val myListMap = mutableMapOf<Int, ArrayList<Advertise>>()
|
||||||
|
private val changeStatusQueue: LinkedBlockingQueue<ChangeStatus> = LinkedBlockingQueue<ChangeStatus>() //阻塞队列
|
||||||
|
|
||||||
|
private var refreshPlayerLists: BlockQueueTask<Any>? = null //利用LinkedBlockingDeque创建异步生产者-消费者任务 //todo 需要停止线程
|
||||||
|
private var lastThread: LastThread? = null//执行最后一次
|
||||||
|
|
||||||
|
private val handler = Handler(Looper.getMainLooper())
|
||||||
|
|
||||||
|
@Volatile
|
||||||
|
private var playViewModel: PlayViewModel? = null//viewModel
|
||||||
|
|
||||||
|
private var timer: Timer = Timer()
|
||||||
|
private var kuroTimer: KuroTimer=KuroTimer()
|
||||||
|
|
||||||
|
var currentListOrder: Int = 0
|
||||||
|
|
||||||
|
var currentSyncTime: Long = 0
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将广告发送给观察者
|
||||||
|
*/
|
||||||
|
@Deprecated("已经废弃")
|
||||||
|
fun getAdvertise() = liveData(Dispatchers.IO) {
|
||||||
|
// fun getAdvertise() = liveData{
|
||||||
|
YoungUtil.YoungLog("getAdvertise")
|
||||||
|
val advertise = getTestPlayAdvertise(myListMap[getTestPlayLevels()])
|
||||||
|
val result = try {
|
||||||
|
Result.success(advertise)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Result.failure<Advertise>(e)
|
||||||
|
}
|
||||||
|
emit(result)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setSyncTime(syncTime: Long) {
|
||||||
|
currentSyncTime = syncTime
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getAdvertiseTEST(): Advertise? {
|
||||||
|
// return getPlayAdvertise(circularListMap[getPlayLevels()])
|
||||||
|
val advertise = getTestPlayAdvertise(myListMap[getTestPlayLevels()])
|
||||||
|
return advertise
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// fun getPlayCircularList(): CircularList<Advertise>? {
|
||||||
|
// return circularListMap[getPlayLevels()]
|
||||||
|
// }
|
||||||
|
|
||||||
|
fun getTestPlayCircularList(): MutableList<Advertise>? {
|
||||||
|
return myListMap[getTestPlayLevels()]
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拿到将要播放的广告
|
||||||
|
*/
|
||||||
|
private fun getPlayAdvertise(list: CircularList<Advertise>?): Advertise? {
|
||||||
|
YoungUtil.YoungLog("getPlayAdvertise")
|
||||||
|
list?.let {
|
||||||
|
if (it.isEmpty) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
for (index in 0..list.size()) {
|
||||||
|
val advertise = list.headAndNext
|
||||||
|
if (advertise.isAllowPlay()) {
|
||||||
|
return advertise
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拿到将要播放的广告
|
||||||
|
*/
|
||||||
|
private fun getTestPlayAdvertise(list: MutableList<Advertise>?): Advertise? {
|
||||||
|
YoungUtil.YoungLog("getTestPlayAdvertise")
|
||||||
|
val currentTimeMillis = System.currentTimeMillis()
|
||||||
|
list?.let {
|
||||||
|
if (it.isEmpty()) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
//防止如果需求定点广告切换成普通广告,但是要继续上次普通广告的播放,然后现在的广告列表数改变,下标越界的情况
|
||||||
|
// if(currentListOrder>=list.size){
|
||||||
|
// currentListOrder=0
|
||||||
|
// }
|
||||||
|
|
||||||
|
for (index in 0..list.size) {
|
||||||
|
|
||||||
|
//防止下标越界
|
||||||
|
if (currentListOrder >= list.size) {
|
||||||
|
currentListOrder = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
//YoungUtil.YoungLog("当前播放的广告list位数 : $currentListOrder")
|
||||||
|
val advertise = list[currentListOrder]
|
||||||
|
|
||||||
|
if (advertise.isAllowPlay()) {
|
||||||
|
//YoungUtil.YoungLog("拿到广告花费时间 :${System.currentTimeMillis() - currentTimeMillis}")
|
||||||
|
YoungUtil.YoungLog("拿到广告:" + advertise.ad_id)
|
||||||
|
return advertise
|
||||||
|
} else {
|
||||||
|
YoungUtil.YoungLog("在播放过程中时间不满足,currentListOrder+1继续播放")
|
||||||
|
currentListOrder += 1
|
||||||
|
if (currentListOrder >= list.size) {
|
||||||
|
currentListOrder = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拿到应该播放的等级
|
||||||
|
*/
|
||||||
|
private fun getPlayLevels(): Int {
|
||||||
|
val levels = AdvertiseType.values()
|
||||||
|
for (index in AdvertiseType.values().size downTo 0) {
|
||||||
|
val circularList = circularListMap[index]
|
||||||
|
if (circularList!!.size() > 0) {
|
||||||
|
return index
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return AdvertiseType.IDLE.ordinal
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getTestPlayLevels(): Int {
|
||||||
|
val levels = AdvertiseType.values()
|
||||||
|
for (index in AdvertiseType.values().size downTo 0) {
|
||||||
|
val list = myListMap[index]
|
||||||
|
if (list!!.size > 0) {
|
||||||
|
YoungUtil.YoungLog("当前播放广告的等级$index")
|
||||||
|
return index
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return AdvertiseType.IDLE.ordinal
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新循环列表
|
||||||
|
*/
|
||||||
|
@Synchronized
|
||||||
|
fun refreshMyList() {
|
||||||
|
val currentTimeMillis = System.currentTimeMillis()
|
||||||
|
YoungUtil.YoungLog("refreshMyList 是否在主线程: ${Thread.currentThread().isMainThread()}")
|
||||||
|
// myListMap.clear()
|
||||||
|
|
||||||
|
for (index in AdvertiseType.values().size downTo 0) {
|
||||||
|
myListMap[index] = ArrayList()
|
||||||
|
}
|
||||||
|
|
||||||
|
//清楚排序规则
|
||||||
|
DaoUtil.getOrderDao().deleteAll()
|
||||||
|
|
||||||
|
val daoAdvertises = DaoUtil.getAdvertise().queryBuilder().orderDesc(AdvertiseDao.Properties.CreateAt).list()
|
||||||
|
|
||||||
|
val advertises = mutableListOf<Advertise>()
|
||||||
|
//定点广告list
|
||||||
|
val area = DaoUtil.getAdvertise().queryBuilder().where(AdvertiseDao.Properties.BelongTo.eq(AdvertiseType.AREA.ordinal)).list()
|
||||||
|
|
||||||
|
if (Configurations.config(TaxiApp.instance()).advertiseOrder() != "" && area.size == 0) {
|
||||||
|
val orderList = Gson().fromJson<AdvertiseOrder>(Configurations.config(TaxiApp.instance()).advertiseOrder()).advertise_order
|
||||||
|
YoungUtil.YoungLog("当前的播放顺序策略:${orderList.toString()}")
|
||||||
|
|
||||||
|
orderList.forEach { orderListAdid ->
|
||||||
|
daoAdvertises.forEach { daoAdvertis ->
|
||||||
|
if (orderListAdid == daoAdvertis.ad_id) {
|
||||||
|
YoungUtil.YoungLog("adid相同加入 播放数组 adid:$orderListAdid")
|
||||||
|
|
||||||
|
advertises.add(daoAdvertis)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// //将剩下没排序的广告加入播放列表
|
||||||
|
// for (daoAdvertise in daoAdvertises.reversed()) {
|
||||||
|
// var insert =true
|
||||||
|
// for (advertise in advertises) {
|
||||||
|
// if (advertise.ad_id == daoAdvertise.ad_id){
|
||||||
|
// insert =false
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (insert){
|
||||||
|
// YoungUtil.YoungLog("有没有排序的广告 ad_id:${daoAdvertise.ad_id} 加入排序")
|
||||||
|
// advertises.add(daoAdvertise)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
//如果服务端的排序解析失败还是按原来的顺序
|
||||||
|
if (orderList.isNullOrEmpty()) {
|
||||||
|
advertises.addAll(daoAdvertises)
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
//Collections.reverse(daoAdvertises)
|
||||||
|
daoAdvertises.reverse()
|
||||||
|
daoAdvertises.forEach {
|
||||||
|
advertises.add(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (index in 0 until advertises.size) {
|
||||||
|
val order = Order()
|
||||||
|
order.ad_id = advertises[index].ad_id
|
||||||
|
if (index == advertises.size - 1) {
|
||||||
|
order.isLast = true
|
||||||
|
}
|
||||||
|
DaoUtil.getOrderDao().insert(order)
|
||||||
|
}
|
||||||
|
|
||||||
|
for (index in 0 until advertises.size) {
|
||||||
|
YoungUtil.YoungLog("列表序号:${advertises[index].ad_id} 创建时间 ${advertises[index].createAt}")
|
||||||
|
// sb.append("\n广告id:${advertise.ad_id}")
|
||||||
|
|
||||||
|
val advertise = advertises[index]
|
||||||
|
|
||||||
|
if (index == advertises.size - 1) {
|
||||||
|
YoungUtil.YoungLog("最后一个素材 设置为true")
|
||||||
|
advertise.isLast = true
|
||||||
|
}
|
||||||
|
|
||||||
|
val newAdvertise = oldAdvertiseToNewAdvertise(advertise)
|
||||||
|
|
||||||
|
if (newAdvertise.isAllowPlay()) {
|
||||||
|
YoungUtil.YoungLog("广告准备ok 加入Mylist 广告ad_id:${newAdvertise.ad_id},是否是最后一个广告:${newAdvertise.isLast},belongto: ${newAdvertise.belongTo}")
|
||||||
|
myListMap[newAdvertise.belongTo]?.add(newAdvertise)
|
||||||
|
} else {
|
||||||
|
YoungUtil.YoungLog("广告不满足不加入播放列表:${newAdvertise.ad_id}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val last = System.currentTimeMillis()
|
||||||
|
//YoungUtil.YoungLog("刷新列表用时${last - currentTimeMillis}")
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun oldAdvertiseToNewAdvertise(oldAdvertise: Advertise): Advertise {
|
||||||
|
val advertise = Advertise()
|
||||||
|
advertise.apply {
|
||||||
|
belongTo = oldAdvertise.belongTo
|
||||||
|
ad_id = oldAdvertise.ad_id
|
||||||
|
id = oldAdvertise.id
|
||||||
|
media_type = oldAdvertise.media_type
|
||||||
|
media_url = oldAdvertise.media_url
|
||||||
|
pathName = oldAdvertise.pathName
|
||||||
|
duration = oldAdvertise.duration
|
||||||
|
createAt = oldAdvertise.createAt
|
||||||
|
isLast = oldAdvertise.isLast
|
||||||
|
time_Span = oldAdvertise.time_Span
|
||||||
|
region_id = oldAdvertise.region_id
|
||||||
|
longitude = oldAdvertise.longitude
|
||||||
|
latitude = oldAdvertise.latitude
|
||||||
|
isDownloaded =oldAdvertise.isDownloaded
|
||||||
|
isDownloading =oldAdvertise.isDownloading
|
||||||
|
// if (sanleAdvertise.createAt ==null){
|
||||||
|
// send("服务器日志 三乐广告 createAt :${sanleAdvertise.createAt}")
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
|
return advertise
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生产数据,存放更改的状态
|
||||||
|
* @param type 广告类型
|
||||||
|
* @param status 播放状态
|
||||||
|
*/
|
||||||
|
fun updatePlayerUI(type: AdvertiseType, status: PlayerStatus) {
|
||||||
|
try {
|
||||||
|
changeStatusQueue.put(ChangeStatus(type, status))
|
||||||
|
} catch (e: InterruptedException) {
|
||||||
|
YoungUtil.YoungLog(e.message!!)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun powerOnAdvertise(viewModel: PlayViewModel) {
|
||||||
|
KuroExecutor.execute(Runnable {
|
||||||
|
YoungUtil.YoungLog("开机播放广告")
|
||||||
|
Thread.sleep(3000)
|
||||||
|
if (playViewModel == null) {
|
||||||
|
playViewModel = viewModel
|
||||||
|
}
|
||||||
|
refreshMyList()
|
||||||
|
// refreshCircularList()
|
||||||
|
// playViewModel?.refreshAdvertise(getAdvertiseTEST())
|
||||||
|
playViewModel?.refreshAdvertise()
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化BlockQueueTask 并开启内部的线程 一旦RefreshPlayer生产数据就会执行execOnReceiveItem
|
||||||
|
*/
|
||||||
|
fun initRefreshPlayerList() {
|
||||||
|
object : BlockQueueTask<Any?>(RefreshPlayer.getContainer(), 0) {
|
||||||
|
override fun execOnReceiveItem(item: Any?) {
|
||||||
|
lastThread!!.call("")
|
||||||
|
}
|
||||||
|
}.start()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun initLastThread(viewModel: PlayViewModel) {
|
||||||
|
YoungUtil.YoungLog("initLastThread")
|
||||||
|
if (playViewModel == null) {
|
||||||
|
playViewModel = viewModel
|
||||||
|
}
|
||||||
|
|
||||||
|
lastThread = LastThread(LastThreadListener { flag, _ ->
|
||||||
|
YoungUtil.YoungLog("initRefreshPlayerList: ok : $flag")
|
||||||
|
//延时时间到了才会等于1,其他时间为0
|
||||||
|
if (flag == 1) {
|
||||||
|
//广告位置设置为0并刷新播放的列表
|
||||||
|
currentListOrder = 0
|
||||||
|
refreshMyList()
|
||||||
|
if (Configurations.config(TaxiApp.instance()).sync() && getTestPlayLevels() == AdvertiseType.GROUP.ordinal) {
|
||||||
|
//设置同步播放并且是分组广告
|
||||||
|
// if (Settings.sync) {
|
||||||
|
val syncTimeModel = getSyncSingleTime(currentSyncTime, getTestPlayCircularList())
|
||||||
|
YoungUtil.YoungLog("播放方式为同步播放,同步时间:${syncTimeModel.delay}=============================================")
|
||||||
|
val currentTimeMillis = System.currentTimeMillis()
|
||||||
|
val advertise = getAdvertiseTEST()
|
||||||
|
val getAdvertiseSyncTime = syncTimeModel.delay-(System.currentTimeMillis()-currentTimeMillis)
|
||||||
|
YoungUtil.YoungLog("获取到广告的时间 校准同步时间:$getAdvertiseSyncTime")
|
||||||
|
// handler.postDelayed(SyncTimerTask(playViewModel!!, advertise, syncTimeModel.currentPosition), syncTimeModel.delay)
|
||||||
|
kuroTimer.cancel()
|
||||||
|
kuroTimer.purge()
|
||||||
|
kuroTimer = KuroTimer()
|
||||||
|
kuroTimer.schedule(SyncTimerTask(playViewModel!!, advertise, syncTimeModel.currentPosition), syncTimeModel.delay)
|
||||||
|
} else {
|
||||||
|
//非同步播放或者定点播放
|
||||||
|
YoungUtil.YoungLog("播放方式为非同步播放")
|
||||||
|
playViewModel!!.refreshAdvertise()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
true
|
||||||
|
})
|
||||||
|
|
||||||
|
lastThread!!.setSleep(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
// private fun getSyncTime(circularList: CircularList<Advertise>?): Date {
|
||||||
|
// if (circularList == null || circularList.size() == 0) return Date()
|
||||||
|
// var all = 0
|
||||||
|
// for (index in 0 until circularList.size()) {
|
||||||
|
// YoungUtil.YoungLog("getSyncTime index :$index")
|
||||||
|
// val advertise = circularList.getItem(index)
|
||||||
|
// all += advertise.duration.toInt()
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return if (all > 0) {
|
||||||
|
// val curr = System.currentTimeMillis()
|
||||||
|
// val past = TimeUtil.pastSeconds(null, "00:00", curr)
|
||||||
|
// val delay = all - past % all
|
||||||
|
// YoungUtil.YoungLog("同步时间delay: $delay")
|
||||||
|
// val playDate = Date(curr + delay)
|
||||||
|
// playDate
|
||||||
|
// } else {
|
||||||
|
// Date()
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,108 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic
|
||||||
|
|
||||||
|
import android.os.Environment
|
||||||
|
import cn.trans88.kurotool.util.LogLevel
|
||||||
|
import cn.trans88.kurotool.util.ThreadUtil
|
||||||
|
//import cn.trans88.taxiappkotlin.ext.pref
|
||||||
|
//import cn.trans88.taxiappkotlin.logic.enumType.CompanyType
|
||||||
|
import cn.trans88.taxiappkotlin.logic.model.SettingMod
|
||||||
|
import com.google.gson.Gson
|
||||||
|
import java.io.File
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
//object Settings {
|
||||||
|
//普通账户
|
||||||
|
//var registerToken by pref("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50X2lkIjoiNWY4OTNiODE1NzIzMDk0YWQzZmM5MTI0IiwiZ3JvdXBfaWQiOiI1Zjg5M2I4MTU3MjMwOTRhZDNmYzkxMjYiLCJ1c2VyX2lkIjoiNWY4OTNiODE1NzIzMDk0YWQzZmM5MTI1In0.o2M6CE2yFi7dvjILb485sQF436eMDdKwzTryK4rw3W0")
|
||||||
|
//var appToken by pref("")
|
||||||
|
//var company by pref(CompanyType.SANLE.name)
|
||||||
|
//var sync by pref(true)
|
||||||
|
//var logServiceUrl by pref("http://taxihub.cn:2348/")
|
||||||
|
//var connServiceUrl by pref("")
|
||||||
|
//var screenSizeX by pref(160)
|
||||||
|
//var screenSizeY by pref(64)
|
||||||
|
//var taxiInfo by pref("")
|
||||||
|
//var cardId by pref("")
|
||||||
|
//var taxiServiceUrl by pref("")//长连接的url
|
||||||
|
//var downloadUrl by pref("")//下载url
|
||||||
|
//var accountId by pref("")//账户id
|
||||||
|
//var taxiBaseUrl by pref("http://taxihub.cn:2346/")//注册连接的url
|
||||||
|
|
||||||
|
//var isDeleteOldAdvitise by pref(false)//是否第一次删除广告
|
||||||
|
//var isFirstRegister by pref(true)//是否注册成功
|
||||||
|
//var enableWriteLog by pref(false)//是否能够写入日志
|
||||||
|
//var advertiseOrder by pref("")
|
||||||
|
//var loggerSwitch by pref(true)//是否记录播放日志
|
||||||
|
//var gpsSwitch by pref(true)//是否记录gps
|
||||||
|
|
||||||
|
//var upload_debug_file_url by pref("http://taxihub.cn:2345/postDebugFile")//上传运行日志
|
||||||
|
|
||||||
|
//没有使用的属性:
|
||||||
|
//var sendGpsTime by pref(10000)//上传gps的时间
|
||||||
|
|
||||||
|
|
||||||
|
//本来就已注释的:
|
||||||
|
// var taxiBaseUrl by pref("http://ledok.cn:2346/")//测试时候注册连接的url
|
||||||
|
// var taxiBaseUrl by pref("http://8.135.34.174:2346/")//三乐注册连接的url
|
||||||
|
// var isReservedConfig by pref(true)//是否保留配置 这个值不写入sd卡,也就是卸载后会重置
|
||||||
|
//测试账户
|
||||||
|
// var registerToken by pref("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50X2lkIjoiNWY0NzY1ODNhNTE0MDgxODljYjY0Y2YyIiwiZ3JvdXBfaWQiOiI1ZjQ3NjU4M2E1MTQwODE4OWNiNjRjZjQiLCJ1c2VyX2lkIjoiNWY0NzY1ODNhNTE0MDgxODljYjY0Y2YzIn0.LK1-V9ICg2O9nW03MDIkfVWPI2flJOsyAhQNaRBEGuw")
|
||||||
|
//三乐的默认账户
|
||||||
|
// var registerToken by pref("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50X2lkIjoiNWZlMDVkNWYxYjY4OTYyNjc4YjFlNmRiIiwiZ3JvdXBfaWQiOiI1ZmUwNWQ1ZjFiNjg5NjI2NzhiMWU2ZGQiLCJ1c2VyX2lkIjoiNWZlMDVkNWYxYjY4OTYyNjc4YjFlNmRjIn0.JJlLsq3_W875JnSa3ZGnBKp2dGBYE5SST39lH_g4uqw")
|
||||||
|
|
||||||
|
/*
|
||||||
|
@Synchronized
|
||||||
|
fun toJson() {
|
||||||
|
val settingMod = SettingMod()
|
||||||
|
settingMod.registerToken = registerToken
|
||||||
|
settingMod.appToken = appToken
|
||||||
|
settingMod.company = company
|
||||||
|
settingMod.sync = sync
|
||||||
|
settingMod.logServiceUrl = logServiceUrl
|
||||||
|
settingMod.connServiceUrl = connServiceUrl
|
||||||
|
settingMod.screenSizeX = screenSizeX
|
||||||
|
settingMod.screenSizeY = screenSizeY
|
||||||
|
settingMod.taxiInfo = taxiInfo
|
||||||
|
settingMod.cardId = cardId
|
||||||
|
settingMod.taxiServiceUrl = taxiServiceUrl
|
||||||
|
settingMod.downloadUrl = downloadUrl
|
||||||
|
settingMod.accountId = accountId
|
||||||
|
settingMod.taxiBaseUrl = taxiBaseUrl
|
||||||
|
settingMod.isDeleteOldAdvitise = isDeleteOldAdvitise
|
||||||
|
settingMod.isFirstRegister = isFirstRegister
|
||||||
|
settingMod.enableWriteLog = enableWriteLog
|
||||||
|
settingMod.advertiseOrder = advertiseOrder
|
||||||
|
|
||||||
|
val settings = Gson().toJson(settingMod)
|
||||||
|
YoungUtil.YoungLog("Setting序列化内容$settings")
|
||||||
|
val file = File(Environment.getExternalStorageDirectory(), "/taxiConfig")
|
||||||
|
if (!file.exists()) {
|
||||||
|
file.mkdirs()
|
||||||
|
}
|
||||||
|
|
||||||
|
val dest = File(file, "/taxiconfig.txt")
|
||||||
|
if (!dest.exists()) {
|
||||||
|
dest.createNewFile()
|
||||||
|
}
|
||||||
|
|
||||||
|
writeLogToFile(dest,settings)
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
private fun writeLogToFile(file: File, settingJson: String) {
|
||||||
|
ThreadUtil.executeByPool(Runnable {
|
||||||
|
if (file.exists() && settingJson.isNotEmpty()) {
|
||||||
|
val simpleDateFormat = SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSSS", Locale.getDefault())
|
||||||
|
val formatString = simpleDateFormat.format(Date())
|
||||||
|
val parent = file.parentFile
|
||||||
|
if (!parent.exists()) {
|
||||||
|
parent.mkdir()
|
||||||
|
}
|
||||||
|
file.createNewFile()
|
||||||
|
file.writeText(settingJson)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
//}
|
|
@ -0,0 +1,265 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.dao;
|
||||||
|
|
||||||
|
import android.database.Cursor;
|
||||||
|
import android.database.sqlite.SQLiteStatement;
|
||||||
|
|
||||||
|
import org.greenrobot.greendao.AbstractDao;
|
||||||
|
import org.greenrobot.greendao.Property;
|
||||||
|
import org.greenrobot.greendao.internal.DaoConfig;
|
||||||
|
import org.greenrobot.greendao.database.Database;
|
||||||
|
import org.greenrobot.greendao.database.DatabaseStatement;
|
||||||
|
|
||||||
|
import cn.trans88.taxiappkotlin.logic.model.Advertise;
|
||||||
|
|
||||||
|
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
|
||||||
|
/**
|
||||||
|
* DAO for table "ADVERTISE".
|
||||||
|
*/
|
||||||
|
public class AdvertiseDao extends AbstractDao<Advertise, Long> {
|
||||||
|
|
||||||
|
public static final String TABLENAME = "ADVERTISE";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Properties of entity Advertise.<br/>
|
||||||
|
* Can be used for QueryBuilder and for referencing column names.
|
||||||
|
*/
|
||||||
|
public static class Properties {
|
||||||
|
public final static Property AutoId = new Property(0, Long.class, "autoId", true, "_id");
|
||||||
|
public final static Property Id = new Property(1, String.class, "id", false, "ID");
|
||||||
|
public final static Property BelongTo = new Property(2, int.class, "belongTo", false, "BELONG_TO");
|
||||||
|
public final static Property Media_type = new Property(3, int.class, "media_type", false, "MEDIA_TYPE");
|
||||||
|
public final static Property Media_url = new Property(4, String.class, "media_url", false, "MEDIA_URL");
|
||||||
|
public final static Property Ad_id = new Property(5, String.class, "ad_id", false, "AD_ID");
|
||||||
|
public final static Property Region_id = new Property(6, String.class, "region_id", false, "REGION_ID");
|
||||||
|
public final static Property PathName = new Property(7, String.class, "pathName", false, "PATH_NAME");
|
||||||
|
public final static Property Duration = new Property(8, String.class, "duration", false, "DURATION");
|
||||||
|
public final static Property CreateAt = new Property(9, Long.class, "createAt", false, "CREATE_AT");
|
||||||
|
public final static Property Longitude = new Property(10, Double.class, "longitude", false, "LONGITUDE");
|
||||||
|
public final static Property Latitude = new Property(11, Double.class, "latitude", false, "LATITUDE");
|
||||||
|
public final static Property IsDownloaded = new Property(12, boolean.class, "isDownloaded", false, "IS_DOWNLOADED");
|
||||||
|
public final static Property IsDownloading = new Property(13, boolean.class, "isDownloading", false, "IS_DOWNLOADING");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public AdvertiseDao(DaoConfig config) {
|
||||||
|
super(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AdvertiseDao(DaoConfig config, DaoSession daoSession) {
|
||||||
|
super(config, daoSession);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Creates the underlying database table. */
|
||||||
|
public static void createTable(Database db, boolean ifNotExists) {
|
||||||
|
String constraint = ifNotExists? "IF NOT EXISTS ": "";
|
||||||
|
db.execSQL("CREATE TABLE " + constraint + "\"ADVERTISE\" (" + //
|
||||||
|
"\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: autoId
|
||||||
|
"\"ID\" TEXT," + // 1: id
|
||||||
|
"\"BELONG_TO\" INTEGER NOT NULL ," + // 2: belongTo
|
||||||
|
"\"MEDIA_TYPE\" INTEGER NOT NULL ," + // 3: media_type
|
||||||
|
"\"MEDIA_URL\" TEXT," + // 4: media_url
|
||||||
|
"\"AD_ID\" TEXT," + // 5: ad_id
|
||||||
|
"\"REGION_ID\" TEXT," + // 6: region_id
|
||||||
|
"\"PATH_NAME\" TEXT," + // 7: pathName
|
||||||
|
"\"DURATION\" TEXT," + // 8: duration
|
||||||
|
"\"CREATE_AT\" INTEGER," + // 9: createAt
|
||||||
|
"\"LONGITUDE\" REAL," + // 10: longitude
|
||||||
|
"\"LATITUDE\" REAL," + // 11: latitude
|
||||||
|
"\"IS_DOWNLOADED\" INTEGER NOT NULL ," + // 12: isDownloaded
|
||||||
|
"\"IS_DOWNLOADING\" INTEGER NOT NULL );"); // 13: isDownloading
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Drops the underlying database table. */
|
||||||
|
public static void dropTable(Database db, boolean ifExists) {
|
||||||
|
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"ADVERTISE\"";
|
||||||
|
db.execSQL(sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final void bindValues(DatabaseStatement stmt, Advertise entity) {
|
||||||
|
stmt.clearBindings();
|
||||||
|
|
||||||
|
Long autoId = entity.getAutoId();
|
||||||
|
if (autoId != null) {
|
||||||
|
stmt.bindLong(1, autoId);
|
||||||
|
}
|
||||||
|
|
||||||
|
String id = entity.getId();
|
||||||
|
if (id != null) {
|
||||||
|
stmt.bindString(2, id);
|
||||||
|
}
|
||||||
|
stmt.bindLong(3, entity.getBelongTo());
|
||||||
|
stmt.bindLong(4, entity.getMedia_type());
|
||||||
|
|
||||||
|
String media_url = entity.getMedia_url();
|
||||||
|
if (media_url != null) {
|
||||||
|
stmt.bindString(5, media_url);
|
||||||
|
}
|
||||||
|
|
||||||
|
String ad_id = entity.getAd_id();
|
||||||
|
if (ad_id != null) {
|
||||||
|
stmt.bindString(6, ad_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
String region_id = entity.getRegion_id();
|
||||||
|
if (region_id != null) {
|
||||||
|
stmt.bindString(7, region_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
String pathName = entity.getPathName();
|
||||||
|
if (pathName != null) {
|
||||||
|
stmt.bindString(8, pathName);
|
||||||
|
}
|
||||||
|
|
||||||
|
String duration = entity.getDuration();
|
||||||
|
if (duration != null) {
|
||||||
|
stmt.bindString(9, duration);
|
||||||
|
}
|
||||||
|
|
||||||
|
Long createAt = entity.getCreateAt();
|
||||||
|
if (createAt != null) {
|
||||||
|
stmt.bindLong(10, createAt);
|
||||||
|
}
|
||||||
|
|
||||||
|
Double longitude = entity.getLongitude();
|
||||||
|
if (longitude != null) {
|
||||||
|
stmt.bindDouble(11, longitude);
|
||||||
|
}
|
||||||
|
|
||||||
|
Double latitude = entity.getLatitude();
|
||||||
|
if (latitude != null) {
|
||||||
|
stmt.bindDouble(12, latitude);
|
||||||
|
}
|
||||||
|
stmt.bindLong(13, entity.getIsDownloaded() ? 1L: 0L);
|
||||||
|
stmt.bindLong(14, entity.getIsDownloading() ? 1L: 0L);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final void bindValues(SQLiteStatement stmt, Advertise entity) {
|
||||||
|
stmt.clearBindings();
|
||||||
|
|
||||||
|
Long autoId = entity.getAutoId();
|
||||||
|
if (autoId != null) {
|
||||||
|
stmt.bindLong(1, autoId);
|
||||||
|
}
|
||||||
|
|
||||||
|
String id = entity.getId();
|
||||||
|
if (id != null) {
|
||||||
|
stmt.bindString(2, id);
|
||||||
|
}
|
||||||
|
stmt.bindLong(3, entity.getBelongTo());
|
||||||
|
stmt.bindLong(4, entity.getMedia_type());
|
||||||
|
|
||||||
|
String media_url = entity.getMedia_url();
|
||||||
|
if (media_url != null) {
|
||||||
|
stmt.bindString(5, media_url);
|
||||||
|
}
|
||||||
|
|
||||||
|
String ad_id = entity.getAd_id();
|
||||||
|
if (ad_id != null) {
|
||||||
|
stmt.bindString(6, ad_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
String region_id = entity.getRegion_id();
|
||||||
|
if (region_id != null) {
|
||||||
|
stmt.bindString(7, region_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
String pathName = entity.getPathName();
|
||||||
|
if (pathName != null) {
|
||||||
|
stmt.bindString(8, pathName);
|
||||||
|
}
|
||||||
|
|
||||||
|
String duration = entity.getDuration();
|
||||||
|
if (duration != null) {
|
||||||
|
stmt.bindString(9, duration);
|
||||||
|
}
|
||||||
|
|
||||||
|
Long createAt = entity.getCreateAt();
|
||||||
|
if (createAt != null) {
|
||||||
|
stmt.bindLong(10, createAt);
|
||||||
|
}
|
||||||
|
|
||||||
|
Double longitude = entity.getLongitude();
|
||||||
|
if (longitude != null) {
|
||||||
|
stmt.bindDouble(11, longitude);
|
||||||
|
}
|
||||||
|
|
||||||
|
Double latitude = entity.getLatitude();
|
||||||
|
if (latitude != null) {
|
||||||
|
stmt.bindDouble(12, latitude);
|
||||||
|
}
|
||||||
|
stmt.bindLong(13, entity.getIsDownloaded() ? 1L: 0L);
|
||||||
|
stmt.bindLong(14, entity.getIsDownloading() ? 1L: 0L);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long readKey(Cursor cursor, int offset) {
|
||||||
|
return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Advertise readEntity(Cursor cursor, int offset) {
|
||||||
|
Advertise entity = new Advertise( //
|
||||||
|
cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // autoId
|
||||||
|
cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // id
|
||||||
|
cursor.getInt(offset + 2), // belongTo
|
||||||
|
cursor.getInt(offset + 3), // media_type
|
||||||
|
cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // media_url
|
||||||
|
cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // ad_id
|
||||||
|
cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // region_id
|
||||||
|
cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // pathName
|
||||||
|
cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // duration
|
||||||
|
cursor.isNull(offset + 9) ? null : cursor.getLong(offset + 9), // createAt
|
||||||
|
cursor.isNull(offset + 10) ? null : cursor.getDouble(offset + 10), // longitude
|
||||||
|
cursor.isNull(offset + 11) ? null : cursor.getDouble(offset + 11), // latitude
|
||||||
|
cursor.getShort(offset + 12) != 0, // isDownloaded
|
||||||
|
cursor.getShort(offset + 13) != 0 // isDownloading
|
||||||
|
);
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readEntity(Cursor cursor, Advertise entity, int offset) {
|
||||||
|
entity.setAutoId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
|
||||||
|
entity.setId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
|
||||||
|
entity.setBelongTo(cursor.getInt(offset + 2));
|
||||||
|
entity.setMedia_type(cursor.getInt(offset + 3));
|
||||||
|
entity.setMedia_url(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
|
||||||
|
entity.setAd_id(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
|
||||||
|
entity.setRegion_id(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
|
||||||
|
entity.setPathName(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
|
||||||
|
entity.setDuration(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8));
|
||||||
|
entity.setCreateAt(cursor.isNull(offset + 9) ? null : cursor.getLong(offset + 9));
|
||||||
|
entity.setLongitude(cursor.isNull(offset + 10) ? null : cursor.getDouble(offset + 10));
|
||||||
|
entity.setLatitude(cursor.isNull(offset + 11) ? null : cursor.getDouble(offset + 11));
|
||||||
|
entity.setIsDownloaded(cursor.getShort(offset + 12) != 0);
|
||||||
|
entity.setIsDownloading(cursor.getShort(offset + 13) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final Long updateKeyAfterInsert(Advertise entity, long rowId) {
|
||||||
|
entity.setAutoId(rowId);
|
||||||
|
return rowId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getKey(Advertise entity) {
|
||||||
|
if(entity != null) {
|
||||||
|
return entity.getAutoId();
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasKey(Advertise entity) {
|
||||||
|
return entity.getAutoId() != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final boolean isEntityUpdateable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,161 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.dao;
|
||||||
|
|
||||||
|
import android.database.Cursor;
|
||||||
|
import android.database.sqlite.SQLiteStatement;
|
||||||
|
|
||||||
|
import org.greenrobot.greendao.AbstractDao;
|
||||||
|
import org.greenrobot.greendao.Property;
|
||||||
|
import org.greenrobot.greendao.internal.DaoConfig;
|
||||||
|
import org.greenrobot.greendao.database.Database;
|
||||||
|
import org.greenrobot.greendao.database.DatabaseStatement;
|
||||||
|
|
||||||
|
import cn.trans88.taxiappkotlin.logic.model.Container;
|
||||||
|
|
||||||
|
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
|
||||||
|
/**
|
||||||
|
* DAO for table "CONTAINER".
|
||||||
|
*/
|
||||||
|
public class ContainerDao extends AbstractDao<Container, Long> {
|
||||||
|
|
||||||
|
public static final String TABLENAME = "CONTAINER";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Properties of entity Container.<br/>
|
||||||
|
* Can be used for QueryBuilder and for referencing column names.
|
||||||
|
*/
|
||||||
|
public static class Properties {
|
||||||
|
public final static Property AutoId = new Property(0, Long.class, "autoId", true, "_id");
|
||||||
|
public final static Property Id = new Property(1, String.class, "id", false, "ID");
|
||||||
|
public final static Property Ad_container_id = new Property(2, String.class, "ad_container_id", false, "AD_CONTAINER_ID");
|
||||||
|
public final static Property Play_duration = new Property(3, int.class, "play_duration", false, "PLAY_DURATION");
|
||||||
|
public final static Property Pause_while_move = new Property(4, boolean.class, "pause_while_move", false, "PAUSE_WHILE_MOVE");
|
||||||
|
public final static Property Price = new Property(5, int.class, "price", false, "PRICE");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ContainerDao(DaoConfig config) {
|
||||||
|
super(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ContainerDao(DaoConfig config, DaoSession daoSession) {
|
||||||
|
super(config, daoSession);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Creates the underlying database table. */
|
||||||
|
public static void createTable(Database db, boolean ifNotExists) {
|
||||||
|
String constraint = ifNotExists? "IF NOT EXISTS ": "";
|
||||||
|
db.execSQL("CREATE TABLE " + constraint + "\"CONTAINER\" (" + //
|
||||||
|
"\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: autoId
|
||||||
|
"\"ID\" TEXT," + // 1: id
|
||||||
|
"\"AD_CONTAINER_ID\" TEXT," + // 2: ad_container_id
|
||||||
|
"\"PLAY_DURATION\" INTEGER NOT NULL ," + // 3: play_duration
|
||||||
|
"\"PAUSE_WHILE_MOVE\" INTEGER NOT NULL ," + // 4: pause_while_move
|
||||||
|
"\"PRICE\" INTEGER NOT NULL );"); // 5: price
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Drops the underlying database table. */
|
||||||
|
public static void dropTable(Database db, boolean ifExists) {
|
||||||
|
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"CONTAINER\"";
|
||||||
|
db.execSQL(sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final void bindValues(DatabaseStatement stmt, Container entity) {
|
||||||
|
stmt.clearBindings();
|
||||||
|
|
||||||
|
Long autoId = entity.getAutoId();
|
||||||
|
if (autoId != null) {
|
||||||
|
stmt.bindLong(1, autoId);
|
||||||
|
}
|
||||||
|
|
||||||
|
String id = entity.getId();
|
||||||
|
if (id != null) {
|
||||||
|
stmt.bindString(2, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
String ad_container_id = entity.getAd_container_id();
|
||||||
|
if (ad_container_id != null) {
|
||||||
|
stmt.bindString(3, ad_container_id);
|
||||||
|
}
|
||||||
|
stmt.bindLong(4, entity.getPlay_duration());
|
||||||
|
stmt.bindLong(5, entity.getPause_while_move() ? 1L: 0L);
|
||||||
|
stmt.bindLong(6, entity.getPrice());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final void bindValues(SQLiteStatement stmt, Container entity) {
|
||||||
|
stmt.clearBindings();
|
||||||
|
|
||||||
|
Long autoId = entity.getAutoId();
|
||||||
|
if (autoId != null) {
|
||||||
|
stmt.bindLong(1, autoId);
|
||||||
|
}
|
||||||
|
|
||||||
|
String id = entity.getId();
|
||||||
|
if (id != null) {
|
||||||
|
stmt.bindString(2, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
String ad_container_id = entity.getAd_container_id();
|
||||||
|
if (ad_container_id != null) {
|
||||||
|
stmt.bindString(3, ad_container_id);
|
||||||
|
}
|
||||||
|
stmt.bindLong(4, entity.getPlay_duration());
|
||||||
|
stmt.bindLong(5, entity.getPause_while_move() ? 1L: 0L);
|
||||||
|
stmt.bindLong(6, entity.getPrice());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long readKey(Cursor cursor, int offset) {
|
||||||
|
return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Container readEntity(Cursor cursor, int offset) {
|
||||||
|
Container entity = new Container( //
|
||||||
|
cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // autoId
|
||||||
|
cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // id
|
||||||
|
cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // ad_container_id
|
||||||
|
cursor.getInt(offset + 3), // play_duration
|
||||||
|
cursor.getShort(offset + 4) != 0, // pause_while_move
|
||||||
|
cursor.getInt(offset + 5) // price
|
||||||
|
);
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readEntity(Cursor cursor, Container entity, int offset) {
|
||||||
|
entity.setAutoId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
|
||||||
|
entity.setId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
|
||||||
|
entity.setAd_container_id(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
|
||||||
|
entity.setPlay_duration(cursor.getInt(offset + 3));
|
||||||
|
entity.setPause_while_move(cursor.getShort(offset + 4) != 0);
|
||||||
|
entity.setPrice(cursor.getInt(offset + 5));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final Long updateKeyAfterInsert(Container entity, long rowId) {
|
||||||
|
entity.setAutoId(rowId);
|
||||||
|
return rowId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getKey(Container entity) {
|
||||||
|
if(entity != null) {
|
||||||
|
return entity.getAutoId();
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasKey(Container entity) {
|
||||||
|
return entity.getAutoId() != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final boolean isEntityUpdateable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,126 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.dao;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
import android.database.sqlite.SQLiteDatabase.CursorFactory;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import org.greenrobot.greendao.AbstractDaoMaster;
|
||||||
|
import org.greenrobot.greendao.database.StandardDatabase;
|
||||||
|
import org.greenrobot.greendao.database.Database;
|
||||||
|
import org.greenrobot.greendao.database.DatabaseOpenHelper;
|
||||||
|
import org.greenrobot.greendao.identityscope.IdentityScopeType;
|
||||||
|
|
||||||
|
|
||||||
|
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
|
||||||
|
/**
|
||||||
|
* Master of DAO (schema version 35): knows all DAOs.
|
||||||
|
*/
|
||||||
|
public class DaoMaster extends AbstractDaoMaster {
|
||||||
|
public static final int SCHEMA_VERSION = 35;
|
||||||
|
|
||||||
|
/** Creates underlying database table using DAOs. */
|
||||||
|
public static void createAllTables(Database db, boolean ifNotExists) {
|
||||||
|
AdvertiseDao.createTable(db, ifNotExists);
|
||||||
|
ContainerDao.createTable(db, ifNotExists);
|
||||||
|
LocationDao.createTable(db, ifNotExists);
|
||||||
|
NotNetAdvertiseDao.createTable(db, ifNotExists);
|
||||||
|
OrderDao.createTable(db, ifNotExists);
|
||||||
|
PlayLoggerDao.createTable(db, ifNotExists);
|
||||||
|
PositionAdvertiseDao.createTable(db, ifNotExists);
|
||||||
|
RegionsDao.createTable(db, ifNotExists);
|
||||||
|
SanleAdvertiseDao.createTable(db, ifNotExists);
|
||||||
|
TextInfoDao.createTable(db, ifNotExists);
|
||||||
|
TimeSpanDao.createTable(db, ifNotExists);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Drops underlying database table using DAOs. */
|
||||||
|
public static void dropAllTables(Database db, boolean ifExists) {
|
||||||
|
AdvertiseDao.dropTable(db, ifExists);
|
||||||
|
ContainerDao.dropTable(db, ifExists);
|
||||||
|
LocationDao.dropTable(db, ifExists);
|
||||||
|
NotNetAdvertiseDao.dropTable(db, ifExists);
|
||||||
|
OrderDao.dropTable(db, ifExists);
|
||||||
|
PlayLoggerDao.dropTable(db, ifExists);
|
||||||
|
PositionAdvertiseDao.dropTable(db, ifExists);
|
||||||
|
RegionsDao.dropTable(db, ifExists);
|
||||||
|
SanleAdvertiseDao.dropTable(db, ifExists);
|
||||||
|
TextInfoDao.dropTable(db, ifExists);
|
||||||
|
TimeSpanDao.dropTable(db, ifExists);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WARNING: Drops all table on Upgrade! Use only during development.
|
||||||
|
* Convenience method using a {@link DevOpenHelper}.
|
||||||
|
*/
|
||||||
|
public static DaoSession newDevSession(Context context, String name) {
|
||||||
|
Database db = new DevOpenHelper(context, name).getWritableDb();
|
||||||
|
DaoMaster daoMaster = new DaoMaster(db);
|
||||||
|
return daoMaster.newSession();
|
||||||
|
}
|
||||||
|
|
||||||
|
public DaoMaster(SQLiteDatabase db) {
|
||||||
|
this(new StandardDatabase(db));
|
||||||
|
}
|
||||||
|
|
||||||
|
public DaoMaster(Database db) {
|
||||||
|
super(db, SCHEMA_VERSION);
|
||||||
|
registerDaoClass(AdvertiseDao.class);
|
||||||
|
registerDaoClass(ContainerDao.class);
|
||||||
|
registerDaoClass(LocationDao.class);
|
||||||
|
registerDaoClass(NotNetAdvertiseDao.class);
|
||||||
|
registerDaoClass(OrderDao.class);
|
||||||
|
registerDaoClass(PlayLoggerDao.class);
|
||||||
|
registerDaoClass(PositionAdvertiseDao.class);
|
||||||
|
registerDaoClass(RegionsDao.class);
|
||||||
|
registerDaoClass(SanleAdvertiseDao.class);
|
||||||
|
registerDaoClass(TextInfoDao.class);
|
||||||
|
registerDaoClass(TimeSpanDao.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DaoSession newSession() {
|
||||||
|
return new DaoSession(db, IdentityScopeType.Session, daoConfigMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DaoSession newSession(IdentityScopeType type) {
|
||||||
|
return new DaoSession(db, type, daoConfigMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calls {@link #createAllTables(Database, boolean)} in {@link #onCreate(Database)} -
|
||||||
|
*/
|
||||||
|
public static abstract class OpenHelper extends DatabaseOpenHelper {
|
||||||
|
public OpenHelper(Context context, String name) {
|
||||||
|
super(context, name, SCHEMA_VERSION);
|
||||||
|
}
|
||||||
|
|
||||||
|
public OpenHelper(Context context, String name, CursorFactory factory) {
|
||||||
|
super(context, name, factory, SCHEMA_VERSION);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Database db) {
|
||||||
|
Log.i("greenDAO", "Creating tables for schema version " + SCHEMA_VERSION);
|
||||||
|
createAllTables(db, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** WARNING: Drops all table on Upgrade! Use only during development. */
|
||||||
|
public static class DevOpenHelper extends OpenHelper {
|
||||||
|
public DevOpenHelper(Context context, String name) {
|
||||||
|
super(context, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DevOpenHelper(Context context, String name, CursorFactory factory) {
|
||||||
|
super(context, name, factory);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpgrade(Database db, int oldVersion, int newVersion) {
|
||||||
|
Log.i("greenDAO", "Upgrading schema from version " + oldVersion + " to " + newVersion + " by dropping all tables");
|
||||||
|
dropAllTables(db, true);
|
||||||
|
onCreate(db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,188 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.dao;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.greenrobot.greendao.AbstractDao;
|
||||||
|
import org.greenrobot.greendao.AbstractDaoSession;
|
||||||
|
import org.greenrobot.greendao.database.Database;
|
||||||
|
import org.greenrobot.greendao.identityscope.IdentityScopeType;
|
||||||
|
import org.greenrobot.greendao.internal.DaoConfig;
|
||||||
|
|
||||||
|
import cn.trans88.taxiappkotlin.logic.model.Advertise;
|
||||||
|
import cn.trans88.taxiappkotlin.logic.model.Container;
|
||||||
|
import cn.trans88.taxiappkotlin.logic.model.Location;
|
||||||
|
import cn.trans88.taxiappkotlin.logic.model.NotNetAdvertise;
|
||||||
|
import cn.trans88.taxiappkotlin.logic.model.Order;
|
||||||
|
import cn.trans88.taxiappkotlin.logic.model.PlayLogger;
|
||||||
|
import cn.trans88.taxiappkotlin.logic.model.PositionAdvertise;
|
||||||
|
import cn.trans88.taxiappkotlin.logic.model.Regions;
|
||||||
|
import cn.trans88.taxiappkotlin.logic.model.SanleAdvertise;
|
||||||
|
import cn.trans88.taxiappkotlin.logic.model.TextInfo;
|
||||||
|
import cn.trans88.taxiappkotlin.logic.model.TimeSpan;
|
||||||
|
|
||||||
|
import cn.trans88.taxiappkotlin.logic.dao.AdvertiseDao;
|
||||||
|
import cn.trans88.taxiappkotlin.logic.dao.ContainerDao;
|
||||||
|
import cn.trans88.taxiappkotlin.logic.dao.LocationDao;
|
||||||
|
import cn.trans88.taxiappkotlin.logic.dao.NotNetAdvertiseDao;
|
||||||
|
import cn.trans88.taxiappkotlin.logic.dao.OrderDao;
|
||||||
|
import cn.trans88.taxiappkotlin.logic.dao.PlayLoggerDao;
|
||||||
|
import cn.trans88.taxiappkotlin.logic.dao.PositionAdvertiseDao;
|
||||||
|
import cn.trans88.taxiappkotlin.logic.dao.RegionsDao;
|
||||||
|
import cn.trans88.taxiappkotlin.logic.dao.SanleAdvertiseDao;
|
||||||
|
import cn.trans88.taxiappkotlin.logic.dao.TextInfoDao;
|
||||||
|
import cn.trans88.taxiappkotlin.logic.dao.TimeSpanDao;
|
||||||
|
|
||||||
|
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*
|
||||||
|
* @see org.greenrobot.greendao.AbstractDaoSession
|
||||||
|
*/
|
||||||
|
public class DaoSession extends AbstractDaoSession {
|
||||||
|
|
||||||
|
private final DaoConfig advertiseDaoConfig;
|
||||||
|
private final DaoConfig containerDaoConfig;
|
||||||
|
private final DaoConfig locationDaoConfig;
|
||||||
|
private final DaoConfig notNetAdvertiseDaoConfig;
|
||||||
|
private final DaoConfig orderDaoConfig;
|
||||||
|
private final DaoConfig playLoggerDaoConfig;
|
||||||
|
private final DaoConfig positionAdvertiseDaoConfig;
|
||||||
|
private final DaoConfig regionsDaoConfig;
|
||||||
|
private final DaoConfig sanleAdvertiseDaoConfig;
|
||||||
|
private final DaoConfig textInfoDaoConfig;
|
||||||
|
private final DaoConfig timeSpanDaoConfig;
|
||||||
|
|
||||||
|
private final AdvertiseDao advertiseDao;
|
||||||
|
private final ContainerDao containerDao;
|
||||||
|
private final LocationDao locationDao;
|
||||||
|
private final NotNetAdvertiseDao notNetAdvertiseDao;
|
||||||
|
private final OrderDao orderDao;
|
||||||
|
private final PlayLoggerDao playLoggerDao;
|
||||||
|
private final PositionAdvertiseDao positionAdvertiseDao;
|
||||||
|
private final RegionsDao regionsDao;
|
||||||
|
private final SanleAdvertiseDao sanleAdvertiseDao;
|
||||||
|
private final TextInfoDao textInfoDao;
|
||||||
|
private final TimeSpanDao timeSpanDao;
|
||||||
|
|
||||||
|
public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
|
||||||
|
daoConfigMap) {
|
||||||
|
super(db);
|
||||||
|
|
||||||
|
advertiseDaoConfig = daoConfigMap.get(AdvertiseDao.class).clone();
|
||||||
|
advertiseDaoConfig.initIdentityScope(type);
|
||||||
|
|
||||||
|
containerDaoConfig = daoConfigMap.get(ContainerDao.class).clone();
|
||||||
|
containerDaoConfig.initIdentityScope(type);
|
||||||
|
|
||||||
|
locationDaoConfig = daoConfigMap.get(LocationDao.class).clone();
|
||||||
|
locationDaoConfig.initIdentityScope(type);
|
||||||
|
|
||||||
|
notNetAdvertiseDaoConfig = daoConfigMap.get(NotNetAdvertiseDao.class).clone();
|
||||||
|
notNetAdvertiseDaoConfig.initIdentityScope(type);
|
||||||
|
|
||||||
|
orderDaoConfig = daoConfigMap.get(OrderDao.class).clone();
|
||||||
|
orderDaoConfig.initIdentityScope(type);
|
||||||
|
|
||||||
|
playLoggerDaoConfig = daoConfigMap.get(PlayLoggerDao.class).clone();
|
||||||
|
playLoggerDaoConfig.initIdentityScope(type);
|
||||||
|
|
||||||
|
positionAdvertiseDaoConfig = daoConfigMap.get(PositionAdvertiseDao.class).clone();
|
||||||
|
positionAdvertiseDaoConfig.initIdentityScope(type);
|
||||||
|
|
||||||
|
regionsDaoConfig = daoConfigMap.get(RegionsDao.class).clone();
|
||||||
|
regionsDaoConfig.initIdentityScope(type);
|
||||||
|
|
||||||
|
sanleAdvertiseDaoConfig = daoConfigMap.get(SanleAdvertiseDao.class).clone();
|
||||||
|
sanleAdvertiseDaoConfig.initIdentityScope(type);
|
||||||
|
|
||||||
|
textInfoDaoConfig = daoConfigMap.get(TextInfoDao.class).clone();
|
||||||
|
textInfoDaoConfig.initIdentityScope(type);
|
||||||
|
|
||||||
|
timeSpanDaoConfig = daoConfigMap.get(TimeSpanDao.class).clone();
|
||||||
|
timeSpanDaoConfig.initIdentityScope(type);
|
||||||
|
|
||||||
|
advertiseDao = new AdvertiseDao(advertiseDaoConfig, this);
|
||||||
|
containerDao = new ContainerDao(containerDaoConfig, this);
|
||||||
|
locationDao = new LocationDao(locationDaoConfig, this);
|
||||||
|
notNetAdvertiseDao = new NotNetAdvertiseDao(notNetAdvertiseDaoConfig, this);
|
||||||
|
orderDao = new OrderDao(orderDaoConfig, this);
|
||||||
|
playLoggerDao = new PlayLoggerDao(playLoggerDaoConfig, this);
|
||||||
|
positionAdvertiseDao = new PositionAdvertiseDao(positionAdvertiseDaoConfig, this);
|
||||||
|
regionsDao = new RegionsDao(regionsDaoConfig, this);
|
||||||
|
sanleAdvertiseDao = new SanleAdvertiseDao(sanleAdvertiseDaoConfig, this);
|
||||||
|
textInfoDao = new TextInfoDao(textInfoDaoConfig, this);
|
||||||
|
timeSpanDao = new TimeSpanDao(timeSpanDaoConfig, this);
|
||||||
|
|
||||||
|
registerDao(Advertise.class, advertiseDao);
|
||||||
|
registerDao(Container.class, containerDao);
|
||||||
|
registerDao(Location.class, locationDao);
|
||||||
|
registerDao(NotNetAdvertise.class, notNetAdvertiseDao);
|
||||||
|
registerDao(Order.class, orderDao);
|
||||||
|
registerDao(PlayLogger.class, playLoggerDao);
|
||||||
|
registerDao(PositionAdvertise.class, positionAdvertiseDao);
|
||||||
|
registerDao(Regions.class, regionsDao);
|
||||||
|
registerDao(SanleAdvertise.class, sanleAdvertiseDao);
|
||||||
|
registerDao(TextInfo.class, textInfoDao);
|
||||||
|
registerDao(TimeSpan.class, timeSpanDao);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
advertiseDaoConfig.clearIdentityScope();
|
||||||
|
containerDaoConfig.clearIdentityScope();
|
||||||
|
locationDaoConfig.clearIdentityScope();
|
||||||
|
notNetAdvertiseDaoConfig.clearIdentityScope();
|
||||||
|
orderDaoConfig.clearIdentityScope();
|
||||||
|
playLoggerDaoConfig.clearIdentityScope();
|
||||||
|
positionAdvertiseDaoConfig.clearIdentityScope();
|
||||||
|
regionsDaoConfig.clearIdentityScope();
|
||||||
|
sanleAdvertiseDaoConfig.clearIdentityScope();
|
||||||
|
textInfoDaoConfig.clearIdentityScope();
|
||||||
|
timeSpanDaoConfig.clearIdentityScope();
|
||||||
|
}
|
||||||
|
|
||||||
|
public AdvertiseDao getAdvertiseDao() {
|
||||||
|
return advertiseDao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ContainerDao getContainerDao() {
|
||||||
|
return containerDao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocationDao getLocationDao() {
|
||||||
|
return locationDao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public NotNetAdvertiseDao getNotNetAdvertiseDao() {
|
||||||
|
return notNetAdvertiseDao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderDao getOrderDao() {
|
||||||
|
return orderDao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PlayLoggerDao getPlayLoggerDao() {
|
||||||
|
return playLoggerDao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PositionAdvertiseDao getPositionAdvertiseDao() {
|
||||||
|
return positionAdvertiseDao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RegionsDao getRegionsDao() {
|
||||||
|
return regionsDao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SanleAdvertiseDao getSanleAdvertiseDao() {
|
||||||
|
return sanleAdvertiseDao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TextInfoDao getTextInfoDao() {
|
||||||
|
return textInfoDao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TimeSpanDao getTimeSpanDao() {
|
||||||
|
return timeSpanDao;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,154 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.dao
|
||||||
|
|
||||||
|
//import cn.trans88.taxiappkotlin.entity.Advertise
|
||||||
|
import android.database.sqlite.SQLiteDatabase
|
||||||
|
import cn.trans88.taxiappkotlin.TaxiApp
|
||||||
|
import cn.trans88.taxiappkotlin.logic.model.*
|
||||||
|
import cn.trans88.taxiappkotlin.ui.advertise.AdvertiseType
|
||||||
|
import org.greenrobot.greendao.database.Database
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
|
||||||
|
object DaoUtil {
|
||||||
|
private const val DB_NAME = "taxi-app-database.db"
|
||||||
|
|
||||||
|
// private val helperDaoDB = HelperDaoDB(TaxiApp.instance(), DB_NAME, null)
|
||||||
|
// val db = helperDaoDB.writableDatabase
|
||||||
|
// private val daoMaster: DaoMaster = DaoMaster(db)
|
||||||
|
// val daoSession: DaoSession = daoMaster.newSession()
|
||||||
|
private var helperDaoDB:HelperDaoDB
|
||||||
|
var db:SQLiteDatabase
|
||||||
|
// var db:Database
|
||||||
|
private var daoMaster: DaoMaster
|
||||||
|
var daoSession: DaoSession
|
||||||
|
|
||||||
|
init {
|
||||||
|
helperDaoDB = HelperDaoDB(TaxiApp.instance(), DB_NAME, null)
|
||||||
|
// db = helperDaoDB.getEncryptedWritableDb("123")
|
||||||
|
db = helperDaoDB.writableDatabase
|
||||||
|
// db.disableWriteAheadLogging()
|
||||||
|
daoMaster = DaoMaster(db)
|
||||||
|
daoSession= daoMaster.newSession()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Synchronized
|
||||||
|
fun getOrderDao(): OrderDao {
|
||||||
|
return daoMaster.newSession().orderDao
|
||||||
|
}
|
||||||
|
|
||||||
|
@Synchronized
|
||||||
|
fun getPlayLoggerDao(): PlayLoggerDao {
|
||||||
|
return daoMaster.newSession().playLoggerDao
|
||||||
|
}
|
||||||
|
|
||||||
|
@Synchronized
|
||||||
|
fun getAdvertise(): AdvertiseDao {
|
||||||
|
return daoMaster.newSession().advertiseDao
|
||||||
|
}
|
||||||
|
|
||||||
|
@Synchronized
|
||||||
|
fun getLocationDao(): LocationDao {
|
||||||
|
return daoMaster.newSession().locationDao
|
||||||
|
}
|
||||||
|
|
||||||
|
@Synchronized
|
||||||
|
fun getLocations(): List<Location> {
|
||||||
|
return getLocationDao().loadAll()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Synchronized
|
||||||
|
fun getAdvertises(): MutableList<Advertise> {
|
||||||
|
return daoMaster.newSession().advertiseDao.loadAll()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Synchronized
|
||||||
|
fun getSanleAdvertises(): List<SanleAdvertise> {
|
||||||
|
return daoMaster.newSession().sanleAdvertiseDao.loadAll()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Synchronized
|
||||||
|
fun getSanleAdvertise(): SanleAdvertiseDao {
|
||||||
|
return daoMaster.newSession().sanleAdvertiseDao
|
||||||
|
}
|
||||||
|
|
||||||
|
@Synchronized
|
||||||
|
fun getPositionAdvertise(): PositionAdvertiseDao = daoMaster.newSession().positionAdvertiseDao
|
||||||
|
|
||||||
|
@Synchronized
|
||||||
|
fun getTimeSpan(): TimeSpanDao = daoMaster.newSession().timeSpanDao
|
||||||
|
|
||||||
|
@Synchronized
|
||||||
|
fun getPositionAdvertises(): List<PositionAdvertise> = daoMaster.newSession().positionAdvertiseDao.loadAll()
|
||||||
|
|
||||||
|
@Synchronized
|
||||||
|
fun getRegion(): RegionsDao {
|
||||||
|
return daoMaster.newSession().regionsDao
|
||||||
|
}
|
||||||
|
|
||||||
|
@Synchronized
|
||||||
|
fun getPlayLogger(): PlayLoggerDao {
|
||||||
|
return daoMaster.newSession().playLoggerDao
|
||||||
|
}
|
||||||
|
|
||||||
|
@Synchronized
|
||||||
|
fun getPlayLoggers(): List<PlayLogger> {
|
||||||
|
return getPlayLogger().loadAll()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Synchronized
|
||||||
|
fun getContainerDao(): ContainerDao {
|
||||||
|
return daoMaster.newSession().containerDao
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除全部普通广告
|
||||||
|
*/
|
||||||
|
@Synchronized
|
||||||
|
fun deleteAllNormalAdvertiseWeb() {
|
||||||
|
val advertises: List<Advertise> =
|
||||||
|
getAdvertise().queryBuilder().where(AdvertiseDao.Properties.BelongTo.eq(AdvertiseType.NORMAL.ordinal)).list()
|
||||||
|
for (advertise in advertises) {
|
||||||
|
if (null != advertise.getPathName()) {
|
||||||
|
val file = File(advertise.getPathName())
|
||||||
|
if (file.exists()) {
|
||||||
|
file.delete()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
getAdvertise().delete(advertise)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除所有广告
|
||||||
|
*/
|
||||||
|
@Synchronized
|
||||||
|
fun deleteAllAdvertise() {
|
||||||
|
val advertises = getAdvertise().loadAll()
|
||||||
|
for (advertise in advertises) {
|
||||||
|
if (null != advertise.pathName) {
|
||||||
|
val file = File(advertise.pathName)
|
||||||
|
if (file.exists()) {
|
||||||
|
file.delete()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
getAdvertise().delete(advertise)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除单个广告
|
||||||
|
*/
|
||||||
|
@Synchronized
|
||||||
|
fun deleteAdvertise(advertise: Advertise) {
|
||||||
|
getPositionAdvertise().queryBuilder().where(PositionAdvertiseDao.Properties.Task_id.eq(advertise.ad_id)).buildDelete().executeDeleteWithoutDetachingEntities()
|
||||||
|
getTimeSpan().queryBuilder().where(TimeSpanDao.Properties.AdvertiseId.eq(advertise.ad_id)).buildDelete().executeDeleteWithoutDetachingEntities()
|
||||||
|
getRegion().queryBuilder().where(RegionsDao.Properties.RegionAdId.eq(advertise.ad_id)).buildDelete().executeDeleteWithoutDetachingEntities()
|
||||||
|
getAdvertise().queryBuilder().where(AdvertiseDao.Properties.Ad_id.eq(advertise.ad_id)).buildDelete().executeDeleteWithoutDetachingEntities()
|
||||||
|
if (null != advertise.pathName) {
|
||||||
|
val file = File(advertise.pathName)
|
||||||
|
if (file.exists()) {
|
||||||
|
file.delete()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.dao
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.database.sqlite.SQLiteDatabase.CursorFactory
|
||||||
|
import cn.trans88.taxiappkotlin.util.YoungUtil
|
||||||
|
import com.github.yuweiguocn.library.greendao.MigrationHelper
|
||||||
|
import org.greenrobot.greendao.database.Database
|
||||||
|
|
||||||
|
class HelperDaoDB(
|
||||||
|
context: Context,
|
||||||
|
name: String,
|
||||||
|
factory: CursorFactory?
|
||||||
|
) : DaoMaster.OpenHelper(context, name, factory) {
|
||||||
|
override fun onUpgrade(db: Database?, oldVersion: Int, newVersion: Int) {
|
||||||
|
MigrationHelper.migrate(
|
||||||
|
db,
|
||||||
|
object : MigrationHelper.ReCreateAllTableListener {
|
||||||
|
override fun onDropAllTables(db: Database?, ifExists: Boolean) {
|
||||||
|
YoungUtil.YoungLog("删除旧表$ifExists")
|
||||||
|
DaoMaster.dropAllTables(db, ifExists)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreateAllTables(db: Database?, ifNotExists: Boolean) {
|
||||||
|
YoungUtil.YoungLog("创建新表$ifNotExists")
|
||||||
|
DaoMaster.createAllTables(db, ifNotExists)
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
AdvertiseDao::class.java,
|
||||||
|
SanleAdvertiseDao::class.java,
|
||||||
|
LocationDao::class.java,
|
||||||
|
ContainerDao::class.java,
|
||||||
|
PlayLoggerDao::class.java,
|
||||||
|
TimeSpanDao::class.java,
|
||||||
|
RegionsDao::class.java,
|
||||||
|
PositionAdvertiseDao::class.java,
|
||||||
|
TextInfoDao::class.java
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,213 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.dao;
|
||||||
|
|
||||||
|
import android.database.Cursor;
|
||||||
|
import android.database.sqlite.SQLiteStatement;
|
||||||
|
|
||||||
|
import org.greenrobot.greendao.AbstractDao;
|
||||||
|
import org.greenrobot.greendao.Property;
|
||||||
|
import org.greenrobot.greendao.internal.DaoConfig;
|
||||||
|
import org.greenrobot.greendao.database.Database;
|
||||||
|
import org.greenrobot.greendao.database.DatabaseStatement;
|
||||||
|
|
||||||
|
import cn.trans88.taxiappkotlin.logic.model.Location;
|
||||||
|
|
||||||
|
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
|
||||||
|
/**
|
||||||
|
* DAO for table "LOCATION".
|
||||||
|
*/
|
||||||
|
public class LocationDao extends AbstractDao<Location, Long> {
|
||||||
|
|
||||||
|
public static final String TABLENAME = "LOCATION";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Properties of entity Location.<br/>
|
||||||
|
* Can be used for QueryBuilder and for referencing column names.
|
||||||
|
*/
|
||||||
|
public static class Properties {
|
||||||
|
public final static Property Id = new Property(0, Long.class, "id", true, "_id");
|
||||||
|
public final static Property Timestamp = new Property(1, Long.class, "timestamp", false, "TIMESTAMP");
|
||||||
|
public final static Property Longitude = new Property(2, Double.class, "longitude", false, "LONGITUDE");
|
||||||
|
public final static Property Latitude = new Property(3, Double.class, "latitude", false, "LATITUDE");
|
||||||
|
public final static Property Speed = new Property(4, Float.class, "speed", false, "SPEED");
|
||||||
|
public final static Property Bearing = new Property(5, Float.class, "bearing", false, "BEARING");
|
||||||
|
public final static Property Distance = new Property(6, Float.class, "distance", false, "DISTANCE");
|
||||||
|
public final static Property Elapse = new Property(7, Long.class, "elapse", false, "ELAPSE");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public LocationDao(DaoConfig config) {
|
||||||
|
super(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocationDao(DaoConfig config, DaoSession daoSession) {
|
||||||
|
super(config, daoSession);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Creates the underlying database table. */
|
||||||
|
public static void createTable(Database db, boolean ifNotExists) {
|
||||||
|
String constraint = ifNotExists? "IF NOT EXISTS ": "";
|
||||||
|
db.execSQL("CREATE TABLE " + constraint + "\"LOCATION\" (" + //
|
||||||
|
"\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id
|
||||||
|
"\"TIMESTAMP\" INTEGER," + // 1: timestamp
|
||||||
|
"\"LONGITUDE\" REAL," + // 2: longitude
|
||||||
|
"\"LATITUDE\" REAL," + // 3: latitude
|
||||||
|
"\"SPEED\" REAL," + // 4: speed
|
||||||
|
"\"BEARING\" REAL," + // 5: bearing
|
||||||
|
"\"DISTANCE\" REAL," + // 6: distance
|
||||||
|
"\"ELAPSE\" INTEGER);"); // 7: elapse
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Drops the underlying database table. */
|
||||||
|
public static void dropTable(Database db, boolean ifExists) {
|
||||||
|
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"LOCATION\"";
|
||||||
|
db.execSQL(sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final void bindValues(DatabaseStatement stmt, Location entity) {
|
||||||
|
stmt.clearBindings();
|
||||||
|
|
||||||
|
Long id = entity.getId();
|
||||||
|
if (id != null) {
|
||||||
|
stmt.bindLong(1, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
Long timestamp = entity.getTimestamp();
|
||||||
|
if (timestamp != null) {
|
||||||
|
stmt.bindLong(2, timestamp);
|
||||||
|
}
|
||||||
|
|
||||||
|
Double longitude = entity.getLongitude();
|
||||||
|
if (longitude != null) {
|
||||||
|
stmt.bindDouble(3, longitude);
|
||||||
|
}
|
||||||
|
|
||||||
|
Double latitude = entity.getLatitude();
|
||||||
|
if (latitude != null) {
|
||||||
|
stmt.bindDouble(4, latitude);
|
||||||
|
}
|
||||||
|
|
||||||
|
Float speed = entity.getSpeed();
|
||||||
|
if (speed != null) {
|
||||||
|
stmt.bindDouble(5, speed);
|
||||||
|
}
|
||||||
|
|
||||||
|
Float bearing = entity.getBearing();
|
||||||
|
if (bearing != null) {
|
||||||
|
stmt.bindDouble(6, bearing);
|
||||||
|
}
|
||||||
|
|
||||||
|
Float distance = entity.getDistance();
|
||||||
|
if (distance != null) {
|
||||||
|
stmt.bindDouble(7, distance);
|
||||||
|
}
|
||||||
|
|
||||||
|
Long elapse = entity.getElapse();
|
||||||
|
if (elapse != null) {
|
||||||
|
stmt.bindLong(8, elapse);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final void bindValues(SQLiteStatement stmt, Location entity) {
|
||||||
|
stmt.clearBindings();
|
||||||
|
|
||||||
|
Long id = entity.getId();
|
||||||
|
if (id != null) {
|
||||||
|
stmt.bindLong(1, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
Long timestamp = entity.getTimestamp();
|
||||||
|
if (timestamp != null) {
|
||||||
|
stmt.bindLong(2, timestamp);
|
||||||
|
}
|
||||||
|
|
||||||
|
Double longitude = entity.getLongitude();
|
||||||
|
if (longitude != null) {
|
||||||
|
stmt.bindDouble(3, longitude);
|
||||||
|
}
|
||||||
|
|
||||||
|
Double latitude = entity.getLatitude();
|
||||||
|
if (latitude != null) {
|
||||||
|
stmt.bindDouble(4, latitude);
|
||||||
|
}
|
||||||
|
|
||||||
|
Float speed = entity.getSpeed();
|
||||||
|
if (speed != null) {
|
||||||
|
stmt.bindDouble(5, speed);
|
||||||
|
}
|
||||||
|
|
||||||
|
Float bearing = entity.getBearing();
|
||||||
|
if (bearing != null) {
|
||||||
|
stmt.bindDouble(6, bearing);
|
||||||
|
}
|
||||||
|
|
||||||
|
Float distance = entity.getDistance();
|
||||||
|
if (distance != null) {
|
||||||
|
stmt.bindDouble(7, distance);
|
||||||
|
}
|
||||||
|
|
||||||
|
Long elapse = entity.getElapse();
|
||||||
|
if (elapse != null) {
|
||||||
|
stmt.bindLong(8, elapse);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long readKey(Cursor cursor, int offset) {
|
||||||
|
return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Location readEntity(Cursor cursor, int offset) {
|
||||||
|
Location entity = new Location( //
|
||||||
|
cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
|
||||||
|
cursor.isNull(offset + 1) ? null : cursor.getLong(offset + 1), // timestamp
|
||||||
|
cursor.isNull(offset + 2) ? null : cursor.getDouble(offset + 2), // longitude
|
||||||
|
cursor.isNull(offset + 3) ? null : cursor.getDouble(offset + 3), // latitude
|
||||||
|
cursor.isNull(offset + 4) ? null : cursor.getFloat(offset + 4), // speed
|
||||||
|
cursor.isNull(offset + 5) ? null : cursor.getFloat(offset + 5), // bearing
|
||||||
|
cursor.isNull(offset + 6) ? null : cursor.getFloat(offset + 6), // distance
|
||||||
|
cursor.isNull(offset + 7) ? null : cursor.getLong(offset + 7) // elapse
|
||||||
|
);
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readEntity(Cursor cursor, Location entity, int offset) {
|
||||||
|
entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
|
||||||
|
entity.setTimestamp(cursor.isNull(offset + 1) ? null : cursor.getLong(offset + 1));
|
||||||
|
entity.setLongitude(cursor.isNull(offset + 2) ? null : cursor.getDouble(offset + 2));
|
||||||
|
entity.setLatitude(cursor.isNull(offset + 3) ? null : cursor.getDouble(offset + 3));
|
||||||
|
entity.setSpeed(cursor.isNull(offset + 4) ? null : cursor.getFloat(offset + 4));
|
||||||
|
entity.setBearing(cursor.isNull(offset + 5) ? null : cursor.getFloat(offset + 5));
|
||||||
|
entity.setDistance(cursor.isNull(offset + 6) ? null : cursor.getFloat(offset + 6));
|
||||||
|
entity.setElapse(cursor.isNull(offset + 7) ? null : cursor.getLong(offset + 7));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final Long updateKeyAfterInsert(Location entity, long rowId) {
|
||||||
|
entity.setId(rowId);
|
||||||
|
return rowId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getKey(Location entity) {
|
||||||
|
if(entity != null) {
|
||||||
|
return entity.getId();
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasKey(Location entity) {
|
||||||
|
return entity.getId() != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final boolean isEntityUpdateable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,183 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.dao;
|
||||||
|
|
||||||
|
import android.database.Cursor;
|
||||||
|
import android.database.sqlite.SQLiteStatement;
|
||||||
|
|
||||||
|
import org.greenrobot.greendao.AbstractDao;
|
||||||
|
import org.greenrobot.greendao.Property;
|
||||||
|
import org.greenrobot.greendao.internal.DaoConfig;
|
||||||
|
import org.greenrobot.greendao.database.Database;
|
||||||
|
import org.greenrobot.greendao.database.DatabaseStatement;
|
||||||
|
|
||||||
|
import cn.trans88.taxiappkotlin.logic.model.NotNetAdvertise;
|
||||||
|
|
||||||
|
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
|
||||||
|
/**
|
||||||
|
* DAO for table "NOT_NET_ADVERTISE".
|
||||||
|
*/
|
||||||
|
public class NotNetAdvertiseDao extends AbstractDao<NotNetAdvertise, Long> {
|
||||||
|
|
||||||
|
public static final String TABLENAME = "NOT_NET_ADVERTISE";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Properties of entity NotNetAdvertise.<br/>
|
||||||
|
* Can be used for QueryBuilder and for referencing column names.
|
||||||
|
*/
|
||||||
|
public static class Properties {
|
||||||
|
public final static Property AutoId = new Property(0, Long.class, "autoId", true, "_id");
|
||||||
|
public final static Property Id = new Property(1, String.class, "id", false, "ID");
|
||||||
|
public final static Property BelongTo = new Property(2, int.class, "belongTo", false, "BELONG_TO");
|
||||||
|
public final static Property Media_type = new Property(3, int.class, "media_type", false, "MEDIA_TYPE");
|
||||||
|
public final static Property Media_url = new Property(4, String.class, "media_url", false, "MEDIA_URL");
|
||||||
|
public final static Property PathName = new Property(5, String.class, "pathName", false, "PATH_NAME");
|
||||||
|
public final static Property Duration = new Property(6, String.class, "duration", false, "DURATION");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public NotNetAdvertiseDao(DaoConfig config) {
|
||||||
|
super(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
public NotNetAdvertiseDao(DaoConfig config, DaoSession daoSession) {
|
||||||
|
super(config, daoSession);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Creates the underlying database table. */
|
||||||
|
public static void createTable(Database db, boolean ifNotExists) {
|
||||||
|
String constraint = ifNotExists? "IF NOT EXISTS ": "";
|
||||||
|
db.execSQL("CREATE TABLE " + constraint + "\"NOT_NET_ADVERTISE\" (" + //
|
||||||
|
"\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: autoId
|
||||||
|
"\"ID\" TEXT," + // 1: id
|
||||||
|
"\"BELONG_TO\" INTEGER NOT NULL ," + // 2: belongTo
|
||||||
|
"\"MEDIA_TYPE\" INTEGER NOT NULL ," + // 3: media_type
|
||||||
|
"\"MEDIA_URL\" TEXT," + // 4: media_url
|
||||||
|
"\"PATH_NAME\" TEXT," + // 5: pathName
|
||||||
|
"\"DURATION\" TEXT);"); // 6: duration
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Drops the underlying database table. */
|
||||||
|
public static void dropTable(Database db, boolean ifExists) {
|
||||||
|
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"NOT_NET_ADVERTISE\"";
|
||||||
|
db.execSQL(sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final void bindValues(DatabaseStatement stmt, NotNetAdvertise entity) {
|
||||||
|
stmt.clearBindings();
|
||||||
|
|
||||||
|
Long autoId = entity.getAutoId();
|
||||||
|
if (autoId != null) {
|
||||||
|
stmt.bindLong(1, autoId);
|
||||||
|
}
|
||||||
|
|
||||||
|
String id = entity.getId();
|
||||||
|
if (id != null) {
|
||||||
|
stmt.bindString(2, id);
|
||||||
|
}
|
||||||
|
stmt.bindLong(3, entity.getBelongTo());
|
||||||
|
stmt.bindLong(4, entity.getMedia_type());
|
||||||
|
|
||||||
|
String media_url = entity.getMedia_url();
|
||||||
|
if (media_url != null) {
|
||||||
|
stmt.bindString(5, media_url);
|
||||||
|
}
|
||||||
|
|
||||||
|
String pathName = entity.getPathName();
|
||||||
|
if (pathName != null) {
|
||||||
|
stmt.bindString(6, pathName);
|
||||||
|
}
|
||||||
|
|
||||||
|
String duration = entity.getDuration();
|
||||||
|
if (duration != null) {
|
||||||
|
stmt.bindString(7, duration);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final void bindValues(SQLiteStatement stmt, NotNetAdvertise entity) {
|
||||||
|
stmt.clearBindings();
|
||||||
|
|
||||||
|
Long autoId = entity.getAutoId();
|
||||||
|
if (autoId != null) {
|
||||||
|
stmt.bindLong(1, autoId);
|
||||||
|
}
|
||||||
|
|
||||||
|
String id = entity.getId();
|
||||||
|
if (id != null) {
|
||||||
|
stmt.bindString(2, id);
|
||||||
|
}
|
||||||
|
stmt.bindLong(3, entity.getBelongTo());
|
||||||
|
stmt.bindLong(4, entity.getMedia_type());
|
||||||
|
|
||||||
|
String media_url = entity.getMedia_url();
|
||||||
|
if (media_url != null) {
|
||||||
|
stmt.bindString(5, media_url);
|
||||||
|
}
|
||||||
|
|
||||||
|
String pathName = entity.getPathName();
|
||||||
|
if (pathName != null) {
|
||||||
|
stmt.bindString(6, pathName);
|
||||||
|
}
|
||||||
|
|
||||||
|
String duration = entity.getDuration();
|
||||||
|
if (duration != null) {
|
||||||
|
stmt.bindString(7, duration);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long readKey(Cursor cursor, int offset) {
|
||||||
|
return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NotNetAdvertise readEntity(Cursor cursor, int offset) {
|
||||||
|
NotNetAdvertise entity = new NotNetAdvertise( //
|
||||||
|
cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // autoId
|
||||||
|
cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // id
|
||||||
|
cursor.getInt(offset + 2), // belongTo
|
||||||
|
cursor.getInt(offset + 3), // media_type
|
||||||
|
cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // media_url
|
||||||
|
cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // pathName
|
||||||
|
cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6) // duration
|
||||||
|
);
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readEntity(Cursor cursor, NotNetAdvertise entity, int offset) {
|
||||||
|
entity.setAutoId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
|
||||||
|
entity.setId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
|
||||||
|
entity.setBelongTo(cursor.getInt(offset + 2));
|
||||||
|
entity.setMedia_type(cursor.getInt(offset + 3));
|
||||||
|
entity.setMedia_url(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
|
||||||
|
entity.setPathName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
|
||||||
|
entity.setDuration(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final Long updateKeyAfterInsert(NotNetAdvertise entity, long rowId) {
|
||||||
|
entity.setAutoId(rowId);
|
||||||
|
return rowId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getKey(NotNetAdvertise entity) {
|
||||||
|
if(entity != null) {
|
||||||
|
return entity.getAutoId();
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasKey(NotNetAdvertise entity) {
|
||||||
|
return entity.getAutoId() != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final boolean isEntityUpdateable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,143 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.dao;
|
||||||
|
|
||||||
|
import android.database.Cursor;
|
||||||
|
import android.database.sqlite.SQLiteStatement;
|
||||||
|
|
||||||
|
import org.greenrobot.greendao.AbstractDao;
|
||||||
|
import org.greenrobot.greendao.Property;
|
||||||
|
import org.greenrobot.greendao.internal.DaoConfig;
|
||||||
|
import org.greenrobot.greendao.database.Database;
|
||||||
|
import org.greenrobot.greendao.database.DatabaseStatement;
|
||||||
|
|
||||||
|
import cn.trans88.taxiappkotlin.logic.model.Order;
|
||||||
|
|
||||||
|
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
|
||||||
|
/**
|
||||||
|
* DAO for table "ORDER".
|
||||||
|
*/
|
||||||
|
public class OrderDao extends AbstractDao<Order, Long> {
|
||||||
|
|
||||||
|
public static final String TABLENAME = "ORDER";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Properties of entity Order.<br/>
|
||||||
|
* Can be used for QueryBuilder and for referencing column names.
|
||||||
|
*/
|
||||||
|
public static class Properties {
|
||||||
|
public final static Property AutoId = new Property(0, Long.class, "autoId", true, "_id");
|
||||||
|
public final static Property Ad_id = new Property(1, String.class, "ad_id", false, "AD_ID");
|
||||||
|
public final static Property IsLast = new Property(2, Boolean.class, "isLast", false, "IS_LAST");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public OrderDao(DaoConfig config) {
|
||||||
|
super(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderDao(DaoConfig config, DaoSession daoSession) {
|
||||||
|
super(config, daoSession);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Creates the underlying database table. */
|
||||||
|
public static void createTable(Database db, boolean ifNotExists) {
|
||||||
|
String constraint = ifNotExists? "IF NOT EXISTS ": "";
|
||||||
|
db.execSQL("CREATE TABLE " + constraint + "\"ORDER\" (" + //
|
||||||
|
"\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: autoId
|
||||||
|
"\"AD_ID\" TEXT," + // 1: ad_id
|
||||||
|
"\"IS_LAST\" INTEGER);"); // 2: isLast
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Drops the underlying database table. */
|
||||||
|
public static void dropTable(Database db, boolean ifExists) {
|
||||||
|
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"ORDER\"";
|
||||||
|
db.execSQL(sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final void bindValues(DatabaseStatement stmt, Order entity) {
|
||||||
|
stmt.clearBindings();
|
||||||
|
|
||||||
|
Long autoId = entity.getAutoId();
|
||||||
|
if (autoId != null) {
|
||||||
|
stmt.bindLong(1, autoId);
|
||||||
|
}
|
||||||
|
|
||||||
|
String ad_id = entity.getAd_id();
|
||||||
|
if (ad_id != null) {
|
||||||
|
stmt.bindString(2, ad_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
Boolean isLast = entity.getIsLast();
|
||||||
|
if (isLast != null) {
|
||||||
|
stmt.bindLong(3, isLast ? 1L: 0L);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final void bindValues(SQLiteStatement stmt, Order entity) {
|
||||||
|
stmt.clearBindings();
|
||||||
|
|
||||||
|
Long autoId = entity.getAutoId();
|
||||||
|
if (autoId != null) {
|
||||||
|
stmt.bindLong(1, autoId);
|
||||||
|
}
|
||||||
|
|
||||||
|
String ad_id = entity.getAd_id();
|
||||||
|
if (ad_id != null) {
|
||||||
|
stmt.bindString(2, ad_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
Boolean isLast = entity.getIsLast();
|
||||||
|
if (isLast != null) {
|
||||||
|
stmt.bindLong(3, isLast ? 1L: 0L);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long readKey(Cursor cursor, int offset) {
|
||||||
|
return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Order readEntity(Cursor cursor, int offset) {
|
||||||
|
Order entity = new Order( //
|
||||||
|
cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // autoId
|
||||||
|
cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // ad_id
|
||||||
|
cursor.isNull(offset + 2) ? null : cursor.getShort(offset + 2) != 0 // isLast
|
||||||
|
);
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readEntity(Cursor cursor, Order entity, int offset) {
|
||||||
|
entity.setAutoId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
|
||||||
|
entity.setAd_id(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
|
||||||
|
entity.setIsLast(cursor.isNull(offset + 2) ? null : cursor.getShort(offset + 2) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final Long updateKeyAfterInsert(Order entity, long rowId) {
|
||||||
|
entity.setAutoId(rowId);
|
||||||
|
return rowId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getKey(Order entity) {
|
||||||
|
if(entity != null) {
|
||||||
|
return entity.getAutoId();
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasKey(Order entity) {
|
||||||
|
return entity.getAutoId() != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final boolean isEntityUpdateable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,229 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.dao;
|
||||||
|
|
||||||
|
import android.database.Cursor;
|
||||||
|
import android.database.sqlite.SQLiteStatement;
|
||||||
|
|
||||||
|
import org.greenrobot.greendao.AbstractDao;
|
||||||
|
import org.greenrobot.greendao.Property;
|
||||||
|
import org.greenrobot.greendao.internal.DaoConfig;
|
||||||
|
import org.greenrobot.greendao.database.Database;
|
||||||
|
import org.greenrobot.greendao.database.DatabaseStatement;
|
||||||
|
|
||||||
|
import cn.trans88.taxiappkotlin.logic.model.PlayLogger;
|
||||||
|
|
||||||
|
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
|
||||||
|
/**
|
||||||
|
* DAO for table "PLAY_LOGGER".
|
||||||
|
*/
|
||||||
|
public class PlayLoggerDao extends AbstractDao<PlayLogger, Long> {
|
||||||
|
|
||||||
|
public static final String TABLENAME = "PLAY_LOGGER";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Properties of entity PlayLogger.<br/>
|
||||||
|
* Can be used for QueryBuilder and for referencing column names.
|
||||||
|
*/
|
||||||
|
public static class Properties {
|
||||||
|
public final static Property AutoId = new Property(0, Long.class, "autoId", true, "_id");
|
||||||
|
public final static Property Ad_type = new Property(1, int.class, "ad_type", false, "AD_TYPE");
|
||||||
|
public final static Property Ad_id = new Property(2, String.class, "ad_id", false, "AD_ID");
|
||||||
|
public final static Property Media_url = new Property(3, String.class, "media_url", false, "MEDIA_URL");
|
||||||
|
public final static Property Begin_play_ts = new Property(4, long.class, "begin_play_ts", false, "BEGIN_PLAY_TS");
|
||||||
|
public final static Property End_play_ts = new Property(5, long.class, "end_play_ts", false, "END_PLAY_TS");
|
||||||
|
public final static Property Created_at = new Property(6, long.class, "created_at", false, "CREATED_AT");
|
||||||
|
public final static Property Duration = new Property(7, long.class, "duration", false, "DURATION");
|
||||||
|
public final static Property Region_id = new Property(8, String.class, "region_id", false, "REGION_ID");
|
||||||
|
public final static Property Ad_container_id = new Property(9, String.class, "ad_container_id", false, "AD_CONTAINER_ID");
|
||||||
|
public final static Property Longitude = new Property(10, Double.class, "longitude", false, "LONGITUDE");
|
||||||
|
public final static Property Latitude = new Property(11, Double.class, "latitude", false, "LATITUDE");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public PlayLoggerDao(DaoConfig config) {
|
||||||
|
super(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PlayLoggerDao(DaoConfig config, DaoSession daoSession) {
|
||||||
|
super(config, daoSession);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Creates the underlying database table. */
|
||||||
|
public static void createTable(Database db, boolean ifNotExists) {
|
||||||
|
String constraint = ifNotExists? "IF NOT EXISTS ": "";
|
||||||
|
db.execSQL("CREATE TABLE " + constraint + "\"PLAY_LOGGER\" (" + //
|
||||||
|
"\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: autoId
|
||||||
|
"\"AD_TYPE\" INTEGER NOT NULL ," + // 1: ad_type
|
||||||
|
"\"AD_ID\" TEXT," + // 2: ad_id
|
||||||
|
"\"MEDIA_URL\" TEXT," + // 3: media_url
|
||||||
|
"\"BEGIN_PLAY_TS\" INTEGER NOT NULL ," + // 4: begin_play_ts
|
||||||
|
"\"END_PLAY_TS\" INTEGER NOT NULL ," + // 5: end_play_ts
|
||||||
|
"\"CREATED_AT\" INTEGER NOT NULL ," + // 6: created_at
|
||||||
|
"\"DURATION\" INTEGER NOT NULL ," + // 7: duration
|
||||||
|
"\"REGION_ID\" TEXT," + // 8: region_id
|
||||||
|
"\"AD_CONTAINER_ID\" TEXT," + // 9: ad_container_id
|
||||||
|
"\"LONGITUDE\" REAL," + // 10: longitude
|
||||||
|
"\"LATITUDE\" REAL);"); // 11: latitude
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Drops the underlying database table. */
|
||||||
|
public static void dropTable(Database db, boolean ifExists) {
|
||||||
|
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"PLAY_LOGGER\"";
|
||||||
|
db.execSQL(sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final void bindValues(DatabaseStatement stmt, PlayLogger entity) {
|
||||||
|
stmt.clearBindings();
|
||||||
|
|
||||||
|
Long autoId = entity.getAutoId();
|
||||||
|
if (autoId != null) {
|
||||||
|
stmt.bindLong(1, autoId);
|
||||||
|
}
|
||||||
|
stmt.bindLong(2, entity.getAd_type());
|
||||||
|
|
||||||
|
String ad_id = entity.getAd_id();
|
||||||
|
if (ad_id != null) {
|
||||||
|
stmt.bindString(3, ad_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
String media_url = entity.getMedia_url();
|
||||||
|
if (media_url != null) {
|
||||||
|
stmt.bindString(4, media_url);
|
||||||
|
}
|
||||||
|
stmt.bindLong(5, entity.getBegin_play_ts());
|
||||||
|
stmt.bindLong(6, entity.getEnd_play_ts());
|
||||||
|
stmt.bindLong(7, entity.getCreated_at());
|
||||||
|
stmt.bindLong(8, entity.getDuration());
|
||||||
|
|
||||||
|
String region_id = entity.getRegion_id();
|
||||||
|
if (region_id != null) {
|
||||||
|
stmt.bindString(9, region_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
String ad_container_id = entity.getAd_container_id();
|
||||||
|
if (ad_container_id != null) {
|
||||||
|
stmt.bindString(10, ad_container_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
Double longitude = entity.getLongitude();
|
||||||
|
if (longitude != null) {
|
||||||
|
stmt.bindDouble(11, longitude);
|
||||||
|
}
|
||||||
|
|
||||||
|
Double latitude = entity.getLatitude();
|
||||||
|
if (latitude != null) {
|
||||||
|
stmt.bindDouble(12, latitude);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final void bindValues(SQLiteStatement stmt, PlayLogger entity) {
|
||||||
|
stmt.clearBindings();
|
||||||
|
|
||||||
|
Long autoId = entity.getAutoId();
|
||||||
|
if (autoId != null) {
|
||||||
|
stmt.bindLong(1, autoId);
|
||||||
|
}
|
||||||
|
stmt.bindLong(2, entity.getAd_type());
|
||||||
|
|
||||||
|
String ad_id = entity.getAd_id();
|
||||||
|
if (ad_id != null) {
|
||||||
|
stmt.bindString(3, ad_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
String media_url = entity.getMedia_url();
|
||||||
|
if (media_url != null) {
|
||||||
|
stmt.bindString(4, media_url);
|
||||||
|
}
|
||||||
|
stmt.bindLong(5, entity.getBegin_play_ts());
|
||||||
|
stmt.bindLong(6, entity.getEnd_play_ts());
|
||||||
|
stmt.bindLong(7, entity.getCreated_at());
|
||||||
|
stmt.bindLong(8, entity.getDuration());
|
||||||
|
|
||||||
|
String region_id = entity.getRegion_id();
|
||||||
|
if (region_id != null) {
|
||||||
|
stmt.bindString(9, region_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
String ad_container_id = entity.getAd_container_id();
|
||||||
|
if (ad_container_id != null) {
|
||||||
|
stmt.bindString(10, ad_container_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
Double longitude = entity.getLongitude();
|
||||||
|
if (longitude != null) {
|
||||||
|
stmt.bindDouble(11, longitude);
|
||||||
|
}
|
||||||
|
|
||||||
|
Double latitude = entity.getLatitude();
|
||||||
|
if (latitude != null) {
|
||||||
|
stmt.bindDouble(12, latitude);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long readKey(Cursor cursor, int offset) {
|
||||||
|
return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PlayLogger readEntity(Cursor cursor, int offset) {
|
||||||
|
PlayLogger entity = new PlayLogger( //
|
||||||
|
cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // autoId
|
||||||
|
cursor.getInt(offset + 1), // ad_type
|
||||||
|
cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // ad_id
|
||||||
|
cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // media_url
|
||||||
|
cursor.getLong(offset + 4), // begin_play_ts
|
||||||
|
cursor.getLong(offset + 5), // end_play_ts
|
||||||
|
cursor.getLong(offset + 6), // created_at
|
||||||
|
cursor.getLong(offset + 7), // duration
|
||||||
|
cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // region_id
|
||||||
|
cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // ad_container_id
|
||||||
|
cursor.isNull(offset + 10) ? null : cursor.getDouble(offset + 10), // longitude
|
||||||
|
cursor.isNull(offset + 11) ? null : cursor.getDouble(offset + 11) // latitude
|
||||||
|
);
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readEntity(Cursor cursor, PlayLogger entity, int offset) {
|
||||||
|
entity.setAutoId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
|
||||||
|
entity.setAd_type(cursor.getInt(offset + 1));
|
||||||
|
entity.setAd_id(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
|
||||||
|
entity.setMedia_url(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
|
||||||
|
entity.setBegin_play_ts(cursor.getLong(offset + 4));
|
||||||
|
entity.setEnd_play_ts(cursor.getLong(offset + 5));
|
||||||
|
entity.setCreated_at(cursor.getLong(offset + 6));
|
||||||
|
entity.setDuration(cursor.getLong(offset + 7));
|
||||||
|
entity.setRegion_id(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8));
|
||||||
|
entity.setAd_container_id(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9));
|
||||||
|
entity.setLongitude(cursor.isNull(offset + 10) ? null : cursor.getDouble(offset + 10));
|
||||||
|
entity.setLatitude(cursor.isNull(offset + 11) ? null : cursor.getDouble(offset + 11));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final Long updateKeyAfterInsert(PlayLogger entity, long rowId) {
|
||||||
|
entity.setAutoId(rowId);
|
||||||
|
return rowId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getKey(PlayLogger entity) {
|
||||||
|
if(entity != null) {
|
||||||
|
return entity.getAutoId();
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasKey(PlayLogger entity) {
|
||||||
|
return entity.getAutoId() != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final boolean isEntityUpdateable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,197 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.dao;
|
||||||
|
|
||||||
|
import android.database.Cursor;
|
||||||
|
import android.database.sqlite.SQLiteStatement;
|
||||||
|
|
||||||
|
import org.greenrobot.greendao.AbstractDao;
|
||||||
|
import org.greenrobot.greendao.Property;
|
||||||
|
import org.greenrobot.greendao.internal.DaoConfig;
|
||||||
|
import org.greenrobot.greendao.database.Database;
|
||||||
|
import org.greenrobot.greendao.database.DatabaseStatement;
|
||||||
|
|
||||||
|
import cn.trans88.taxiappkotlin.logic.model.PositionAdvertise;
|
||||||
|
|
||||||
|
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
|
||||||
|
/**
|
||||||
|
* DAO for table "POSITION_ADVERTISE".
|
||||||
|
*/
|
||||||
|
public class PositionAdvertiseDao extends AbstractDao<PositionAdvertise, Long> {
|
||||||
|
|
||||||
|
public static final String TABLENAME = "POSITION_ADVERTISE";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Properties of entity PositionAdvertise.<br/>
|
||||||
|
* Can be used for QueryBuilder and for referencing column names.
|
||||||
|
*/
|
||||||
|
public static class Properties {
|
||||||
|
public final static Property AutoId = new Property(0, Long.class, "autoId", true, "_id");
|
||||||
|
public final static Property Id = new Property(1, String.class, "id", false, "ID");
|
||||||
|
public final static Property BelongTo = new Property(2, int.class, "belongTo", false, "BELONG_TO");
|
||||||
|
public final static Property Media_type = new Property(3, int.class, "media_type", false, "MEDIA_TYPE");
|
||||||
|
public final static Property Media_url = new Property(4, String.class, "media_url", false, "MEDIA_URL");
|
||||||
|
public final static Property Task_id = new Property(5, String.class, "task_id", false, "TASK_ID");
|
||||||
|
public final static Property PathName = new Property(6, String.class, "pathName", false, "PATH_NAME");
|
||||||
|
public final static Property Duration = new Property(7, String.class, "duration", false, "DURATION");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public PositionAdvertiseDao(DaoConfig config) {
|
||||||
|
super(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PositionAdvertiseDao(DaoConfig config, DaoSession daoSession) {
|
||||||
|
super(config, daoSession);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Creates the underlying database table. */
|
||||||
|
public static void createTable(Database db, boolean ifNotExists) {
|
||||||
|
String constraint = ifNotExists? "IF NOT EXISTS ": "";
|
||||||
|
db.execSQL("CREATE TABLE " + constraint + "\"POSITION_ADVERTISE\" (" + //
|
||||||
|
"\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: autoId
|
||||||
|
"\"ID\" TEXT," + // 1: id
|
||||||
|
"\"BELONG_TO\" INTEGER NOT NULL ," + // 2: belongTo
|
||||||
|
"\"MEDIA_TYPE\" INTEGER NOT NULL ," + // 3: media_type
|
||||||
|
"\"MEDIA_URL\" TEXT," + // 4: media_url
|
||||||
|
"\"TASK_ID\" TEXT," + // 5: task_id
|
||||||
|
"\"PATH_NAME\" TEXT," + // 6: pathName
|
||||||
|
"\"DURATION\" TEXT);"); // 7: duration
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Drops the underlying database table. */
|
||||||
|
public static void dropTable(Database db, boolean ifExists) {
|
||||||
|
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"POSITION_ADVERTISE\"";
|
||||||
|
db.execSQL(sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final void bindValues(DatabaseStatement stmt, PositionAdvertise entity) {
|
||||||
|
stmt.clearBindings();
|
||||||
|
|
||||||
|
Long autoId = entity.getAutoId();
|
||||||
|
if (autoId != null) {
|
||||||
|
stmt.bindLong(1, autoId);
|
||||||
|
}
|
||||||
|
|
||||||
|
String id = entity.getId();
|
||||||
|
if (id != null) {
|
||||||
|
stmt.bindString(2, id);
|
||||||
|
}
|
||||||
|
stmt.bindLong(3, entity.getBelongTo());
|
||||||
|
stmt.bindLong(4, entity.getMedia_type());
|
||||||
|
|
||||||
|
String media_url = entity.getMedia_url();
|
||||||
|
if (media_url != null) {
|
||||||
|
stmt.bindString(5, media_url);
|
||||||
|
}
|
||||||
|
|
||||||
|
String task_id = entity.getTask_id();
|
||||||
|
if (task_id != null) {
|
||||||
|
stmt.bindString(6, task_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
String pathName = entity.getPathName();
|
||||||
|
if (pathName != null) {
|
||||||
|
stmt.bindString(7, pathName);
|
||||||
|
}
|
||||||
|
|
||||||
|
String duration = entity.getDuration();
|
||||||
|
if (duration != null) {
|
||||||
|
stmt.bindString(8, duration);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final void bindValues(SQLiteStatement stmt, PositionAdvertise entity) {
|
||||||
|
stmt.clearBindings();
|
||||||
|
|
||||||
|
Long autoId = entity.getAutoId();
|
||||||
|
if (autoId != null) {
|
||||||
|
stmt.bindLong(1, autoId);
|
||||||
|
}
|
||||||
|
|
||||||
|
String id = entity.getId();
|
||||||
|
if (id != null) {
|
||||||
|
stmt.bindString(2, id);
|
||||||
|
}
|
||||||
|
stmt.bindLong(3, entity.getBelongTo());
|
||||||
|
stmt.bindLong(4, entity.getMedia_type());
|
||||||
|
|
||||||
|
String media_url = entity.getMedia_url();
|
||||||
|
if (media_url != null) {
|
||||||
|
stmt.bindString(5, media_url);
|
||||||
|
}
|
||||||
|
|
||||||
|
String task_id = entity.getTask_id();
|
||||||
|
if (task_id != null) {
|
||||||
|
stmt.bindString(6, task_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
String pathName = entity.getPathName();
|
||||||
|
if (pathName != null) {
|
||||||
|
stmt.bindString(7, pathName);
|
||||||
|
}
|
||||||
|
|
||||||
|
String duration = entity.getDuration();
|
||||||
|
if (duration != null) {
|
||||||
|
stmt.bindString(8, duration);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long readKey(Cursor cursor, int offset) {
|
||||||
|
return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PositionAdvertise readEntity(Cursor cursor, int offset) {
|
||||||
|
PositionAdvertise entity = new PositionAdvertise( //
|
||||||
|
cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // autoId
|
||||||
|
cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // id
|
||||||
|
cursor.getInt(offset + 2), // belongTo
|
||||||
|
cursor.getInt(offset + 3), // media_type
|
||||||
|
cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // media_url
|
||||||
|
cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // task_id
|
||||||
|
cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // pathName
|
||||||
|
cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7) // duration
|
||||||
|
);
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readEntity(Cursor cursor, PositionAdvertise entity, int offset) {
|
||||||
|
entity.setAutoId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
|
||||||
|
entity.setId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
|
||||||
|
entity.setBelongTo(cursor.getInt(offset + 2));
|
||||||
|
entity.setMedia_type(cursor.getInt(offset + 3));
|
||||||
|
entity.setMedia_url(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
|
||||||
|
entity.setTask_id(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
|
||||||
|
entity.setPathName(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
|
||||||
|
entity.setDuration(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final Long updateKeyAfterInsert(PositionAdvertise entity, long rowId) {
|
||||||
|
entity.setAutoId(rowId);
|
||||||
|
return rowId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getKey(PositionAdvertise entity) {
|
||||||
|
if(entity != null) {
|
||||||
|
return entity.getAutoId();
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasKey(PositionAdvertise entity) {
|
||||||
|
return entity.getAutoId() != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final boolean isEntityUpdateable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,173 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.dao;
|
||||||
|
|
||||||
|
import android.database.Cursor;
|
||||||
|
import android.database.sqlite.SQLiteStatement;
|
||||||
|
|
||||||
|
import org.greenrobot.greendao.AbstractDao;
|
||||||
|
import org.greenrobot.greendao.Property;
|
||||||
|
import org.greenrobot.greendao.internal.DaoConfig;
|
||||||
|
import org.greenrobot.greendao.database.Database;
|
||||||
|
import org.greenrobot.greendao.database.DatabaseStatement;
|
||||||
|
|
||||||
|
import cn.trans88.taxiappkotlin.logic.model.Regions;
|
||||||
|
|
||||||
|
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
|
||||||
|
/**
|
||||||
|
* DAO for table "REGIONS".
|
||||||
|
*/
|
||||||
|
public class RegionsDao extends AbstractDao<Regions, Long> {
|
||||||
|
|
||||||
|
public static final String TABLENAME = "REGIONS";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Properties of entity Regions.<br/>
|
||||||
|
* Can be used for QueryBuilder and for referencing column names.
|
||||||
|
*/
|
||||||
|
public static class Properties {
|
||||||
|
public final static Property AutoId = new Property(0, Long.class, "autoId", true, "_id");
|
||||||
|
public final static Property Id = new Property(1, String.class, "id", false, "ID");
|
||||||
|
public final static Property RegionAdId = new Property(2, String.class, "RegionAdId", false, "REGION_AD_ID");
|
||||||
|
public final static Property Lat = new Property(3, double.class, "lat", false, "LAT");
|
||||||
|
public final static Property Lng = new Property(4, double.class, "lng", false, "LNG");
|
||||||
|
public final static Property Price = new Property(5, int.class, "price", false, "PRICE");
|
||||||
|
public final static Property Radius = new Property(6, int.class, "radius", false, "RADIUS");
|
||||||
|
public final static Property IsInRegion = new Property(7, boolean.class, "isInRegion", false, "IS_IN_REGION");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public RegionsDao(DaoConfig config) {
|
||||||
|
super(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
public RegionsDao(DaoConfig config, DaoSession daoSession) {
|
||||||
|
super(config, daoSession);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Creates the underlying database table. */
|
||||||
|
public static void createTable(Database db, boolean ifNotExists) {
|
||||||
|
String constraint = ifNotExists? "IF NOT EXISTS ": "";
|
||||||
|
db.execSQL("CREATE TABLE " + constraint + "\"REGIONS\" (" + //
|
||||||
|
"\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: autoId
|
||||||
|
"\"ID\" TEXT," + // 1: id
|
||||||
|
"\"REGION_AD_ID\" TEXT," + // 2: RegionAdId
|
||||||
|
"\"LAT\" REAL NOT NULL ," + // 3: lat
|
||||||
|
"\"LNG\" REAL NOT NULL ," + // 4: lng
|
||||||
|
"\"PRICE\" INTEGER NOT NULL ," + // 5: price
|
||||||
|
"\"RADIUS\" INTEGER NOT NULL ," + // 6: radius
|
||||||
|
"\"IS_IN_REGION\" INTEGER NOT NULL );"); // 7: isInRegion
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Drops the underlying database table. */
|
||||||
|
public static void dropTable(Database db, boolean ifExists) {
|
||||||
|
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"REGIONS\"";
|
||||||
|
db.execSQL(sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final void bindValues(DatabaseStatement stmt, Regions entity) {
|
||||||
|
stmt.clearBindings();
|
||||||
|
|
||||||
|
Long autoId = entity.getAutoId();
|
||||||
|
if (autoId != null) {
|
||||||
|
stmt.bindLong(1, autoId);
|
||||||
|
}
|
||||||
|
|
||||||
|
String id = entity.getId();
|
||||||
|
if (id != null) {
|
||||||
|
stmt.bindString(2, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
String RegionAdId = entity.getRegionAdId();
|
||||||
|
if (RegionAdId != null) {
|
||||||
|
stmt.bindString(3, RegionAdId);
|
||||||
|
}
|
||||||
|
stmt.bindDouble(4, entity.getLat());
|
||||||
|
stmt.bindDouble(5, entity.getLng());
|
||||||
|
stmt.bindLong(6, entity.getPrice());
|
||||||
|
stmt.bindLong(7, entity.getRadius());
|
||||||
|
stmt.bindLong(8, entity.getIsInRegion() ? 1L: 0L);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final void bindValues(SQLiteStatement stmt, Regions entity) {
|
||||||
|
stmt.clearBindings();
|
||||||
|
|
||||||
|
Long autoId = entity.getAutoId();
|
||||||
|
if (autoId != null) {
|
||||||
|
stmt.bindLong(1, autoId);
|
||||||
|
}
|
||||||
|
|
||||||
|
String id = entity.getId();
|
||||||
|
if (id != null) {
|
||||||
|
stmt.bindString(2, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
String RegionAdId = entity.getRegionAdId();
|
||||||
|
if (RegionAdId != null) {
|
||||||
|
stmt.bindString(3, RegionAdId);
|
||||||
|
}
|
||||||
|
stmt.bindDouble(4, entity.getLat());
|
||||||
|
stmt.bindDouble(5, entity.getLng());
|
||||||
|
stmt.bindLong(6, entity.getPrice());
|
||||||
|
stmt.bindLong(7, entity.getRadius());
|
||||||
|
stmt.bindLong(8, entity.getIsInRegion() ? 1L: 0L);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long readKey(Cursor cursor, int offset) {
|
||||||
|
return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Regions readEntity(Cursor cursor, int offset) {
|
||||||
|
Regions entity = new Regions( //
|
||||||
|
cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // autoId
|
||||||
|
cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // id
|
||||||
|
cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // RegionAdId
|
||||||
|
cursor.getDouble(offset + 3), // lat
|
||||||
|
cursor.getDouble(offset + 4), // lng
|
||||||
|
cursor.getInt(offset + 5), // price
|
||||||
|
cursor.getInt(offset + 6), // radius
|
||||||
|
cursor.getShort(offset + 7) != 0 // isInRegion
|
||||||
|
);
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readEntity(Cursor cursor, Regions entity, int offset) {
|
||||||
|
entity.setAutoId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
|
||||||
|
entity.setId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
|
||||||
|
entity.setRegionAdId(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
|
||||||
|
entity.setLat(cursor.getDouble(offset + 3));
|
||||||
|
entity.setLng(cursor.getDouble(offset + 4));
|
||||||
|
entity.setPrice(cursor.getInt(offset + 5));
|
||||||
|
entity.setRadius(cursor.getInt(offset + 6));
|
||||||
|
entity.setIsInRegion(cursor.getShort(offset + 7) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final Long updateKeyAfterInsert(Regions entity, long rowId) {
|
||||||
|
entity.setAutoId(rowId);
|
||||||
|
return rowId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getKey(Regions entity) {
|
||||||
|
if(entity != null) {
|
||||||
|
return entity.getAutoId();
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasKey(Regions entity) {
|
||||||
|
return entity.getAutoId() != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final boolean isEntityUpdateable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,211 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.dao;
|
||||||
|
|
||||||
|
import android.database.Cursor;
|
||||||
|
import android.database.sqlite.SQLiteStatement;
|
||||||
|
|
||||||
|
import org.greenrobot.greendao.AbstractDao;
|
||||||
|
import org.greenrobot.greendao.Property;
|
||||||
|
import org.greenrobot.greendao.internal.DaoConfig;
|
||||||
|
import org.greenrobot.greendao.database.Database;
|
||||||
|
import org.greenrobot.greendao.database.DatabaseStatement;
|
||||||
|
|
||||||
|
import cn.trans88.taxiappkotlin.logic.model.SanleAdvertise;
|
||||||
|
|
||||||
|
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
|
||||||
|
/**
|
||||||
|
* DAO for table "SANLE_ADVERTISE".
|
||||||
|
*/
|
||||||
|
public class SanleAdvertiseDao extends AbstractDao<SanleAdvertise, Long> {
|
||||||
|
|
||||||
|
public static final String TABLENAME = "SANLE_ADVERTISE";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Properties of entity SanleAdvertise.<br/>
|
||||||
|
* Can be used for QueryBuilder and for referencing column names.
|
||||||
|
*/
|
||||||
|
public static class Properties {
|
||||||
|
public final static Property AutoId = new Property(0, Long.class, "AutoId", true, "_id");
|
||||||
|
public final static Property Id = new Property(1, String.class, "id", false, "ID");
|
||||||
|
public final static Property Task_id = new Property(2, String.class, "task_id", false, "TASK_ID");
|
||||||
|
public final static Property BelongTo = new Property(3, int.class, "belongTo", false, "BELONG_TO");
|
||||||
|
public final static Property Media_type = new Property(4, int.class, "media_type", false, "MEDIA_TYPE");
|
||||||
|
public final static Property Media_url = new Property(5, String.class, "media_url", false, "MEDIA_URL");
|
||||||
|
public final static Property PathName = new Property(6, String.class, "pathName", false, "PATH_NAME");
|
||||||
|
public final static Property Duration = new Property(7, String.class, "duration", false, "DURATION");
|
||||||
|
public final static Property CreateAt = new Property(8, Long.class, "createAt", false, "CREATE_AT");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public SanleAdvertiseDao(DaoConfig config) {
|
||||||
|
super(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SanleAdvertiseDao(DaoConfig config, DaoSession daoSession) {
|
||||||
|
super(config, daoSession);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Creates the underlying database table. */
|
||||||
|
public static void createTable(Database db, boolean ifNotExists) {
|
||||||
|
String constraint = ifNotExists? "IF NOT EXISTS ": "";
|
||||||
|
db.execSQL("CREATE TABLE " + constraint + "\"SANLE_ADVERTISE\" (" + //
|
||||||
|
"\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: AutoId
|
||||||
|
"\"ID\" TEXT," + // 1: id
|
||||||
|
"\"TASK_ID\" TEXT," + // 2: task_id
|
||||||
|
"\"BELONG_TO\" INTEGER NOT NULL ," + // 3: belongTo
|
||||||
|
"\"MEDIA_TYPE\" INTEGER NOT NULL ," + // 4: media_type
|
||||||
|
"\"MEDIA_URL\" TEXT," + // 5: media_url
|
||||||
|
"\"PATH_NAME\" TEXT," + // 6: pathName
|
||||||
|
"\"DURATION\" TEXT," + // 7: duration
|
||||||
|
"\"CREATE_AT\" INTEGER);"); // 8: createAt
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Drops the underlying database table. */
|
||||||
|
public static void dropTable(Database db, boolean ifExists) {
|
||||||
|
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SANLE_ADVERTISE\"";
|
||||||
|
db.execSQL(sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final void bindValues(DatabaseStatement stmt, SanleAdvertise entity) {
|
||||||
|
stmt.clearBindings();
|
||||||
|
|
||||||
|
Long AutoId = entity.getAutoId();
|
||||||
|
if (AutoId != null) {
|
||||||
|
stmt.bindLong(1, AutoId);
|
||||||
|
}
|
||||||
|
|
||||||
|
String id = entity.getId();
|
||||||
|
if (id != null) {
|
||||||
|
stmt.bindString(2, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
String task_id = entity.getTask_id();
|
||||||
|
if (task_id != null) {
|
||||||
|
stmt.bindString(3, task_id);
|
||||||
|
}
|
||||||
|
stmt.bindLong(4, entity.getBelongTo());
|
||||||
|
stmt.bindLong(5, entity.getMedia_type());
|
||||||
|
|
||||||
|
String media_url = entity.getMedia_url();
|
||||||
|
if (media_url != null) {
|
||||||
|
stmt.bindString(6, media_url);
|
||||||
|
}
|
||||||
|
|
||||||
|
String pathName = entity.getPathName();
|
||||||
|
if (pathName != null) {
|
||||||
|
stmt.bindString(7, pathName);
|
||||||
|
}
|
||||||
|
|
||||||
|
String duration = entity.getDuration();
|
||||||
|
if (duration != null) {
|
||||||
|
stmt.bindString(8, duration);
|
||||||
|
}
|
||||||
|
|
||||||
|
Long createAt = entity.getCreateAt();
|
||||||
|
if (createAt != null) {
|
||||||
|
stmt.bindLong(9, createAt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final void bindValues(SQLiteStatement stmt, SanleAdvertise entity) {
|
||||||
|
stmt.clearBindings();
|
||||||
|
|
||||||
|
Long AutoId = entity.getAutoId();
|
||||||
|
if (AutoId != null) {
|
||||||
|
stmt.bindLong(1, AutoId);
|
||||||
|
}
|
||||||
|
|
||||||
|
String id = entity.getId();
|
||||||
|
if (id != null) {
|
||||||
|
stmt.bindString(2, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
String task_id = entity.getTask_id();
|
||||||
|
if (task_id != null) {
|
||||||
|
stmt.bindString(3, task_id);
|
||||||
|
}
|
||||||
|
stmt.bindLong(4, entity.getBelongTo());
|
||||||
|
stmt.bindLong(5, entity.getMedia_type());
|
||||||
|
|
||||||
|
String media_url = entity.getMedia_url();
|
||||||
|
if (media_url != null) {
|
||||||
|
stmt.bindString(6, media_url);
|
||||||
|
}
|
||||||
|
|
||||||
|
String pathName = entity.getPathName();
|
||||||
|
if (pathName != null) {
|
||||||
|
stmt.bindString(7, pathName);
|
||||||
|
}
|
||||||
|
|
||||||
|
String duration = entity.getDuration();
|
||||||
|
if (duration != null) {
|
||||||
|
stmt.bindString(8, duration);
|
||||||
|
}
|
||||||
|
|
||||||
|
Long createAt = entity.getCreateAt();
|
||||||
|
if (createAt != null) {
|
||||||
|
stmt.bindLong(9, createAt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long readKey(Cursor cursor, int offset) {
|
||||||
|
return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SanleAdvertise readEntity(Cursor cursor, int offset) {
|
||||||
|
SanleAdvertise entity = new SanleAdvertise( //
|
||||||
|
cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // AutoId
|
||||||
|
cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // id
|
||||||
|
cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // task_id
|
||||||
|
cursor.getInt(offset + 3), // belongTo
|
||||||
|
cursor.getInt(offset + 4), // media_type
|
||||||
|
cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // media_url
|
||||||
|
cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // pathName
|
||||||
|
cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // duration
|
||||||
|
cursor.isNull(offset + 8) ? null : cursor.getLong(offset + 8) // createAt
|
||||||
|
);
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readEntity(Cursor cursor, SanleAdvertise entity, int offset) {
|
||||||
|
entity.setAutoId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
|
||||||
|
entity.setId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
|
||||||
|
entity.setTask_id(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
|
||||||
|
entity.setBelongTo(cursor.getInt(offset + 3));
|
||||||
|
entity.setMedia_type(cursor.getInt(offset + 4));
|
||||||
|
entity.setMedia_url(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
|
||||||
|
entity.setPathName(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
|
||||||
|
entity.setDuration(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
|
||||||
|
entity.setCreateAt(cursor.isNull(offset + 8) ? null : cursor.getLong(offset + 8));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final Long updateKeyAfterInsert(SanleAdvertise entity, long rowId) {
|
||||||
|
entity.setAutoId(rowId);
|
||||||
|
return rowId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getKey(SanleAdvertise entity) {
|
||||||
|
if(entity != null) {
|
||||||
|
return entity.getAutoId();
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasKey(SanleAdvertise entity) {
|
||||||
|
return entity.getAutoId() != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final boolean isEntityUpdateable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,213 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.dao;
|
||||||
|
|
||||||
|
import android.database.Cursor;
|
||||||
|
import android.database.sqlite.SQLiteStatement;
|
||||||
|
|
||||||
|
import org.greenrobot.greendao.AbstractDao;
|
||||||
|
import org.greenrobot.greendao.Property;
|
||||||
|
import org.greenrobot.greendao.internal.DaoConfig;
|
||||||
|
import org.greenrobot.greendao.database.Database;
|
||||||
|
import org.greenrobot.greendao.database.DatabaseStatement;
|
||||||
|
|
||||||
|
import cn.trans88.taxiappkotlin.logic.model.TextInfo;
|
||||||
|
|
||||||
|
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
|
||||||
|
/**
|
||||||
|
* DAO for table "TEXT_INFO".
|
||||||
|
*/
|
||||||
|
public class TextInfoDao extends AbstractDao<TextInfo, Long> {
|
||||||
|
|
||||||
|
public static final String TABLENAME = "TEXT_INFO";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Properties of entity TextInfo.<br/>
|
||||||
|
* Can be used for QueryBuilder and for referencing column names.
|
||||||
|
*/
|
||||||
|
public static class Properties {
|
||||||
|
public final static Property Id = new Property(0, Long.class, "id", true, "_id");
|
||||||
|
public final static Property Text = new Property(1, String.class, "text", false, "TEXT");
|
||||||
|
public final static Property Size = new Property(2, int.class, "size", false, "SIZE");
|
||||||
|
public final static Property Color = new Property(3, String.class, "color", false, "COLOR");
|
||||||
|
public final static Property BackgroundColor = new Property(4, String.class, "backgroundColor", false, "BACKGROUND_COLOR");
|
||||||
|
public final static Property DrawableId = new Property(5, int.class, "drawableId", false, "DRAWABLE_ID");
|
||||||
|
public final static Property Stoke = new Property(6, int.class, "stoke", false, "STOKE");
|
||||||
|
public final static Property StokeColor = new Property(7, String.class, "stokeColor", false, "STOKE_COLOR");
|
||||||
|
public final static Property Effect = new Property(8, int.class, "effect", false, "EFFECT");
|
||||||
|
public final static Property FontName = new Property(9, String.class, "fontName", false, "FONT_NAME");
|
||||||
|
public final static Property LetterSpacing = new Property(10, float.class, "letterSpacing", false, "LETTER_SPACING");
|
||||||
|
public final static Property LineSpacing = new Property(11, float.class, "lineSpacing", false, "LINE_SPACING");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public TextInfoDao(DaoConfig config) {
|
||||||
|
super(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TextInfoDao(DaoConfig config, DaoSession daoSession) {
|
||||||
|
super(config, daoSession);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Creates the underlying database table. */
|
||||||
|
public static void createTable(Database db, boolean ifNotExists) {
|
||||||
|
String constraint = ifNotExists? "IF NOT EXISTS ": "";
|
||||||
|
db.execSQL("CREATE TABLE " + constraint + "\"TEXT_INFO\" (" + //
|
||||||
|
"\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id
|
||||||
|
"\"TEXT\" TEXT NOT NULL ," + // 1: text
|
||||||
|
"\"SIZE\" INTEGER NOT NULL ," + // 2: size
|
||||||
|
"\"COLOR\" TEXT," + // 3: color
|
||||||
|
"\"BACKGROUND_COLOR\" TEXT," + // 4: backgroundColor
|
||||||
|
"\"DRAWABLE_ID\" INTEGER NOT NULL ," + // 5: drawableId
|
||||||
|
"\"STOKE\" INTEGER NOT NULL ," + // 6: stoke
|
||||||
|
"\"STOKE_COLOR\" TEXT," + // 7: stokeColor
|
||||||
|
"\"EFFECT\" INTEGER NOT NULL ," + // 8: effect
|
||||||
|
"\"FONT_NAME\" TEXT," + // 9: fontName
|
||||||
|
"\"LETTER_SPACING\" REAL NOT NULL ," + // 10: letterSpacing
|
||||||
|
"\"LINE_SPACING\" REAL NOT NULL );"); // 11: lineSpacing
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Drops the underlying database table. */
|
||||||
|
public static void dropTable(Database db, boolean ifExists) {
|
||||||
|
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TEXT_INFO\"";
|
||||||
|
db.execSQL(sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final void bindValues(DatabaseStatement stmt, TextInfo entity) {
|
||||||
|
stmt.clearBindings();
|
||||||
|
|
||||||
|
Long id = entity.getId();
|
||||||
|
if (id != null) {
|
||||||
|
stmt.bindLong(1, id);
|
||||||
|
}
|
||||||
|
stmt.bindString(2, entity.getText());
|
||||||
|
stmt.bindLong(3, entity.getSize());
|
||||||
|
|
||||||
|
String color = entity.getColor();
|
||||||
|
if (color != null) {
|
||||||
|
stmt.bindString(4, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
String backgroundColor = entity.getBackgroundColor();
|
||||||
|
if (backgroundColor != null) {
|
||||||
|
stmt.bindString(5, backgroundColor);
|
||||||
|
}
|
||||||
|
stmt.bindLong(6, entity.getDrawableId());
|
||||||
|
stmt.bindLong(7, entity.getStoke());
|
||||||
|
|
||||||
|
String stokeColor = entity.getStokeColor();
|
||||||
|
if (stokeColor != null) {
|
||||||
|
stmt.bindString(8, stokeColor);
|
||||||
|
}
|
||||||
|
stmt.bindLong(9, entity.getEffect());
|
||||||
|
|
||||||
|
String fontName = entity.getFontName();
|
||||||
|
if (fontName != null) {
|
||||||
|
stmt.bindString(10, fontName);
|
||||||
|
}
|
||||||
|
stmt.bindDouble(11, entity.getLetterSpacing());
|
||||||
|
stmt.bindDouble(12, entity.getLineSpacing());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final void bindValues(SQLiteStatement stmt, TextInfo entity) {
|
||||||
|
stmt.clearBindings();
|
||||||
|
|
||||||
|
Long id = entity.getId();
|
||||||
|
if (id != null) {
|
||||||
|
stmt.bindLong(1, id);
|
||||||
|
}
|
||||||
|
stmt.bindString(2, entity.getText());
|
||||||
|
stmt.bindLong(3, entity.getSize());
|
||||||
|
|
||||||
|
String color = entity.getColor();
|
||||||
|
if (color != null) {
|
||||||
|
stmt.bindString(4, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
String backgroundColor = entity.getBackgroundColor();
|
||||||
|
if (backgroundColor != null) {
|
||||||
|
stmt.bindString(5, backgroundColor);
|
||||||
|
}
|
||||||
|
stmt.bindLong(6, entity.getDrawableId());
|
||||||
|
stmt.bindLong(7, entity.getStoke());
|
||||||
|
|
||||||
|
String stokeColor = entity.getStokeColor();
|
||||||
|
if (stokeColor != null) {
|
||||||
|
stmt.bindString(8, stokeColor);
|
||||||
|
}
|
||||||
|
stmt.bindLong(9, entity.getEffect());
|
||||||
|
|
||||||
|
String fontName = entity.getFontName();
|
||||||
|
if (fontName != null) {
|
||||||
|
stmt.bindString(10, fontName);
|
||||||
|
}
|
||||||
|
stmt.bindDouble(11, entity.getLetterSpacing());
|
||||||
|
stmt.bindDouble(12, entity.getLineSpacing());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long readKey(Cursor cursor, int offset) {
|
||||||
|
return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TextInfo readEntity(Cursor cursor, int offset) {
|
||||||
|
TextInfo entity = new TextInfo( //
|
||||||
|
cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
|
||||||
|
cursor.getString(offset + 1), // text
|
||||||
|
cursor.getInt(offset + 2), // size
|
||||||
|
cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // color
|
||||||
|
cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // backgroundColor
|
||||||
|
cursor.getInt(offset + 5), // drawableId
|
||||||
|
cursor.getInt(offset + 6), // stoke
|
||||||
|
cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // stokeColor
|
||||||
|
cursor.getInt(offset + 8), // effect
|
||||||
|
cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // fontName
|
||||||
|
cursor.getFloat(offset + 10), // letterSpacing
|
||||||
|
cursor.getFloat(offset + 11) // lineSpacing
|
||||||
|
);
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readEntity(Cursor cursor, TextInfo entity, int offset) {
|
||||||
|
entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
|
||||||
|
entity.setText(cursor.getString(offset + 1));
|
||||||
|
entity.setSize(cursor.getInt(offset + 2));
|
||||||
|
entity.setColor(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
|
||||||
|
entity.setBackgroundColor(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
|
||||||
|
entity.setDrawableId(cursor.getInt(offset + 5));
|
||||||
|
entity.setStoke(cursor.getInt(offset + 6));
|
||||||
|
entity.setStokeColor(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
|
||||||
|
entity.setEffect(cursor.getInt(offset + 8));
|
||||||
|
entity.setFontName(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9));
|
||||||
|
entity.setLetterSpacing(cursor.getFloat(offset + 10));
|
||||||
|
entity.setLineSpacing(cursor.getFloat(offset + 11));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final Long updateKeyAfterInsert(TextInfo entity, long rowId) {
|
||||||
|
entity.setId(rowId);
|
||||||
|
return rowId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getKey(TextInfo entity) {
|
||||||
|
if(entity != null) {
|
||||||
|
return entity.getId();
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasKey(TextInfo entity) {
|
||||||
|
return entity.getId() != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final boolean isEntityUpdateable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,153 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.dao;
|
||||||
|
|
||||||
|
import android.database.Cursor;
|
||||||
|
import android.database.sqlite.SQLiteStatement;
|
||||||
|
|
||||||
|
import org.greenrobot.greendao.AbstractDao;
|
||||||
|
import org.greenrobot.greendao.Property;
|
||||||
|
import org.greenrobot.greendao.internal.DaoConfig;
|
||||||
|
import org.greenrobot.greendao.database.Database;
|
||||||
|
import org.greenrobot.greendao.database.DatabaseStatement;
|
||||||
|
|
||||||
|
import cn.trans88.taxiappkotlin.logic.model.TimeSpan;
|
||||||
|
|
||||||
|
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
|
||||||
|
/**
|
||||||
|
* DAO for table "TIME_SPAN".
|
||||||
|
*/
|
||||||
|
public class TimeSpanDao extends AbstractDao<TimeSpan, Long> {
|
||||||
|
|
||||||
|
public static final String TABLENAME = "TIME_SPAN";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Properties of entity TimeSpan.<br/>
|
||||||
|
* Can be used for QueryBuilder and for referencing column names.
|
||||||
|
*/
|
||||||
|
public static class Properties {
|
||||||
|
public final static Property Id = new Property(0, Long.class, "id", true, "_id");
|
||||||
|
public final static Property AdvertiseId = new Property(1, String.class, "advertiseId", false, "ADVERTISE_ID");
|
||||||
|
public final static Property Date_start = new Property(2, long.class, "date_start", false, "DATE_START");
|
||||||
|
public final static Property Date_end = new Property(3, long.class, "date_end", false, "DATE_END");
|
||||||
|
public final static Property Day_start = new Property(4, long.class, "day_start", false, "DAY_START");
|
||||||
|
public final static Property Day_end = new Property(5, long.class, "day_end", false, "DAY_END");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public TimeSpanDao(DaoConfig config) {
|
||||||
|
super(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TimeSpanDao(DaoConfig config, DaoSession daoSession) {
|
||||||
|
super(config, daoSession);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Creates the underlying database table. */
|
||||||
|
public static void createTable(Database db, boolean ifNotExists) {
|
||||||
|
String constraint = ifNotExists? "IF NOT EXISTS ": "";
|
||||||
|
db.execSQL("CREATE TABLE " + constraint + "\"TIME_SPAN\" (" + //
|
||||||
|
"\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id
|
||||||
|
"\"ADVERTISE_ID\" TEXT," + // 1: advertiseId
|
||||||
|
"\"DATE_START\" INTEGER NOT NULL ," + // 2: date_start
|
||||||
|
"\"DATE_END\" INTEGER NOT NULL ," + // 3: date_end
|
||||||
|
"\"DAY_START\" INTEGER NOT NULL ," + // 4: day_start
|
||||||
|
"\"DAY_END\" INTEGER NOT NULL );"); // 5: day_end
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Drops the underlying database table. */
|
||||||
|
public static void dropTable(Database db, boolean ifExists) {
|
||||||
|
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TIME_SPAN\"";
|
||||||
|
db.execSQL(sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final void bindValues(DatabaseStatement stmt, TimeSpan entity) {
|
||||||
|
stmt.clearBindings();
|
||||||
|
|
||||||
|
Long id = entity.getId();
|
||||||
|
if (id != null) {
|
||||||
|
stmt.bindLong(1, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
String advertiseId = entity.getAdvertiseId();
|
||||||
|
if (advertiseId != null) {
|
||||||
|
stmt.bindString(2, advertiseId);
|
||||||
|
}
|
||||||
|
stmt.bindLong(3, entity.getDate_start());
|
||||||
|
stmt.bindLong(4, entity.getDate_end());
|
||||||
|
stmt.bindLong(5, entity.getDay_start());
|
||||||
|
stmt.bindLong(6, entity.getDay_end());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final void bindValues(SQLiteStatement stmt, TimeSpan entity) {
|
||||||
|
stmt.clearBindings();
|
||||||
|
|
||||||
|
Long id = entity.getId();
|
||||||
|
if (id != null) {
|
||||||
|
stmt.bindLong(1, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
String advertiseId = entity.getAdvertiseId();
|
||||||
|
if (advertiseId != null) {
|
||||||
|
stmt.bindString(2, advertiseId);
|
||||||
|
}
|
||||||
|
stmt.bindLong(3, entity.getDate_start());
|
||||||
|
stmt.bindLong(4, entity.getDate_end());
|
||||||
|
stmt.bindLong(5, entity.getDay_start());
|
||||||
|
stmt.bindLong(6, entity.getDay_end());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long readKey(Cursor cursor, int offset) {
|
||||||
|
return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TimeSpan readEntity(Cursor cursor, int offset) {
|
||||||
|
TimeSpan entity = new TimeSpan( //
|
||||||
|
cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
|
||||||
|
cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // advertiseId
|
||||||
|
cursor.getLong(offset + 2), // date_start
|
||||||
|
cursor.getLong(offset + 3), // date_end
|
||||||
|
cursor.getLong(offset + 4), // day_start
|
||||||
|
cursor.getLong(offset + 5) // day_end
|
||||||
|
);
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readEntity(Cursor cursor, TimeSpan entity, int offset) {
|
||||||
|
entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
|
||||||
|
entity.setAdvertiseId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
|
||||||
|
entity.setDate_start(cursor.getLong(offset + 2));
|
||||||
|
entity.setDate_end(cursor.getLong(offset + 3));
|
||||||
|
entity.setDay_start(cursor.getLong(offset + 4));
|
||||||
|
entity.setDay_end(cursor.getLong(offset + 5));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final Long updateKeyAfterInsert(TimeSpan entity, long rowId) {
|
||||||
|
entity.setId(rowId);
|
||||||
|
return rowId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getKey(TimeSpan entity) {
|
||||||
|
if(entity != null) {
|
||||||
|
return entity.getId();
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasKey(TimeSpan entity) {
|
||||||
|
return entity.getId() != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final boolean isEntityUpdateable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.enumType
|
||||||
|
|
||||||
|
/*
|
||||||
|
enum class CompanyType {
|
||||||
|
|
||||||
|
XIXUN,
|
||||||
|
SANLE,
|
||||||
|
HAOSHENG,
|
||||||
|
MAIDIER
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
|
@ -0,0 +1,173 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.exception
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.pm.PackageManager
|
||||||
|
import android.os.Build
|
||||||
|
import androidx.core.content.pm.PackageInfoCompat
|
||||||
|
import cn.trans88.taxiappkotlin.logic.network.ConnManger.sendException
|
||||||
|
import cn.trans88.taxiappkotlin.util.YoungUtil
|
||||||
|
import com.trs88.kurolibrary.log.KuroStackTraceUtil
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.*
|
||||||
|
import kotlin.collections.LinkedHashMap
|
||||||
|
|
||||||
|
class CrashHandler private constructor(context: Context) : Thread.UncaughtExceptionHandler{
|
||||||
|
private val logPackage=javaClass.name.substring(0,javaClass.name.lastIndexOf('.')+1)
|
||||||
|
// 上下文对象
|
||||||
|
private val mContext = context
|
||||||
|
|
||||||
|
// 用于存放参数信息
|
||||||
|
private val info = LinkedHashMap<String, String>()
|
||||||
|
|
||||||
|
// 用于格式化日期
|
||||||
|
private val mDateFormat = SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault())
|
||||||
|
|
||||||
|
//上传服务器的地址
|
||||||
|
private var postUrl:String? = null
|
||||||
|
|
||||||
|
//默认打印异常的深度
|
||||||
|
private var dep:Int=5
|
||||||
|
|
||||||
|
// 单例模式
|
||||||
|
companion object {
|
||||||
|
private var instance: CrashHandler? = null
|
||||||
|
fun getInstance(context: Context): CrashHandler {
|
||||||
|
if (instance == null) {
|
||||||
|
synchronized(CrashHandler::class) {
|
||||||
|
instance = CrashHandler(context)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return instance!!
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构造初始化
|
||||||
|
*/
|
||||||
|
// init {
|
||||||
|
// // 设置当前类为应用默认处理器
|
||||||
|
// Thread.setDefaultUncaughtExceptionHandler(this)
|
||||||
|
// }
|
||||||
|
|
||||||
|
fun init(){
|
||||||
|
// 设置当前类为应用默认处理器
|
||||||
|
Thread.setDefaultUncaughtExceptionHandler(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置打印异常的深度
|
||||||
|
*/
|
||||||
|
fun setDep(dep:Int):CrashHandler{
|
||||||
|
this.dep =dep
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setInfo(key:String,value:String):CrashHandler{
|
||||||
|
info[key] = value
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun setPost(url:String):CrashHandler{
|
||||||
|
postUrl =url
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当 UncaughtException 发生时转入该函数
|
||||||
|
* @param t
|
||||||
|
* @param e
|
||||||
|
*/
|
||||||
|
override fun uncaughtException(t: Thread, e: Throwable) {
|
||||||
|
handleException(e)
|
||||||
|
try {
|
||||||
|
Thread.sleep(2000)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
}
|
||||||
|
// exitProcess(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义错误处理
|
||||||
|
* @param e
|
||||||
|
*/
|
||||||
|
private fun handleException(e: Throwable) {
|
||||||
|
sendException(getLogSummary(e))
|
||||||
|
YoungUtil.YoungLog(getLogSummary(e))
|
||||||
|
|
||||||
|
// send("服务器日志 ${getLogSummary(e)}")
|
||||||
|
|
||||||
|
// if (postUrl!=null){
|
||||||
|
// val rxRestClient =RxRestClient.builder()
|
||||||
|
// .baseUrl(postUrl)
|
||||||
|
// .build()
|
||||||
|
// .setParam("msg",getLogSummary(e))
|
||||||
|
// .post(object :BaseObserver<CrashResponse>(){
|
||||||
|
// override fun onGot(entities: CrashResponse?) {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收集参数信息
|
||||||
|
* @param context
|
||||||
|
*/
|
||||||
|
private fun putInfoToMap(context: Context) {
|
||||||
|
info["设备型号"] = Build.MODEL
|
||||||
|
info["设备品牌"] = Build.BOARD
|
||||||
|
info["硬件名称"] = Build.HARDWARE
|
||||||
|
info["硬件制造商"] = Build.MANUFACTURER
|
||||||
|
info["系统版本"] = Build.VERSION.RELEASE
|
||||||
|
info["系统版本号"] = "${Build.VERSION.SDK_INT}"
|
||||||
|
|
||||||
|
// if(SaveSimpleData.getCardID()!=null&& SaveSimpleData.getCardID() != ""){
|
||||||
|
// info["熙讯卡号"] =SaveSimpleData.getCardID()
|
||||||
|
// }
|
||||||
|
|
||||||
|
val pm = context.packageManager
|
||||||
|
val pi = pm.getPackageInfo(context.packageName, PackageManager.GET_ACTIVITIES)
|
||||||
|
if (pi != null) {
|
||||||
|
info["应用版本"] = pi.versionName
|
||||||
|
info["应用版本号"] = "${PackageInfoCompat.getLongVersionCode(pi)}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取日志头信息
|
||||||
|
* @return StringBuffer
|
||||||
|
*/
|
||||||
|
private fun getLogHeader(): StringBuffer {
|
||||||
|
val sb = StringBuffer()
|
||||||
|
sb.append(">>>>时间: ${mDateFormat.format(Date())}\n")
|
||||||
|
putInfoToMap(mContext)
|
||||||
|
info.entries.forEach {
|
||||||
|
sb.append("${it.key}: ${it.value}\n")
|
||||||
|
}
|
||||||
|
return sb
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取日志概要
|
||||||
|
* @param e
|
||||||
|
* @return 日志概要
|
||||||
|
*/
|
||||||
|
private fun getLogSummary(e: Throwable): String {
|
||||||
|
val croppedRealStackTrack = KuroStackTraceUtil.getCroppedRealStackTrack(e.stackTrace, logPackage, dep)
|
||||||
|
val sb = getLogHeader().append("\n")
|
||||||
|
sb.append("异常类: ${e.javaClass}\n")
|
||||||
|
sb.append("异常信息: ${e.message}\n\n")
|
||||||
|
// for (i in e.stackTrace.indices) {
|
||||||
|
for (i in croppedRealStackTrack.indices) {
|
||||||
|
sb.append("****堆栈追踪 ${i + 1}\n")
|
||||||
|
// sb.append("堆栈位置:${}")
|
||||||
|
sb.append("类名: ${e.stackTrace[i].className}\n")
|
||||||
|
sb.append("方法: ${e.stackTrace[i].methodName}\n")
|
||||||
|
sb.append("文件: ${e.stackTrace[i].fileName}\n")
|
||||||
|
sb.append("行数: ${e.stackTrace[i].lineNumber}\n\n")
|
||||||
|
}
|
||||||
|
return sb.toString().trim()
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.gps
|
||||||
|
|
||||||
|
interface GpsInformationListener {
|
||||||
|
fun onSpeedStop(stop :Boolean)
|
||||||
|
fun onSpeedChanged(speed: Float)
|
||||||
|
fun onLocationChanged(longitude: Double, latitude: Double,bearing:Float,speed: Float,satelliteNumber:Int)
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.gps
|
||||||
|
|
||||||
|
import android.content.BroadcastReceiver
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import cn.trans88.taxiappkotlin.util.YoungUtil
|
||||||
|
|
||||||
|
class GpsReceiver : BroadcastReceiver() {
|
||||||
|
companion object{
|
||||||
|
private var gpsListener:GpsInformationListener? =null
|
||||||
|
|
||||||
|
fun setGpsListener(gpsListener:GpsInformationListener){
|
||||||
|
this.gpsListener=gpsListener
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onReceive(context: Context, intent: Intent) {
|
||||||
|
if (intent.action =="com.xixun.joey.gpsinfo"){
|
||||||
|
val lat = intent.getDoubleExtra("latitude", 0.0);
|
||||||
|
val lng = intent.getDoubleExtra("longitude", 0.0);
|
||||||
|
val satelliteNumber = intent.getIntExtra("satelliteNumber", 0);
|
||||||
|
val speed = intent.getFloatExtra("speed", 0f)
|
||||||
|
//YoungUtil.YoungLog("广播接收坐标信息:lat:$lat,lng:$lng,satell:$satelliteNumber,speed:$speed")
|
||||||
|
gpsListener?.onLocationChanged(lng,lat,0f,speed,satelliteNumber)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,299 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.gps;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.location.Criteria;
|
||||||
|
import android.location.GpsSatellite;
|
||||||
|
import android.location.GpsStatus;
|
||||||
|
import android.location.Location;
|
||||||
|
import android.location.LocationListener;
|
||||||
|
import android.location.LocationManager;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.provider.Settings;
|
||||||
|
|
||||||
|
import androidx.core.app.ActivityCompat;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import cn.trans88.taxiappkotlin.TaxiApp;
|
||||||
|
import cn.trans88.taxiappkotlin.logic.dao.AdvertiseDao;
|
||||||
|
import cn.trans88.taxiappkotlin.logic.dao.DaoUtil;
|
||||||
|
import cn.trans88.taxiappkotlin.logic.model.Advertise;
|
||||||
|
import cn.trans88.taxiappkotlin.play.RefreshPlayer;
|
||||||
|
import cn.trans88.taxiappkotlin.ui.advertise.AdvertiseType;
|
||||||
|
import cn.trans88.taxiappkotlin.util.YoungUtil;
|
||||||
|
|
||||||
|
import static android.content.Context.LOCATION_SERVICE;
|
||||||
|
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
|
||||||
|
|
||||||
|
public class GpsUtils {
|
||||||
|
// private final static float msToKms = 3.6f;
|
||||||
|
private final static float edge = 3.0f;
|
||||||
|
private static GpsUtils instance;
|
||||||
|
|
||||||
|
private volatile float lastSpeed;
|
||||||
|
private GpsInformationListener listener;
|
||||||
|
private LocationManager mLocationManager;
|
||||||
|
|
||||||
|
private GpsUtils() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized static GpsUtils getInstance() {
|
||||||
|
if (null == instance) {
|
||||||
|
instance = new GpsUtils();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private boolean getGpsFromAndroid() {
|
||||||
|
try {
|
||||||
|
// Looper.prepare();
|
||||||
|
Context context = TaxiApp.Companion.instance();
|
||||||
|
YoungUtil.YoungLog("Get gps info from android");
|
||||||
|
mLocationManager = (LocationManager) context.getSystemService(LOCATION_SERVICE);
|
||||||
|
if (null == mLocationManager) {
|
||||||
|
YoungUtil.YoungLog("mLocationManager is null");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isEnabled(context, mLocationManager)) {
|
||||||
|
// 获取位置信息
|
||||||
|
// 如果不设置查询要求,getLastKnownLocation方法传人的参数为LocationManager.GPS_PROVIDER
|
||||||
|
if (ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) != PERMISSION_GRANTED
|
||||||
|
&& ActivityCompat.checkSelfPermission(context, Manifest.permission.ACCESS_COARSE_LOCATION) != PERMISSION_GRANTED) {
|
||||||
|
YoungUtil.YoungLog("Taxi app has not got gps permission !");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
String bestProvider = mLocationManager.getBestProvider(getLocationCriteria(), true);
|
||||||
|
Location location = mLocationManager.getLastKnownLocation(bestProvider);
|
||||||
|
// Location location =getLastKnownLocation();
|
||||||
|
if (null != location) {
|
||||||
|
YoungUtil.YoungLog("初始化Location不为空");
|
||||||
|
handlerGps(location);
|
||||||
|
}else {
|
||||||
|
YoungUtil.YoungLog("初始化Location为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 监听状态
|
||||||
|
mLocationManager.addGpsStatusListener(initGpsStatusListener(mLocationManager));
|
||||||
|
// 绑定监听,有4个参数
|
||||||
|
// 参数1,设备:有GPS_PROVIDER和NETWORK_PROVIDER两种
|
||||||
|
// 参数2,位置信息更新周期,单位毫秒
|
||||||
|
// 参数3,位置变化最小距离:当位置距离变化超过此值时,将更新位置信息
|
||||||
|
// 参数4,监听
|
||||||
|
// 备注:参数2和3,如果参数3不为0,则以参数3为准;参数3为0,则通过时间来定时更新;两者为0,则随时刷新
|
||||||
|
|
||||||
|
// 1秒更新一次,或最小位移变化超过1米更新一次;
|
||||||
|
// 注意:此处更新准确度非常低,推荐在service里面启动一个Thread,在run中sleep(10000);然后执行handler.sendMessage(),更新位置
|
||||||
|
// mLocationManager.requestLocationUpdates(getProviderInOutdoor(), 1*1000, 0, initLocationListener());
|
||||||
|
mLocationManager.requestLocationUpdates(bestProvider, 2*1000, 0, initLocationListener());
|
||||||
|
// Looper.loop();
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
YoungUtil.YoungLog("Gps has not enabled !");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
YoungUtil.YoungLog("Failed when get gps from android ==>"+e.getMessage());
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private Location getLastKnownLocation() {
|
||||||
|
List<String> providers = mLocationManager.getProviders(true);
|
||||||
|
Location bestLocation = null;
|
||||||
|
for (String provider : providers) {
|
||||||
|
@SuppressLint("MissingPermission")
|
||||||
|
Location l = mLocationManager.getLastKnownLocation(provider);
|
||||||
|
if (l == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (bestLocation == null || l.getAccuracy() < bestLocation.getAccuracy()) {
|
||||||
|
// Found best last known location: %s", l);
|
||||||
|
bestLocation = l;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return bestLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getProviderOnIndoor(){
|
||||||
|
String provider = LocationManager.NETWORK_PROVIDER;
|
||||||
|
// 获取所有可用的位置提供器
|
||||||
|
List<String> providerList = mLocationManager.getProviders(true);
|
||||||
|
// 测试一般都在室内,这里颠倒了判断顺序
|
||||||
|
if(providerList.contains(LocationManager.NETWORK_PROVIDER)){
|
||||||
|
YoungUtil.YoungLog("NETWORK_PROVIDER");
|
||||||
|
provider = LocationManager.NETWORK_PROVIDER;
|
||||||
|
}else if (providerList.contains(LocationManager.GPS_PROVIDER)) {
|
||||||
|
YoungUtil.YoungLog("GPS_PROVIDER");
|
||||||
|
provider = LocationManager.GPS_PROVIDER;
|
||||||
|
}else{
|
||||||
|
// 当没有可用的位置提供器时,弹出Toast提示用户
|
||||||
|
YoungUtil.YoungLog("获取不到位置提供器");
|
||||||
|
}
|
||||||
|
|
||||||
|
return provider;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private String getProviderInOutdoor(){
|
||||||
|
String provider = LocationManager.GPS_PROVIDER;
|
||||||
|
// 获取所有可用的位置提供器
|
||||||
|
List<String> providerList = mLocationManager.getProviders(true);
|
||||||
|
// 测试一般都在室内,这里颠倒了判断顺序
|
||||||
|
if(providerList.contains(LocationManager.GPS_PROVIDER)){
|
||||||
|
YoungUtil.YoungLog("GPS_PROVIDER");
|
||||||
|
provider = LocationManager.GPS_PROVIDER;
|
||||||
|
}else if (providerList.contains(LocationManager.NETWORK_PROVIDER)) {
|
||||||
|
YoungUtil.YoungLog("NETWORK_PROVIDER");
|
||||||
|
provider = LocationManager.NETWORK_PROVIDER;
|
||||||
|
}else{
|
||||||
|
// 当没有可用的位置提供器时,弹出Toast提示用户
|
||||||
|
YoungUtil.YoungLog("获取不到位置提供器");
|
||||||
|
}
|
||||||
|
|
||||||
|
return provider;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//判断gps是否处于打开状态
|
||||||
|
private boolean isEnabled(Context context, LocationManager locationManager) {
|
||||||
|
if (Build.VERSION.SDK_INT < 19) {
|
||||||
|
return locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
|
||||||
|
}else{
|
||||||
|
int state = Settings.Secure.getInt(context.getContentResolver(), Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_OFF);
|
||||||
|
return (state != Settings.Secure.LOCATION_MODE_OFF);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回查询条件
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private Criteria getLocationCriteria() {
|
||||||
|
Criteria criteria = new Criteria();
|
||||||
|
// 设置定位精确度 Criteria.ACCURACY_COARSE比较粗略,Criteria.ACCURACY_FINE则比较精细
|
||||||
|
criteria.setAccuracy(Criteria.ACCURACY_FINE);
|
||||||
|
criteria.setSpeedRequired(true); // 设置是否要求速度
|
||||||
|
criteria.setCostAllowed(false); // 设置是否允许运营商收费
|
||||||
|
criteria.setBearingRequired(true); // 设置是否需要方位信息
|
||||||
|
criteria.setAltitudeRequired(false); // 设置是否需要海拔信息
|
||||||
|
criteria.setPowerRequirement(Criteria.POWER_LOW); // 设置对电源的需求
|
||||||
|
return criteria;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 状态监听
|
||||||
|
private GpsStatus.Listener initGpsStatusListener(LocationManager locationManager) {
|
||||||
|
return event -> {
|
||||||
|
switch (event) {
|
||||||
|
case GpsStatus.GPS_EVENT_FIRST_FIX:
|
||||||
|
// 第一次定位
|
||||||
|
YoungUtil.YoungLog("第一次定位");
|
||||||
|
break;
|
||||||
|
case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
|
||||||
|
int gpscount = 0;
|
||||||
|
@SuppressLint("MissingPermission") GpsStatus gpsStatus =locationManager.getGpsStatus(null);
|
||||||
|
int maxSatellites =gpsStatus.getMaxSatellites();
|
||||||
|
Iterator<GpsSatellite> iterator = gpsStatus.getSatellites().iterator();
|
||||||
|
while (iterator.hasNext()&& gpscount <=maxSatellites){
|
||||||
|
GpsSatellite s =iterator.next();
|
||||||
|
if (s.usedInFix()){
|
||||||
|
gpscount=gpscount+1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
YoungUtil.YoungLog("onLocationChanged: 卫星数量: "+gpscount);
|
||||||
|
|
||||||
|
if (gpscount ==0){
|
||||||
|
YoungUtil.YoungLog("onLocationChanged: 信号弱");
|
||||||
|
List<Advertise> list = DaoUtil.INSTANCE.getAdvertise().queryBuilder().where(AdvertiseDao.Properties.BelongTo.eq(AdvertiseType.AREA.ordinal())).list();
|
||||||
|
for (Advertise advertise : list) {
|
||||||
|
DaoUtil.INSTANCE.getAdvertise().delete(advertise);
|
||||||
|
try {
|
||||||
|
RefreshPlayer.refresh();
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case GpsStatus.GPS_EVENT_STARTED:
|
||||||
|
// 定位启动
|
||||||
|
YoungUtil.YoungLog("定位启动");
|
||||||
|
break;
|
||||||
|
case GpsStatus.GPS_EVENT_STOPPED:
|
||||||
|
// 定位结束
|
||||||
|
YoungUtil.YoungLog("定位结束");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private LocationListener initLocationListener() {
|
||||||
|
return new LocationListener() {
|
||||||
|
@Override
|
||||||
|
public void onLocationChanged(Location location) {
|
||||||
|
if (null != location) {
|
||||||
|
// ToastUtilKt.showToast(location.getLongitude()+"",TaxiApp.Companion.instance(), Toast.LENGTH_SHORT);
|
||||||
|
// handlerGps((float) location.getLongitude(), (float) location.getLatitude(), location.getSpeed());
|
||||||
|
handlerGps(location);
|
||||||
|
}else {
|
||||||
|
YoungUtil.YoungLog("initLocationListener Coordinate: location is null");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStatusChanged(String s, int i, Bundle bundle) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onProviderEnabled(String s) {
|
||||||
|
YoungUtil.YoungLog("onProviderEnabled");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onProviderDisabled(String s) {
|
||||||
|
YoungUtil.YoungLog("onProviderDisabled");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private synchronized void handlerGps(Location location) {
|
||||||
|
if (null != listener) {
|
||||||
|
if (lastSpeed < edge && location.getSpeed() > edge) {
|
||||||
|
listener.onSpeedStop(false);
|
||||||
|
}
|
||||||
|
if (lastSpeed > edge && location.getSpeed() < edge) {
|
||||||
|
listener.onSpeedStop(true);
|
||||||
|
}
|
||||||
|
if (lastSpeed != location.getSpeed()) {
|
||||||
|
listener.onSpeedChanged(location.getSpeed());
|
||||||
|
}
|
||||||
|
YoungUtil.YoungLog("gps handler 坐标发送变化");
|
||||||
|
listener.onLocationChanged(location.getLongitude(), location.getLatitude(),location.getBearing(),location.getSpeed(),0);
|
||||||
|
lastSpeed = location.getSpeed();
|
||||||
|
}else {
|
||||||
|
YoungUtil.YoungLog("initLocationListener listener is null!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGpsInformationListener(GpsInformationListener listener) {
|
||||||
|
this.listener = listener;
|
||||||
|
try {
|
||||||
|
lastSpeed = -1;
|
||||||
|
if (!getGpsFromAndroid()){
|
||||||
|
YoungUtil.YoungLog("Initialized GPS Failed ==> 无法调用设备GPS");
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
YoungUtil.YoungLog("Initialized GPS Failed ==> " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
public class ActionModel {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* action : InvokeTaxiAppFunction
|
||||||
|
* jsonCommand : {"action":"BindAccount","accountIdToken":"123"}
|
||||||
|
*/
|
||||||
|
|
||||||
|
private String action;
|
||||||
|
private String jsonCommand;
|
||||||
|
|
||||||
|
public String getAction() {
|
||||||
|
return action;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAction(String action) {
|
||||||
|
this.action = action;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getJsonCommand() {
|
||||||
|
return jsonCommand;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJsonCommand(String jsonCommand) {
|
||||||
|
this.jsonCommand = jsonCommand;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package net.trans88.taxiappkotlin.entity
|
||||||
|
|
||||||
|
import org.greenrobot.greendao.annotation.Entity
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
data class AdCommand (
|
||||||
|
val adProgramId:String,
|
||||||
|
val cmdType:String
|
||||||
|
)
|
|
@ -0,0 +1,236 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
import org.greenrobot.greendao.annotation.Entity;
|
||||||
|
import org.greenrobot.greendao.annotation.Generated;
|
||||||
|
import org.greenrobot.greendao.annotation.Id;
|
||||||
|
import org.greenrobot.greendao.annotation.Transient;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
//todo 可以让advertise 变成一个基类,其他的广告对象去继承它,当然可以把具体的行为再抽出来变成单独的行为类以减少代码的重复冗余
|
||||||
|
@Entity
|
||||||
|
public class Advertise implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
@Id(autoincrement = true)
|
||||||
|
private Long autoId;
|
||||||
|
private String id;
|
||||||
|
private int belongTo;//0 -idle 、1-Normal 2、。。。
|
||||||
|
private int media_type;
|
||||||
|
private String media_url;
|
||||||
|
private String ad_id;//记录任务的唯一id 包括region_ad_id task_id 等
|
||||||
|
private String region_id; //就是服务器的区域id
|
||||||
|
private String pathName;
|
||||||
|
private String duration;
|
||||||
|
private Long createAt;
|
||||||
|
private Double longitude=0.0;
|
||||||
|
private Double latitude=0.0;
|
||||||
|
|
||||||
|
private boolean isDownloaded=false;
|
||||||
|
private boolean isDownloading=false;
|
||||||
|
|
||||||
|
@Transient
|
||||||
|
private List<Regions> regions;
|
||||||
|
|
||||||
|
@Transient
|
||||||
|
private List<TimeSpan> time_span;
|
||||||
|
|
||||||
|
@Transient
|
||||||
|
private boolean isLast=false;
|
||||||
|
|
||||||
|
//更新数据库时,带Generated标签的方法要删除重新创建
|
||||||
|
@Generated(hash = 1676323656)
|
||||||
|
public Advertise(Long autoId, String id, int belongTo, int media_type,
|
||||||
|
String media_url, String ad_id, String region_id, String pathName,
|
||||||
|
String duration, Long createAt, Double longitude, Double latitude,
|
||||||
|
boolean isDownloaded, boolean isDownloading) {
|
||||||
|
this.autoId = autoId;
|
||||||
|
this.id = id;
|
||||||
|
this.belongTo = belongTo;
|
||||||
|
this.media_type = media_type;
|
||||||
|
this.media_url = media_url;
|
||||||
|
this.ad_id = ad_id;
|
||||||
|
this.region_id = region_id;
|
||||||
|
this.pathName = pathName;
|
||||||
|
this.duration = duration;
|
||||||
|
this.createAt = createAt;
|
||||||
|
this.longitude = longitude;
|
||||||
|
this.latitude = latitude;
|
||||||
|
this.isDownloaded = isDownloaded;
|
||||||
|
this.isDownloading = isDownloading;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated(hash = 1516411721)
|
||||||
|
public Advertise() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<TimeSpan> getTime_Span() {
|
||||||
|
return time_span;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTime_Span(List<TimeSpan> time_Span) {
|
||||||
|
this.time_span = time_Span;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getAutoId() {
|
||||||
|
return this.autoId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAutoId(Long autoId) {
|
||||||
|
this.autoId = autoId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getBelongTo() {
|
||||||
|
return this.belongTo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBelongTo(int belongTo) {
|
||||||
|
this.belongTo = belongTo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMedia_type() {
|
||||||
|
return this.media_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMedia_type(int media_type) {
|
||||||
|
this.media_type = media_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMedia_url() {
|
||||||
|
return this.media_url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMedia_url(String media_url) {
|
||||||
|
this.media_url = media_url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAd_id() {
|
||||||
|
return this.ad_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAd_id(String ad_id) {
|
||||||
|
this.ad_id = ad_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isLast() {
|
||||||
|
return isLast;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLast(boolean last) {
|
||||||
|
isLast = last;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPathName() {
|
||||||
|
return this.pathName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPathName(String pathName) {
|
||||||
|
this.pathName = pathName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDuration() {
|
||||||
|
return this.duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDuration(String duration) {
|
||||||
|
this.duration = duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Regions> getRegions() {
|
||||||
|
return regions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRegions(List<Regions> regions) {
|
||||||
|
this.regions = regions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRegion_id() {
|
||||||
|
return this.region_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRegion_id(String region_id) {
|
||||||
|
this.region_id = region_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
Advertise advertise = (Advertise) o;
|
||||||
|
return id.equals(advertise.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getCreateAt() {
|
||||||
|
return this.createAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateAt(Long createAt) {
|
||||||
|
this.createAt = createAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getIsDownloaded() {
|
||||||
|
return this.isDownloaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsDownloaded(boolean isDownloaded) {
|
||||||
|
this.isDownloaded = isDownloaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Double getLongitude() {
|
||||||
|
return this.longitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLongitude(Double longitude) {
|
||||||
|
this.longitude = longitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Double getLatitude() {
|
||||||
|
return this.latitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLatitude(Double latitude) {
|
||||||
|
this.latitude = latitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Advertise{" +
|
||||||
|
"autoId=" + autoId +
|
||||||
|
", id='" + id + '\'' +
|
||||||
|
", belongTo=" + belongTo +
|
||||||
|
", media_type=" + media_type +
|
||||||
|
", media_url='" + media_url + '\'' +
|
||||||
|
", ad_id='" + ad_id + '\'' +
|
||||||
|
", region_id='" + region_id + '\'' +
|
||||||
|
", pathName='" + pathName + '\'' +
|
||||||
|
", duration='" + duration + '\'' +
|
||||||
|
", createAt=" + createAt +
|
||||||
|
", longitude=" + longitude +
|
||||||
|
", latitude=" + latitude +
|
||||||
|
", isDownloaded=" + isDownloaded +
|
||||||
|
", regions=" + regions +
|
||||||
|
", time_span=" + time_span +
|
||||||
|
", isLast=" + isLast +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getIsDownloading() {
|
||||||
|
return this.isDownloading;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsDownloading(boolean isDownloading) {
|
||||||
|
this.isDownloading = isDownloading;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class AdvertiseOrder {
|
||||||
|
String task_id;
|
||||||
|
List<String> advertise_order;
|
||||||
|
String id;
|
||||||
|
|
||||||
|
public String getTask_id() {
|
||||||
|
return task_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTask_id(String task_id) {
|
||||||
|
this.task_id = task_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAdvertise_order() {
|
||||||
|
return advertise_order;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAdvertise_order(List<String> advertise_order) {
|
||||||
|
this.advertise_order = advertise_order;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
public class AdvertiseProcess {
|
||||||
|
private String type = "notify_download_ad_progress";
|
||||||
|
private String ad_id;
|
||||||
|
private String progress;
|
||||||
|
|
||||||
|
public String getAd_id() {
|
||||||
|
return ad_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAd_id(String ad_id) {
|
||||||
|
this.ad_id = ad_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProgress() {
|
||||||
|
return progress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProgress(String progress) {
|
||||||
|
this.progress = progress;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
package net.trans88.taxiappkotlin.entity
|
||||||
|
|
||||||
|
data class BaseCommand (val type:String)
|
|
@ -0,0 +1,31 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
public class BaseResponse {
|
||||||
|
private String id;
|
||||||
|
private String task_id;
|
||||||
|
private String type="";
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTask_id() {
|
||||||
|
return task_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTask_id(String task_id) {
|
||||||
|
this.task_id = task_id;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
|
public class BaseTask {
|
||||||
|
private String type;
|
||||||
|
private JsonObject task;
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JsonObject getTask() {
|
||||||
|
return task;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTask(JsonObject task) {
|
||||||
|
this.task = task;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "BaseTask{" +
|
||||||
|
"type='" + type + '\'' +
|
||||||
|
", task='" + task + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
public class BatchRegisterBean {
|
||||||
|
String task_id;
|
||||||
|
String token;
|
||||||
|
String service_url;
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
public class BindModel {
|
||||||
|
private String action;
|
||||||
|
private String accountIdToken;
|
||||||
|
private String server;
|
||||||
|
private String tlsServer;
|
||||||
|
|
||||||
|
public String getAction() {
|
||||||
|
return action;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAction(String action) {
|
||||||
|
this.action = action;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAccountIdToken() {
|
||||||
|
return accountIdToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccountIdToken(String accountIdToken) {
|
||||||
|
this.accountIdToken = accountIdToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getServer() {
|
||||||
|
return server;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setServer(String server) {
|
||||||
|
this.server = server;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTlsServer() {
|
||||||
|
return tlsServer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTlsServer(String tlsServer) {
|
||||||
|
this.tlsServer = tlsServer;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
public class BusInfo {
|
||||||
|
String task_id;
|
||||||
|
String media_id;
|
||||||
|
String id;
|
||||||
|
String background_type;
|
||||||
|
|
||||||
|
public String getMedia_id() {
|
||||||
|
return media_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMedia_id(String media_id) {
|
||||||
|
this.media_id = media_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTask_id() {
|
||||||
|
return task_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTask_id(String task_id) {
|
||||||
|
this.task_id = task_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBackground_type() {
|
||||||
|
return background_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBackground_type(String background_type) {
|
||||||
|
this.background_type = background_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,73 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
import org.greenrobot.greendao.annotation.Entity;
|
||||||
|
import org.greenrobot.greendao.annotation.Generated;
|
||||||
|
import org.greenrobot.greendao.annotation.Id;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
public class Container {
|
||||||
|
@Id(autoincrement = true)
|
||||||
|
private Long autoId;
|
||||||
|
private String id;
|
||||||
|
private String ad_container_id;
|
||||||
|
private int play_duration;
|
||||||
|
private boolean pause_while_move;
|
||||||
|
private int price;
|
||||||
|
|
||||||
|
@Generated(hash = 170305053)
|
||||||
|
public Container(Long autoId, String id, String ad_container_id,
|
||||||
|
int play_duration, boolean pause_while_move, int price) {
|
||||||
|
this.autoId = autoId;
|
||||||
|
this.id = id;
|
||||||
|
this.ad_container_id = ad_container_id;
|
||||||
|
this.play_duration = play_duration;
|
||||||
|
this.pause_while_move = pause_while_move;
|
||||||
|
this.price = price;
|
||||||
|
}
|
||||||
|
@Generated(hash = 46441586)
|
||||||
|
public Container() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getAutoId() {
|
||||||
|
return this.autoId;
|
||||||
|
}
|
||||||
|
public void setAutoId(Long autoId) {
|
||||||
|
this.autoId = autoId;
|
||||||
|
}
|
||||||
|
public String getId() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
public String getContainer_id() {
|
||||||
|
return this.ad_container_id;
|
||||||
|
}
|
||||||
|
public void setContainer_id(String container_id) {
|
||||||
|
this.ad_container_id = container_id;
|
||||||
|
}
|
||||||
|
public int getPlay_duration() {
|
||||||
|
return this.play_duration;
|
||||||
|
}
|
||||||
|
public void setPlay_duration(int play_duration) {
|
||||||
|
this.play_duration = play_duration;
|
||||||
|
}
|
||||||
|
public boolean getPause_while_move() {
|
||||||
|
return this.pause_while_move;
|
||||||
|
}
|
||||||
|
public void setPause_while_move(boolean pause_while_move) {
|
||||||
|
this.pause_while_move = pause_while_move;
|
||||||
|
}
|
||||||
|
public int getPrice() {
|
||||||
|
return this.price;
|
||||||
|
}
|
||||||
|
public void setPrice(int price) {
|
||||||
|
this.price = price;
|
||||||
|
}
|
||||||
|
public String getAd_container_id() {
|
||||||
|
return this.ad_container_id;
|
||||||
|
}
|
||||||
|
public void setAd_container_id(String ad_container_id) {
|
||||||
|
this.ad_container_id = ad_container_id;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
public class CrashResponse {
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class CurrentPlayAdvertises {
|
||||||
|
List<String> currentPlayAdvertise;
|
||||||
|
|
||||||
|
public List<String> getCurrentPlayAdvertise() {
|
||||||
|
return currentPlayAdvertise;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrentPlayAdvertise(List<String> currentPlayAdvertise) {
|
||||||
|
this.currentPlayAdvertise = currentPlayAdvertise;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
public class DeleteAdvertiseBean {
|
||||||
|
private String id;
|
||||||
|
private String ad_id;
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAd_id() {
|
||||||
|
return ad_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAd_id(String ad_id) {
|
||||||
|
this.ad_id = ad_id;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model
|
||||||
|
|
||||||
|
data class DeletePositionAdvertiseBean (val id:String,val task_id:String)
|
|
@ -0,0 +1,22 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
public class DeleteSanleAdvertiseBean {
|
||||||
|
private String id;
|
||||||
|
private String task_id;
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTask_id() {
|
||||||
|
return task_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTask_id(String task_id) {
|
||||||
|
this.task_id = task_id;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
public class DeleteSanleBean {
|
||||||
|
private String task_id;
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
public String getTask_id() {
|
||||||
|
return task_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTask_id(String task_id) {
|
||||||
|
this.task_id = task_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model
|
||||||
|
|
||||||
|
data class ExceptionModel(
|
||||||
|
val card_id: String,
|
||||||
|
val exception_info: String,
|
||||||
|
val package_name: String
|
||||||
|
)
|
|
@ -0,0 +1,17 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
public class Files {
|
||||||
|
public Files(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,79 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
import android.os.Parcel;
|
||||||
|
import android.os.Parcelable;
|
||||||
|
|
||||||
|
public class FpgaInfo implements Parcelable {
|
||||||
|
public String version;
|
||||||
|
public String x;
|
||||||
|
public String y;
|
||||||
|
public String width;
|
||||||
|
public String height;
|
||||||
|
public String humidity;
|
||||||
|
public String temperature;
|
||||||
|
public String cardVoltage;
|
||||||
|
public String externalVoltage1;
|
||||||
|
public String externalVoltage2;
|
||||||
|
public String doorOpened;
|
||||||
|
public String smoke;
|
||||||
|
|
||||||
|
// 必须提供一个名为CREATOR的static final属性 该属性需要实现android.os.Parcelable.Creator<T>接口
|
||||||
|
public static final Creator<FpgaInfo> CREATOR = new Creator<FpgaInfo>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FpgaInfo createFromParcel(Parcel source) {
|
||||||
|
return new FpgaInfo(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FpgaInfo[] newArray(int size) {
|
||||||
|
return new FpgaInfo[size];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public FpgaInfo() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private FpgaInfo(Parcel source) {
|
||||||
|
readFromParcel(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int describeContents() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 注意写入变量和读取变量的顺序应该一致 不然得不到正确的结果
|
||||||
|
@Override
|
||||||
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
|
dest.writeString(version);
|
||||||
|
dest.writeString(x);
|
||||||
|
dest.writeString(y);
|
||||||
|
dest.writeString(width);
|
||||||
|
dest.writeString(height);
|
||||||
|
dest.writeString(humidity);
|
||||||
|
dest.writeString(temperature);
|
||||||
|
dest.writeString(cardVoltage);
|
||||||
|
dest.writeString(externalVoltage1);
|
||||||
|
dest.writeString(externalVoltage2);
|
||||||
|
dest.writeString( doorOpened);
|
||||||
|
dest.writeString( smoke);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 注意读取变量和写入变量的顺序应该一致 不然得不到正确的结果
|
||||||
|
public void readFromParcel(Parcel source) {
|
||||||
|
version = source.readString();
|
||||||
|
x = source.readString();
|
||||||
|
y = source.readString();
|
||||||
|
width = source.readString();
|
||||||
|
height = source.readString();
|
||||||
|
humidity = source.readString();
|
||||||
|
temperature = source.readString();
|
||||||
|
cardVoltage =source.readString();
|
||||||
|
externalVoltage1 = source.readString();
|
||||||
|
externalVoltage2 = source.readString();
|
||||||
|
doorOpened = source.readString();
|
||||||
|
smoke = source.readString();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,109 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
import org.greenrobot.greendao.annotation.Entity;
|
||||||
|
import org.greenrobot.greendao.annotation.Id;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import org.greenrobot.greendao.annotation.Generated;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
public class Location implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Id(autoincrement = true)
|
||||||
|
private Long id;
|
||||||
|
private Long timestamp;
|
||||||
|
private Double longitude;
|
||||||
|
private Double latitude;
|
||||||
|
private Float speed;
|
||||||
|
private Float bearing;
|
||||||
|
private Float distance;
|
||||||
|
private Long elapse;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Generated(hash = 2055779998)
|
||||||
|
public Location(Long id, Long timestamp, Double longitude, Double latitude,
|
||||||
|
Float speed, Float bearing, Float distance, Long elapse) {
|
||||||
|
this.id = id;
|
||||||
|
this.timestamp = timestamp;
|
||||||
|
this.longitude = longitude;
|
||||||
|
this.latitude = latitude;
|
||||||
|
this.speed = speed;
|
||||||
|
this.bearing = bearing;
|
||||||
|
this.distance = distance;
|
||||||
|
this.elapse = elapse;
|
||||||
|
}
|
||||||
|
@Generated(hash = 375979639)
|
||||||
|
public Location() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
public Double getLongitude() {
|
||||||
|
return this.longitude;
|
||||||
|
}
|
||||||
|
public void setLongitude(Double longitude) {
|
||||||
|
this.longitude = longitude;
|
||||||
|
}
|
||||||
|
public Double getLatitude() {
|
||||||
|
return this.latitude;
|
||||||
|
}
|
||||||
|
public void setLatitude(Double latitude) {
|
||||||
|
this.latitude = latitude;
|
||||||
|
}
|
||||||
|
public Float getSpeed() {
|
||||||
|
return this.speed;
|
||||||
|
}
|
||||||
|
public void setSpeed(Float speed) {
|
||||||
|
this.speed = speed;
|
||||||
|
}
|
||||||
|
public Float getBearing() {
|
||||||
|
return this.bearing;
|
||||||
|
}
|
||||||
|
public void setBearing(Float bearing) {
|
||||||
|
this.bearing = bearing;
|
||||||
|
}
|
||||||
|
public Long getTimestamp() {
|
||||||
|
return this.timestamp;
|
||||||
|
}
|
||||||
|
public void setTimestamp(Long timestamp) {
|
||||||
|
this.timestamp = timestamp;
|
||||||
|
}
|
||||||
|
public Float getDistance() {
|
||||||
|
return this.distance;
|
||||||
|
}
|
||||||
|
public void setDistance(Float distance) {
|
||||||
|
this.distance = distance;
|
||||||
|
}
|
||||||
|
public Long getElapse() {
|
||||||
|
return this.elapse;
|
||||||
|
}
|
||||||
|
public void setElapse(Long elapse) {
|
||||||
|
this.elapse = elapse;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Location{" +
|
||||||
|
"id=" + id +
|
||||||
|
", timestamp=" + timestamp +
|
||||||
|
", longitude=" + longitude +
|
||||||
|
", latitude=" + latitude +
|
||||||
|
", speed=" + speed +
|
||||||
|
", bearing=" + bearing +
|
||||||
|
", distance=" + distance +
|
||||||
|
", elapse=" + elapse +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model
|
||||||
|
|
||||||
|
abstract class Media {
|
||||||
|
abstract var createAt:Long
|
||||||
|
abstract var duration: String
|
||||||
|
}
|
|
@ -0,0 +1,73 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
import org.greenrobot.greendao.annotation.Entity;
|
||||||
|
import org.greenrobot.greendao.annotation.Id;
|
||||||
|
import org.greenrobot.greendao.annotation.Generated;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
public class NotNetAdvertise {
|
||||||
|
@Id(autoincrement = true)
|
||||||
|
private Long autoId;
|
||||||
|
private String id;
|
||||||
|
private int belongTo;//0 -idle 、1-Normal 2、。。。
|
||||||
|
private int media_type;
|
||||||
|
private String media_url;
|
||||||
|
private String pathName;
|
||||||
|
private String duration;
|
||||||
|
@Generated(hash = 2047487559)
|
||||||
|
public NotNetAdvertise(Long autoId, String id, int belongTo, int media_type,
|
||||||
|
String media_url, String pathName, String duration) {
|
||||||
|
this.autoId = autoId;
|
||||||
|
this.id = id;
|
||||||
|
this.belongTo = belongTo;
|
||||||
|
this.media_type = media_type;
|
||||||
|
this.media_url = media_url;
|
||||||
|
this.pathName = pathName;
|
||||||
|
this.duration = duration;
|
||||||
|
}
|
||||||
|
@Generated(hash = 1292645837)
|
||||||
|
public NotNetAdvertise() {
|
||||||
|
}
|
||||||
|
public Long getAutoId() {
|
||||||
|
return this.autoId;
|
||||||
|
}
|
||||||
|
public void setAutoId(Long autoId) {
|
||||||
|
this.autoId = autoId;
|
||||||
|
}
|
||||||
|
public String getId() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
public int getBelongTo() {
|
||||||
|
return this.belongTo;
|
||||||
|
}
|
||||||
|
public void setBelongTo(int belongTo) {
|
||||||
|
this.belongTo = belongTo;
|
||||||
|
}
|
||||||
|
public int getMedia_type() {
|
||||||
|
return this.media_type;
|
||||||
|
}
|
||||||
|
public void setMedia_type(int media_type) {
|
||||||
|
this.media_type = media_type;
|
||||||
|
}
|
||||||
|
public String getMedia_url() {
|
||||||
|
return this.media_url;
|
||||||
|
}
|
||||||
|
public void setMedia_url(String media_url) {
|
||||||
|
this.media_url = media_url;
|
||||||
|
}
|
||||||
|
public String getPathName() {
|
||||||
|
return this.pathName;
|
||||||
|
}
|
||||||
|
public void setPathName(String pathName) {
|
||||||
|
this.pathName = pathName;
|
||||||
|
}
|
||||||
|
public String getDuration() {
|
||||||
|
return this.duration;
|
||||||
|
}
|
||||||
|
public void setDuration(String duration) {
|
||||||
|
this.duration = duration;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
import org.greenrobot.greendao.annotation.Entity;
|
||||||
|
import org.greenrobot.greendao.annotation.Id;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import org.greenrobot.greendao.annotation.Generated;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
public class Order implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
@Id(autoincrement = true)
|
||||||
|
private Long autoId;
|
||||||
|
|
||||||
|
private String ad_id;
|
||||||
|
|
||||||
|
private Boolean isLast=false;
|
||||||
|
|
||||||
|
@Generated(hash = 1287477733)
|
||||||
|
public Order(Long autoId, String ad_id, Boolean isLast) {
|
||||||
|
this.autoId = autoId;
|
||||||
|
this.ad_id = ad_id;
|
||||||
|
this.isLast = isLast;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated(hash = 1105174599)
|
||||||
|
public Order() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getAutoId() {
|
||||||
|
return autoId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAutoId(Long autoId) {
|
||||||
|
this.autoId = autoId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAd_id() {
|
||||||
|
return ad_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAd_id(String ad_id) {
|
||||||
|
this.ad_id = ad_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getIsLast() {
|
||||||
|
return this.isLast;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsLast(Boolean isLast) {
|
||||||
|
this.isLast = isLast;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class OrderModel extends SanleResponse {
|
||||||
|
private List<String> advertise_order;
|
||||||
|
|
||||||
|
public List<String> getAdvertise_order() {
|
||||||
|
return advertise_order;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAdvertise_order(List<String> advertise_order) {
|
||||||
|
this.advertise_order = advertise_order;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class PlayAdvertiseModel extends SanleResponse {
|
||||||
|
private List<String> ad_list;
|
||||||
|
private List<String> current_play_list;
|
||||||
|
|
||||||
|
public List<String> getAd_list() {
|
||||||
|
return ad_list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAd_list(List<String> ad_list) {
|
||||||
|
this.ad_list = ad_list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getCurrent_play_list() {
|
||||||
|
return current_play_list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrent_play_list(List<String> current_play_list) {
|
||||||
|
this.current_play_list = current_play_list;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,125 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
import org.greenrobot.greendao.annotation.Entity;
|
||||||
|
import org.greenrobot.greendao.annotation.Generated;
|
||||||
|
import org.greenrobot.greendao.annotation.Id;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by joey on 17-12-19.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
public class PlayLogger implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
@Id(autoincrement = true)
|
||||||
|
private Long autoId;
|
||||||
|
private int ad_type;
|
||||||
|
private String ad_id;
|
||||||
|
private String media_url;
|
||||||
|
private long begin_play_ts;
|
||||||
|
private long end_play_ts;
|
||||||
|
private long created_at;
|
||||||
|
private long duration;
|
||||||
|
private String region_id;
|
||||||
|
private String ad_container_id;
|
||||||
|
private Double longitude;
|
||||||
|
private Double latitude;
|
||||||
|
|
||||||
|
@Generated(hash = 1151059545)
|
||||||
|
public PlayLogger(Long autoId, int ad_type, String ad_id, String media_url,
|
||||||
|
long begin_play_ts, long end_play_ts, long created_at, long duration,
|
||||||
|
String region_id, String ad_container_id, Double longitude,
|
||||||
|
Double latitude) {
|
||||||
|
this.autoId = autoId;
|
||||||
|
this.ad_type = ad_type;
|
||||||
|
this.ad_id = ad_id;
|
||||||
|
this.media_url = media_url;
|
||||||
|
this.begin_play_ts = begin_play_ts;
|
||||||
|
this.end_play_ts = end_play_ts;
|
||||||
|
this.created_at = created_at;
|
||||||
|
this.duration = duration;
|
||||||
|
this.region_id = region_id;
|
||||||
|
this.ad_container_id = ad_container_id;
|
||||||
|
this.longitude = longitude;
|
||||||
|
this.latitude = latitude;
|
||||||
|
}
|
||||||
|
@Generated(hash = 200959585)
|
||||||
|
public PlayLogger() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAd_type() {
|
||||||
|
return this.ad_type;
|
||||||
|
}
|
||||||
|
public void setAd_type(int ad_type) {
|
||||||
|
this.ad_type = ad_type;
|
||||||
|
}
|
||||||
|
public String getAd_id() {
|
||||||
|
return this.ad_id;
|
||||||
|
}
|
||||||
|
public void setAd_id(String ad_id) {
|
||||||
|
this.ad_id = ad_id;
|
||||||
|
}
|
||||||
|
public long getBegin_play_ts() {
|
||||||
|
return this.begin_play_ts;
|
||||||
|
}
|
||||||
|
public void setBegin_play_ts(long begin_play_ts) {
|
||||||
|
this.begin_play_ts = begin_play_ts;
|
||||||
|
}
|
||||||
|
public long getEnd_play_ts() {
|
||||||
|
return this.end_play_ts;
|
||||||
|
}
|
||||||
|
public void setEnd_play_ts(long end_play_ts) {
|
||||||
|
this.end_play_ts = end_play_ts;
|
||||||
|
}
|
||||||
|
public long getCreated_at() {
|
||||||
|
return this.created_at;
|
||||||
|
}
|
||||||
|
public void setCreated_at(long created_at) {
|
||||||
|
this.created_at = created_at;
|
||||||
|
}
|
||||||
|
public long getDuration() {
|
||||||
|
return this.duration;
|
||||||
|
}
|
||||||
|
public void setDuration(long duration) {
|
||||||
|
this.duration = duration;
|
||||||
|
}
|
||||||
|
public String getMedia_url() {
|
||||||
|
return this.media_url;
|
||||||
|
}
|
||||||
|
public void setMedia_url(String media_url) {
|
||||||
|
this.media_url = media_url;
|
||||||
|
}
|
||||||
|
public String getRegion_id() {
|
||||||
|
return this.region_id;
|
||||||
|
}
|
||||||
|
public void setRegion_id(String region_id) {
|
||||||
|
this.region_id = region_id;
|
||||||
|
}
|
||||||
|
public String getAd_container_id() {
|
||||||
|
return this.ad_container_id;
|
||||||
|
}
|
||||||
|
public void setAd_container_id(String ad_container_id) {
|
||||||
|
this.ad_container_id = ad_container_id;
|
||||||
|
}
|
||||||
|
public Long getAutoId() {
|
||||||
|
return this.autoId;
|
||||||
|
}
|
||||||
|
public void setAutoId(Long autoId) {
|
||||||
|
this.autoId = autoId;
|
||||||
|
}
|
||||||
|
public Double getLongitude() {
|
||||||
|
return this.longitude;
|
||||||
|
}
|
||||||
|
public void setLongitude(Double longitude) {
|
||||||
|
this.longitude = longitude;
|
||||||
|
}
|
||||||
|
public Double getLatitude() {
|
||||||
|
return this.latitude;
|
||||||
|
}
|
||||||
|
public void setLatitude(Double latitude) {
|
||||||
|
this.latitude = latitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,144 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
import org.greenrobot.greendao.annotation.Entity;
|
||||||
|
import org.greenrobot.greendao.annotation.Generated;
|
||||||
|
import org.greenrobot.greendao.annotation.Id;
|
||||||
|
import org.greenrobot.greendao.annotation.Transient;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
public class PositionAdvertise implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
@Id(autoincrement = true)
|
||||||
|
private Long autoId;
|
||||||
|
private String id;
|
||||||
|
private int belongTo;//0 -idle 、1-Normal 2、。。。
|
||||||
|
private int media_type;
|
||||||
|
private String media_url;
|
||||||
|
private String task_id;
|
||||||
|
private String pathName;
|
||||||
|
private String duration;
|
||||||
|
|
||||||
|
@Transient
|
||||||
|
private List<Regions> regions;
|
||||||
|
|
||||||
|
@Transient
|
||||||
|
private List<TimeSpan> time_span;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Generated(hash = 90801906)
|
||||||
|
public PositionAdvertise(Long autoId, String id, int belongTo, int media_type,
|
||||||
|
String media_url, String task_id, String pathName, String duration) {
|
||||||
|
this.autoId = autoId;
|
||||||
|
this.id = id;
|
||||||
|
this.belongTo = belongTo;
|
||||||
|
this.media_type = media_type;
|
||||||
|
this.media_url = media_url;
|
||||||
|
this.task_id = task_id;
|
||||||
|
this.pathName = pathName;
|
||||||
|
this.duration = duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated(hash = 697706016)
|
||||||
|
public PositionAdvertise() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public List<TimeSpan> getTime_span() {
|
||||||
|
return time_span;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTime_span(List<TimeSpan> time_span) {
|
||||||
|
this.time_span = time_span;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "PositionAdvertise{" +
|
||||||
|
"autoId=" + autoId +
|
||||||
|
", id='" + id + '\'' +
|
||||||
|
", belongTo=" + belongTo +
|
||||||
|
", media_type=" + media_type +
|
||||||
|
", media_url='" + media_url + '\'' +
|
||||||
|
", region_ad_id='" + task_id + '\'' +
|
||||||
|
", pathName='" + pathName + '\'' +
|
||||||
|
", duration='" + duration + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getAutoId() {
|
||||||
|
return this.autoId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAutoId(Long autoId) {
|
||||||
|
this.autoId = autoId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getBelongTo() {
|
||||||
|
return this.belongTo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBelongTo(int belongTo) {
|
||||||
|
this.belongTo = belongTo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMedia_type() {
|
||||||
|
return this.media_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMedia_type(int media_type) {
|
||||||
|
this.media_type = media_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMedia_url() {
|
||||||
|
return this.media_url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMedia_url(String media_url) {
|
||||||
|
this.media_url = media_url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTask_id() {
|
||||||
|
return this.task_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTask_id(String task_id) {
|
||||||
|
this.task_id = task_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPathName() {
|
||||||
|
return this.pathName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPathName(String pathName) {
|
||||||
|
this.pathName = pathName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDuration() {
|
||||||
|
return this.duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDuration(String duration) {
|
||||||
|
this.duration = duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Regions> getRegions() {
|
||||||
|
return regions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRegions(List<Regions> regions) {
|
||||||
|
this.regions = regions;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
public class PutPositionResponse {
|
||||||
|
private String id;
|
||||||
|
private String region_ad_id;
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRegion_ad_id() {
|
||||||
|
return region_ad_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRegion_ad_id(String region_ad_id) {
|
||||||
|
this.region_ad_id = region_ad_id;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class QueryLogFile {
|
||||||
|
private String id;
|
||||||
|
private String task_id;
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTask_id() {
|
||||||
|
return task_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTask_id(String task_id) {
|
||||||
|
this.task_id = task_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Files> fileList;
|
||||||
|
|
||||||
|
public List<Files> getFileList() {
|
||||||
|
return fileList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFileList(List<Files> fileList) {
|
||||||
|
this.fileList = fileList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,89 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
import org.greenrobot.greendao.annotation.Entity;
|
||||||
|
import org.greenrobot.greendao.annotation.Generated;
|
||||||
|
import org.greenrobot.greendao.annotation.Id;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
public class Regions {
|
||||||
|
@Id(autoincrement = true)
|
||||||
|
private Long autoId;
|
||||||
|
private String id;
|
||||||
|
private String RegionAdId;
|
||||||
|
private double lat;
|
||||||
|
private double lng;
|
||||||
|
private int price;
|
||||||
|
private int radius;
|
||||||
|
private boolean isInRegion=false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Generated(hash = 343985898)
|
||||||
|
public Regions(Long autoId, String id, String RegionAdId, double lat,
|
||||||
|
double lng, int price, int radius, boolean isInRegion) {
|
||||||
|
this.autoId = autoId;
|
||||||
|
this.id = id;
|
||||||
|
this.RegionAdId = RegionAdId;
|
||||||
|
this.lat = lat;
|
||||||
|
this.lng = lng;
|
||||||
|
this.price = price;
|
||||||
|
this.radius = radius;
|
||||||
|
this.isInRegion = isInRegion;
|
||||||
|
}
|
||||||
|
@Generated(hash = 564136921)
|
||||||
|
public Regions() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public Long getAutoId() {
|
||||||
|
return this.autoId;
|
||||||
|
}
|
||||||
|
public void setAutoId(Long autoId) {
|
||||||
|
this.autoId = autoId;
|
||||||
|
}
|
||||||
|
public String getId() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getLat() {
|
||||||
|
return this.lat;
|
||||||
|
}
|
||||||
|
public void setLat(double lat) {
|
||||||
|
this.lat = lat;
|
||||||
|
}
|
||||||
|
public double getLng() {
|
||||||
|
return this.lng;
|
||||||
|
}
|
||||||
|
public void setLng(double lng) {
|
||||||
|
this.lng = lng;
|
||||||
|
}
|
||||||
|
public int getPrice() {
|
||||||
|
return this.price;
|
||||||
|
}
|
||||||
|
public void setPrice(int price) {
|
||||||
|
this.price = price;
|
||||||
|
}
|
||||||
|
public int getRadius() {
|
||||||
|
return this.radius;
|
||||||
|
}
|
||||||
|
public void setRadius(int radius) {
|
||||||
|
this.radius = radius;
|
||||||
|
}
|
||||||
|
public String getRegionAdId() {
|
||||||
|
return this.RegionAdId;
|
||||||
|
}
|
||||||
|
public void setRegionAdId(String RegionAdId) {
|
||||||
|
this.RegionAdId = RegionAdId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getIsInRegion() {
|
||||||
|
return this.isInRegion;
|
||||||
|
}
|
||||||
|
public void setIsInRegion(boolean isInRegion) {
|
||||||
|
this.isInRegion = isInRegion;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,58 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
public class RegisterRequest {
|
||||||
|
private String card_id;
|
||||||
|
private String name;
|
||||||
|
private String driver_tel;
|
||||||
|
private String taxi_phone_url;
|
||||||
|
private String Licence;
|
||||||
|
private String driver_name;
|
||||||
|
|
||||||
|
public String getCard_id() {
|
||||||
|
return card_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCard_id(String card_id) {
|
||||||
|
this.card_id = card_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDriver_tel() {
|
||||||
|
return driver_tel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDriver_tel(String driver_tel) {
|
||||||
|
this.driver_tel = driver_tel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTaxi_phone_url() {
|
||||||
|
return taxi_phone_url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTaxi_phone_url(String taxi_phone_url) {
|
||||||
|
this.taxi_phone_url = taxi_phone_url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLicence() {
|
||||||
|
return Licence;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLicence(String licence) {
|
||||||
|
Licence = licence;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDriver_name() {
|
||||||
|
return driver_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDriver_name(String driver_name) {
|
||||||
|
this.driver_name = driver_name;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,118 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class RegisterResponse implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private int error_code;
|
||||||
|
private String msg;
|
||||||
|
private String taxi_service_url;
|
||||||
|
private String log_service_url;
|
||||||
|
private String media_download_url;
|
||||||
|
private String upload_debug_file_url ="";//上传运行日志地址
|
||||||
|
private String token;
|
||||||
|
|
||||||
|
private String driver_name;
|
||||||
|
private String driver_tel;
|
||||||
|
private String licence;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public int getError_code() {
|
||||||
|
return error_code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setError_code(int error_code) {
|
||||||
|
this.error_code = error_code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMsg() {
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMsg(String msg) {
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTaxi_service_url() {
|
||||||
|
return taxi_service_url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLog_service_url() {
|
||||||
|
return log_service_url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLog_service_url(String log_service_url) {
|
||||||
|
this.log_service_url = log_service_url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getToken() {
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setToken(String token) {
|
||||||
|
this.token = token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMedia_download_url() {
|
||||||
|
return media_download_url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMedia_download_url(String media_download_url) {
|
||||||
|
this.media_download_url = media_download_url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTaxi_service_url(String taxi_service_url) {
|
||||||
|
this.taxi_service_url = taxi_service_url;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDriver_name() {
|
||||||
|
return driver_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDriver_name(String driver_name) {
|
||||||
|
this.driver_name = driver_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDriver_tel() {
|
||||||
|
return driver_tel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDriver_tel(String driver_tel) {
|
||||||
|
this.driver_tel = driver_tel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLicence() {
|
||||||
|
return licence;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLicence(String licence) {
|
||||||
|
this.licence = licence;
|
||||||
|
}
|
||||||
|
public String getUpload_debug_file_url() {
|
||||||
|
return upload_debug_file_url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpload_debug_file_url(String upload_debug_file_url) {
|
||||||
|
this.upload_debug_file_url = upload_debug_file_url;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "RegisterResponse{" +
|
||||||
|
"error_code=" + error_code +
|
||||||
|
", msg='" + msg + '\'' +
|
||||||
|
", taxi_service_url='" + taxi_service_url + '\'' +
|
||||||
|
", log_service_url='" + log_service_url + '\'' +
|
||||||
|
", media_download_url='" + media_download_url + '\'' +
|
||||||
|
", upload_debug_file_url='" + upload_debug_file_url + '\'' +
|
||||||
|
", token='" + token + '\'' +
|
||||||
|
", driver_name='" + driver_name + '\'' +
|
||||||
|
", driver_tel='" + driver_tel + '\'' +
|
||||||
|
", licence='" + licence + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,142 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
import org.greenrobot.greendao.annotation.Entity;
|
||||||
|
import org.greenrobot.greendao.annotation.Id;
|
||||||
|
import org.greenrobot.greendao.annotation.Transient;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.greenrobot.greendao.annotation.Generated;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
public class SanleAdvertise {
|
||||||
|
@Id(autoincrement = true)
|
||||||
|
private Long AutoId;
|
||||||
|
private String id;
|
||||||
|
private String task_id;
|
||||||
|
private int belongTo;
|
||||||
|
private int media_type;
|
||||||
|
private String media_url;
|
||||||
|
private String pathName;
|
||||||
|
private String duration;
|
||||||
|
private Long createAt;
|
||||||
|
|
||||||
|
|
||||||
|
@Transient
|
||||||
|
private List<TimeSpan> time_span;
|
||||||
|
|
||||||
|
@Generated(hash = 1955420225)
|
||||||
|
public SanleAdvertise(Long AutoId, String id, String task_id, int belongTo,
|
||||||
|
int media_type, String media_url, String pathName, String duration,
|
||||||
|
Long createAt) {
|
||||||
|
this.AutoId = AutoId;
|
||||||
|
this.id = id;
|
||||||
|
this.task_id = task_id;
|
||||||
|
this.belongTo = belongTo;
|
||||||
|
this.media_type = media_type;
|
||||||
|
this.media_url = media_url;
|
||||||
|
this.pathName = pathName;
|
||||||
|
this.duration = duration;
|
||||||
|
this.createAt = createAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated(hash = 440435512)
|
||||||
|
public SanleAdvertise() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TimeSpan> getTime_span() {
|
||||||
|
return time_span;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTime_span(List<TimeSpan> time_span) {
|
||||||
|
this.time_span = time_span;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getAutoId() {
|
||||||
|
return this.AutoId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAutoId(Long AutoId) {
|
||||||
|
this.AutoId = AutoId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTask_id() {
|
||||||
|
return this.task_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTask_id(String task_id) {
|
||||||
|
this.task_id = task_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getBelongTo() {
|
||||||
|
return this.belongTo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBelongTo(int belongTo) {
|
||||||
|
this.belongTo = belongTo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMedia_type() {
|
||||||
|
return this.media_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMedia_type(int media_type) {
|
||||||
|
this.media_type = media_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMedia_url() {
|
||||||
|
return this.media_url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMedia_url(String media_url) {
|
||||||
|
this.media_url = media_url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPathName() {
|
||||||
|
return this.pathName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPathName(String pathName) {
|
||||||
|
this.pathName = pathName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDuration() {
|
||||||
|
return this.duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDuration(String duration) {
|
||||||
|
this.duration = duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getCreateAt() {
|
||||||
|
return this.createAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateAt(Long createAt) {
|
||||||
|
this.createAt = createAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "SanleAdvertise{" +
|
||||||
|
"AutoId=" + AutoId +
|
||||||
|
", id='" + id + '\'' +
|
||||||
|
", task_id='" + task_id + '\'' +
|
||||||
|
", belongTo=" + belongTo +
|
||||||
|
", media_type=" + media_type +
|
||||||
|
", media_url='" + media_url + '\'' +
|
||||||
|
", pathName='" + pathName + '\'' +
|
||||||
|
", duration='" + duration + '\'' +
|
||||||
|
", createAt=" + createAt +
|
||||||
|
", time_span=" + time_span +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
public class SanleResponse {
|
||||||
|
private String type;
|
||||||
|
private String task_id;
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTask_id() {
|
||||||
|
return task_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTask_id(String task_id) {
|
||||||
|
this.task_id = task_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
public class SanleTest extends Advertise {
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
public class SendLogModel {
|
||||||
|
private String task_id;
|
||||||
|
private String name;
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
public String getTask_id() {
|
||||||
|
return task_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTask_id(String task_id) {
|
||||||
|
this.task_id = task_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
public class SendTaxiInfoResponse {
|
||||||
|
private int error_code;
|
||||||
|
private String msg;
|
||||||
|
|
||||||
|
public int getError_code() {
|
||||||
|
return error_code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setError_code(int error_code) {
|
||||||
|
this.error_code = error_code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMsg() {
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMsg(String msg) {
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,172 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class SettingMod implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private String registerToken;
|
||||||
|
private String appToken;
|
||||||
|
private String company;
|
||||||
|
private Boolean sync;
|
||||||
|
private String logServiceUrl;
|
||||||
|
private String connServiceUrl;
|
||||||
|
private int screenSizeX;
|
||||||
|
private int screenSizeY;
|
||||||
|
private String taxiInfo;
|
||||||
|
private String cardId;
|
||||||
|
private String taxiServiceUrl;
|
||||||
|
private String downloadUrl;
|
||||||
|
private String accountId;
|
||||||
|
private String taxiBaseUrl;
|
||||||
|
private Boolean isDeleteOldAdvitise;
|
||||||
|
private Boolean isFirstRegister;
|
||||||
|
private Boolean enableWriteLog;
|
||||||
|
private String advertiseOrder;
|
||||||
|
|
||||||
|
public String getRegisterToken() {
|
||||||
|
return registerToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRegisterToken(String registerToken) {
|
||||||
|
this.registerToken = registerToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAppToken() {
|
||||||
|
return appToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAppToken(String appToken) {
|
||||||
|
this.appToken = appToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCompany() {
|
||||||
|
return company;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCompany(String company) {
|
||||||
|
this.company = company;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getSync() {
|
||||||
|
return sync;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSync(Boolean sync) {
|
||||||
|
this.sync = sync;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLogServiceUrl() {
|
||||||
|
return logServiceUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLogServiceUrl(String logServiceUrl) {
|
||||||
|
this.logServiceUrl = logServiceUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getConnServiceUrl() {
|
||||||
|
return connServiceUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConnServiceUrl(String connServiceUrl) {
|
||||||
|
this.connServiceUrl = connServiceUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getScreenSizeX() {
|
||||||
|
return screenSizeX;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScreenSizeX(int screenSizeX) {
|
||||||
|
this.screenSizeX = screenSizeX;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getScreenSizeY() {
|
||||||
|
return screenSizeY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScreenSizeY(int screenSizeY) {
|
||||||
|
this.screenSizeY = screenSizeY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTaxiInfo() {
|
||||||
|
return taxiInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTaxiInfo(String taxiInfo) {
|
||||||
|
this.taxiInfo = taxiInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCardId() {
|
||||||
|
return cardId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCardId(String cardId) {
|
||||||
|
this.cardId = cardId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTaxiServiceUrl() {
|
||||||
|
return taxiServiceUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTaxiServiceUrl(String taxiServiceUrl) {
|
||||||
|
this.taxiServiceUrl = taxiServiceUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDownloadUrl() {
|
||||||
|
return downloadUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDownloadUrl(String downloadUrl) {
|
||||||
|
this.downloadUrl = downloadUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAccountId() {
|
||||||
|
return accountId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccountId(String accountId) {
|
||||||
|
this.accountId = accountId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTaxiBaseUrl() {
|
||||||
|
return taxiBaseUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTaxiBaseUrl(String taxiBaseUrl) {
|
||||||
|
this.taxiBaseUrl = taxiBaseUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getIsDeleteOldAdvitise() {
|
||||||
|
return isDeleteOldAdvitise;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsDeleteOldAdvitise(Boolean deleteOldAdvitise) {
|
||||||
|
isDeleteOldAdvitise = deleteOldAdvitise;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getIsFirstRegister() {
|
||||||
|
return isFirstRegister;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsFirstRegister(Boolean firstRegister) {
|
||||||
|
isFirstRegister = firstRegister;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getEnableWriteLog() {
|
||||||
|
return enableWriteLog;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnableWriteLog(Boolean enableWriteLog) {
|
||||||
|
this.enableWriteLog = enableWriteLog;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAdvertiseOrder() {
|
||||||
|
return advertiseOrder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAdvertiseOrder(String advertiseOrder) {
|
||||||
|
this.advertiseOrder = advertiseOrder;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
public class Switch {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id : 5e89bdf18283968413a4503e
|
||||||
|
* task_id : 5e89bdf18283968413a4503e
|
||||||
|
* turn_on : true
|
||||||
|
*/
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
private String task_id;
|
||||||
|
private boolean turn_on;
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTask_id() {
|
||||||
|
return task_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTask_id(String task_id) {
|
||||||
|
this.task_id = task_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isTurn_on() {
|
||||||
|
return turn_on;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTurn_on(boolean turn_on) {
|
||||||
|
this.turn_on = turn_on;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,62 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
public class SwitchAccount {
|
||||||
|
private String id;
|
||||||
|
private String task_id;
|
||||||
|
private String account_id_token;
|
||||||
|
private String taxiServerTLSURL;
|
||||||
|
private String taxiServerURL;
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTask_id() {
|
||||||
|
return task_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTask_id(String task_id) {
|
||||||
|
this.task_id = task_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAccount_id_token() {
|
||||||
|
return account_id_token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccount_id_token(String account_id_token) {
|
||||||
|
this.account_id_token = account_id_token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTaxiServerTLSURL() {
|
||||||
|
return taxiServerTLSURL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTaxiServerTLSURL(String taxiServerTLSURL) {
|
||||||
|
this.taxiServerTLSURL = taxiServerTLSURL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTaxiServerURL() {
|
||||||
|
return taxiServerURL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTaxiServerURL(String taxiServerURL) {
|
||||||
|
this.taxiServerURL = taxiServerURL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "SwitchAccount{" +
|
||||||
|
"id='" + id + '\'' +
|
||||||
|
", task_id='" + task_id + '\'' +
|
||||||
|
", account_id_token='" + account_id_token + '\'' +
|
||||||
|
", taxiServerTLSURL='" + taxiServerTLSURL + '\'' +
|
||||||
|
", taxiServerURL='" + taxiServerURL + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
public class SyncTimeModel {
|
||||||
|
private int currentPosition =0;
|
||||||
|
private Long delay =0L;
|
||||||
|
|
||||||
|
public int getCurrentPosition() {
|
||||||
|
return currentPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrentPosition(int currentPosition) {
|
||||||
|
this.currentPosition = currentPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getDelay() {
|
||||||
|
return delay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDelay(Long delay) {
|
||||||
|
this.delay = delay;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,60 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
public class TaxiInfo {
|
||||||
|
private String action;
|
||||||
|
private String licensePlateNumber;
|
||||||
|
private String taxiPictureUrl;
|
||||||
|
private String driverName;
|
||||||
|
private String driverTel;
|
||||||
|
|
||||||
|
public String getAction() {
|
||||||
|
return action;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAction(String action) {
|
||||||
|
this.action = action;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLicensePlateNumber() {
|
||||||
|
return licensePlateNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLicensePlateNumber(String licensePlateNumber) {
|
||||||
|
this.licensePlateNumber = licensePlateNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTaxiPictureUrl() {
|
||||||
|
return taxiPictureUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTaxiPictureUrl(String taxiPictureUrl) {
|
||||||
|
this.taxiPictureUrl = taxiPictureUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDriverName() {
|
||||||
|
return driverName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDriverName(String driverName) {
|
||||||
|
this.driverName = driverName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDriverTel() {
|
||||||
|
return driverTel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDriverTel(String driverTel) {
|
||||||
|
this.driverTel = driverTel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "TaxiInfo{" +
|
||||||
|
"action='" + action + '\'' +
|
||||||
|
", licensePlateNumber='" + licensePlateNumber + '\'' +
|
||||||
|
", taxiPictureUrl='" + taxiPictureUrl + '\'' +
|
||||||
|
", driverName='" + driverName + '\'' +
|
||||||
|
", driverTel='" + driverTel + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
public class TaxiServerModel {
|
||||||
|
private String action;
|
||||||
|
private String server;
|
||||||
|
private String tlsServer;
|
||||||
|
|
||||||
|
public String getAction() {
|
||||||
|
return action;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAction(String action) {
|
||||||
|
this.action = action;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getServer() {
|
||||||
|
return server;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setServer(String server) {
|
||||||
|
this.server = server;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTlsServer() {
|
||||||
|
return tlsServer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTlsServer(String tlsServer) {
|
||||||
|
this.tlsServer = tlsServer;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,556 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class TestEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* type : commandXixunPlayer
|
||||||
|
* command : {"_type":"PlayXixunTask","id":123,"task":{"_id":123,"name":"emergency","_department":null,"items":[{"_id":123,"_program":{"_id":"test","totalSize":0,"name":"应急节目","width":1280,"height":800,"_company":null,"_department":null,"_role":null,"_user":null,"__v":0,"layers":[{"repeat":true,"sources":[{"id":"","name":"text-program","sInterval":0,"sUrl":"","exitEffectTimeSpan":0,"entryEffectTimeSpan":0,"exitEffect":"None","entryEffect":"None","height":750,"width":1280,"top":50,"left":0,"playTime":0,"timeSpan":100000,"html":"<p style=\"font-size: 60px;\"> <\/p>","center":false,"lineHeight":1.4,"speed":10,"_type":"MultiLineText","backgroundColor":"rgba(0,0,0,1)"}]}],"dateCreated":"2020-5-29 09:55:12"},"priority":1,"repeatTimes":10,"version":0,"schedules":[]}],"executeDate":null,"cmdId":123}}
|
||||||
|
*/
|
||||||
|
|
||||||
|
private String type;
|
||||||
|
private CommandBean command;
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CommandBean getCommand() {
|
||||||
|
return command;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCommand(CommandBean command) {
|
||||||
|
this.command = command;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class CommandBean {
|
||||||
|
/**
|
||||||
|
* _type : PlayXixunTask
|
||||||
|
* id : 123
|
||||||
|
* task : {"_id":123,"name":"emergency","_department":null,"items":[{"_id":123,"_program":{"_id":"test","totalSize":0,"name":"应急节目","width":1280,"height":800,"_company":null,"_department":null,"_role":null,"_user":null,"__v":0,"layers":[{"repeat":true,"sources":[{"id":"","name":"text-program","sInterval":0,"sUrl":"","exitEffectTimeSpan":0,"entryEffectTimeSpan":0,"exitEffect":"None","entryEffect":"None","height":750,"width":1280,"top":50,"left":0,"playTime":0,"timeSpan":100000,"html":"<p style=\"font-size: 60px;\"> <\/p>","center":false,"lineHeight":1.4,"speed":10,"_type":"MultiLineText","backgroundColor":"rgba(0,0,0,1)"}]}],"dateCreated":"2020-5-29 09:55:12"},"priority":1,"repeatTimes":10,"version":0,"schedules":[]}],"executeDate":null,"cmdId":123}
|
||||||
|
*/
|
||||||
|
|
||||||
|
private String _type;
|
||||||
|
private int id;
|
||||||
|
private TaskBean task;
|
||||||
|
|
||||||
|
public String get_type() {
|
||||||
|
return _type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set_type(String _type) {
|
||||||
|
this._type = _type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TaskBean getTask() {
|
||||||
|
return task;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTask(TaskBean task) {
|
||||||
|
this.task = task;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class TaskBean {
|
||||||
|
/**
|
||||||
|
* _id : 123
|
||||||
|
* name : emergency
|
||||||
|
* _department : null
|
||||||
|
* items : [{"_id":123,"_program":{"_id":"test","totalSize":0,"name":"应急节目","width":1280,"height":800,"_company":null,"_department":null,"_role":null,"_user":null,"__v":0,"layers":[{"repeat":true,"sources":[{"id":"","name":"text-program","sInterval":0,"sUrl":"","exitEffectTimeSpan":0,"entryEffectTimeSpan":0,"exitEffect":"None","entryEffect":"None","height":750,"width":1280,"top":50,"left":0,"playTime":0,"timeSpan":100000,"html":"<p style=\"font-size: 60px;\"> <\/p>","center":false,"lineHeight":1.4,"speed":10,"_type":"MultiLineText","backgroundColor":"rgba(0,0,0,1)"}]}],"dateCreated":"2020-5-29 09:55:12"},"priority":1,"repeatTimes":10,"version":0,"schedules":[]}]
|
||||||
|
* executeDate : null
|
||||||
|
* cmdId : 123
|
||||||
|
*/
|
||||||
|
|
||||||
|
private int _id;
|
||||||
|
private String name;
|
||||||
|
private Object _department;
|
||||||
|
private Object executeDate;
|
||||||
|
private int cmdId;
|
||||||
|
private List<ItemsBean> items;
|
||||||
|
|
||||||
|
public int get_id() {
|
||||||
|
return _id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set_id(int _id) {
|
||||||
|
this._id = _id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object get_department() {
|
||||||
|
return _department;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set_department(Object _department) {
|
||||||
|
this._department = _department;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getExecuteDate() {
|
||||||
|
return executeDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExecuteDate(Object executeDate) {
|
||||||
|
this.executeDate = executeDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCmdId() {
|
||||||
|
return cmdId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmdId(int cmdId) {
|
||||||
|
this.cmdId = cmdId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ItemsBean> getItems() {
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setItems(List<ItemsBean> items) {
|
||||||
|
this.items = items;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ItemsBean {
|
||||||
|
/**
|
||||||
|
* _id : 123
|
||||||
|
* _program : {"_id":"test","totalSize":0,"name":"应急节目","width":1280,"height":800,"_company":null,"_department":null,"_role":null,"_user":null,"__v":0,"layers":[{"repeat":true,"sources":[{"id":"","name":"text-program","sInterval":0,"sUrl":"","exitEffectTimeSpan":0,"entryEffectTimeSpan":0,"exitEffect":"None","entryEffect":"None","height":750,"width":1280,"top":50,"left":0,"playTime":0,"timeSpan":100000,"html":"<p style=\"font-size: 60px;\"> <\/p>","center":false,"lineHeight":1.4,"speed":10,"_type":"MultiLineText","backgroundColor":"rgba(0,0,0,1)"}]}],"dateCreated":"2020-5-29 09:55:12"}
|
||||||
|
* priority : 1
|
||||||
|
* repeatTimes : 10
|
||||||
|
* version : 0
|
||||||
|
* schedules : []
|
||||||
|
*/
|
||||||
|
|
||||||
|
private int _id;
|
||||||
|
private ProgramBean _program;
|
||||||
|
private int priority;
|
||||||
|
private int repeatTimes;
|
||||||
|
private int version;
|
||||||
|
private List<?> schedules;
|
||||||
|
|
||||||
|
public int get_id() {
|
||||||
|
return _id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set_id(int _id) {
|
||||||
|
this._id = _id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProgramBean get_program() {
|
||||||
|
return _program;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set_program(ProgramBean _program) {
|
||||||
|
this._program = _program;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPriority() {
|
||||||
|
return priority;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPriority(int priority) {
|
||||||
|
this.priority = priority;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRepeatTimes() {
|
||||||
|
return repeatTimes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRepeatTimes(int repeatTimes) {
|
||||||
|
this.repeatTimes = repeatTimes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getVersion() {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVersion(int version) {
|
||||||
|
this.version = version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<?> getSchedules() {
|
||||||
|
return schedules;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSchedules(List<?> schedules) {
|
||||||
|
this.schedules = schedules;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ProgramBean {
|
||||||
|
/**
|
||||||
|
* _id : test
|
||||||
|
* totalSize : 0
|
||||||
|
* name : 应急节目
|
||||||
|
* width : 1280
|
||||||
|
* height : 800
|
||||||
|
* _company : null
|
||||||
|
* _department : null
|
||||||
|
* _role : null
|
||||||
|
* _user : null
|
||||||
|
* __v : 0
|
||||||
|
* layers : [{"repeat":true,"sources":[{"id":"","name":"text-program","sInterval":0,"sUrl":"","exitEffectTimeSpan":0,"entryEffectTimeSpan":0,"exitEffect":"None","entryEffect":"None","height":750,"width":1280,"top":50,"left":0,"playTime":0,"timeSpan":100000,"html":"<p style=\"font-size: 60px;\"> <\/p>","center":false,"lineHeight":1.4,"speed":10,"_type":"MultiLineText","backgroundColor":"rgba(0,0,0,1)"}]}]
|
||||||
|
* dateCreated : 2020-5-29 09:55:12
|
||||||
|
*/
|
||||||
|
|
||||||
|
private String _id;
|
||||||
|
private int totalSize;
|
||||||
|
private String name;
|
||||||
|
private int width;
|
||||||
|
private int height;
|
||||||
|
private Object _company;
|
||||||
|
private Object _department;
|
||||||
|
private Object _role;
|
||||||
|
private Object _user;
|
||||||
|
private int __v;
|
||||||
|
private String dateCreated;
|
||||||
|
private List<LayersBean> layers;
|
||||||
|
|
||||||
|
public String get_id() {
|
||||||
|
return _id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set_id(String _id) {
|
||||||
|
this._id = _id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTotalSize() {
|
||||||
|
return totalSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTotalSize(int totalSize) {
|
||||||
|
this.totalSize = totalSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getWidth() {
|
||||||
|
return width;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWidth(int width) {
|
||||||
|
this.width = width;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHeight() {
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeight(int height) {
|
||||||
|
this.height = height;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object get_company() {
|
||||||
|
return _company;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set_company(Object _company) {
|
||||||
|
this._company = _company;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object get_department() {
|
||||||
|
return _department;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set_department(Object _department) {
|
||||||
|
this._department = _department;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object get_role() {
|
||||||
|
return _role;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set_role(Object _role) {
|
||||||
|
this._role = _role;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object get_user() {
|
||||||
|
return _user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set_user(Object _user) {
|
||||||
|
this._user = _user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int get__v() {
|
||||||
|
return __v;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set__v(int __v) {
|
||||||
|
this.__v = __v;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDateCreated() {
|
||||||
|
return dateCreated;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDateCreated(String dateCreated) {
|
||||||
|
this.dateCreated = dateCreated;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<LayersBean> getLayers() {
|
||||||
|
return layers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLayers(List<LayersBean> layers) {
|
||||||
|
this.layers = layers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class LayersBean {
|
||||||
|
/**
|
||||||
|
* repeat : true
|
||||||
|
* sources : [{"id":"","name":"text-program","sInterval":0,"sUrl":"","exitEffectTimeSpan":0,"entryEffectTimeSpan":0,"exitEffect":"None","entryEffect":"None","height":750,"width":1280,"top":50,"left":0,"playTime":0,"timeSpan":100000,"html":"<p style=\"font-size: 60px;\"> <\/p>","center":false,"lineHeight":1.4,"speed":10,"_type":"MultiLineText","backgroundColor":"rgba(0,0,0,1)"}]
|
||||||
|
*/
|
||||||
|
|
||||||
|
private boolean repeat;
|
||||||
|
private List<SourcesBean> sources;
|
||||||
|
|
||||||
|
public boolean isRepeat() {
|
||||||
|
return repeat;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRepeat(boolean repeat) {
|
||||||
|
this.repeat = repeat;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<SourcesBean> getSources() {
|
||||||
|
return sources;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSources(List<SourcesBean> sources) {
|
||||||
|
this.sources = sources;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class SourcesBean {
|
||||||
|
/**
|
||||||
|
* id :
|
||||||
|
* name : text-program
|
||||||
|
* sInterval : 0
|
||||||
|
* sUrl :
|
||||||
|
* exitEffectTimeSpan : 0
|
||||||
|
* entryEffectTimeSpan : 0
|
||||||
|
* exitEffect : None
|
||||||
|
* entryEffect : None
|
||||||
|
* height : 750
|
||||||
|
* width : 1280
|
||||||
|
* top : 50
|
||||||
|
* left : 0
|
||||||
|
* playTime : 0
|
||||||
|
* timeSpan : 100000
|
||||||
|
* html : <p style="font-size: 60px;"> </p>
|
||||||
|
* center : false
|
||||||
|
* lineHeight : 1.4
|
||||||
|
* speed : 10
|
||||||
|
* _type : MultiLineText
|
||||||
|
* backgroundColor : rgba(0,0,0,1)
|
||||||
|
*/
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
private String name;
|
||||||
|
private int sInterval;
|
||||||
|
private String sUrl;
|
||||||
|
private int exitEffectTimeSpan;
|
||||||
|
private int entryEffectTimeSpan;
|
||||||
|
private String exitEffect;
|
||||||
|
private String entryEffect;
|
||||||
|
private int height;
|
||||||
|
private int width;
|
||||||
|
private int top;
|
||||||
|
private int left;
|
||||||
|
private int playTime;
|
||||||
|
private int timeSpan;
|
||||||
|
private String html;
|
||||||
|
private boolean center;
|
||||||
|
private double lineHeight;
|
||||||
|
private int speed;
|
||||||
|
private String _type;
|
||||||
|
private String backgroundColor;
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSInterval() {
|
||||||
|
return sInterval;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSInterval(int sInterval) {
|
||||||
|
this.sInterval = sInterval;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSUrl() {
|
||||||
|
return sUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSUrl(String sUrl) {
|
||||||
|
this.sUrl = sUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getExitEffectTimeSpan() {
|
||||||
|
return exitEffectTimeSpan;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExitEffectTimeSpan(int exitEffectTimeSpan) {
|
||||||
|
this.exitEffectTimeSpan = exitEffectTimeSpan;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getEntryEffectTimeSpan() {
|
||||||
|
return entryEffectTimeSpan;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEntryEffectTimeSpan(int entryEffectTimeSpan) {
|
||||||
|
this.entryEffectTimeSpan = entryEffectTimeSpan;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getExitEffect() {
|
||||||
|
return exitEffect;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExitEffect(String exitEffect) {
|
||||||
|
this.exitEffect = exitEffect;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEntryEffect() {
|
||||||
|
return entryEffect;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEntryEffect(String entryEffect) {
|
||||||
|
this.entryEffect = entryEffect;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHeight() {
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeight(int height) {
|
||||||
|
this.height = height;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getWidth() {
|
||||||
|
return width;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWidth(int width) {
|
||||||
|
this.width = width;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTop() {
|
||||||
|
return top;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTop(int top) {
|
||||||
|
this.top = top;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLeft() {
|
||||||
|
return left;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLeft(int left) {
|
||||||
|
this.left = left;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPlayTime() {
|
||||||
|
return playTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlayTime(int playTime) {
|
||||||
|
this.playTime = playTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTimeSpan() {
|
||||||
|
return timeSpan;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTimeSpan(int timeSpan) {
|
||||||
|
this.timeSpan = timeSpan;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHtml() {
|
||||||
|
return html;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHtml(String html) {
|
||||||
|
this.html = html;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCenter() {
|
||||||
|
return center;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCenter(boolean center) {
|
||||||
|
this.center = center;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getLineHeight() {
|
||||||
|
return lineHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLineHeight(double lineHeight) {
|
||||||
|
this.lineHeight = lineHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSpeed() {
|
||||||
|
return speed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSpeed(int speed) {
|
||||||
|
this.speed = speed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String get_type() {
|
||||||
|
return _type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set_type(String _type) {
|
||||||
|
this._type = _type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBackgroundColor() {
|
||||||
|
return backgroundColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBackgroundColor(String backgroundColor) {
|
||||||
|
this.backgroundColor = backgroundColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,192 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
import org.greenrobot.greendao.annotation.Entity;
|
||||||
|
import org.greenrobot.greendao.annotation.Generated;
|
||||||
|
import org.greenrobot.greendao.annotation.Id;
|
||||||
|
import org.greenrobot.greendao.annotation.NotNull;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
public class TextInfo implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
@Id(autoincrement = true) private Long id;
|
||||||
|
@NotNull private String text;
|
||||||
|
private int size;
|
||||||
|
private String color;
|
||||||
|
private String backgroundColor;
|
||||||
|
private int drawableId;
|
||||||
|
private int stoke;
|
||||||
|
private String stokeColor;
|
||||||
|
private int effect;
|
||||||
|
private String fontName;
|
||||||
|
private float letterSpacing;
|
||||||
|
private float lineSpacing;
|
||||||
|
|
||||||
|
public TextInfo(String text) {
|
||||||
|
this.text = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TextInfo(String text, FontEffect effect) {
|
||||||
|
this.text = text;
|
||||||
|
this.effect = effect.ordinal();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated(hash = 781783440)
|
||||||
|
public TextInfo(Long id, @NotNull String text, int size, String color, String backgroundColor, int drawableId,
|
||||||
|
int stoke, String stokeColor, int effect, String fontName, float letterSpacing, float lineSpacing) {
|
||||||
|
this.id = id;
|
||||||
|
this.text = text;
|
||||||
|
this.size = size;
|
||||||
|
this.color = color;
|
||||||
|
this.backgroundColor = backgroundColor;
|
||||||
|
this.drawableId = drawableId;
|
||||||
|
this.stoke = stoke;
|
||||||
|
this.stokeColor = stokeColor;
|
||||||
|
this.effect = effect;
|
||||||
|
this.fontName = fontName;
|
||||||
|
this.letterSpacing = letterSpacing;
|
||||||
|
this.lineSpacing = lineSpacing;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated(hash = 2123665448)
|
||||||
|
public TextInfo() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isBihuMultiline() {
|
||||||
|
return getText().contains("\n");
|
||||||
|
// int length = TextUtils.getLength(getText());
|
||||||
|
// length -= (getText().split("\n").length - 1);
|
||||||
|
// return (FontEffect.findEffectByValue(getEffect()) != FontEffect.SCROLL_LEFT) && (length >= 6 && length <= 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getText() {
|
||||||
|
return this.text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setText(String text) {
|
||||||
|
this.text = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSize() {
|
||||||
|
return this.size;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSize(int size) {
|
||||||
|
this.size = size;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getColor() {
|
||||||
|
return this.color;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColor(String color) {
|
||||||
|
this.color = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBackgroundColor() {
|
||||||
|
return this.backgroundColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBackgroundColor(String backgroundColor) {
|
||||||
|
this.backgroundColor = backgroundColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDrawableId() {
|
||||||
|
return this.drawableId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDrawableId(int drawableId) {
|
||||||
|
this.drawableId = drawableId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getStoke() {
|
||||||
|
return this.stoke;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStoke(int stoke) {
|
||||||
|
this.stoke = stoke;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStokeColor() {
|
||||||
|
return this.stokeColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStokeColor(String stokeColor) {
|
||||||
|
this.stokeColor = stokeColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getEffect() {
|
||||||
|
return this.effect;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEffect(int effect) {
|
||||||
|
this.effect = effect;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFontName() {
|
||||||
|
return this.fontName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFontName(String fontName) {
|
||||||
|
this.fontName = fontName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getLetterSpacing() {
|
||||||
|
return this.letterSpacing;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLetterSpacing(float letterSpacing) {
|
||||||
|
this.letterSpacing = letterSpacing;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getLineSpacing() {
|
||||||
|
return this.lineSpacing;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLineSpacing(float lineSpacing) {
|
||||||
|
this.lineSpacing = lineSpacing;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum FontEffect {
|
||||||
|
NORMAL,
|
||||||
|
SCROLL_LEFT;
|
||||||
|
|
||||||
|
public static FontEffect findEffectByValue(int value) {
|
||||||
|
for (FontEffect effect : FontEffect.values()) {
|
||||||
|
if (value == effect.ordinal()) {
|
||||||
|
return effect;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NORMAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum ScreenMode {
|
||||||
|
NORMAL,
|
||||||
|
// 单屏
|
||||||
|
SINGLE,
|
||||||
|
// 滚屏
|
||||||
|
SCROLL,
|
||||||
|
// 双屏
|
||||||
|
DOUBLE;
|
||||||
|
|
||||||
|
public static ScreenMode findModeByValue(int value) {
|
||||||
|
for (ScreenMode mode : ScreenMode.values()) {
|
||||||
|
if (value == mode.ordinal()) {
|
||||||
|
return mode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NORMAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,65 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.model;
|
||||||
|
|
||||||
|
import org.greenrobot.greendao.annotation.Entity;
|
||||||
|
import org.greenrobot.greendao.annotation.Id;
|
||||||
|
import org.greenrobot.greendao.annotation.Generated;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
public class TimeSpan {
|
||||||
|
@Id(autoincrement = true)
|
||||||
|
private Long id;
|
||||||
|
private String advertiseId;
|
||||||
|
private long date_start;
|
||||||
|
private long date_end;
|
||||||
|
private long day_start;
|
||||||
|
private long day_end;
|
||||||
|
@Generated(hash = 621861312)
|
||||||
|
public TimeSpan(Long id, String advertiseId, long date_start, long date_end,
|
||||||
|
long day_start, long day_end) {
|
||||||
|
this.id = id;
|
||||||
|
this.advertiseId = advertiseId;
|
||||||
|
this.date_start = date_start;
|
||||||
|
this.date_end = date_end;
|
||||||
|
this.day_start = day_start;
|
||||||
|
this.day_end = day_end;
|
||||||
|
}
|
||||||
|
@Generated(hash = 208601253)
|
||||||
|
public TimeSpan() {
|
||||||
|
}
|
||||||
|
public Long getId() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
public String getAdvertiseId() {
|
||||||
|
return this.advertiseId;
|
||||||
|
}
|
||||||
|
public void setAdvertiseId(String advertiseId) {
|
||||||
|
this.advertiseId = advertiseId;
|
||||||
|
}
|
||||||
|
public long getDate_start() {
|
||||||
|
return this.date_start;
|
||||||
|
}
|
||||||
|
public void setDate_start(long date_start) {
|
||||||
|
this.date_start = date_start;
|
||||||
|
}
|
||||||
|
public long getDate_end() {
|
||||||
|
return this.date_end;
|
||||||
|
}
|
||||||
|
public void setDate_end(long date_end) {
|
||||||
|
this.date_end = date_end;
|
||||||
|
}
|
||||||
|
public long getDay_start() {
|
||||||
|
return this.day_start;
|
||||||
|
}
|
||||||
|
public void setDay_start(long day_start) {
|
||||||
|
this.day_start = day_start;
|
||||||
|
}
|
||||||
|
public long getDay_end() {
|
||||||
|
return this.day_end;
|
||||||
|
}
|
||||||
|
public void setDay_end(long day_end) {
|
||||||
|
this.day_end = day_end;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.network
|
||||||
|
|
||||||
|
interface BusInfoDownLoadCallback {
|
||||||
|
fun busInfoDownLoaded()
|
||||||
|
}
|
|
@ -0,0 +1,590 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.network
|
||||||
|
|
||||||
|
import android.os.Looper
|
||||||
|
import android.os.RemoteException
|
||||||
|
import cn.trans88.kurotool.net.rx.BaseObserver
|
||||||
|
import cn.trans88.kurotool.net.rx.RxRestClient
|
||||||
|
import cn.trans88.kurotool.util.ThreadUtil
|
||||||
|
import cn.trans88.taxiappkotlin.Configurations
|
||||||
|
import cn.trans88.taxiappkotlin.TaxiApp
|
||||||
|
import cn.trans88.taxiappkotlin.logic.dao.DaoUtil
|
||||||
|
import cn.trans88.taxiappkotlin.logic.model.*
|
||||||
|
import cn.trans88.taxiappkotlin.play.RefreshPlayer
|
||||||
|
import cn.trans88.taxiappkotlin.util.KuroTimer
|
||||||
|
import cn.trans88.taxiappkotlin.util.KuroTimerTask
|
||||||
|
import cn.trans88.taxiappkotlin.util.YoungUtil
|
||||||
|
import cn.trans88.taxiappkotlin.util.checkAppToken
|
||||||
|
import cn.trans88.taxiappkotlin.xixunUtil.Xixun
|
||||||
|
import com.amused.joey.DelayTimer
|
||||||
|
import com.google.gson.Gson
|
||||||
|
import com.trs88.kurolibrary.execute.KuroExecutor
|
||||||
|
import com.trs88.kurolibrary.file.KuroFileUtil
|
||||||
|
import com.trs88.kurolibrary.file.PostFileCallBack
|
||||||
|
import com.xixun.xy.conn.aidl.ConnService
|
||||||
|
import net.sysolution.taxiapp.ITaxiListener
|
||||||
|
import okhttp3.*
|
||||||
|
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
||||||
|
import okhttp3.RequestBody.Companion.asRequestBody
|
||||||
|
import java.io.File
|
||||||
|
import java.io.IOException
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TRS
|
||||||
|
* @deprecated 处理各种网络请求连接
|
||||||
|
*/
|
||||||
|
object ConnManger {
|
||||||
|
// private val handler =Handler()
|
||||||
|
|
||||||
|
@Volatile
|
||||||
|
var isRegisterSuccess = false
|
||||||
|
|
||||||
|
// val BaseUrl ="http://ledok.cn:2346/"
|
||||||
|
// val BaseUrl ="http://taxihub.cn:2346/"
|
||||||
|
private var connService: ConnService? = null
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册App
|
||||||
|
*/
|
||||||
|
fun registerApp() {
|
||||||
|
KuroExecutor.execute(Runnable {
|
||||||
|
YoungUtil.YoungLog("registerApp")
|
||||||
|
var baseUrl = ""
|
||||||
|
//如果已经注册成功就不再注册
|
||||||
|
if (isRegisterSuccess) {
|
||||||
|
return@Runnable
|
||||||
|
}
|
||||||
|
|
||||||
|
YoungUtil.YoungLog("开始注册 TID:${Thread.currentThread().id},当前baseUrl: ${Configurations.config(TaxiApp.instance()).taxiBaseUrl()}")
|
||||||
|
|
||||||
|
val registerRequest = RegisterRequest()
|
||||||
|
|
||||||
|
if (TaxiApp.isTest) {
|
||||||
|
registerRequest.card_id = "y60-a20-40919"
|
||||||
|
} else {
|
||||||
|
val cardId = Xixun.getCardId()
|
||||||
|
registerRequest.card_id = cardId
|
||||||
|
//Settings.cardId = cardId
|
||||||
|
Configurations.config(TaxiApp.instance()).cardIdSave(cardId)
|
||||||
|
}
|
||||||
|
/* edit by yzd @ 20211201
|
||||||
|
baseUrl = if (Settings.taxiBaseUrl.contains("http") || Settings.taxiBaseUrl.contains("https")) {
|
||||||
|
Settings.taxiBaseUrl
|
||||||
|
} else {
|
||||||
|
YoungUtil.YoungLog("凭证不合法:赋值http://taxihub.cn:2346/")
|
||||||
|
"http://taxihub.cn:2346/"
|
||||||
|
}*/
|
||||||
|
val tu = Configurations.config(TaxiApp.instance()).taxiBaseUrl();
|
||||||
|
baseUrl = if (tu.contains("http") || tu.contains("https")) {
|
||||||
|
tu
|
||||||
|
} else {
|
||||||
|
YoungUtil.YoungLog("凭证不合法:赋值http://taxihub.cn:2346/")
|
||||||
|
"http://taxihub.cn:2346/"
|
||||||
|
}
|
||||||
|
|
||||||
|
val gson = Gson()
|
||||||
|
val requestJson = gson.toJson(registerRequest)
|
||||||
|
val parse = ("application/json;charset=UTF-8").toMediaTypeOrNull()
|
||||||
|
val body = RequestBody.create(parse, requestJson)
|
||||||
|
val client = RxRestClient.builder().baseUrl("${baseUrl}v1/cms/taxi/").useInterceptor(true).build()
|
||||||
|
|
||||||
|
client.setURL("register")
|
||||||
|
// .setBaseUrl("${Settings.taxiBaseUrl}v1/cms/taxi/")
|
||||||
|
.setBaseUrl("${baseUrl}v1/cms/taxi/")
|
||||||
|
.setBody(body)
|
||||||
|
.setHeader("Authorization", "Bearer ${Configurations.config(TaxiApp.instance()).registerToken()}")
|
||||||
|
// .setHeader("IsFirstRegister",TaxiApp.isFirstRegister.toString())
|
||||||
|
.setHeader("IsFirstRegister", Configurations.config(TaxiApp.instance()).isFirstRegister().toString())
|
||||||
|
//todo 如果解析的对象的属性有为空的赋值比如之前的upload_debug_file_url暂时还没有数据,会抛出解析错误异常
|
||||||
|
.post(object : BaseObserver<RegisterResponse>() {
|
||||||
|
override fun onGot(registerResponse: RegisterResponse) {
|
||||||
|
DelayTimer.cancel { registerApp() }
|
||||||
|
// TaxiApp.isFirstRegister =false
|
||||||
|
|
||||||
|
isRegisterSuccess = true
|
||||||
|
|
||||||
|
//Settings.isFirstRegister = false
|
||||||
|
Configurations.config(TaxiApp.instance()).isFirstRegisterSave(false);
|
||||||
|
|
||||||
|
YoungUtil.YoungLog("注册请求成功${registerResponse}")
|
||||||
|
//Settings.appToken = registerResponse.token
|
||||||
|
Configurations.config(TaxiApp.instance()).appTokenSave(registerResponse.token)
|
||||||
|
//Settings.taxiServiceUrl = registerResponse.taxi_service_url
|
||||||
|
Configurations.config(TaxiApp.instance()).taxiServiceUrlSave(registerResponse.taxi_service_url)
|
||||||
|
//Settings.logServiceUrl = registerResponse.log_service_url
|
||||||
|
Configurations.config(TaxiApp.instance()).logServiceUrlSave(registerResponse.log_service_url)
|
||||||
|
//Settings.downloadUrl = "${registerResponse.media_download_url}?id="
|
||||||
|
Configurations.config(TaxiApp.instance()).downloadUrlSave("${registerResponse.media_download_url}?id=")
|
||||||
|
//Settings.upload_debug_file_url = registerResponse.upload_debug_file_url
|
||||||
|
Configurations.config(TaxiApp.instance()).upload_debug_file_urlSave(registerResponse.upload_debug_file_url);
|
||||||
|
|
||||||
|
//注册时获得该账号的车辆信息
|
||||||
|
val taxiInfo = TaxiInfo()
|
||||||
|
taxiInfo.action = ""
|
||||||
|
taxiInfo.driverName = registerResponse.driver_name
|
||||||
|
taxiInfo.driverTel = registerResponse.driver_tel
|
||||||
|
taxiInfo.licensePlateNumber = registerResponse.licence
|
||||||
|
taxiInfo.taxiPictureUrl = ""
|
||||||
|
val toJson = gson.toJson(taxiInfo)
|
||||||
|
//Settings.taxiInfo = toJson
|
||||||
|
Configurations.config(TaxiApp.instance()).taxiInfoSave(toJson)
|
||||||
|
|
||||||
|
sendLogger()
|
||||||
|
sendLocation()
|
||||||
|
|
||||||
|
WsManager.initWebSocket()
|
||||||
|
|
||||||
|
// Settings.toJson()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onFailed(msg: String?) {
|
||||||
|
YoungUtil.YoungLog("注册失败,重新开始注册:$msg")
|
||||||
|
isRegisterSuccess = false
|
||||||
|
// val timer = Timer()
|
||||||
|
DelayTimer.timer({ registerApp() }, 4000)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
// if (isRegisterSuccess){
|
||||||
|
// DelayTimer.cancel(runnable)
|
||||||
|
// }else{
|
||||||
|
// DelayTimer.timer(runnable, 4000)
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setConnService(connService: ConnService?) {
|
||||||
|
YoungUtil.YoungLog("设置connService")
|
||||||
|
this.connService = connService
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送车辆信息
|
||||||
|
*/
|
||||||
|
fun sendTaxiInfo(taxiInfo: TaxiInfo) {
|
||||||
|
// val client = RxRestClient.builder().baseUrl("${Settings.taxiBaseUrl}v1/cms/taxi/").useInterceptor(true).build()
|
||||||
|
val client = RxRestClient.builder().baseUrl("http://taxihub.cn:2346/v1/cms/taxi/").useInterceptor(true).build()
|
||||||
|
// taxiInfo.action="SendTaxiInfo"
|
||||||
|
val gson = Gson()
|
||||||
|
val taxiInfoJson = gson.toJson(taxiInfo)
|
||||||
|
val parse = ("application/json;charset=UTF-8").toMediaTypeOrNull()
|
||||||
|
val body = RequestBody.create(parse, taxiInfoJson)
|
||||||
|
|
||||||
|
client.setURL("updateTaxiInfo")
|
||||||
|
.setBody(body)
|
||||||
|
.setHeader("Authorization", "Bearer ${Configurations.config(TaxiApp.instance()).registerToken()}")
|
||||||
|
.setHeader("Card_ID", Xixun.getCardId())
|
||||||
|
.post(object : BaseObserver<SendTaxiInfoResponse>() {
|
||||||
|
override fun onGot(sendTaxiInfoResponse: SendTaxiInfoResponse) {
|
||||||
|
DelayTimer.cancel { sendTaxiInfo(taxiInfo) }
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onFailed(msg: String?) {
|
||||||
|
YoungUtil.YoungLog("发送车辆信息失败,重新发送:$msg")
|
||||||
|
DelayTimer.timer({ sendTaxiInfo(taxiInfo) }, 8000)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送坐标
|
||||||
|
*/
|
||||||
|
fun sendLocation() {
|
||||||
|
KuroExecutor.execute(Runnable {
|
||||||
|
YoungUtil.YoungLog("sendLocation in MainThread is ${Looper.getMainLooper().thread === Thread.currentThread()}")
|
||||||
|
//todo 如果这里突然有大量的信息序列化是不是同样会内存溢出
|
||||||
|
val locations = DaoUtil.getLocations()
|
||||||
|
// for (location in locations) {
|
||||||
|
// if (TimeUtil.isExpiredTime(location.timestamp,3)){
|
||||||
|
// YoungUtil.YoungLog("sendLocation 存在超过7天的日志,清除:${location.id}")
|
||||||
|
// DaoUtil.getLocationDao().delete(location)
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (locations.isNotEmpty()) {
|
||||||
|
val requestJson: String = if (locations.size < 20) {
|
||||||
|
ProcessingCommands.gson.toJson(locations)
|
||||||
|
} else {
|
||||||
|
ProcessingCommands.gson.toJson(locations.subList(0, 19))
|
||||||
|
}
|
||||||
|
|
||||||
|
val parse = ("application/json;charset=UTF-8").toMediaTypeOrNull()
|
||||||
|
val body = RequestBody.create(parse, requestJson)
|
||||||
|
|
||||||
|
val okHttpClient = OkHttpClient()
|
||||||
|
//YoungUtil.YoungLog("准备上传坐标,上传地址:${SaveSimpleData.getLogServiceUrl()}")
|
||||||
|
YoungUtil.YoungLog("准备上传坐标")
|
||||||
|
YoungUtil.YoungLog("sendLocation:${requestJson}")
|
||||||
|
val request: Request = Request.Builder()
|
||||||
|
.url(Configurations.config(TaxiApp.instance()).logServiceUrl() + "postGpsLocationLog") //要访问的链接
|
||||||
|
.addHeader("Authorization", "Bearer ${Configurations.config(TaxiApp.instance()).appToken()}")
|
||||||
|
.post(body)
|
||||||
|
.build()
|
||||||
|
val call = okHttpClient.newCall(request)
|
||||||
|
call.enqueue(object : Callback {
|
||||||
|
override fun onFailure(call: Call, e: IOException) {
|
||||||
|
YoungUtil.YoungLog("上传坐标失败:${e.message}")
|
||||||
|
DaoUtil.getLocationDao().deleteAll()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onResponse(call: Call, response: Response) {
|
||||||
|
YoungUtil.YoungLog("上传坐标成功:${response.message},response is Sussceful ${response.isSuccessful}${response.code}")
|
||||||
|
if (response.code == 200) {
|
||||||
|
if (locations.size < 20) {
|
||||||
|
DaoUtil.getLocationDao().deleteAll()
|
||||||
|
} else {
|
||||||
|
for (index in 0..19) {
|
||||||
|
DaoUtil.getLocationDao().delete(locations[index])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
//edit by yzd @20211201
|
||||||
|
//if (Settings.gpsSwitch) {
|
||||||
|
if (Configurations.config(TaxiApp.instance()).gpsSwitch()) {
|
||||||
|
val timer = KuroTimer()
|
||||||
|
timer.schedule(object : KuroTimerTask() {
|
||||||
|
override fun run() {
|
||||||
|
sendLocation()
|
||||||
|
}
|
||||||
|
|
||||||
|
}, 10000)
|
||||||
|
} else {
|
||||||
|
val timer = KuroTimer()
|
||||||
|
timer.schedule(object : KuroTimerTask() {
|
||||||
|
override fun run() {
|
||||||
|
sendLocation()
|
||||||
|
}
|
||||||
|
|
||||||
|
}, 60 * 60 * 1000)
|
||||||
|
}
|
||||||
|
|
||||||
|
// DelayTimer.timer({ sendLocation() }, 10000)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送播放日志
|
||||||
|
*/
|
||||||
|
fun sendLogger() {
|
||||||
|
//edit by yzd @20211201
|
||||||
|
//if (Settings.loggerSwitch) {
|
||||||
|
if (Configurations.config(TaxiApp.instance()).loggerSwitch()) {
|
||||||
|
ThreadUtil.executeByPool(Runnable {
|
||||||
|
YoungUtil.YoungLog("sendLogger in Thread is ${Looper.getMainLooper().thread === Thread.currentThread()}")
|
||||||
|
val playLoggers = DaoUtil.getPlayLoggers()
|
||||||
|
// for (playLogger in playLoggers) {
|
||||||
|
// if (TimeUtil.isExpiredTime(playLogger.created_at,3)){
|
||||||
|
// YoungUtil.YoungLog("sendLogger 存在超过7天的日志,清除:${playLogger.ad_id}")
|
||||||
|
// DaoUtil.getPlayLogger().delete(playLogger)
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
if (playLoggers.isNotEmpty()) {
|
||||||
|
val requestJson: String = if (playLoggers.size < 20) {
|
||||||
|
ProcessingCommands.gson.toJson(playLoggers)
|
||||||
|
} else {
|
||||||
|
ProcessingCommands.gson.toJson(playLoggers.subList(0, 19))
|
||||||
|
}
|
||||||
|
|
||||||
|
val okHttpClient = OkHttpClient()
|
||||||
|
YoungUtil.YoungLog("准备上传日志")
|
||||||
|
val parse = ("application/json;charset=UTF-8").toMediaTypeOrNull()
|
||||||
|
val body = RequestBody.create(parse, requestJson)
|
||||||
|
YoungUtil.YoungLog("sendLogger:${requestJson}")
|
||||||
|
val request: Request = Request.Builder()
|
||||||
|
.url(Configurations.config(TaxiApp.instance()).logServiceUrl() + "postPlayerLog") //要访问的链接
|
||||||
|
.addHeader("Authorization", "Bearer ${Configurations.config(TaxiApp.instance()).appToken()}")
|
||||||
|
.addHeader("Accept-Encoding", "gzip")
|
||||||
|
.post(body)
|
||||||
|
.build()
|
||||||
|
val call = okHttpClient.newCall(request)
|
||||||
|
call.enqueue(object : Callback {
|
||||||
|
override fun onFailure(call: Call, e: IOException) {
|
||||||
|
YoungUtil.YoungLog("上传日志失败:${e.message}")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onResponse(call: Call, response: Response) {
|
||||||
|
YoungUtil.YoungLog("上传日志成功:${response.message},response isSuccessful ${response.isSuccessful}${response.code}")
|
||||||
|
if (response.code == 200) {
|
||||||
|
if (playLoggers.size < 20) {
|
||||||
|
DaoUtil.getPlayLogger().deleteAll()
|
||||||
|
} else {
|
||||||
|
for (index in 0..19) {
|
||||||
|
DaoUtil.getPlayLogger().delete(playLoggers[index])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
val timer = KuroTimer()
|
||||||
|
timer.schedule(object : KuroTimerTask() {
|
||||||
|
override fun run() {
|
||||||
|
sendLogger()
|
||||||
|
}
|
||||||
|
}, 30000)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送运行日志
|
||||||
|
*/
|
||||||
|
fun sendLogToService(file: File, taskId: String) {
|
||||||
|
val headers = mapOf<String, String>("task_id" to taskId, "card_id" to Xixun.getCardId())
|
||||||
|
|
||||||
|
//KuroFileUtil.postFileToUrl(file,Settings.upload_debug_file_url,headers,object : PostFileCallBack {
|
||||||
|
KuroFileUtil.postFileToUrl(file,Configurations.config(TaxiApp.instance()).upload_debug_file_url(),headers,object : PostFileCallBack {
|
||||||
|
override fun onFailure(call: Call, e: IOException) {
|
||||||
|
YoungUtil.YoungLog("上传log失败:${e.message}")
|
||||||
|
if (file.exists()) {
|
||||||
|
file.delete()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onResponse(call: Call, response: Response) {
|
||||||
|
YoungUtil.YoungLog("上传log成功:${response.message},response isSuccessful ${response.isSuccessful}${response.code}")
|
||||||
|
if (file.exists()) {
|
||||||
|
file.delete()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onProgress(cur: Long, total: Long,progress:Int) {
|
||||||
|
YoungUtil.YoungLog("上传文件进度,cur:$cur,total :$total,progress :$progress")
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送异常
|
||||||
|
*/
|
||||||
|
fun sendException(exception: String) {
|
||||||
|
ThreadUtil.executeByPool(
|
||||||
|
Runnable {
|
||||||
|
val okHttpClient = OkHttpClient()
|
||||||
|
val cardId = if (TaxiApp.isTest) {
|
||||||
|
TaxiApp.testCardid
|
||||||
|
} else {
|
||||||
|
Xixun.getCardId()
|
||||||
|
}
|
||||||
|
val exceptionModel = ExceptionModel(cardId, exception, "net.sysolution.taxiapp")
|
||||||
|
val requestJson = ProcessingCommands.gson.toJson(exceptionModel)
|
||||||
|
val parse = ("application/json;charset=UTF-8").toMediaTypeOrNull()
|
||||||
|
val body = RequestBody.create(parse, requestJson)
|
||||||
|
val request: Request = Request.Builder()
|
||||||
|
.url("http://taxihub.cn:2345/postException") //要访问的链接
|
||||||
|
.addHeader("Authorization", "Bearer ${Configurations.config(TaxiApp.instance()).appToken()}")
|
||||||
|
.post(body)
|
||||||
|
.build()
|
||||||
|
val call = okHttpClient.newCall(request)
|
||||||
|
call.enqueue(object : Callback {
|
||||||
|
override fun onFailure(call: Call, e: IOException) {
|
||||||
|
YoungUtil.YoungLog("上传异常失败:${e.message}")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onResponse(call: Call, response: Response) {
|
||||||
|
YoungUtil.YoungLog("上传异常成功:${response.message},response isSussceful ${response.isSuccessful}${response.code}")
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绑定账号
|
||||||
|
*/
|
||||||
|
@Synchronized
|
||||||
|
fun bindAccount(bindModel: BindModel, listener: ITaxiListener) {
|
||||||
|
try {
|
||||||
|
YoungUtil.YoungLog("准备绑定账号")
|
||||||
|
//edit by yzd @20211201
|
||||||
|
val accountId = checkAppToken(bindModel.accountIdToken)
|
||||||
|
//2022-0620by yzd修复一个bug:下面这行如果不注释,导致切换凭证的时候如果taxibaseUrl没变,setConnServiceUrl就不会被调用,使得conn不会切换服务地址
|
||||||
|
//if (accountId != Configurations.config(TaxiApp.instance()).accountId() || bindModel.server != Configurations.config(TaxiApp.instance()).taxiBaseUrl()) {
|
||||||
|
//Settings.accountId = accountId
|
||||||
|
Configurations.config(TaxiApp.instance()).accountIdSave(accountId)
|
||||||
|
//不等说明账户更换,重新连接
|
||||||
|
resetAccountCleanDao()
|
||||||
|
Configurations.config(TaxiApp.instance()).registerTokenSave(bindModel.accountIdToken)
|
||||||
|
|
||||||
|
if (bindModel.server != null && bindModel.server != "") {
|
||||||
|
//Settings.taxiBaseUrl = bindModel.server
|
||||||
|
Configurations.config(TaxiApp.instance()).taxiBaseUrlSave(bindModel.server);
|
||||||
|
setConnServiceUrl(bindModel.server)
|
||||||
|
}
|
||||||
|
|
||||||
|
reconnect(1003,"切换账户关闭连接")
|
||||||
|
|
||||||
|
YoungUtil.YoungLog("用户不同,账号重新绑定")
|
||||||
|
//}
|
||||||
|
/*
|
||||||
|
if (accountId != Settings.accountId || bindModel.server != Settings.taxiBaseUrl) {
|
||||||
|
Settings.accountId = accountId
|
||||||
|
//不等说明账户更换,重新连接
|
||||||
|
resetAccountCleanDao()
|
||||||
|
Settings.registerToken = bindModel.accountIdToken
|
||||||
|
|
||||||
|
if (bindModel.server != null && bindModel.server != "") {
|
||||||
|
Settings.taxiBaseUrl = bindModel.server
|
||||||
|
setConnServiceUrl(bindModel.server)
|
||||||
|
}
|
||||||
|
|
||||||
|
reconnect(1003,"切换账户关闭连接")
|
||||||
|
|
||||||
|
YoungUtil.YoungLog("用户不同,账号重新绑定")
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
YoungUtil.YoungLog("账号绑定完成")
|
||||||
|
//Settings.registerToken = bindModel.accountIdToken
|
||||||
|
Configurations.config(TaxiApp.instance()).registerTokenSave(bindModel.accountIdToken)
|
||||||
|
listener.onSuccess("true")
|
||||||
|
} catch (e: RemoteException) {
|
||||||
|
e.printStackTrace()
|
||||||
|
listener.onError(e.message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转移账号
|
||||||
|
*/
|
||||||
|
@Synchronized
|
||||||
|
fun switchAccount(token: String, taxiServerURL: String) {
|
||||||
|
try {
|
||||||
|
YoungUtil.YoungLog("准备转移账号")
|
||||||
|
val accountId = checkAppToken(token)
|
||||||
|
if (accountId != Configurations.config(TaxiApp.instance()).accountId() || taxiServerURL != Configurations.config(TaxiApp.instance()).taxiBaseUrl()) {
|
||||||
|
//Settings.accountId = accountId
|
||||||
|
Configurations.config(TaxiApp.instance()).accountIdSave(accountId)
|
||||||
|
Configurations.config(TaxiApp.instance()).taxiBaseUrlSave(taxiServerURL)
|
||||||
|
|
||||||
|
setConnServiceUrl(taxiServerURL)
|
||||||
|
|
||||||
|
//不等说明账户更换,重新连接
|
||||||
|
resetAccountCleanDao()
|
||||||
|
//Settings.registerToken = token
|
||||||
|
Configurations.config(TaxiApp.instance()).registerTokenSave(token)
|
||||||
|
reconnect(1003,"切换账户关闭连接")
|
||||||
|
YoungUtil.YoungLog("用户不同,账号重新绑定 切换账户")
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
if (accountId != Settings.accountId || taxiServerURL != Settings.taxiBaseUrl) {
|
||||||
|
Settings.accountId = accountId
|
||||||
|
Settings.taxiBaseUrl = taxiServerURL
|
||||||
|
|
||||||
|
setConnServiceUrl(taxiServerURL)
|
||||||
|
|
||||||
|
//不等说明账户更换,重新连接
|
||||||
|
resetAccountCleanDao()
|
||||||
|
Settings.registerToken = token
|
||||||
|
reconnect(1003,"切换账户关闭连接")
|
||||||
|
YoungUtil.YoungLog("用户不同,账号重新绑定 切换账户")
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
YoungUtil.YoungLog("账号转移完成")
|
||||||
|
} catch (e: RemoteException) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置conn服务器
|
||||||
|
*/
|
||||||
|
private fun setConnServiceUrl(taxiServerURL: String) {
|
||||||
|
//设置conn服务器
|
||||||
|
val split = taxiServerURL.split(":")
|
||||||
|
val sb = StringBuffer()
|
||||||
|
sb.append(split[0])
|
||||||
|
sb.append(":")
|
||||||
|
sb.append(split[1])
|
||||||
|
sb.append(":2340")
|
||||||
|
|
||||||
|
YoungUtil.YoungLog("设置conn服务器url: ${sb.toString()}")
|
||||||
|
|
||||||
|
//Settings.connServiceUrl = sb.toString()
|
||||||
|
Configurations.config(TaxiApp.instance()).connServiceUrlSave(sb.toString())
|
||||||
|
|
||||||
|
if (connService != null) {
|
||||||
|
val isSuccess = connService!!.setServerURL(Configurations.config(TaxiApp.instance()).connServiceUrl())
|
||||||
|
YoungUtil.YoungLog("设置conn服务器是否成功: $isSuccess")
|
||||||
|
} else {
|
||||||
|
YoungUtil.YoungLog("设置conn服务器失败: connService is null")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置账号时清空数据库并把没发送完的日志发送完
|
||||||
|
*/
|
||||||
|
private fun resetAccountCleanDao() {
|
||||||
|
resetAccountSendLogger()
|
||||||
|
//Settings.taxiInfo = ""
|
||||||
|
//Settings.advertiseOrder = ""
|
||||||
|
Configurations.config(TaxiApp.instance()).taxiInfoSave("")
|
||||||
|
Configurations.config(TaxiApp.instance()).advertiseOrderSave("");
|
||||||
|
// DaoUtil.getAdvertise().deleteAll()
|
||||||
|
DaoUtil.deleteAllAdvertise()
|
||||||
|
DaoUtil.getSanleAdvertise().deleteAll()
|
||||||
|
DaoUtil.getPositionAdvertise().deleteAll()
|
||||||
|
DaoUtil.getContainerDao().deleteAll()
|
||||||
|
DaoUtil.getLocationDao().deleteAll()
|
||||||
|
DaoUtil.getPlayLoggerDao().deleteAll()
|
||||||
|
DaoUtil.getRegion().deleteAll()
|
||||||
|
DaoUtil.getTimeSpan().deleteAll()
|
||||||
|
RefreshPlayer.refresh()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置账号将未发送的日志发送出去
|
||||||
|
*/
|
||||||
|
private fun resetAccountSendLogger() {
|
||||||
|
DaoUtil.getPlayLoggerDao().deleteAll()
|
||||||
|
// YoungUtil.YoungLog("resetAccountSendLogger in MainThread is ${Looper.getMainLooper().thread === Thread.currentThread()}")
|
||||||
|
// val playLoggers = DaoUtil.getPlayLoggers()
|
||||||
|
// if (playLoggers.isNotEmpty()) {
|
||||||
|
// val okHttpClient = OkHttpClient()
|
||||||
|
//// YoungUtil.YoungLog("准备上传日志,上传地址:${SaveSimpleData.getLogServiceUrl()}")
|
||||||
|
// YoungUtil.YoungLog("重置账号准备上传日志,上传地址:${Settings.logServiceUrl}")
|
||||||
|
// val requestJson = ProcessingCommands.gson.toJson(playLoggers)
|
||||||
|
// val parse = ("application/json;charset=UTF-8").toMediaTypeOrNull()
|
||||||
|
// val body = RequestBody.create(parse, requestJson)
|
||||||
|
// YoungUtil.YoungLog("resetAccountSendLogger:${requestJson}")
|
||||||
|
// val request: Request = Request.Builder()
|
||||||
|
//// .url(SaveSimpleData.getLogServiceUrl()+"postPlayerLog") //要访问的链接
|
||||||
|
// .url(Settings.logServiceUrl + "postPlayerLog") //要访问的链接
|
||||||
|
//// .addHeader("Authorization","Bearer ${SaveSimpleData.getAppToken()}")
|
||||||
|
// .addHeader("Authorization", "Bearer ${Settings.appToken}")
|
||||||
|
// .post(body)
|
||||||
|
// .build()
|
||||||
|
// val call = okHttpClient.newCall(request)
|
||||||
|
// call.enqueue(object : Callback {
|
||||||
|
// override fun onFailure(call: Call, e: IOException) {
|
||||||
|
// YoungUtil.YoungLog("上传日志失败:${e.message}")
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// override fun onResponse(call: Call, response: Response) {
|
||||||
|
// YoungUtil.YoungLog("重置账号上传日志成功:${response.message},response isSussceful ${response.isSuccessful}${response.code}")
|
||||||
|
// if (response.code == 200) {
|
||||||
|
// DaoUtil.getPlayLoggerDao().deleteAll()
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun reconnect(code:Int,msg:String) {
|
||||||
|
WsManager.stopConnect(code,msg)
|
||||||
|
isRegisterSuccess = false
|
||||||
|
//Settings.isFirstRegister = true
|
||||||
|
Configurations.config(TaxiApp.instance()).isFirstRegisterSave(true)
|
||||||
|
registerApp()
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
package cn.trans88.taxiappkotlin.logic.network;
|
||||||
|
|
||||||
|
import android.os.Environment;
|
||||||
|
import android.os.StatFs;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.text.DecimalFormat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create by: joey on 18-10-25 15:06
|
||||||
|
* Description:
|
||||||
|
*/
|
||||||
|
public class DiskUtil {
|
||||||
|
private final static int K1 = 1024;
|
||||||
|
|
||||||
|
public static String dataCapacityConversion(final float data) {
|
||||||
|
float space = data;
|
||||||
|
String unit = "B";
|
||||||
|
for (int count = 0; count < 4; ++count) {
|
||||||
|
if (space < K1) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
space /= K1;
|
||||||
|
switch (count) {
|
||||||
|
case 0:
|
||||||
|
unit = "KB";
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
unit = "MB";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
unit = "GB";
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
unit = "TB";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new DecimalFormat(".0").format(space) + unit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long getDataFree() {
|
||||||
|
File path = Environment.getDataDirectory();
|
||||||
|
StatFs stat = new StatFs(path.getPath());
|
||||||
|
long blockSize = stat.getBlockSize();
|
||||||
|
long availableBlocks = stat.getAvailableBlocks();
|
||||||
|
return availableBlocks * blockSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getDataFreeUnit() {
|
||||||
|
return dataCapacityConversion(getDataFree());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long getDataSpace() {
|
||||||
|
File path = Environment.getDataDirectory();
|
||||||
|
StatFs stat = new StatFs(path.getPath());
|
||||||
|
long blockSize = stat.getBlockSize(); //每个block 占字节数
|
||||||
|
long totalBlocks = stat.getBlockCount(); //block总数
|
||||||
|
return totalBlocks * blockSize;
|
||||||
|
}
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user