diff --git a/app/build.gradle b/app/build.gradle index c272d8d..0ecd3d3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -43,24 +43,25 @@ android { } } + dependencies { - implementation 'androidx.appcompat:appcompat:1.5.1' + implementation 'androidx.appcompat:appcompat:1.6.0' implementation 'androidx.browser:browser:1.4.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' implementation 'androidx.core:core-ktx:1.9.0' - implementation 'androidx.fragment:fragment-ktx:1.5.3' + implementation 'androidx.fragment:fragment-ktx:1.5.5' implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.1' implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1' implementation 'androidx.preference:preference-ktx:1.2.0' implementation 'androidx.sqlite:sqlite-framework:2.2.0' implementation 'androidx.sqlite:sqlite-ktx:2.2.0' implementation 'androidx.viewpager2:viewpager2:1.0.0' - implementation 'androidx.webkit:webkit:1.5.0' - implementation 'com.google.android.material:material:1.7.0' + implementation 'androidx.webkit:webkit:1.6.0' + implementation 'com.google.android.material:material:1.8.0' implementation 'com.squareup.okhttp3:okhttp:4.9.0' implementation 'commons-codec:commons-codec:1.13' - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.1' + implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.20' + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4' implementation project(':sax-framework') } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d36a67f..b325283 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -115,6 +115,14 @@ + + + + diff --git a/app/src/main/java/com/tughi/aggregator/activities/backup/BackupActivity.kt b/app/src/main/java/com/tughi/aggregator/activities/backup/BackupActivity.kt new file mode 100644 index 0000000..30c299b --- /dev/null +++ b/app/src/main/java/com/tughi/aggregator/activities/backup/BackupActivity.kt @@ -0,0 +1,99 @@ +package com.tughi.aggregator.activities.backup + +import android.content.ComponentName +import android.content.Intent +import android.content.ServiceConnection +import android.os.Bundle +import android.os.IBinder +import android.view.MenuItem +import android.view.View +import android.view.ViewGroup +import android.widget.Button +import android.widget.ProgressBar +import androidx.lifecycle.MutableLiveData +import com.tughi.aggregator.AppActivity +import com.tughi.aggregator.R +import com.tughi.aggregator.services.BackupService +import kotlin.math.roundToInt + +class BackupActivity : AppActivity() { + private var service: BackupService? = null + private val serviceConnection = object : ServiceConnection { + override fun onServiceConnected(name: ComponentName?, binder: IBinder?) { + service = (binder as BackupService.LocalBinder).getService().also { service -> + service.status.observe(this@BackupActivity) { status -> + serviceStatus.value = status + } + } + } + + override fun onServiceDisconnected(name: ComponentName?) { + service = null + } + } + + private val serviceStatus = MutableLiveData() + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + supportActionBar?.apply { + setDisplayHomeAsUpEnabled(true) + setHomeAsUpIndicator(R.drawable.action_back) + } + + setContentView(R.layout.backup_activity) + + val actionsWrapper = findViewById(R.id.actions_wrapper) + val backupButton = actionsWrapper.findViewById