forked from upstream-mirrors/quik
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:
@@ -26,4 +26,11 @@
|
||||
android:grantUriPermissions="true">
|
||||
</provider>
|
||||
</application>
|
||||
|
||||
<queries>
|
||||
<intent>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<data android:scheme="*" android:mimeType="*/*" />
|
||||
</intent>
|
||||
</queries>
|
||||
</manifest>
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,11 +41,11 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/fileName"
|
||||
style="@style/TextPrimary"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#ddffffff"
|
||||
android:background="#a7ffffff"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/black"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
|
||||
Reference in New Issue
Block a user