Сравнить коммиты
| Автор | SHA1 | Дата | |
|---|---|---|---|
|
|
94e094e648 | ||
|
|
25c0434e4c | ||
|
|
3afcfa17d0 | ||
|
|
02263d5fd9 | ||
|
|
a884b2f3d7 | ||
|
|
6910790fa7 | ||
|
|
6cab1a0b36 | ||
|
|
edd4f670fe |
+10
-9
@@ -9,8 +9,8 @@ android {
|
||||
buildConfigField 'boolean', 'HIDDEN_APP', 'false'
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 30
|
||||
versionCode 69
|
||||
versionName '6.8'
|
||||
versionCode 72
|
||||
versionName '6.11'
|
||||
multiDexEnabled true
|
||||
}
|
||||
|
||||
@@ -51,15 +51,16 @@ dependencies {
|
||||
implementation 'androidx.multidex:multidex:2.0.1'
|
||||
implementation 'androidx.preference:preference-ktx:1.1.1'
|
||||
implementation 'androidx.test:core-ktx:1.4.0'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
testImplementation 'org.robolectric:robolectric:4.1'
|
||||
googleImplementation 'com.google.firebase:firebase-core:19.0.0'
|
||||
googleImplementation 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'
|
||||
googleImplementation 'com.google.firebase:firebase-analytics:19.0.0'
|
||||
googleImplementation 'com.google.android.gms:play-services-location:18.0.0'
|
||||
googleImplementation 'com.google.android.play:core:1.10.0'
|
||||
implementation "androidx.core:core-ktx:1.6.0"
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
testImplementation 'org.robolectric:robolectric:4.1'
|
||||
googleImplementation platform('com.google.firebase:firebase-bom:28.2.1')
|
||||
googleImplementation 'com.google.firebase:firebase-core'
|
||||
googleImplementation 'com.google.firebase:firebase-analytics'
|
||||
googleImplementation 'com.google.firebase:firebase-crashlytics'
|
||||
googleImplementation 'com.google.android.gms:play-services-location:18.0.0'
|
||||
googleImplementation 'com.google.android.play:core:1.10.0'
|
||||
}
|
||||
|
||||
if (getGradle().getStartParameter().getTaskRequests().toString().contains('Google')) {
|
||||
|
||||
@@ -30,7 +30,7 @@ class DatabaseHelper(context: Context?) : SQLiteOpenHelper(context, DATABASE_NAM
|
||||
fun onComplete(success: Boolean, result: T)
|
||||
}
|
||||
|
||||
private abstract class DatabaseAsyncTask<T>(val handler: DatabaseHandler<T>) : AsyncTask<Unit, Unit, T?>() {
|
||||
private abstract class DatabaseAsyncTask<T>(val handler: DatabaseHandler<T?>) : AsyncTask<Unit, Unit, T?>() {
|
||||
|
||||
private var error: RuntimeException? = null
|
||||
|
||||
@@ -46,7 +46,7 @@ class DatabaseHelper(context: Context?) : SQLiteOpenHelper(context, DATABASE_NAM
|
||||
protected abstract fun executeMethod(): T
|
||||
|
||||
override fun onPostExecute(result: T?) {
|
||||
result?.let { handler.onComplete(error == null, result) }
|
||||
handler.onComplete(error == null, result)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ class DatabaseHelper(context: Context?) : SQLiteOpenHelper(context, DATABASE_NAM
|
||||
db.insertOrThrow("position", null, values)
|
||||
}
|
||||
|
||||
fun insertPositionAsync(position: Position, handler: DatabaseHandler<Unit>) {
|
||||
fun insertPositionAsync(position: Position, handler: DatabaseHandler<Unit?>) {
|
||||
object : DatabaseAsyncTask<Unit>(handler) {
|
||||
override fun executeMethod() {
|
||||
insertPosition(position)
|
||||
@@ -138,7 +138,7 @@ class DatabaseHelper(context: Context?) : SQLiteOpenHelper(context, DATABASE_NAM
|
||||
}
|
||||
}
|
||||
|
||||
fun deletePositionAsync(id: Long, handler: DatabaseHandler<Unit>) {
|
||||
fun deletePositionAsync(id: Long, handler: DatabaseHandler<Unit?>) {
|
||||
object : DatabaseAsyncTask<Unit>(handler) {
|
||||
override fun executeMethod() {
|
||||
deletePosition(id)
|
||||
|
||||
@@ -24,11 +24,6 @@ import android.graphics.Color
|
||||
import android.os.Build
|
||||
import android.app.Activity
|
||||
|
||||
import androidx.annotation.NonNull
|
||||
|
||||
|
||||
|
||||
|
||||
open class MainApplication : MultiDexApplication() {
|
||||
|
||||
override fun onCreate() {
|
||||
|
||||
@@ -104,8 +104,8 @@ class TrackingController(private val context: Context) : PositionListener, Netwo
|
||||
|
||||
private fun write(position: Position) {
|
||||
log("write", position)
|
||||
databaseHelper.insertPositionAsync(position, object : DatabaseHandler<Unit> {
|
||||
override fun onComplete(success: Boolean, result: Unit) {
|
||||
databaseHelper.insertPositionAsync(position, object : DatabaseHandler<Unit?> {
|
||||
override fun onComplete(success: Boolean, result: Unit?) {
|
||||
if (success) {
|
||||
if (isOnline && isWaiting) {
|
||||
read()
|
||||
@@ -139,8 +139,8 @@ class TrackingController(private val context: Context) : PositionListener, Netwo
|
||||
|
||||
private fun delete(position: Position) {
|
||||
log("delete", position)
|
||||
databaseHelper.deletePositionAsync(position.id, object : DatabaseHandler<Unit> {
|
||||
override fun onComplete(success: Boolean, result: Unit) {
|
||||
databaseHelper.deletePositionAsync(position.id, object : DatabaseHandler<Unit?> {
|
||||
override fun onComplete(success: Boolean, result: Unit?) {
|
||||
if (success) {
|
||||
read()
|
||||
} else {
|
||||
|
||||
@@ -49,7 +49,7 @@ class TrackingService : Service() {
|
||||
stopForeground(true)
|
||||
}
|
||||
|
||||
override fun onStartCommand(intent: Intent, flags: Int, startId: Int): Int {
|
||||
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
|
||||
stopSelfResult(startId)
|
||||
return START_NOT_STICKY
|
||||
}
|
||||
@@ -83,7 +83,7 @@ class TrackingService : Service() {
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.ECLAIR)
|
||||
override fun onStartCommand(intent: Intent, flags: Int, startId: Int): Int {
|
||||
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
|
||||
WakefulBroadcastReceiver.completeWakefulIntent(intent)
|
||||
return START_STICKY
|
||||
}
|
||||
|
||||
@@ -51,8 +51,8 @@ abstract class WakefulBroadcastReceiver : BroadcastReceiver() {
|
||||
}
|
||||
}
|
||||
|
||||
fun completeWakefulIntent(intent: Intent): Boolean {
|
||||
val id = intent.getIntExtra(EXTRA_WAKE_LOCK_ID, 0)
|
||||
fun completeWakefulIntent(intent: Intent?): Boolean {
|
||||
val id = intent?.getIntExtra(EXTRA_WAKE_LOCK_ID, 0) ?: 0
|
||||
if (id == 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user