75 lines
3.4 KiB
Java
75 lines
3.4 KiB
Java
package com.ubtrobot.analytics;
|
|
|
|
import android.content.ContentValues;
|
|
import android.database.Cursor;
|
|
import android.util.Log;
|
|
import com.ubt.jimu.controller.data.widget.JockstickDataConverter;
|
|
import com.unity3d.ads.metadata.MediationMetaData;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class ActivenessScheme {
|
|
public static void a(AnalyticsDBHelper analyticsDBHelper) {
|
|
Log.i("Analytics", "Create table: activeness");
|
|
StringBuffer stringBuffer = new StringBuffer();
|
|
stringBuffer.append("CREATE TABLE IF NOT EXISTS ");
|
|
stringBuffer.append("activeness");
|
|
stringBuffer.append("(");
|
|
stringBuffer.append(JockstickDataConverter.ID);
|
|
stringBuffer.append(" INTEGER PRIMARY KEY AUTOINCREMENT,");
|
|
stringBuffer.append("event_id");
|
|
stringBuffer.append(" VARCHAR NOT NULL,");
|
|
stringBuffer.append("user_id");
|
|
stringBuffer.append(" VARCHAR DEFAULT '',");
|
|
stringBuffer.append(MediationMetaData.KEY_VERSION);
|
|
stringBuffer.append(" VARCHAR DEFAULT '',");
|
|
stringBuffer.append("started_at");
|
|
stringBuffer.append(" INTEGER DEFAULT 0,");
|
|
stringBuffer.append("ticktock_at");
|
|
stringBuffer.append(" INTEGER DEFAULT 0,");
|
|
stringBuffer.append("duration");
|
|
stringBuffer.append(" INTEGER DEFAULT 0");
|
|
stringBuffer.append(")");
|
|
analyticsDBHelper.a(stringBuffer.toString());
|
|
}
|
|
|
|
public static void b(AnalyticsDBHelper analyticsDBHelper) {
|
|
Log.i("Analytics", "Running upgradeToVersion4 ...");
|
|
if (analyticsDBHelper.a("activeness", "user_id")) {
|
|
return;
|
|
}
|
|
String format = String.format("ALTER TABLE %s ADD COLUMN %s VARCHAR DEFAULT ''", "activeness", "user_id");
|
|
String format2 = String.format("ALTER TABLE %s ADD COLUMN %s VARCHAR DEFAULT ''", "activeness", MediationMetaData.KEY_VERSION);
|
|
analyticsDBHelper.b(format);
|
|
analyticsDBHelper.b(format2);
|
|
}
|
|
|
|
public static class Converters {
|
|
static ContentValues a(ActivenessRecord activenessRecord) {
|
|
ContentValues contentValues = new ContentValues();
|
|
contentValues.put("event_id", activenessRecord.b());
|
|
contentValues.put("user_id", activenessRecord.e());
|
|
contentValues.put(MediationMetaData.KEY_VERSION, activenessRecord.f());
|
|
contentValues.put("started_at", Long.valueOf(activenessRecord.c()));
|
|
contentValues.put("ticktock_at", Long.valueOf(activenessRecord.d()));
|
|
contentValues.put("duration", Long.valueOf(activenessRecord.a()));
|
|
return contentValues;
|
|
}
|
|
|
|
static ActivenessRecord a(Cursor cursor) {
|
|
String string = cursor.getString(cursor.getColumnIndex("event_id"));
|
|
String string2 = cursor.getString(cursor.getColumnIndex("user_id"));
|
|
String string3 = cursor.getString(cursor.getColumnIndex(MediationMetaData.KEY_VERSION));
|
|
long j = cursor.getLong(cursor.getColumnIndex("started_at"));
|
|
long j2 = cursor.getLong(cursor.getColumnIndex("ticktock_at"));
|
|
long j3 = cursor.getLong(cursor.getColumnIndex("duration"));
|
|
ActivenessRecord activenessRecord = new ActivenessRecord(string);
|
|
activenessRecord.a(string2);
|
|
activenessRecord.b(string3);
|
|
activenessRecord.b(j);
|
|
activenessRecord.c(j2);
|
|
activenessRecord.a(j3);
|
|
return activenessRecord;
|
|
}
|
|
}
|
|
}
|