diff --git a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/apps/AppItem.kt b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/apps/AppItem.kt index 5d1b543c..a03e08ad 100644 --- a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/apps/AppItem.kt +++ b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/apps/AppItem.kt @@ -196,7 +196,7 @@ fun AppItem( label = stringResource(R.string.menu_app_info), icon = Icons.Rounded.Info ) { - viewModel.openAppInfo(context as AppCompatActivity) + viewModel.openAppInfo(context) }) toolbarActions.add( @@ -204,7 +204,7 @@ fun AppItem( label = stringResource(R.string.menu_launch), icon = Icons.Rounded.OpenInNew, action = { - viewModel.launch(context as AppCompatActivity) + viewModel.launch(context) } ) ) @@ -216,7 +216,7 @@ fun AppItem( icon = Icons.Rounded.Share ) { scope.launch { - viewModel.shareApkFile(context as AppCompatActivity) + viewModel.shareApkFile(context) } } } else { @@ -228,7 +228,7 @@ fun AppItem( label = stringResource(R.string.share_menu_store_link, storeDetails.label), icon = Icons.Rounded.Share, action = { - viewModel.shareStoreLink(context as AppCompatActivity, storeDetails.url) + viewModel.shareStoreLink(context, storeDetails.url) } ), DefaultToolbarAction( @@ -236,7 +236,7 @@ fun AppItem( icon = Icons.Rounded.Share ) { scope.launch { - viewModel.shareApkFile(context as AppCompatActivity) + viewModel.shareApkFile(context) } } ) @@ -250,7 +250,7 @@ fun AppItem( label = stringResource(R.string.menu_uninstall), icon = Icons.Rounded.Delete, ) { - viewModel.uninstall(context as AppCompatActivity) + viewModel.uninstall(context) onBack() } ) diff --git a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/apps/AppItemVM.kt b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/apps/AppItemVM.kt index 0f5603ea..04f2823b 100644 --- a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/apps/AppItemVM.kt +++ b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/apps/AppItemVM.kt @@ -8,14 +8,9 @@ import android.graphics.drawable.Drawable import android.net.Uri import android.provider.Settings import android.service.notification.StatusBarNotification -import androidx.appcompat.app.AppCompatActivity import androidx.core.content.FileProvider import androidx.core.content.getSystemService -import de.mm20.launcher2.badges.BadgeRepository 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.notifications.NotificationRepository import de.mm20.launcher2.search.data.AppShortcut @@ -25,7 +20,6 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.map import kotlinx.coroutines.withContext -import org.koin.core.component.KoinComponent import org.koin.core.component.inject class AppItemVM( @@ -41,8 +35,8 @@ class AppItemVM( notificationRepository.cancelNotification(notification) } - fun openAppInfo(activity: AppCompatActivity) { - activity.tryStartActivity( + fun openAppInfo(context: Context) { + context.tryStartActivity( Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).apply { data = Uri.parse("package:${app.`package`}") 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( - activity.cacheDir, + context.cacheDir, "${app.`package`}-${app.version}.apk" ) withContext(Dispatchers.IO) { try { - val info = activity.packageManager + val info = context.packageManager .getApplicationInfo(app.`package`, 0) val file = java.io.File(info.publicSourceDir) @@ -73,30 +67,30 @@ class AppItemVM( val shareIntent = Intent(Intent.ACTION_SEND) shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) val uri = FileProvider.getUriForFile( - activity, - activity.applicationContext.packageName + ".fileprovider", + context, + context.applicationContext.packageName + ".fileprovider", fileCopy ) shareIntent.putExtra(Intent.EXTRA_STREAM, uri) shareIntent.type = "application/vnd.android.package-archive" 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) shareIntent.putExtra(Intent.EXTRA_TEXT, url) 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 - fun uninstall(activity: AppCompatActivity) { + fun uninstall(context: Context) { val intent = Intent(Intent.ACTION_DELETE) intent.data = Uri.parse("package:" + app.`package`) - activity.startActivity(intent) + context.startActivity(intent) } diff --git a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/calendar/CalendarItem.kt b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/calendar/CalendarItem.kt index 098cb1a5..e9b7e7f3 100644 --- a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/calendar/CalendarItem.kt +++ b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/calendar/CalendarItem.kt @@ -135,7 +135,7 @@ fun CalendarItem( modifier = Modifier .fillMaxWidth() .clickable { - viewModel.openLocation(context as AppCompatActivity) + viewModel.openLocation(context) } ) { Icon( @@ -199,7 +199,7 @@ fun CalendarItem( label = stringResource(R.string.calendar_menu_open_externally), icon = Icons.Rounded.OpenInNew, action = { - viewModel.launch(context as AppCompatActivity) + viewModel.launch(context) onBack() } ) diff --git a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/calendar/CalendarItemVM.kt b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/calendar/CalendarItemVM.kt index a42163dd..ab873bce 100644 --- a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/calendar/CalendarItemVM.kt +++ b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/calendar/CalendarItemVM.kt @@ -4,8 +4,6 @@ import android.content.Context import android.content.Intent import android.net.Uri import android.text.format.DateUtils -import android.widget.TextView -import androidx.appcompat.app.AppCompatActivity import de.mm20.launcher2.ktx.tryStartActivity import de.mm20.launcher2.search.data.CalendarEvent import de.mm20.launcher2.ui.R @@ -50,15 +48,34 @@ class CalendarItemVM( } 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) - return DateUtils.formatDateRange(context, calendarEvent.startTime, calendarEvent.endTime, DateUtils.FORMAT_SHOW_DATE or DateUtils.FORMAT_SHOW_TIME or DateUtils.FORMAT_SHOW_WEEKDAY) + if (calendarEvent.allDay) return DateUtils.formatDateRange( + 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( 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) ) } diff --git a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/common/SearchableItemVM.kt b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/common/SearchableItemVM.kt index 20fa6057..e9697d1d 100644 --- a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/common/SearchableItemVM.kt +++ b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/common/SearchableItemVM.kt @@ -1,5 +1,6 @@ package de.mm20.launcher2.ui.launcher.search.common +import android.content.Context import androidx.appcompat.app.AppCompatActivity import androidx.compose.ui.geometry.Rect import androidx.core.app.ActivityOptionsCompat @@ -44,10 +45,11 @@ abstract class SearchableItemVM( } - fun launch(context: AppCompatActivity, bounds: Rect? = null): Boolean { - val options = if (bounds != null) { + fun launch(context: Context, bounds: Rect? = null): Boolean { + val view = (context as? AppCompatActivity)?.window?.decorView + val options = if (bounds != null && view != null) { ActivityOptionsCompat.makeClipRevealAnimation( - context.window.decorView, + view, bounds.left.toInt(), bounds.top.toInt(), bounds.width.toInt(), diff --git a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/common/grid/GridItem.kt b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/common/grid/GridItem.kt index fa737ea0..ce92fde3 100644 --- a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/common/grid/GridItem.kt +++ b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/common/grid/GridItem.kt @@ -66,7 +66,7 @@ fun GridItem(modifier: Modifier = Modifier, item: Searchable) { badge = badge, icon = icon, onClick = { - if (!launchOnPress || !viewModel.launch(context as AppCompatActivity, bounds)) { + if (!launchOnPress || !viewModel.launch(context, bounds)) { showPopup = true } }, diff --git a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/common/grid/SearchResultGrid.kt b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/common/grid/SearchResultGrid.kt index 9d5e244c..97be7421 100644 --- a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/common/grid/SearchResultGrid.kt +++ b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/common/grid/SearchResultGrid.kt @@ -32,11 +32,14 @@ import kotlinx.coroutines.delay import kotlin.math.ceil @Composable -fun SearchResultGrid(items: List) { +fun SearchResultGrid( + items: List, + modifier: Modifier = Modifier, +) { val columns = LocalGridColumns.current 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()) { Row { diff --git a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/common/list/ListItem.kt b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/common/list/ListItem.kt index 2a2dc50f..cf106f6b 100644 --- a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/common/list/ListItem.kt +++ b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/common/list/ListItem.kt @@ -149,7 +149,7 @@ fun ListItem(modifier: Modifier = Modifier, item: Searchable) { modifier = Modifier.combinedClickable( enabled = !showDetails, onClick = { - if (!viewModel.launch(context as AppCompatActivity, bounds)) { + if (!viewModel.launch(context, bounds)) { showDetails = true } }, diff --git a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/contacts/ContactItem.kt b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/contacts/ContactItem.kt index d27751ff..66442e5f 100644 --- a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/contacts/ContactItem.kt +++ b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/contacts/ContactItem.kt @@ -110,7 +110,7 @@ fun ContactItem( modifier = Modifier.padding(end = 16.dp), text = it.label, onClick = { - viewModel.contact(context as AppCompatActivity, it) + viewModel.contact(context, it) } ) } @@ -134,7 +134,7 @@ fun ContactItem( modifier = Modifier.padding(end = 16.dp), text = it.label, onClick = { - viewModel.contact(context as AppCompatActivity, it) + viewModel.contact(context, it) } ) } @@ -158,7 +158,7 @@ fun ContactItem( modifier = Modifier.padding(end = 16.dp), text = it.label, onClick = { - viewModel.contact(context as AppCompatActivity, it) + viewModel.contact(context, it) } ) } @@ -182,7 +182,7 @@ fun ContactItem( modifier = Modifier.padding(end = 16.dp), text = it.label, onClick = { - viewModel.contact(context as AppCompatActivity, it) + viewModel.contact(context, it) } ) } @@ -206,7 +206,7 @@ fun ContactItem( modifier = Modifier.padding(end = 16.dp), text = it.label, 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), icon = Icons.Rounded.OpenInNew, action = { - viewModel.launch(context as AppCompatActivity) + viewModel.launch(context) } ) ) diff --git a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/contacts/ContactItemVM.kt b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/contacts/ContactItemVM.kt index 66b4701d..51c9dde9 100644 --- a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/contacts/ContactItemVM.kt +++ b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/contacts/ContactItemVM.kt @@ -1,20 +1,20 @@ package de.mm20.launcher2.ui.launcher.search.contacts +import android.content.Context import android.content.Intent import android.net.Uri -import androidx.appcompat.app.AppCompatActivity import de.mm20.launcher2.ktx.tryStartActivity import de.mm20.launcher2.search.data.Contact import de.mm20.launcher2.search.data.ContactInfo import de.mm20.launcher2.ui.launcher.search.common.SearchableItemVM -import org.koin.core.component.KoinComponent class ContactItemVM( val contact: Contact -): SearchableItemVM(contact) { - fun contact(context: AppCompatActivity, contactInfo: ContactInfo) { +) : SearchableItemVM(contact) { + fun contact(context: Context, contactInfo: ContactInfo) { 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)) ) } } \ No newline at end of file diff --git a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/files/FileItem.kt b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/files/FileItem.kt index d2fa23fe..2258ade1 100644 --- a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/files/FileItem.kt +++ b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/files/FileItem.kt @@ -164,7 +164,7 @@ fun FileItem( label = stringResource(R.string.menu_open_file), icon = Icons.Rounded.OpenInNew, action = { - viewModel.launch(context as AppCompatActivity) + viewModel.launch(context) } ) ) @@ -174,7 +174,7 @@ fun FileItem( label = stringResource(R.string.menu_share), icon = Icons.Rounded.Share, action = { - viewModel.share(context as AppCompatActivity) + viewModel.share(context) } )) } diff --git a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/files/FileItemVM.kt b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/files/FileItemVM.kt index 7fe7ebf0..a0a4d8f6 100644 --- a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/files/FileItemVM.kt +++ b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/files/FileItemVM.kt @@ -1,7 +1,7 @@ package de.mm20.launcher2.ui.launcher.search.files +import android.content.Context import android.content.Intent -import androidx.appcompat.app.AppCompatActivity import androidx.core.content.FileProvider import de.mm20.launcher2.files.FileRepository import de.mm20.launcher2.search.data.File @@ -21,7 +21,7 @@ class FileItemVM( fileRepository.deleteFile(file) } - fun share(context: AppCompatActivity) { + fun share(context: Context) { val shareIntent = Intent(Intent.ACTION_SEND) shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) val uri = FileProvider.getUriForFile( diff --git a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/shortcut/ShortcutItem.kt b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/shortcut/ShortcutItem.kt index 473b9a32..fd51e73e 100644 --- a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/shortcut/ShortcutItem.kt +++ b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/shortcut/ShortcutItem.kt @@ -98,7 +98,7 @@ fun AppItem( label = stringResource(R.string.menu_app_info), icon = Icons.Rounded.Info ) { - viewModel.openAppInfo(context as AppCompatActivity) + viewModel.openAppInfo(context) }) Toolbar( diff --git a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/shortcut/ShortcutItemVM.kt b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/shortcut/ShortcutItemVM.kt index 39288394..dd02d551 100644 --- a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/shortcut/ShortcutItemVM.kt +++ b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/shortcut/ShortcutItemVM.kt @@ -1,15 +1,15 @@ package de.mm20.launcher2.ui.launcher.search.shortcut +import android.content.Context import android.content.Intent import android.net.Uri import android.provider.Settings -import androidx.appcompat.app.AppCompatActivity import de.mm20.launcher2.ktx.tryStartActivity import de.mm20.launcher2.search.data.AppShortcut import de.mm20.launcher2.ui.launcher.search.common.SearchableItemVM class ShortcutItemVM(private val shortcut: AppShortcut) : SearchableItemVM(shortcut) { - fun openAppInfo(context: AppCompatActivity) { + fun openAppInfo(context: Context) { context.tryStartActivity( Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).apply { data = Uri.parse("package:${shortcut.launcherShortcut.`package`}") diff --git a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/website/WebsiteItem.kt b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/website/WebsiteItem.kt index 399c6162..d2aaa5f2 100644 --- a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/website/WebsiteItem.kt +++ b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/website/WebsiteItem.kt @@ -47,7 +47,7 @@ fun WebsiteItem( Column( modifier = modifier.clickable { - viewModel.launch(context as AppCompatActivity) + viewModel.launch(context) } ) { if (website.image.isNotBlank()) { @@ -104,7 +104,7 @@ fun WebsiteItem( label = stringResource(R.string.menu_share), icon= Icons.Rounded.Share, action = { - viewModel.share(context as AppCompatActivity) + viewModel.share(context) } ) ) diff --git a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/website/WebsiteItemVM.kt b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/website/WebsiteItemVM.kt index 1f2d3f3b..2cf77e8c 100644 --- a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/website/WebsiteItemVM.kt +++ b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/website/WebsiteItemVM.kt @@ -1,18 +1,15 @@ package de.mm20.launcher2.ui.launcher.search.website +import android.content.Context 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.ui.launcher.search.common.SearchableItemVM -import org.koin.core.component.KoinComponent -import org.koin.core.component.inject class WebsiteItemVM( private val website: Website -): SearchableItemVM(website) { +) : SearchableItemVM(website) { - fun share(context: AppCompatActivity) { + fun share(context: Context) { val shareIntent = Intent(Intent.ACTION_SEND) shareIntent.putExtra( Intent.EXTRA_TEXT, diff --git a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/wikipedia/WikipediaItem.kt b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/wikipedia/WikipediaItem.kt index c4998cef..99ec8779 100644 --- a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/wikipedia/WikipediaItem.kt +++ b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/wikipedia/WikipediaItem.kt @@ -47,7 +47,7 @@ fun WikipediaItem( Column( modifier = modifier.clickable { - viewModel.launch(context as AppCompatActivity) + viewModel.launch(context) } ) { if (!wikipedia.image.isNullOrEmpty()) { @@ -110,7 +110,7 @@ fun WikipediaItem( label = stringResource(R.string.menu_share), icon = Icons.Rounded.Share, action = { - viewModel.share(context as AppCompatActivity) + viewModel.share(context) } ) ) diff --git a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/wikipedia/WikipediaItemVM.kt b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/wikipedia/WikipediaItemVM.kt index 276f313c..cf249764 100644 --- a/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/wikipedia/WikipediaItemVM.kt +++ b/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/wikipedia/WikipediaItemVM.kt @@ -1,20 +1,16 @@ package de.mm20.launcher2.ui.launcher.search.wikipedia +import android.content.Context import android.content.Intent -import androidx.appcompat.app.AppCompatActivity import androidx.core.text.HtmlCompat -import de.mm20.launcher2.favorites.FavoritesRepository import de.mm20.launcher2.search.data.Wikipedia -import de.mm20.launcher2.ui.R import de.mm20.launcher2.ui.launcher.search.common.SearchableItemVM -import org.koin.core.component.KoinComponent -import org.koin.core.component.inject class WikipediaItemVM( private val wikipedia: Wikipedia ) : SearchableItemVM(wikipedia) { - fun share(context: AppCompatActivity) { + fun share(context: Context) { val text = HtmlCompat.fromHtml(wikipedia.text, HtmlCompat.FROM_HTML_MODE_LEGACY).toString() val shareIntent = Intent(Intent.ACTION_SEND) shareIntent.putExtra( diff --git a/ui/src/main/java/de/mm20/launcher2/ui/legacy/search/ApplicationDetailRepresentation.kt b/ui/src/main/java/de/mm20/launcher2/ui/legacy/search/ApplicationDetailRepresentation.kt index 396ff63c..9a18d35e 100644 --- a/ui/src/main/java/de/mm20/launcher2/ui/legacy/search/ApplicationDetailRepresentation.kt +++ b/ui/src/main/java/de/mm20/launcher2/ui/legacy/search/ApplicationDetailRepresentation.kt @@ -418,7 +418,6 @@ class ApplicationDetailRepresentation : Representation, KoinComponent { private fun shareApk(context: Context, app: Application) { val handler = Handler() val progressDialog = ProgressDialog(context) - progressDialog.setMessage(context.getString(R.string.dialog_wait)) progressDialog.show() val executor = Executors.newSingleThreadExecutor() executor.execute {