mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-17 19:38:52 +01:00
improve attachment icon fetch from other apps. make compose box attachment text background a little less tranparent so icon 'pops' a bit more. make same icon text always black so it can be seen properly.
This commit is contained in:
@@ -136,21 +136,25 @@ fun Uri.contactToVCard(context: Context): Uri =
|
||||
}
|
||||
|
||||
fun Uri.getDefaultActivityIconForMimeType(context: Context): Drawable? =
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
context.packageManager
|
||||
.queryIntentActivities(
|
||||
Intent(Intent.ACTION_VIEW).setDataAndType(this, getType(context)),
|
||||
PackageManager.ResolveInfoFlags.of(
|
||||
PackageManager.MATCH_DEFAULT_ONLY.toLong()
|
||||
)
|
||||
).let {
|
||||
if (it.size > 0) it[0].loadIcon(context.packageManager)
|
||||
else null
|
||||
}
|
||||
} else {
|
||||
context.packageManager
|
||||
.resolveActivity(
|
||||
Intent(Intent.ACTION_VIEW).setDataAndType(this, getType(context)),
|
||||
PackageManager.MATCH_DEFAULT_ONLY)
|
||||
?.loadIcon(context.packageManager)
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
context.packageManager
|
||||
.queryIntentActivities(
|
||||
Intent(Intent.ACTION_VIEW).setDataAndType(this, getType(context)),
|
||||
PackageManager.ResolveInfoFlags.of(
|
||||
PackageManager.MATCH_DEFAULT_ONLY.toLong()
|
||||
)
|
||||
).let {
|
||||
if (it.size > 0) it[0].loadIcon(context.packageManager)
|
||||
else null
|
||||
}
|
||||
} else {
|
||||
// else, pre-tiramisu versions
|
||||
context.packageManager
|
||||
.queryIntentActivities(
|
||||
Intent(Intent.ACTION_VIEW).setDataAndType(this, getType(context)),
|
||||
PackageManager.MATCH_DEFAULT_ONLY
|
||||
).let {
|
||||
if (it.size > 0) it[0].loadIcon(context.packageManager)
|
||||
else null
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user