Remove (useless, potentially dangerous) casts to AppCompatActivity

This commit is contained in:
MM20
2022-02-18 23:34:32 +01:00
parent 3c3cac83c8
commit 6b59aa5118
19 changed files with 82 additions and 74 deletions
@@ -196,7 +196,7 @@ fun AppItem(
label = stringResource(R.string.menu_app_info), label = stringResource(R.string.menu_app_info),
icon = Icons.Rounded.Info icon = Icons.Rounded.Info
) { ) {
viewModel.openAppInfo(context as AppCompatActivity) viewModel.openAppInfo(context)
}) })
toolbarActions.add( toolbarActions.add(
@@ -204,7 +204,7 @@ fun AppItem(
label = stringResource(R.string.menu_launch), label = stringResource(R.string.menu_launch),
icon = Icons.Rounded.OpenInNew, icon = Icons.Rounded.OpenInNew,
action = { action = {
viewModel.launch(context as AppCompatActivity) viewModel.launch(context)
} }
) )
) )
@@ -216,7 +216,7 @@ fun AppItem(
icon = Icons.Rounded.Share icon = Icons.Rounded.Share
) { ) {
scope.launch { scope.launch {
viewModel.shareApkFile(context as AppCompatActivity) viewModel.shareApkFile(context)
} }
} }
} else { } else {
@@ -228,7 +228,7 @@ fun AppItem(
label = stringResource(R.string.share_menu_store_link, storeDetails.label), label = stringResource(R.string.share_menu_store_link, storeDetails.label),
icon = Icons.Rounded.Share, icon = Icons.Rounded.Share,
action = { action = {
viewModel.shareStoreLink(context as AppCompatActivity, storeDetails.url) viewModel.shareStoreLink(context, storeDetails.url)
} }
), ),
DefaultToolbarAction( DefaultToolbarAction(
@@ -236,7 +236,7 @@ fun AppItem(
icon = Icons.Rounded.Share icon = Icons.Rounded.Share
) { ) {
scope.launch { scope.launch {
viewModel.shareApkFile(context as AppCompatActivity) viewModel.shareApkFile(context)
} }
} }
) )
@@ -250,7 +250,7 @@ fun AppItem(
label = stringResource(R.string.menu_uninstall), label = stringResource(R.string.menu_uninstall),
icon = Icons.Rounded.Delete, icon = Icons.Rounded.Delete,
) { ) {
viewModel.uninstall(context as AppCompatActivity) viewModel.uninstall(context)
onBack() onBack()
} }
) )
@@ -8,14 +8,9 @@ import android.graphics.drawable.Drawable
import android.net.Uri import android.net.Uri
import android.provider.Settings import android.provider.Settings
import android.service.notification.StatusBarNotification import android.service.notification.StatusBarNotification
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.FileProvider import androidx.core.content.FileProvider
import androidx.core.content.getSystemService import androidx.core.content.getSystemService
import de.mm20.launcher2.badges.BadgeRepository
import de.mm20.launcher2.crashreporter.CrashReporter import de.mm20.launcher2.crashreporter.CrashReporter
import de.mm20.launcher2.favorites.FavoritesRepository
import de.mm20.launcher2.icons.IconRepository
import de.mm20.launcher2.icons.LauncherIcon
import de.mm20.launcher2.ktx.tryStartActivity import de.mm20.launcher2.ktx.tryStartActivity
import de.mm20.launcher2.notifications.NotificationRepository import de.mm20.launcher2.notifications.NotificationRepository
import de.mm20.launcher2.search.data.AppShortcut import de.mm20.launcher2.search.data.AppShortcut
@@ -25,7 +20,6 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.map
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import org.koin.core.component.KoinComponent
import org.koin.core.component.inject import org.koin.core.component.inject
class AppItemVM( class AppItemVM(
@@ -41,8 +35,8 @@ class AppItemVM(
notificationRepository.cancelNotification(notification) notificationRepository.cancelNotification(notification)
} }
fun openAppInfo(activity: AppCompatActivity) { fun openAppInfo(context: Context) {
activity.tryStartActivity( context.tryStartActivity(
Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).apply { Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).apply {
data = Uri.parse("package:${app.`package`}") data = Uri.parse("package:${app.`package`}")
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
@@ -50,14 +44,14 @@ class AppItemVM(
) )
} }
suspend fun shareApkFile(activity: AppCompatActivity) { suspend fun shareApkFile(context: Context) {
val fileCopy = java.io.File( val fileCopy = java.io.File(
activity.cacheDir, context.cacheDir,
"${app.`package`}-${app.version}.apk" "${app.`package`}-${app.version}.apk"
) )
withContext(Dispatchers.IO) { withContext(Dispatchers.IO) {
try { try {
val info = activity.packageManager val info = context.packageManager
.getApplicationInfo(app.`package`, 0) .getApplicationInfo(app.`package`, 0)
val file = java.io.File(info.publicSourceDir) val file = java.io.File(info.publicSourceDir)
@@ -73,30 +67,30 @@ class AppItemVM(
val shareIntent = Intent(Intent.ACTION_SEND) val shareIntent = Intent(Intent.ACTION_SEND)
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
val uri = FileProvider.getUriForFile( val uri = FileProvider.getUriForFile(
activity, context,
activity.applicationContext.packageName + ".fileprovider", context.applicationContext.packageName + ".fileprovider",
fileCopy fileCopy
) )
shareIntent.putExtra(Intent.EXTRA_STREAM, uri) shareIntent.putExtra(Intent.EXTRA_STREAM, uri)
shareIntent.type = "application/vnd.android.package-archive" shareIntent.type = "application/vnd.android.package-archive"
withContext(Dispatchers.Main) { withContext(Dispatchers.Main) {
activity.startActivity(Intent.createChooser(shareIntent, null)) context.startActivity(Intent.createChooser(shareIntent, null))
} }
} }
fun shareStoreLink(activity: AppCompatActivity, url: String) { fun shareStoreLink(context: Context, url: String) {
val shareIntent = Intent(Intent.ACTION_SEND) val shareIntent = Intent(Intent.ACTION_SEND)
shareIntent.putExtra(Intent.EXTRA_TEXT, url) shareIntent.putExtra(Intent.EXTRA_TEXT, url)
shareIntent.type = "text/plain" shareIntent.type = "text/plain"
activity.startActivity(Intent.createChooser(shareIntent, null)) context.startActivity(Intent.createChooser(shareIntent, null))
} }
val canUninstall = app.flags and ApplicationInfo.FLAG_SYSTEM == 0 val canUninstall = app.flags and ApplicationInfo.FLAG_SYSTEM == 0
fun uninstall(activity: AppCompatActivity) { fun uninstall(context: Context) {
val intent = Intent(Intent.ACTION_DELETE) val intent = Intent(Intent.ACTION_DELETE)
intent.data = Uri.parse("package:" + app.`package`) intent.data = Uri.parse("package:" + app.`package`)
activity.startActivity(intent) context.startActivity(intent)
} }
@@ -135,7 +135,7 @@ fun CalendarItem(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.clickable { .clickable {
viewModel.openLocation(context as AppCompatActivity) viewModel.openLocation(context)
} }
) { ) {
Icon( Icon(
@@ -199,7 +199,7 @@ fun CalendarItem(
label = stringResource(R.string.calendar_menu_open_externally), label = stringResource(R.string.calendar_menu_open_externally),
icon = Icons.Rounded.OpenInNew, icon = Icons.Rounded.OpenInNew,
action = { action = {
viewModel.launch(context as AppCompatActivity) viewModel.launch(context)
onBack() onBack()
} }
) )
@@ -4,8 +4,6 @@ import android.content.Context
import android.content.Intent import android.content.Intent
import android.net.Uri import android.net.Uri
import android.text.format.DateUtils import android.text.format.DateUtils
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import de.mm20.launcher2.ktx.tryStartActivity import de.mm20.launcher2.ktx.tryStartActivity
import de.mm20.launcher2.search.data.CalendarEvent import de.mm20.launcher2.search.data.CalendarEvent
import de.mm20.launcher2.ui.R import de.mm20.launcher2.ui.R
@@ -50,15 +48,34 @@ class CalendarItemVM(
} }
fun formatTime(context: Context): String { fun formatTime(context: Context): String {
if (calendarEvent.allDay) return DateUtils.formatDateRange(context, calendarEvent.startTime, calendarEvent.endTime, DateUtils.FORMAT_SHOW_DATE or DateUtils.FORMAT_SHOW_WEEKDAY) if (calendarEvent.allDay) return DateUtils.formatDateRange(
return DateUtils.formatDateRange(context, calendarEvent.startTime, calendarEvent.endTime, DateUtils.FORMAT_SHOW_DATE or DateUtils.FORMAT_SHOW_TIME or DateUtils.FORMAT_SHOW_WEEKDAY) context,
calendarEvent.startTime,
calendarEvent.endTime,
DateUtils.FORMAT_SHOW_DATE or DateUtils.FORMAT_SHOW_WEEKDAY
)
return DateUtils.formatDateRange(
context,
calendarEvent.startTime,
calendarEvent.endTime,
DateUtils.FORMAT_SHOW_DATE or DateUtils.FORMAT_SHOW_TIME or DateUtils.FORMAT_SHOW_WEEKDAY
)
} }
fun openLocation(context: AppCompatActivity) { fun openLocation(context: Context) {
context.tryStartActivity( context.tryStartActivity(
Intent(Intent.ACTION_VIEW) Intent(Intent.ACTION_VIEW)
.setData(Uri.parse("geo:0,0?q=${URLEncoder.encode(calendarEvent.location, "utf8")}")) .setData(
Uri.parse(
"geo:0,0?q=${
URLEncoder.encode(
calendarEvent.location,
"utf8"
)
}"
)
)
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK) .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
) )
} }
@@ -1,5 +1,6 @@
package de.mm20.launcher2.ui.launcher.search.common package de.mm20.launcher2.ui.launcher.search.common
import android.content.Context
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.compose.ui.geometry.Rect import androidx.compose.ui.geometry.Rect
import androidx.core.app.ActivityOptionsCompat import androidx.core.app.ActivityOptionsCompat
@@ -44,10 +45,11 @@ abstract class SearchableItemVM(
} }
fun launch(context: AppCompatActivity, bounds: Rect? = null): Boolean { fun launch(context: Context, bounds: Rect? = null): Boolean {
val options = if (bounds != null) { val view = (context as? AppCompatActivity)?.window?.decorView
val options = if (bounds != null && view != null) {
ActivityOptionsCompat.makeClipRevealAnimation( ActivityOptionsCompat.makeClipRevealAnimation(
context.window.decorView, view,
bounds.left.toInt(), bounds.left.toInt(),
bounds.top.toInt(), bounds.top.toInt(),
bounds.width.toInt(), bounds.width.toInt(),
@@ -66,7 +66,7 @@ fun GridItem(modifier: Modifier = Modifier, item: Searchable) {
badge = badge, badge = badge,
icon = icon, icon = icon,
onClick = { onClick = {
if (!launchOnPress || !viewModel.launch(context as AppCompatActivity, bounds)) { if (!launchOnPress || !viewModel.launch(context, bounds)) {
showPopup = true showPopup = true
} }
}, },
@@ -32,11 +32,14 @@ import kotlinx.coroutines.delay
import kotlin.math.ceil import kotlin.math.ceil
@Composable @Composable
fun SearchResultGrid(items: List<Searchable>) { fun SearchResultGrid(
items: List<Searchable>,
modifier: Modifier = Modifier,
) {
val columns = LocalGridColumns.current val columns = LocalGridColumns.current
Column( Column(
modifier = Modifier.animateContentSize().fillMaxWidth().padding(4.dp) modifier = modifier.animateContentSize().fillMaxWidth().padding(4.dp)
) { ) {
for (i in 0 until ceil(items.size / columns.toFloat()).toInt()) { for (i in 0 until ceil(items.size / columns.toFloat()).toInt()) {
Row { Row {
@@ -149,7 +149,7 @@ fun ListItem(modifier: Modifier = Modifier, item: Searchable) {
modifier = Modifier.combinedClickable( modifier = Modifier.combinedClickable(
enabled = !showDetails, enabled = !showDetails,
onClick = { onClick = {
if (!viewModel.launch(context as AppCompatActivity, bounds)) { if (!viewModel.launch(context, bounds)) {
showDetails = true showDetails = true
} }
}, },
@@ -110,7 +110,7 @@ fun ContactItem(
modifier = Modifier.padding(end = 16.dp), modifier = Modifier.padding(end = 16.dp),
text = it.label, text = it.label,
onClick = { onClick = {
viewModel.contact(context as AppCompatActivity, it) viewModel.contact(context, it)
} }
) )
} }
@@ -134,7 +134,7 @@ fun ContactItem(
modifier = Modifier.padding(end = 16.dp), modifier = Modifier.padding(end = 16.dp),
text = it.label, text = it.label,
onClick = { onClick = {
viewModel.contact(context as AppCompatActivity, it) viewModel.contact(context, it)
} }
) )
} }
@@ -158,7 +158,7 @@ fun ContactItem(
modifier = Modifier.padding(end = 16.dp), modifier = Modifier.padding(end = 16.dp),
text = it.label, text = it.label,
onClick = { onClick = {
viewModel.contact(context as AppCompatActivity, it) viewModel.contact(context, it)
} }
) )
} }
@@ -182,7 +182,7 @@ fun ContactItem(
modifier = Modifier.padding(end = 16.dp), modifier = Modifier.padding(end = 16.dp),
text = it.label, text = it.label,
onClick = { onClick = {
viewModel.contact(context as AppCompatActivity, it) viewModel.contact(context, it)
} }
) )
} }
@@ -206,7 +206,7 @@ fun ContactItem(
modifier = Modifier.padding(end = 16.dp), modifier = Modifier.padding(end = 16.dp),
text = it.label, text = it.label,
onClick = { onClick = {
viewModel.contact(context as AppCompatActivity, it) viewModel.contact(context, it)
} }
) )
} }
@@ -263,7 +263,7 @@ fun ContactItem(
label = stringResource(R.string.calendar_menu_open_externally), label = stringResource(R.string.calendar_menu_open_externally),
icon = Icons.Rounded.OpenInNew, icon = Icons.Rounded.OpenInNew,
action = { action = {
viewModel.launch(context as AppCompatActivity) viewModel.launch(context)
} }
) )
) )
@@ -1,20 +1,20 @@
package de.mm20.launcher2.ui.launcher.search.contacts package de.mm20.launcher2.ui.launcher.search.contacts
import android.content.Context
import android.content.Intent import android.content.Intent
import android.net.Uri import android.net.Uri
import androidx.appcompat.app.AppCompatActivity
import de.mm20.launcher2.ktx.tryStartActivity import de.mm20.launcher2.ktx.tryStartActivity
import de.mm20.launcher2.search.data.Contact import de.mm20.launcher2.search.data.Contact
import de.mm20.launcher2.search.data.ContactInfo import de.mm20.launcher2.search.data.ContactInfo
import de.mm20.launcher2.ui.launcher.search.common.SearchableItemVM import de.mm20.launcher2.ui.launcher.search.common.SearchableItemVM
import org.koin.core.component.KoinComponent
class ContactItemVM( class ContactItemVM(
val contact: Contact val contact: Contact
): SearchableItemVM(contact) { ) : SearchableItemVM(contact) {
fun contact(context: AppCompatActivity, contactInfo: ContactInfo) { fun contact(context: Context, contactInfo: ContactInfo) {
context.tryStartActivity( context.tryStartActivity(
Intent(Intent.ACTION_VIEW).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK).setData(Uri.parse(contactInfo.data)) Intent(Intent.ACTION_VIEW).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
.setData(Uri.parse(contactInfo.data))
) )
} }
} }
@@ -164,7 +164,7 @@ fun FileItem(
label = stringResource(R.string.menu_open_file), label = stringResource(R.string.menu_open_file),
icon = Icons.Rounded.OpenInNew, icon = Icons.Rounded.OpenInNew,
action = { action = {
viewModel.launch(context as AppCompatActivity) viewModel.launch(context)
} }
) )
) )
@@ -174,7 +174,7 @@ fun FileItem(
label = stringResource(R.string.menu_share), label = stringResource(R.string.menu_share),
icon = Icons.Rounded.Share, icon = Icons.Rounded.Share,
action = { action = {
viewModel.share(context as AppCompatActivity) viewModel.share(context)
} }
)) ))
} }
@@ -1,7 +1,7 @@
package de.mm20.launcher2.ui.launcher.search.files package de.mm20.launcher2.ui.launcher.search.files
import android.content.Context
import android.content.Intent import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.FileProvider import androidx.core.content.FileProvider
import de.mm20.launcher2.files.FileRepository import de.mm20.launcher2.files.FileRepository
import de.mm20.launcher2.search.data.File import de.mm20.launcher2.search.data.File
@@ -21,7 +21,7 @@ class FileItemVM(
fileRepository.deleteFile(file) fileRepository.deleteFile(file)
} }
fun share(context: AppCompatActivity) { fun share(context: Context) {
val shareIntent = Intent(Intent.ACTION_SEND) val shareIntent = Intent(Intent.ACTION_SEND)
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
val uri = FileProvider.getUriForFile( val uri = FileProvider.getUriForFile(
@@ -98,7 +98,7 @@ fun AppItem(
label = stringResource(R.string.menu_app_info), label = stringResource(R.string.menu_app_info),
icon = Icons.Rounded.Info icon = Icons.Rounded.Info
) { ) {
viewModel.openAppInfo(context as AppCompatActivity) viewModel.openAppInfo(context)
}) })
Toolbar( Toolbar(
@@ -1,15 +1,15 @@
package de.mm20.launcher2.ui.launcher.search.shortcut package de.mm20.launcher2.ui.launcher.search.shortcut
import android.content.Context
import android.content.Intent import android.content.Intent
import android.net.Uri import android.net.Uri
import android.provider.Settings import android.provider.Settings
import androidx.appcompat.app.AppCompatActivity
import de.mm20.launcher2.ktx.tryStartActivity import de.mm20.launcher2.ktx.tryStartActivity
import de.mm20.launcher2.search.data.AppShortcut import de.mm20.launcher2.search.data.AppShortcut
import de.mm20.launcher2.ui.launcher.search.common.SearchableItemVM import de.mm20.launcher2.ui.launcher.search.common.SearchableItemVM
class ShortcutItemVM(private val shortcut: AppShortcut) : SearchableItemVM(shortcut) { class ShortcutItemVM(private val shortcut: AppShortcut) : SearchableItemVM(shortcut) {
fun openAppInfo(context: AppCompatActivity) { fun openAppInfo(context: Context) {
context.tryStartActivity( context.tryStartActivity(
Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).apply { Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).apply {
data = Uri.parse("package:${shortcut.launcherShortcut.`package`}") data = Uri.parse("package:${shortcut.launcherShortcut.`package`}")
@@ -47,7 +47,7 @@ fun WebsiteItem(
Column( Column(
modifier = modifier.clickable { modifier = modifier.clickable {
viewModel.launch(context as AppCompatActivity) viewModel.launch(context)
} }
) { ) {
if (website.image.isNotBlank()) { if (website.image.isNotBlank()) {
@@ -104,7 +104,7 @@ fun WebsiteItem(
label = stringResource(R.string.menu_share), label = stringResource(R.string.menu_share),
icon= Icons.Rounded.Share, icon= Icons.Rounded.Share,
action = { action = {
viewModel.share(context as AppCompatActivity) viewModel.share(context)
} }
) )
) )
@@ -1,18 +1,15 @@
package de.mm20.launcher2.ui.launcher.search.website package de.mm20.launcher2.ui.launcher.search.website
import android.content.Context
import android.content.Intent import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import de.mm20.launcher2.favorites.FavoritesRepository
import de.mm20.launcher2.search.data.Website import de.mm20.launcher2.search.data.Website
import de.mm20.launcher2.ui.launcher.search.common.SearchableItemVM import de.mm20.launcher2.ui.launcher.search.common.SearchableItemVM
import org.koin.core.component.KoinComponent
import org.koin.core.component.inject
class WebsiteItemVM( class WebsiteItemVM(
private val website: Website private val website: Website
): SearchableItemVM(website) { ) : SearchableItemVM(website) {
fun share(context: AppCompatActivity) { fun share(context: Context) {
val shareIntent = Intent(Intent.ACTION_SEND) val shareIntent = Intent(Intent.ACTION_SEND)
shareIntent.putExtra( shareIntent.putExtra(
Intent.EXTRA_TEXT, Intent.EXTRA_TEXT,
@@ -47,7 +47,7 @@ fun WikipediaItem(
Column( Column(
modifier = modifier.clickable { modifier = modifier.clickable {
viewModel.launch(context as AppCompatActivity) viewModel.launch(context)
} }
) { ) {
if (!wikipedia.image.isNullOrEmpty()) { if (!wikipedia.image.isNullOrEmpty()) {
@@ -110,7 +110,7 @@ fun WikipediaItem(
label = stringResource(R.string.menu_share), label = stringResource(R.string.menu_share),
icon = Icons.Rounded.Share, icon = Icons.Rounded.Share,
action = { action = {
viewModel.share(context as AppCompatActivity) viewModel.share(context)
} }
) )
) )
@@ -1,20 +1,16 @@
package de.mm20.launcher2.ui.launcher.search.wikipedia package de.mm20.launcher2.ui.launcher.search.wikipedia
import android.content.Context
import android.content.Intent import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import androidx.core.text.HtmlCompat import androidx.core.text.HtmlCompat
import de.mm20.launcher2.favorites.FavoritesRepository
import de.mm20.launcher2.search.data.Wikipedia import de.mm20.launcher2.search.data.Wikipedia
import de.mm20.launcher2.ui.R
import de.mm20.launcher2.ui.launcher.search.common.SearchableItemVM import de.mm20.launcher2.ui.launcher.search.common.SearchableItemVM
import org.koin.core.component.KoinComponent
import org.koin.core.component.inject
class WikipediaItemVM( class WikipediaItemVM(
private val wikipedia: Wikipedia private val wikipedia: Wikipedia
) : SearchableItemVM(wikipedia) { ) : SearchableItemVM(wikipedia) {
fun share(context: AppCompatActivity) { fun share(context: Context) {
val text = HtmlCompat.fromHtml(wikipedia.text, HtmlCompat.FROM_HTML_MODE_LEGACY).toString() val text = HtmlCompat.fromHtml(wikipedia.text, HtmlCompat.FROM_HTML_MODE_LEGACY).toString()
val shareIntent = Intent(Intent.ACTION_SEND) val shareIntent = Intent(Intent.ACTION_SEND)
shareIntent.putExtra( shareIntent.putExtra(
@@ -418,7 +418,6 @@ class ApplicationDetailRepresentation : Representation, KoinComponent {
private fun shareApk(context: Context, app: Application) { private fun shareApk(context: Context, app: Application) {
val handler = Handler() val handler = Handler()
val progressDialog = ProgressDialog(context) val progressDialog = ProgressDialog(context)
progressDialog.setMessage(context.getString(R.string.dialog_wait))
progressDialog.show() progressDialog.show()
val executor = Executors.newSingleThreadExecutor() val executor = Executors.newSingleThreadExecutor()
executor.execute { executor.execute {