/*
- * Copyright 2016-2022 Soren Stoutner <soren@stoutner.com>.
+ * Copyright 2016-2023 Soren Stoutner <soren@stoutner.com>.
*
* This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android>.
*
import com.google.android.material.snackbar.Snackbar
-import com.stoutner.privacybrowser.R
import com.stoutner.privacybrowser.BuildConfig
-import com.stoutner.privacybrowser.asynctasks.SaveAboutVersionImage
+import com.stoutner.privacybrowser.R
+import com.stoutner.privacybrowser.coroutines.SaveAboutVersionImageCoroutine
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
// Define the save about version image activity result launcher. It must be defined before `onCreate()` is run or the app will crash.
private val saveAboutVersionImageActivityResultLauncher = registerForActivityResult(ActivityResultContracts.CreateDocument("image/png")) { fileUri: Uri? ->
- // Only save the file if the URI is not null, which happens if the user exited the file picker by pressing back.
- if (fileUri != null) {
- // Save the about version image.
- SaveAboutVersionImage(requireActivity(), fileUri, aboutVersionLayout.findViewById(R.id.about_version_linearlayout)).execute()
- }
+ // Save the file if the URI is not null, which happens if the user exits the file picker by pressing back.
+ if (fileUri != null)
+ SaveAboutVersionImageCoroutine.saveImage(requireActivity(), fileUri, aboutVersionLayout.findViewById(R.id.about_version_linearlayout))
}
override fun onCreate(savedInstanceState: Bundle?) {
updateMemoryUsageBoolean = true
}
- fun updateMemoryUsage(activity: Activity) {
+ private fun updateMemoryUsage(activity: Activity) {
try {
// Update the memory usage if enabled.
if (updateMemoryUsageBoolean) {
}
}
- fun getAboutVersionString(): String {
+ private fun getAboutVersionString(): String {
// Initialize an about version string builder.
val aboutVersionStringBuilder = StringBuilder()